LaTeX forum ⇒ GeneralMerge 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

Postby micha » Tue Oct 08, 2019 3:47 pm

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! :P :P :P

kaiserkarl13
Posts: 636
Joined: Tue Mar 25, 2008 5:02 pm

Postby kaiserkarl13 » Wed Oct 09, 2019 5:22 am

Does this work?
Code: [Select all] [Expand/Collapse] [Download] ({untitled.tex})
  1. \documentclass{article}
  2. \begin{document}
  3. \include{document1}
  4. \bibliographystyle{unsrt}
  5. \bibliography{bibliography}
  6. \include{document2}
  7. \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

Postby micha » Wed Oct 09, 2019 2:51 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

Postby kaiserkarl13 » Sat Oct 12, 2019 4:59 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

Postby micha » Sun Oct 13, 2019 11:32 am

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

Postby kaiserkarl13 » Tue Oct 15, 2019 5:26 am

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?


Return to “General”

Who is online

Users browsing this forum: No registered users and 8 guests