## LaTeX forum ⇒ General ⇒ Merge reference lists of two documents

LaTeX specific issues not fitting into one of the other forums of this category.
micha
Posts: 3
Joined: Tue Oct 08, 2019 3:36 pm

### Merge reference lists of two documents

Dear all,
I have two tex documents: doc1.tex and doc2.tex. Both have their own reference lists and bibliographies, for example doc1 reads:

\documentclass{article} \begin{document}See the analysis in \cite{ref1}. \bibliographystyle{unsrt}\bibliography{bibliography}\end{document}

and similarly for doc2. When compiled, doc1.pdf and doc2.pdf have their own reference lists, which I call (R1) and (R2).

I would like to achieve the following:
- remove R2 at the end of doc2.pdf
- insert the entries that were in R2, and merge them with R1, in such a way that doc1.pdf contains a merged reference list (R12) which contains both the entries of R1 and R2.
- The citation numbers in the main text of doc2 should still refer properly to those of R12.

Do you know how to do this??? Thank you!

kaiserkarl13
Posts: 636
Joined: Tue Mar 25, 2008 5:02 pm
Does this work?
\documentclass{article}\begin{document}\include{document1}\bibliographystyle{unsrt}\bibliography{bibliography}\include{document2}\end{document}

Note that the preamble and bibliography information should be removed from the included files.

micha
Posts: 3
Joined: Tue Oct 08, 2019 3:36 pm
kaiserkarl13 wrote:Does this work?

No, I don't want document2 to be merged in document1, see the OP.

kaiserkarl13
Posts: 636
Joined: Tue Mar 25, 2008 5:02 pm
micha wrote:
kaiserkarl13 wrote:Does this work?

No, I don't want document2 to be merged in document1, see the OP.

Then what DO you want?

If you want to create a master document and then separate out parts of it, you can split them apart with something like this:
[Codebox=bash]
gs -dLastPage=20 -dBATCH -dNOPAUSE -sDEVICE=pdfwrite -sOutputFile=doc1.pdf doc.pdf
gs -dFirstPage=20 -dBATCH -dNOPAUSE -sDEVICE=pdfwrite -sOutputFile=doc2.pdf doc.pdf
[/Codebox]
It's not possible to generate a bibliography in one document that's linked to another. It's possible to have a combined bibliography with separate reference lists per chapter (which is what chapterbib does), but you can't get a combined reference list in one document with entries from another.

micha
Posts: 3
Joined: Tue Oct 08, 2019 3:36 pm
kaiserkarl13 wrote:
micha wrote:
kaiserkarl13 wrote:Does this work?

No, I don't want document2 to be merged in document1, see the OP.

Then what DO you want?

I want what I described in my original post.

kaiserkarl13 wrote:

It's not possible to generate a bibliography in one document that's linked to another. It's possible to have a combined bibliography with separate reference lists per chapter (which is what chapterbib does), but you can't get a combined reference list in one document with entries from another.

What I wanted was clear then, see ? Too bad that it does not seem to be possible . Thank you.

kaiserkarl13
Posts: 636
Joined: Tue Mar 25, 2008 5:02 pm
micha wrote:I want what I described in my original post.

Put another way: why would you want to do this? Reference lists are linked to specific documents (or portions of them). If you want to split up a PDF after the fact, that's one thing, but why would one document be completely divorced from its reference list?