From: cjmchale@dsg.cs.tcd.ie (Ciaran McHale)
Newsgroups: comp.text.tex
Subject: merging BibTeX bibliographies
Date: 12 Nov 92 18:47:58 GMT
Organization: DSG, Dept. of Computer Science, Trinity College Dublin

Our group has been using LaTeX and BibTex for the last few years. At the
moment, most people maintain their own, separate bibliographies. We
would like to be able to merge them all into a single group-wide
bibliography.

There are a few technical issues involved (e.g., clashing of citation
keys) but from some back-of-an-envelope notes we think it should be
possible to overcome these.

Here's a brief overview of how I see the system working

1. A tool to merge BibTeX files. The resultant, merged file will contain
entries whose key is simply, say, "foo-999" (the keys will be unique but
it doesn't matter what they are) and the entries will contain an extra
field, which will be ignored by the standard BibTeX styles. This extra
field will contain, say, the key(s) used in the pre-merged entry,
keywords etc.

2. A replacement for bibtex called, say, "newbibtex". This will read the
document's .aux file for the \citation commands and search in the common
bibliography file for entries which contain the citation label. Of
course, this citation label needed appear as the actual citation key of
the bibtex entries; it could appear in any of the entry's fields. Any
entries which match are copied to a file, tmp.bib. A tmp.aux file is
created which simply contains \citation commands corresponding to all
the entries in tmp.bib along with the \bibstyle command from the
original document's .aux file. We also write into tmp.aux a
\bibdata{tmp.bib} command. We then run "bibtex tmp" and
rename the resultant tmp.bbl file to <document-name>.bbl, changing
the citation key of each \bibitem to match what was given the the
original \citation commands. (An optional extra at this point is to
write some \bibcite commands into the document's .aux file so that LaTeX
will pick up the citation information the next time it is run rather
than having to run it twice.)

Thus uing "newbibtex" with the merged bibliography file should yield
results similar to using "bibtex" on non-merged bibliographies so we
have backwards compatibility. The scheme outlined above also might
allow for more flexible citation labels. Rather than having to specify
a unique key, the \cite command might contain several pieces of
information such as author's name and year of publication. (Certainly a
lot more intuitive than something like
"powerful-synchronisation-mechanism-24" which is basically what many of
us currently have.) As long as "newbibtex" can find a unique entry
which matches this information, this will be acceptable. If the
citation information is not detailed enough to yield a unique entry
then "newbibtex" can complain in some informative manner.


Of course, we don't want to reinvent the wheel, so if anybody has tried
something like this before and would be willing to share their
experiences (or source code) then that would be apprecriated.


Ciaran.
-- 
---- Ciaran McHale (cjmchale@dsg.cs.tcd.ie)
\bi/ Department of Computer Science, Trinity College, Dublin 2, Ireland.
 \/  Telephone: +353-1-7021539 FAX: +353-1-6772204