# TeXlipse, bibunits, and multiple bibliographies

I am using Eclipse 4.2 with TeXlipse 1.5 (the version bundled with StatET 3.2) and MixTeX 2.9. I have no problem using TeXlipse, bibtex, and natbib to produce bibliographies. But I often want to include multiple bibliographies (i.e., lists of references) in the same document. natbib isn't up to this task. In these cases, I turn to the bibunits package.

The problem is that Texlipse doesn't work well with bibunits. When latex (or pdflatex, etc.) is run on a document that includes \usepackage{bib units}, it generates an .aux file for each bibliography that is to be created: bu1.aux, bu2.aux, and so on. If the bibliographies are to be produced, bibtex needs to process each of these .aux files:

bibtex bu1.aux
bibtex bu2.aux


and so on. But Texlipse doesn't seem to know this. So it doesn't, by default, direct bibtex to process those .aux files. The result is that the bibliographies don't display as they should.

Here is a complete example of a document that the command-line tools (pdflatex, bibtex) handle fine but that gives Texlipse a lot of trouble. Although it uses bibunits, it has only one bibliography (to keep things simple):

\documentclass{article}
\usepackage{bibunits}
\defaultbibliography{references}
\defaultbibliographystyle{plainnat}
\usepackage{natbib}
\begin{document}
\begin{bibunit}
Lorem ipsum dolor \citep{Smith_Lorem_1980}.
\putbib
\end{bibunit}
\end{document}


where references.bib is

@BOOK{Smith_Lorem_1980,
AUTHOR    = {John Smith},
TITLE     = {Sit Amet},
YEAR      = {1980},
PUBLISHER = {Knopf},
}


(The example requires a separate .bib file: TeXlipse doesn't support \thebibliography commands.)

Is there a way to change the Texlipse configuration so that it can handle the .aux file that is generated when files like the example file are processed? Right now, I have rigged up a workaround (configuring BibTeX as an "external tool" to process the .aux files), but it is clunky.

-
You can setup your editor for arara to simplify the compilation. –  Marco Daniel May 26 '13 at 11:59

Similar to the instructions depicted within this question texlipse builder script configuration I point my external build program to a windows bat file.

When using windows running MikTex, I create the following script/organization.

1. In the eclipse project directory I create a src directory to sort all but my main tex file
2. Outside this directory with the build tools I place my main tex file
3. I tend to keep my references which may be common to multiple project to prevent duplication
4. The bat files are based on for loops and current directory variables to identify the project file to build.
5. To address the bibunits specific nature of the question I use a custom bat file (seen in the example below named bibunitBuild.bat containing bu*.aux in a for loop
6. A clean up script is also easy to create and include and depends on your desire to retain logs of the process or a clean working directory with no tmp files.

Contents of bibunitBuild.bat:

FOR %%B IN (bu*.aux) DO ( ECHO Will try and compile %%~dpB%%~nB with bibtex & "%MikTexPath%bibtex.exe" --include-directory="%%~dpB\..\..\References"  "%%~dpB%%~nB")


Contents of xelatexCompile.bat

:CheckOS
IF "%PROCESSOR_ARCHITECTURE%"=="x86" (GOTO 32BIT) ELSE (GOTO 64BIT)

:64BIT
ECHO 64-bit compiling
SET MikTexPath=C:\Program Files\MiKTeX 2.9\miktex\bin\x64\
GOTO END

:32BIT
ECHO 32-bit compiling
SET MikTexPath=C:\Program Files\MiKTeX 2.9\miktex\bin\
GOTO END

:END

SET TeXCompilier=xelatex.exe

FOR %%A IN (*.tex) DO (
"%MikTexPath%%TeXCompilier%" "%%~nxA" &_
call bibunitBuild.bat &_
"%MikTexPath%makeindex.exe" -s "%%~nA.ist" -t "%%~nA.glg" -o "%%~nA.gls" "%%~nA.glo" &_
"%MikTexPath%makeindex.exe" -s "%%~nA.ist" -t "%%~nA.alg" -o "%%~nA.acr" "%%~nA.acn" &_
"%MikTexPath%%TeXCompilier%" "%%~nxA" &_
"%MikTexPath%%TeXCompilier%" "%%~nxA" &_
)

-