# use the same bibliography bib file for two latex source (main and appendix)

I have a main latex source and its bibtex file: ./main.tex and ./main.bib

In main.tex the bibliography is included as \bibliography{main}, then the pdf is correctly produced with all the needed references at the end.

Then I have a subdirectory and the appendix latex file: ./add/appendix.tex, which is a standalone latex source. In this document I would like to share (some of) the ../main.bib references, but keeping the main document numbering. Besides, a bibliographic section is only required in the main.

Including \bibliography{../main.bib} and running \$ bibtex appendix gets the wrong numbering actually, restarting from one.

My problem is actually a bit different of what described here: Multiple LaTeX files using the same bibliography or here: Two Bibliographies: one for main text and one for appendix but still I did not find the solution.

-
For me, Herbert's answer in tex.stackexchange.com/q/98660/21591 is exactly what you are looking for. How does your appendix.tex look like (it seems to be a standalone document)? Does it have a \bibliographystyle{} specification? Do you run bibtex on it? – mafp Jul 4 '13 at 15:14
Thank you, I have managed to get the references working now in the appendix running bibtex on it (I will edit the question). Still, it is not what I am looking for. appendix.tex is a standalone document, and I want to share (some of) the references of the main and especially the numbering must be the same. Besides, while a bibliography section is included in the main, in the appendix resulting document is not required. – gluuke Jul 4 '13 at 15:44
This is a useful clarification, in particular that you want the same numbering. Please edit your question! – mafp Jul 4 '13 at 15:46
Yeah, you are right. I did it. – gluuke Jul 4 '13 at 15:49

I have find a possible solution, inspired from here: Use bibliography numbers and citation from other file

So using the package xc in appendix.tex, like:

\usepackage{xc}
\externalcitedocument[m-]{../main}


and then citing using same labels as in main.tex, the numbering is actually the same and no bibliography appears in appendix.tex. So to cite XX from main.tex in appendix.tex one should do:

\cite{m-XX}


that works nicely.

-

The xc package solution above does not seem to work for me (the main.tex uses biblatex, not bibtex, and that may have something to do with it). I see no evidence of main.bbl or main.aux being read from appendix.tex.

What does work is a \makeatletter\input main.aux\makeatother in appendix.tex, and replacing all the \cite{foo} in appendix.tex by [\ref{foo}].

I'd really like to handle comma-separated references, but my latex skills are too rusty for that hack.

-