I need to use the multibib package to create a double bibliography document.

I am currently working with TeXworks 0.4.3 (on Windows 7), but I cannot make the double bibliographies system work.

The MWE is:

%Secondary bibliography
\newcites{sec}{Secondary contributions}

Text with \citet{primauthor} and \citetsec{secauthor}.



TeXworks correctly produces the "sec.aux" file... But I don't know how to make it process this file! The multibib package says I should put a for cycle

for file in *.aux ; do
bibtex ‘basename $file .aux‘

but I have no idea where to put it... :D

I have tried to make the following test (Thesis is the name of the base tex file):

The try I have made

with no sensible results... any suggestion would be appreciated...

  • 1
    Can you save the shell script to a file, make it executable, and then invoke this file from the TeXworks window you display?
    – Mico
    Aug 7, 2012 at 11:21
  • i use texmaker but had the same problem, i added "bibtex sec.aux" to my own build-script and it works. "bibtex sec" did not create the bbl file.
    – user37805
    Oct 6, 2013 at 11:53

1 Answer 1


The script provided in the multibib documentation is Unix-based, so we will have troubles running it in Windows. In the script, there's also another command running inside single quotes - basename $file .aux - which returns the full path for $file (which is the current element in the for loop).

The solution is to manually run these commands in the following order:

pdflatex mydoc
bibtex mydoc
bibtex sec
pdflatex mydoc
pdflatex mydoc

As Mico suggested in the comments, you can also create a Windows-equivalent batch file. It's been a while since my last Windows batch file, but I'm almost sure we can use this one:

@echo off
FOR %%A IN (*.aux) DO bibtex %%A

Save it as myscript.bat. It will run bibtex on all .aux files in the current directory. Now, I think TeXworks might not run the batch file in the current directory, so we need to change things a little:

@echo off
FOR %%A IN (*.aux) DO bibtex %1\%%A

and then make TeXworks call myscript.bat with $directory as argument (note that $directory is a TeXworks variable which expands to the absolute path to the directory containing your root document).

Another suggestion (and sorry for tooting my own horn here) is to use arara to automate your document compilation. The header would be:

% arara: pdflatex
% arara: bibtex: { files: [ mydoc, sec ] }
% arara: pdflatex
% arara: pdflatex

The secret here is the second line containing the bibtex directive. arara will run bibtex on mydoc (your document name), and also on sec.

Sorry for not providing screenshots and more info, I'm away from my Windows machine right now.

  • wow thanks for the comprehensive answer, that worked sweetly! I gave a look at arara and it is very interesting (I do love palindrome myself), but I'm not sure I can understand how to make it work at its full potentiality in a reasonable time Aug 7, 2012 at 12:26
  • @scannerdarkly Yay, I'm glad it worked! :) By the way, don't worry about arara, it really takes some time to grasp the concepts - it might not be intuitive in the first couple of tries. :P Aug 7, 2012 at 12:55
  • I am TOTALLY confused...how a commented command can run in latex editor?
    – Tash
    Jun 9, 2014 at 0:38

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .