BibTeX is a useful extension to LaTeX for keeping track of references
and automatically generating bibliographies. There is extensive information
about BibTeX available on the web (and elsewhere), but this document should
provide enough basic information to get you started.
Creating a document with BibTeX requires two files:
- As usual, you type your document in a LaTeX file with the extension .tex
- A second file, the bibilography database, has a .bib extension
and contains the references.
Note that the same .bib file can be used for multiple .tex documents.
In particular, it is possible to maintain one or a small number of .bib files
(perhaps orgnized by category) containing information about all the papers
and books you are using in your research.
The Bibliography Database
This sample bibliography database contains
two simple entries: an article and a book.
The basic format of the file is simple: for each bibliographic entry,
the appropriate template contains the citation information. For a complete
set of BibTeX entry templates, see TOPPS
BibTeX Templates.
If you are using Emacs or XEmacs with the AUCTeX package (which is highly
recommended), you can simply select the appropriate template from the "Entry-Types" menu
when editing a BibTeX file.
The LaTeX File
The LaTeX file contains special commands to reference items from the
bibliography database.
- Before the \begin{document} command, include the command \bibliographystyle{style}.
BibTeX has several bibliography styles available, including alpha, abbrv, plain,
and unsrt.
- In the body of the document, whenever an item in the bibliography
database is referenced, include the command \cite{key}.
Here, key is the text occurring immeditately after the
document type in the BibTeX template. For example, either dlr or snedecor_cochran in
the sample file.
- At the end of the document, include the command \bibliography{bibtex-file-list}.
Here, bibtex-file-list is a list of all bibliography
databases from which items are referenced in the document, with the .bib extension
removed. For example, to reference documents from the sample database,
the command would be \bibliography{sample}
Putting it all Together
To compile your LaTeX file, perform the following steps (replacing
test with
the name of your LaTeX file):
- latex test.tex
- bibtex test
- latex test.tex
- latex test.tex
It is only necessary to run BibTeX when the references in the document change. Thus,
the sequence of commands may frequently be shorter than this.
natbib: A Variation on a Theme
The bibliographies produced by standard BibTeX have numbered references, and are
not always in the standard form for statistical journals. To obtain parenthetical
references like (Snedecor and Cochran, 1989) or textual references like Snedecor
and Cochran (1989), it is necessary to use the
natbib package, which works
in almost the same way. The following three changes are necessary to use
natbib:
- Include the natbib package: \usepackage[round]{natbib}
The option [round] produces round parenthesis in the citations.
For other options, see the natbib documentation.
- Choose a natbib bibliography style. Generally, these have
the same names as BibTeX styles, but with nat added. For example, abbrvnat or plainnat.
- In place of \cite, use \citep for parenthetical
references or \citet for textual references.