# Multibib fails to show a second bibliography in the appendix

I am using multibib and natbib together to get two different bibliographies (one for the main text and one for the appendix). Here is an example code

\documentclass[12pt]{article}
\usepackage{natbib}
\usepackage{multibib}
\newcites{apndx}{References}
\begin{document}

First paper to cite: \cite{X1}
\bibliographystyle{ecca}
\bibliography{XXX}

\appendix

Cite a paper in the appendix \citeapndx{X2}

\bibliographystyleapndx{ecca}
\bibliographyapndx{XXX}

\end{document}


However, the second bibliography does not show up, and the citation in the appendix only gives a "?". I looked up in the multibib manual and in other similar questions, but I do not get where the error is.

UPDATE 1 This happens even though I run the bibtex file twice. Here is the log file:

Process started: /Library/TeX/texbin/bibtex "prova".aux

This is BibTeX, Version 0.99d (TeX Live 2016)
The top-level auxiliary file: prova.aux
The style file: plain.bst
Database file #1: myrefs.bib

Process exited normally

Process started: /Library/TeX/texbin/bibtex "prova".aux

This is BibTeX, Version 0.99d (TeX Live 2016)
The top-level auxiliary file: prova.aux
The style file: plain.bst
Database file #1: myrefs.bib

Process exited normally


UPDATE 2: I think the problem is that my TexStudio does not run the sec.aux file which generates the link to the second bibliography. I followed the steps of this link https://sourceforge.net/p/texstudio/wiki/Tips%20and%20Tricks/ and created a .cwl and added it to TexStudio Completion but it still does not work.

• Hi, I use TexStudio and I just hit "Build and View" to compile it (I hit the button multiple times). Does the example code work on your end? Thank you – Andrew Feb 21 '18 at 7:22
• Please have a look to the answer tex.stackexchange.com/a/98681/16550 Possible duplicate? you need two bibtex runs, one for each bibliography! – Mensch Feb 21 '18 at 7:24
• I am hitting the compile button twice, but it does not work. I tried the code in that thread, but it didn't work as well. In particular the first bibliography in that example does not work. The newcites command seem not to work fine. Does my code work on your latex compiler? Thank you. – Andrew Feb 21 '18 at 16:12
• I added the log file showing that I always run the bibtex twice. Still the bibliography does not work. – Andrew Feb 21 '18 at 20:48
• You need to run bibtex prova.aux and then bibtex sec.aux or whatever. Can't you do it on the command line if it is tricky persuading your editor? Or you can use something like latexmk if you want a single run to hit. – cfr Feb 22 '18 at 3:32

Using multibib results after the first compile run of file mwe.tex with pdflatex (or in your case compiling with TeXStudio) in two new files mwe.aux and apndx.aux. Both .aux files needs to be run with bibtex. TeXStudio does the run with bibtex for file mwe.aux, for apndx.aux you need to do it by your own. Just run the command bibtex apndx in a windows terminal. After that you can compile two times with TeXStudio to get the resulting PDF.

To get command \citeapndx be run in a caption of a figure (your question in the comments) you need to use command \protect like (same for a \section):

  \caption{In figure caption \protect\citeapndx{Johnson2000}}
%                           ^^^^^^^^


So with the following file mwe.tex (package filecontents is only used to have both bib files and the tex code in one compiling MWE):

% needs:  bibtex apndx
\RequirePackage{filecontents}
\begin{filecontents}{\jobname.bib}
@inproceedings{Creighton2006,
author    = {Creighton, Oliver and Ott, Martin and Bruegge, Bernd},
booktitle = {Requirements Engineering, 14th IEEE International Conference},
isbn      = {0769525555},
pages     = {109--118},
publisher = {IEEE},
title     = {{Software cinema-video-based requirements engineering}},
url       = {http://ieeexplore.ieee.org/xpls/abs{\_}all.jsp?arnumber=1704054},
year      = {2006},
}
\end{filecontents}
\begin{filecontents}{apndx.bib}
@article{Johnson2000,
author  = {Johnson, W Lewis and Rickel, Jeff W and Lester, James C},
journal = {International Journal of Artificial Intelligence in Education},
number  = {11},
pages   = {47--78},
title   = {{Animated pedagogical agents: face-to-face interaction in
interactive learning environments}},
volume  = {Internatio},
year    = {2000},
}
\end{filecontents}

\documentclass[12pt]{article}

\usepackage{natbib}
\usepackage{multibib}
\usepackage{graphicx}

\newcites{apndx}{References in Appendix}

\begin{document}

First paper to cite: \cite{Creighton2006}
\bibliographystyle{ecca}
\bibliography{\jobname}

\appendix

Cite a paper in the appendix \citeapndx{Johnson2000}

%\section{In the appendix \protect\citeapndx{Johnson2000}} % <===========
\begin{figure}
\centering
\includegraphics[width=5cm]{example-image-a}
\caption{In figure caption \protect\citeapndx{Johnson2000}} % <=======
\label{fig:example-image-a}
\end{figure}

\bibliographystyleapndx{ecca}
\bibliographyapndx{apndx}

\end{document}


and the compiling chain (independent from TeXStudio):

• open a terminal window in Windows with pressing windows start key and R, then type cmd, press enter
• move to the directory where you have your tex code and the bib file(s) with cd <directory path>
• run command pdflatex mwe (resulting in two needed .aux files)
• run command bibtex mwe (compiles mwe.aux)
• run command bibtex apndx (compiles apndx.aux)
• run command pdflatex mwe (resulting in files *.bbl and *.blg)
• run command pdflatex mwe (resulting in pdf file with bibliography)

If you are using an editor (TeXStudio, TeXnicCenter, ...) the editor can run pdflatex mwe and bibtex mwe for you, but not bibtex apndx. So run this command after the first compile run with TeXStudio in a windows terminal ...

After running the compile chain you get the following resulting pdf: