[Tex/LaTex] use the same bibliography bib file for two latex source (main and appendix)

bibliographiesbibtex

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.

Best Answer

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.

Related Question