How to use BibTeX

Contents


Intro - Why use BibTeX?

BibTeX is a package for creating bibliographies in LaTeX documents. One needs only to maintain one database file with bibliography information, which can then be read into any number of documents, and the bibliography is automatically made when the file is processed. Advantages over making manual bibliographies include: consistency in presentation of entries, ease of changing bibliography style, correct numbering and sequential ordering of entries, and the only entries in the bibliography of the final document are those that are cited in the body of the document.

When compiling the document you need to LaTeX the file, then BibTeX it, then LaTeX it twice. When you do this BibTeX finds all the papers you have cited using the \cite{...} command in your LaTeX document and makes an auxiliary file with the extension .bbl which contains the bibliography information the papers cited in your document, and numbers them all in order of appearance.

Since you only need one file, you don't need to create a bibliography for each new document - it happens automatically when you compile the document!

BibTeX in 60 seconds

Ok, so you just want to give it a whirl. No worries, just:
  1. Download a bibliography style file such as h-physrev3.bst,  into the directory where your document is. (There are many options about - just look around the web.)
  2. Create your bibliography database file by downloading (into the directory where your document is) and editing the example file tau.bib.
  3. Remove any  \begin{thebibliography}  ...  \end{thebibliography}  commands from your document.
  4. Just before the  \end{document}  command, add

    \bibliographystyle{h-physrev3.bst}
    \bibliography{tau}
    

    (Alternatively, just download and edit this example  file.)

  5. When processing the file, you need to do: latex filename, bibtex filename, latex filename, latex filename.

How to use BibTeX - the slightly more-detailed version

To run BibTeX you need two extra files, one a bibliography style file (which has the extension .bst) which tells BibTeX how to display your bibliography, and a database (which has extension .bib) with your bibliography information.

When you run BibTeX (using the latex-bibtex commands in the sequence described above), an auxilliary file is created called filename.bbl, which stores the bibliography information specific to your document. If you change the document, e.g., by adding more citations, when you run latex-bibtex again, this file will be updated.

Examples of style files and a starter bibliography database file:

Style File:
There are several styles in common use, my favourites being  prsty.bst,  h-elsevier2.bst,  h-physrev3.bst 

The latter two show also eprint numbers, which can be rather useful if some of your papers appear only in pre-print form. However, it's a rather easy job to edit this bit into the .bbl file produced from prsty.bst. The best thing to do is to try out the style files and choose the one that looks best, or that gives the format of the journal you're writing for.

Bibliography Database:
This is the users own file that contains all the information for bibliography entries on a range of papers, books, etc., that you might want to cite. The file must have the extension .bib. The syntax for a range of entries is shown in the example file tau.bib 
Instead of the manual bibliography information with  \begin{thebibliography}...\end{thebibliography}  information, you just enter (just before the  \end{document}  command):

\bibliographystyle{h-physrev3}
\bibliography{physics}

This tells BibTeX which style to use for displaying the bibliography (in this example, it uses the h-elsevier2 style, where the full filename is h-elsevier2.bst), and the name of the bibliography database file (which will have the full filename physics.bib).

Actually, you can use multiple bibliographies in a LaTeX document by just having a series of \bibliography{...} commands. This allows you to use, for example, a set of bibliography items used and maintained by a group of people, and additionally a set of your own private bibliography entries, with

\bibliographystyle{h-physrev3}
\bibliography{groupbibentries}
\bibliography{mybibentries}

Some nice things about BibTeX

Entries in an appropriate format already exist

The nice people at SLAC have a BibTeX format in their search options for hep articles in the Spires Database  and choosing the BibTeX format in the format options just below where you enter the search command. This means that for the vast majority of papers you don't even have to enter the bibliography information by hand!

Emacs has a BibTeX mode

When you load up a .bib database file, Emacs recognises it as a BibTeX file and enters the BibTeX format, which includes a menu bar with drop-down menus for features like preformatted entry templates (just in case the entry you want to create isn't available on the Spires database), and other utilities for checking the syntax of bibliography entries. (AFAIK, this feature isn't available on MS-Word).

Types of entries

There are many types of entries that one might want to include in a bibligraphy, and it can be hard to get them standardized with the rest of the world, for example: Articles in Journals, Contributions to Conference Proceedings, Theses (published and otherwise), etc. Using either templates available from the BibTeX mode of Emacs, or from looking at similar entries on Spires, you can find a suitable and consistent layout for all such entries.

How about changing styles?

Just change the BibTeX style file. Other types of style file can be found in places like CTAN sites, for example: CTAN-Germany

When you want to submit articles?

When submitting articles, one really wants the bibliography in the body of the document. This is easily done:

Now you have what looks (and acts) like a document with a manual (and hence editable if you want to do some fine-tuning) bibliography.

For example.

The document example.tex  a very basic LaTeX document with the commands to make a BibTeX bibliography. Note that the bibliography it produces has only 2 entries, although the following bibliography database has 3 entries. This is because only 2 of these are cited in example.tex.

To process this file, the style file h-physrev3.bst,  is needed, as well as the BibTeX database file physics.bib. On processing (remember: latex, bibtex, latex, latex), the auxilliary file example.bbl is created which has the bibliography information for example.tex in it.

Return to top

Feedback
Last updated: 26Jan01
Copyright © 1999-2001 Jenny Williams
All Rights Reserved