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.
Best Answer
Using
multibib
results after the first compile run of filemwe.tex
withpdflatex
(or in your case compiling with TeXStudio) in two new filesmwe.aux
andapndx.aux
. Both.aux
files needs to be run withbibtex
. TeXStudio does the run withbibtex
for filemwe.aux
, forapndx.aux
you need to do it by your own. Just run the commandbibtex 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
):So with the following file
mwe.tex
(packagefilecontents
is only used to have both bib files and the tex code in one compiling MWE):and the compiling chain (independent from TeXStudio):
R
, then typecmd
, press entercd <directory path>
pdflatex mwe
(resulting in two needed.aux
files)bibtex mwe
(compilesmwe.aux
)bibtex apndx
(compilesapndx.aux
)pdflatex mwe
(resulting in files*.bbl
and*.blg
)pdflatex mwe
(resulting inpdf
file with bibliography)If you are using an editor (TeXStudio, TeXnicCenter, ...) the editor can run
pdflatex mwe
andbibtex mwe
for you, but notbibtex 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: