using bibtex: a short guide

intro

BibTeX automates most of the work involved in managing references for use in LaTeX files. You need to type each reference only once, and your citations and reference list are automatically formatted consistently, in a style of your choosing.

BibTeX references are stored in a plain text database with a simple format. When you want to cite an item in the database in a LaTeX document, you write \cite{<label>} (or something similar), where <label> is the label attached to the item in the database. You put a command in your LaTeX file specifying the style in which you want the references to appear in the bibliography of the document and another command specifying the location of your reference database. You then process the LaTeX file with latex or pdflatex (which creates, among other things, a list of the labels of the items you cite), then with bibtex (which reads the list of labels, finds the items in your database, and writes a bibliography for your document), and finally with latex again (which incorporates the bibliography into your document).

Using BibTeX has several significant benefits.

  • You need to type each reference only once. Once it is in your database, it can be included in any document you write merely by your typing its label.
  • The style of all your citations in any given document will be consistent. If, for example, the style you use causes \cite{arrow72} to produce "Arrow (1972)", then you'll never find "Arrow [1972]" in your paper.
  • If you cite more than one paper by the same author in the same year, BibTeX appends the appropriate letters to the years—you don't need to fiddle around with them and change "Arrow (1972)" to "Arrow (1972a)" when you add a reference to another paper published by Arrow in 1972.
  • You never need to fuss with the style of the list of references at the end of your document. All you need to do is say \bibliography{research} and all the items you cite will be extracted from your research.bib bibliography file, ordered correctly, and formatted at the end of your document according to the style file you specify.
  • Every item you cite will appear in the list of references in your document, and every item in that list will be one you cite (unless you explicitly specify otherwise)—without your having to do any manual check.
  • If you wish, you can help your readers by including after each item in your list of references a list of the page numbers on which you cite the item.
As an alternative to using bibtex to extract the references from your database and create a bibliography file, you can use biber, a component of the BibLaTeX system. Both programs operate on a database with the same structure. The bibtex program, developed in 1985 in conjunction with the database structure, is tried and true; its main disadvantage is the difficulty of creating custom bibliography styles, although tools exist to help you do so (I discuss them near the bottom of this page). The BibLaTeX system, whose development started in 2006, is potentially more powerful, but I have not been able to get it working properly in any of my LaTeX systems. So I limit my discussion to BibTeX.

how to

To use BibTeX, here's what you need to do.

Create a bibliography database
A BibTeX database is a plain text file. The file must be given the extension bib. Here are some ways to create one. (1) Convert references from text format using text2bib. (2) Convert references in some other format using tools available on the net. (3) Export references from Google Scholar into BibTeX after choosing BibTeX in the "Bibliography manager" section of your Scholar Preferences. (Note, however, that the accuracy of these references is not very high.) (4) Type the database from scratch, either directly as a plain text file or by using a BibTeX management program (e.g. JabRef).

However you create it, the file will look something like the following example. Hover over orange text to see explanations. For each item type, the required fields are highlighted.

@
article
article specifies the type of the item. Many types are available. The most commonly-used are probably article, book, incollection (for a chapter in an edited volume), inproceedings (for an article in conference proceedings), techreport (for a report, like a "Working paper" or "Technical report", issued by an institution), and unpublished. The case of the letters in the name of the type is insignificant; you can write Article or ARTICLE, for example.
{
ahu61
This string is a label that you use to refer to the item when you cite it. It can be any string.
,
author={
Arrow, Kenneth J. and Leonid Hurwicz and Hirofumi Uzawa
The list of authors. Note that "and" appears between every pair of authors. (Of course, when the reference is formatted in your paper, only the "ands" specified by the bibliography style you choose will appear.) BibTeX interprets Arrow, Kenneth J., Kenneth J. Arrow, and Kenneth Joseph Arrow to refer to an author whose last name is "Arrow" and whose forenames are "Kenneth J." or "Kenneth Joseph". So if you want to refer to an item by John Maynard Smith (whose last name was "Maynard Smith"), you need to format the name as Maynard Smith, John or John {Maynard Smith}. It's not exactly the case that BibTeX takes the string following the last space to be the last name. If that string is preceded by a string or strings that start with lowercase letters, those strings as well as the final string are treated as the last name. For example, if you write Ernesto Guevara de la Serna, BibTeX interprets "de la Serna" to be the last name, which is wrong—his last name was Guevara de la Serna; you need to write Guevara de la Serna, Ernesto.
}, title={
Constraint qualifications in maximization problems
Do not surround the title by quotation marks. If the bibliography style you use puts titles in quotation marks, it will do it for you.
}, journal
=
The = can be surrounded by spaces, if you wish.
{Naval Research Logistics Quarterly}, volume={8}, year=
1961
If the value of a field consists only of digits, the braces around it can be omitted.
, pages={
175-191
You can alternatively enter 175--191. Either way, when BibTeX formats your reference it will insert an en-dash between the pages, if that is what your bibliography style specifies (which it should).
} } @book{ab94, author* = {Charalambos D. Aliprantis and Kim C. Border}, year = {1994}, title = {Infinite Dimensional Analysis}, publisher = {Springer}, address = {Berlin} }
*A book must have either an author field or an editor field.
@incollection{m85,
   author={Maskin, Eric S.},
   year={1985},
   title={The theory of implementation in 
{N}ash
The fact that the first letter of "Nash" is enclosed in braces tells BibTeX that if a bibliography style calls for titles to use "sentence capitalization" (only the first letter of the title and the first letter of any proper nouns are capitalized) then the first letter of "Nash" should remain uppercase and not be lowercased.
equilibrium: a survey}, booktitle={Social Goals and Social Organization}, editor={Leonid Hurwicz and David Schmeidler and Hugo Sonnenschein}, pages={173-204}, publisher={Cambridge University Press}, address={Cambridge} } @inproceedings{ah2006, author={Aggarwal, Gagan and Hartline, Jason D.}, year={2006}, title={Knapsack auctions}, booktitle={Proceedings of the 17th Annual ACM-SIAM Symposium on Discrete Algorithms}, pages={1083-1092}, publisher={Association for Computing Machinery}, address={New York} } @techreport{arrow48, author = {Arrow, Kenneth J.}, title = {The possibility of a universal social welfare function}, institution = {RAND Corporation}, year = {1948}, number = {P-41}, type = {Report} } @unpublished{FudenbergKreps1988, title = {A theory of learning, experimentation, and equilibrium in games}, author = {Fudenberg, Drew and Kreps, David M.}, year = {1988}, note = {Unpublished paper} }
Notes
  • The order of the fields is unimportant.
  • Your bib file can contain references you don't cite. BibTeX will put in the list of references at the end of your paper only the ones that you cite (unless you explicitly tell it otherwise).
You can find a full specification for a BibTeX file in Appendix B of LaTeX: A document preparation system by Leslie Lamport (ISBN 0-201-15790-X).
Choose a style for your citations and bibliography
You need to decide how you want citations to appear in your document and how you want the references formatted in the bibliography. The "standard" BibTeX styles mentioned in LaTeX: A document preparation system (p. 74) make citations of the form "see [2]" or "see [AH75]" and number the references in the bibliography. If that's what you want, and you are satisfied with the format of the bibliography that those styles produce, you're done.

If you want your citations to take the form "see Arrow and Hahn (1971)", or you want to tinker with the format of the items in the bibliography, then you need to either find or create a suitable BibTeX style file. If you search for "bibtex style files" on the web, you'll find pages that list style files and show you the output they produce. However, none of these pages makes it easy to choose a style. The styles mentioned in the next section might work for you; or you can create your own (see the final section).

Create a LaTeX file with references to your bibliography database
Your LaTeX file needs to include
  • a reference to a label in your BibTeX file whenever you want to cite an item in the file
  • a reference to the bibliography style file you want to use, which determines how the references you cite are formatted in the bibliography of your document (and possibly a LaTeX style file associated with the bibliography style)
  • a LaTeX command to generate the bibliography at the point in your document where you want it to appear.

Example using te.bst

Here is an example using the bibliography style te.bst, which produces citations in "author (year)" format. This file is available on this page (which has instructions on where to put the file once you get it). The lines related to BibTeX are highlighed. It requires the LaTeX style file natbib.sty to produce citations in the right style in the text (matching the format of the references produced by te.bst). You probably have this file already (assuming you have some implementation of TeX on your computer). If you don't, you can get it on this CTAN page. Hover over orange text to see explanations.

\documentclass[12pt]{article}
\usepackage{natbib}
This command tells LaTeX to use the natbib style, to produces citations in the text in a format consistent with the format of the references produced by te.bst.
\begin{document} \title{BibTeX in action} \author{Martin J. Osborne} \date{2008-1-13} \maketitle \section{Introduction} This document illustrates the use of BibTeX\@. You may want to refer to
\cite{ahu61}
This command tells LaTeX to insert at this point a citation to the item with label ahu61 in your BibTeX database file.
or \cite{ab94} or \cite{m85}. Or you may want to cite a specific page in a reference, like this: see \citet[p.~199]{m85}. Or perhaps you want to cite more than one paper by Maskin: \cite{m85, m99}. Or you want to make a parenthetical reference to one or more articles, in which case the \verb+\citealt+ command omits the parentheses around the year (\citealt{ahu61}).
\bibliographystyle{te}
This command tells BibTeX to use the bibliography style file te.bst. This file should be in a directory where LaTeX and BibTeX can find it. For example, if you're using MiKTeX on Windows, then the available bst files are in a directory named something like \Program Files\MiKTeX 2.9\bibtex\bst. If you have a bst file that is not available there, put it in a subdirectory of \<your local TeX directory>\bibtex\bst, where <your local TeX directory> might sensibly be localtexmf.
\bibliography{research}
This command tells BibTeX to use your bibliography database file research.bib. If this file is not in the same directory as your document, you need to include the path to it, like so: \bibliography{/bib/research}, where \bib is the directory of your system in which the file resides. Notice that the path separator character in the \bibliography command is a forward slash, even on a Windows system.
\end{document}

When you run the LaTeX file through LaTeX and BibTeX (instructions below), you'll get output for the body of the document that looks roughly like this:

This document illustrates the use of BibTeX. You may want to refer to Arrow et al. (1961) or Aliprantis and Border (1994) or Maskin (1985). Or you may want to cite a specific page in a reference, like this: see Maskin (1985, p. 199). Or perhaps you want to cite more than one paper by Maskin: Maskin (1985, 1999). Or you want to make a parenthetical reference to one or more articles, in which case the \citealt command omits the parentheses around the year (Arrow et al. 1961).
A few more options for the \cite command are available. Here they are:
\citet{key}Jones et al. (1990)
\citet*{key}Jones, Baker, and Smith (1990)
\citep{key}(Jones et al. 1990)
\citep*{key}(Jones, Baker, and Smith 1990)
\citep[p.~99]{key}(Jones et al., 1990, p. 99)
\citep[e.g.][]{key}(e.g. Jones et al., 1990)
\citep[e.g.][p.~99]{key}(e.g. Jones et al., 1990, p. 99)
\citeauthor{key}Jones et al.
\citeauthor*{key}Jones, Baker, and Smith
\citeyear{key}1990
\citeapos{key}*Jones et al.'s (1990)

*Assumes \citeapos is defined in your style or document like this:

\def\citeapos#1{\citeauthor{#1}'s (\citeyear{#1})}
(Thanks to Christopher M. Duncombe Rae for pointing out this simple way of generating a possessive citation.)

The list of references will look like this:

Aliprantis, Charalambos D. and Kim C. Border (1994), Infinite Dimensional Analysis. Springer, Berlin.

Arrow, Kenneth J., Leonid Hurwicz, and Hirofumi Uzawa (1961), "Constraint qualifications in maximization problems." Naval Research Logistics Quarterly, 8, 175–191.

Maskin, Eric S. (1985), "The theory of implementation in Nash equilibrium: a survey." In Social Goals and Social Organization (Leonid Hurwicz, David Schmeidler, and Hugo Sonnenschein, eds.), 173–204, Cambridge University Press.

Maskin, Eric S. (1999), "Nash equilibrium and welfare optimality." Review of Economic Studies, 66, 23–38.

Example using apacite.bst

Here is an example using the bibliography style apacite.bst, which in included in many LaTeX systems.
\documentclass[12pt]{article}
\usepackage{apacite}
Note the LaTeX style file is not natbib.
\begin{document} \title{BibTeX in action} \author{Martin J. Osborne} \date{2008-1-13} \maketitle \section{Introduction} This document illustrates the use of BibTeX\@. You may want to refer to
\citeA{ahu61}
Note the final "A". The command \cite produces citations in parentheses.
or \citeA{ab94} or \citeA{m85}. Or you may want to cite a specific page in a reference, like this: see \citeA[p.~199]{m85}. Or perhaps you want to cite more than one paper by Maskin: \citeA{m85, m99}. Or you want to make a parenthetical reference to one or more articles, in which case you can type
\cite{ahu61}
Note the absence of parentheses in the document. The \cite command produces them in the output.
\bibliographystyle{apacite}
This command tells BibTeX to use the bibliography style file apacite.bst.
\bibliography{research}
This command tells BibTeX to use your bibliography database file research.bib. If this file is not in the same directory as your document, you need to include the path to it, like so: \bibliography{/bib/research}, where \bib is the directory of your system in which the file resides. Notice that the path separator character in the \bibliography command is a forward slash, even on a Windows system.
\end{document}

When you run the LaTeX file through LaTeX and BibTeX (instructions below), you'll get output for the body of the document that differs from the output when you use te.bst only in that the names of all three authors of Arrow, Hurwicz, and Uzawa (1961) are listed in the first citation to that work, although not in the second, parenthetical, citation.

The list of references differs more significantly from the list produced by te.bst: only authors' initials, not their full first names, are included, and "&" rather than "and" is used as a separator; numbers in page ranges are separated by hyphens, rather than the conventional en-dashes. Precisely, the list of references produced by apacite.bst looks like this:

Aliprantis, C. D. & K. C. Border (1994), Infinite Dimensional Analysis. Berlin: Springer.

Arrow, K. J., Hurwicz, L., & Uzawa, H. (1961), Constraint qualifications in maximization problems. Naval Research Logistics Quarterly, 8, 175-191.

Maskin, E. S. (1985), The theory of implementation in Nash equilibrium: a survey. In L. Hurwicz, D. Schmeidler, & H. Sonnenschein (Eds.), Social Goals and Social Organization (p. 173-204). Cambridge: Cambridge University Press.

Maskin, Eric S. (1999), Nash equilibrium and welfare optimality. Review of Economic Studies, 66, 23-38.

Creating your own bibliography style

A BibTeX style file is plain text, which in principle you can edit. However, the language used is arcane, and changes that are more than trivial are tricky. A better way to proceed is to create a new style file from scratch, using the custom-bib package (that's how I created te.bst). You run TeX on a file, which asks you a long list of questions about the features of the style you would like. You'll probably not be completely clear about your preferred answers to all the questions on your first attempt, but two or three runs should produce a format to your liking.
Run LaTeX and BibTeX
Finally, you need to run your file through LaTeX, then BibTeX, then one or two more times through LaTeX.

Typically, running LaTeX means typing latex <filename> at the command prompt and running BibTeX means typing bibtex <filename>. If you are using a program with a graphical interface to TeX, you probably need to click on a button. If you are using BaKoMa TeX Word, you don't need to do anything to run LaTeX (it runs automatically); to get BibTeX to run you may need to press F5 or click the "Refresh document references ..." button.