I am trying to use bibunits package. If I compile the TeX file using the following sequence of commands, it works properly.

pdflatex document
bibtex bu1
pdflatex document
pdflatex document

However, if I compile it using TeXstudio 2.8.8, TeXstudio fails to recognize bibtex entries inside the bibunit. Here is a minimal example.

        AUTHOR="Bernd Meyer",
        TITLE="A constraint-based framework for diagrammatic reasoning",
        JOURNAL="Applied Artificial Intelligence",
        VOLUME= "14",
        ISSUE = "4",
        PAGES= "327--344",
        AUTHOR="M. Codish and K. Marriott and C.K. Taboch",
        TITLE="Improving program analyses by structure untupling",
        JOURNAL="Journal of Logic Programming",
        VOLUME= ""43",
        ISSUE = "3",
        PAGES= "251--263",
        References to the \TeX book \cite{Meyer2000}
        and to Lamport’s \LaTeX\ book, which appears
        only in the references\nocite{Codishetal2000}.
  • 2
    bibunits wants you to run bibtex bu1.aux (1 for the 'first' BibUnit); are you sure you're running it? As a matter of taste: I'd put the filecontents in the preamble, too; and have no space before \end{filecontents}.
    – jon
    Feb 13, 2015 at 3:22
  • I updated the question. If I compile the above doc using command-line it works; however, TeXstudio cannot compile it.
    – Javad
    Feb 13, 2015 at 3:34
  • As a matter of fact, I realized that TeXstudio does not run bibtex bu1. I don't know why.
    – Javad
    Feb 13, 2015 at 3:44
  • I presume that's because it is not a 'normal' command for TeXstudio to know to run. (Never used the editor, so I don't know how clever it is.)
    – jon
    Feb 13, 2015 at 3:49
  • Can you open a command window from inside TeXStudio and type "bibtex bubu1" at the command prompt?
    – Mico
    Feb 13, 2015 at 5:22

4 Answers 4


Old question, but exactly my problem. I don't know much about TeXstudio, but I put together a hack to get it to work. There must be a better way. Somebody please post it.

  1. Go to Options->Configure TeXstudio...
  2. Select Commands from the options on the left
  3. Scroll to BibTeX
  4. Update the BibTeX command as described below

The default command should be "bibtex.exe %", which apparently runs bibtex on the main filename (without the extension). I added a list of executions of bibtex on bu# where # is a number from 1 to 9.

So the BibTeX command now looks like:

bibtex.exe % | bibtex.exe bu1 | bibtex.exe bu2 | bibtex.exe bu3 | bibtex.exe bu4 | bibtex.exe bu5 | bibtex.exe bu6 | bibtex.exe bu7 | bibtex.exe bu8 | bibtex.exe bu9

FYI, I am running TeXstudio 2.8.4 on Windows 7

Like I said, a hack. But it seems to work.

Edit: I'm guessing TeXstudio does conditional "recompiles" of the bibliography based on whether it thinks there has been a change. I'm also guessing that it doesn't detect changes well with bibunits. Therefore, I've had to do (at least) three TeXstudio steps when using this hack. First, recompile main tex file. Second, recompile bib file (f11). Third, recompile main tex file again.

  • You're a life saver!
    – AddSup
    Oct 1, 2019 at 18:50
  • How about if someone is using overleaf? Nov 7, 2020 at 15:14


bibtex.exe % 


bibtex ?a*/*.aux 


Options - Configure TeXstudio - Commands - BibTeX.

Source. Compile order: F6, F11, F6, F11, F6, F12, F1.


To add to Claudio Fiandrino's answer, I had some problems due to my path to the working directory having a space in it and so I was getting errors saying that Bibtex needed exactly one argument. I found that changing it to the following worked:

bibtex ?me*/*.aux

The '?m' uses the double-quoted filename without extension, and the 'e' adds the file extension.

(I would have added this as a comment but don't have enough reputation).


For using bibunits with Texstudio under Linux (Texstudio 2.12.22 in my case), I do the following:

  1. Options -> Configure TeXstudio...

  2. Select Build from the options on the left

  3. Under user command, add the following command that implements the building procedure that is described in the bibunits documentation:

    /PATH/TO/SCRIPT/latex_bibunits.sh %.tex | txs:///view

With the bash script latex_bibunits.sh containing:

pdflatex $FILE
buFiles=$(ls bu*.aux)
for f in ${buFiles[@]}; do
    bibtex $f
pdflatex $FILE
pdflatex $FILE

Additionally, make sure that latex_bibunits.sh is executable, for example using chmod 755 latex_bibunits.sh.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.