# Multibib with TeXworks: how to parse second .aux file?

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:

\documentclass{report}
\usepackage{natbib}
\usepackage{multibib}
%Secondary bibliography
\newcites{sec}{Secondary contributions}

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

\bibliographystyle{plainnat}
\bibliography{tbib}
\bibliographystylesec{plainnat}
\bibliographysec{tbib}

\end{document}


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

#!/bin/bash
for file in *.aux ; do
bibtex ‘basename $file .aux‘ done  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): with no sensible results... any suggestion would be appreciated... - 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 '12 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 '13 at 11:53 ## 1 Answer 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
\documentclass{report}
...


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 –  scannerdarkly Aug 7 '12 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 –  Paulo Cereda Aug 7 '12 at 12:55
I am TOTALLY confused...how a commented command can run in latex editor? –  Tash Jun 9 at 0:38