[Tex/LaTex] Merge bibtex citations

bibtex

Can one automate the construction of a BibTeX bibliography which includes all the bibliographic entries from multiple separate LaTeX documents? The documents I have in mind have citations in common, which must only appear once in the combined list.

I could potentially paste the text from all the documents into one file and use the bibliography from that. This would involve a fair bit of editing though, since the documents all use various incompatible documents classes and macros.

Best Answer

Is the goal just to create a .bib file with all the unique references, or to create a single printed bibliography to tack onto the back of all these different documents? If the former (I'm making this assumption because you say that the source documents have "various incompatible classes", etc), then Bibtool and its "extraction" option is your friend. I haven't tested this, but assuming bibtool is installed, if you run latex/bibtex on each separate .tex file, so that the .aux files are generated, then I believe something like

bibtool -x file1.aux file2.aux file3.aux -o consolidated.bib

will move you toward what you want. See p10 and pp27-28 of the bibtool manual. Even if the goal is a single printed bibliography, however, it will be straightforward to produce one once you've created the consolidated .bib file.

Related Question