So many reports/articles/books/etc. get written, by so many people, with references to others. Some references are used in a lot of an author's output, or by several authors in the same group. The formatting required for references differs between the many journals, conferences, publishers, etc. It would be nice not to have to waste time on finding and formatting dozens of such references every time one writes something, and of course to avoid having to keep track of the numbering or other labelling of citations within each document.
Means do exist to automate much of this. There are some proprietary ones for proprietary programs, and probably some other free things -- but the only one that is considered here is Bibtex, the bibliography management program for Latex.
Incidentally, an official guide to the use of Bibtex is Bibtexing (by the author of Bibtex), which is a good start for understanding the input file format. Many users, as I did, imagine that the syntax is similar to that of Latex, e.g. that lines starting in `%' will be comments, or that fields must be in braces {...}: in fact, it's more `free form' than this, with comments being all text outside a proper field, and braces or (double)quotation marks can be used to delimit fields.
Bibtex's functionality is as follows: it is called
at the end of a Latex document, it checks all the citations in that
document (of the form \cite{SomeLabel}
), it finds entries with
this label within a specially formatted text-file (*.bib
),
it formats the entries according to a bibliography style file
(*.bst
) which may be one of several standard ones supplied
with Latex or one supplied by e.g. a journal, then it puts all these
entries into a standard Latex bibliography file (*.bbl
)
with the ordering and the labelling defined by the bibliography style.
Among the tricks of formatting are the ability to do abbreviated or
long versions of months and journal names, and various citation styles such
as plain numbers [21], first-author name and year [Nam07], authors'
names and year e.g. [NTG99] or [NTG+99] for more than 3 authors.
Note that the bibtex *.bib
file can contain more references
than the ones actually used in the document, and only the cited ones are
taken (all can be chosen through \cite{*}
); this allows
a single bibtex file to be used for all of one's work, although the length
may becoming alarming if not split somehow!
The collaborative use of bibtex is often done by having a shared bibtex file, or perhaps one for each of a list of areas, on a shared directory, which can possibly be modified by all the users and can be linked or downloaded for use in a document. Web-based methods are another obvious way, including upload of new references and generation of customised files by selecting desired references from a list. Particularly if using a shared file, it is important to have an agreement on how to form the labels, so that all users can easily make citations. Other bibtex-related files can be shared in such a way, a common type being lists of canonical names and abbreviations of journal and conference names.
Although all this automation is a great help for consistency and for lack of pain when converting for different publications, it bears the usual risk that in some cases one will spend more time sorting out one's bibtex file and styles, or agreeing on things with other people for collaborative use, than if one just did it the basic, primitive way.
My preferred way of using bibtex efficiently, changed several times over my short time of needing such tools, and probably set to change still further, is the following... I mention it on the off-chance that someone else may find it useful without then needing my few iterations to get there.
I have all citation labels, as used in the bibtex file and in the latex source-code, in first-author/year format, e.g. Nam99 for someone whose surname starts with `Nam...' and for a publication in (19)99. The final form of citations in each latex document is of course not dependent on the labels used within the bibtex file and the latex source-code, but if I'm given the choice (internal documents) I use this citation style also.
This type of label is consistent between documents (unlike numbered references), it usually makes it very clear what the reference is, and I've found it neater and clearer than using the initials of all authors' names. It is easily formed by all collaboraters who may choose to share a bibtex list (except for edge cases of two publications in one year, where a rule is needed). On seeing such a label, the referenced work is almost always easily recognisable to `those in the field', and if using a bibliography style that uses this same first-author/year format then all citations will also appear in this way within the final Latex output. Very neat.
Following my enthusiasm for the many-small-files approach to data storage (a principle of e.g. some unix configuration files *.d/*, Maildir format of email storage, reiserfs `database-in-filesystem'), I've gone for one file for each reference! This avoids huge single files or any need of categorisation (which is always a problem). The naming of files is exactly as the label, e.g. Nam99, with all files living in a bibtex/ directory. Thus, knowing the author and year, one can make up the label for citing a work and can find the respective file (if needed).
I have written a perl-script for importing files -- here it is in case it's of any use to someone else: import_bibtex.pl. It takes a stream of bibtex entries on standard input, or a list of bibtex files as arguments. It leaves the input files unchanged, and writes a separate output file in the current directory, named in the Author/Year format (above), for each bibtex entry that it finds in the input.
There are lots of changes made... See the script. Required fields are put in a standard order at the beginning of an entry. Certain extra, large, fields such as an abstract are put at the end. Month names are canonicalised. Some journal or conference names are canonicalised, and messy extra information typical of bibtex downloaded from ieeexplore is removed from conference names. Some checks and warnings are made about required information.
It is NOT a perfect bibtex parser. It tries to cope with variations such
as split lines, brace or quotation-delimited entries
(name = "value"
, or name = {value},
) and simple
comments outside the fields, but it will fail (quietly) if, say, there's an
extra closing brace in a comment after the real closing brace of line,
e.g. name = {value} comment}
would include the comment.
It interprets lines starting in % or # as comments, even though real
bibtex format has all data outside the delimiters being comments.
Still, it's very very handy for me.
refs.bib
,
@Article{Far50, author = {Faraday, M. and Maxwell, J.C.}, title = {The mathematical description of electromagnetism: divergent opinions}, year = {1850}, month = {June}, journal = {An Electrician}, note = {This is fictitious.}, }a citation can be made within a Latex document by the inclusion of this text
\cite{Far50}then at the end of the document the bibtex inclusion is needed, by
\clearpage \renewcommand\refname{References} \bibliographystyle{ntbt} \footnotesize{ \bibliography{refs} }where only the
\bibliography{refs}
is actually needed, to
use the refs.bib
file as the source of the citation information
for label Far50
. The other lines in the example above determine the
style of the citations, with the \bibliographystyle{}
command,
and crudely adjust a few other things such as the text size of the bibliography,
and the title used for the bibliography. Standard styles are plain, alpha,
unsrt, abbrv, but one can also make one's own, using for example the automated
method described in the next section.
Find a standard bibtex style file, e.g. plain.bst, under your Latex
installation root. Have a look at it. To my mind, at least, it's
not pretty -- from a distance it seems fairly clear, but the
syntax, to the level needed for significant changes, was far from
obvious to me when I wanted to do such things as making authors'
names be in small-capitals and to adjust punctuation between
sections of the bibliography. Fortunately, there exists a means
of automatically generating bibliography styles:
custom-bib.
When run under Latex this will make a .bst file after asking a long list
of questions about the desired behaviour.
If you must instead try modifying an existing bibliography style,
copy it to the current directory (with the latex document that uses
it), possibly change its name so as to avoid confusion, then
try your luck!
Page started: 2008-12-21
Last change: 2009-02-01