How to Use BibTeX

From an empty .bib file to a finished bibliography in four steps, plus the choices you'll run into along the way.

On this page
  1. 1. Create your .bib file
  2. 2. Cite in your LaTeX document
  3. 3. Compile
  4. 4. Choose a style
  5. Author–year citations with natbib
  6. BibTeX or biblatex?
  7. Using BibTeX outside LaTeX

1. Create your .bib file

A .bib file is plain text, so any editor will do. Save it next to your document, for example as references.bib, and add entries as described in the format:

@article{einstein1935can,
  author  = {Einstein, A. and Podolsky, B. and Rosen, N.},
  title   = {Can Quantum-Mechanical Description of Physical Reality Be Considered Complete?},
  journal = {Physical Review},
  year    = {1935},
  volume  = {47},
  number  = {10},
  pages   = {777--780},
  doi     = {10.1103/PhysRev.47.777}
}

You rarely need to type entries by hand. Use the DOI → BibTeX lookup, export from Google Scholar or your publisher, or let a reference manager maintain the file for you.

2. Cite in your LaTeX document

Cite entries by their key with \cite, then tell LaTeX which style to use and where the bibliography goes:

\documentclass{article}

\begin{document}

The EPR paradox~\cite{einstein1935can} questioned whether
quantum mechanics is complete.

\bibliographystyle{plain}
\bibliography{references}   % references.bib, without the extension

\end{document}

Only cited entries appear in the bibliography. To include an entry without citing it, use \nocite{key}, or \nocite{*} to include every entry in the file.

3. Compile

BibTeX runs between LaTeX runs. LaTeX first writes the cited keys to an .aux file. BibTeX reads it and writes the formatted bibliography to a .bbl file. LaTeX then includes that file and resolves the citation numbers:

pdflatex paper
bibtex   paper
pdflatex paper
pdflatex paper

Don’t add a file extension when calling bibtex. Most editors and Overleaf run these steps for you. On the command line, latexmk -pdf paper works out the right sequence automatically.

If something goes wrong, look at the .blg file: it contains BibTeX’s warnings and errors, with line numbers in your .bib file. The FAQ covers the most common messages.

4. Choose a style

The bibliography style decides how references are sorted, labelled and formatted. These styles ship with every TeX distribution:

Style Labels Order
plain [1], [2], … Sorted by author, year and title
unsrt [1], [2], … In order of first citation
abbrv [1], [2], … Like plain, with abbreviated first names and months
alpha [Knu84] Sorted, with labels built from author and year
ieeetr [1], [2], … In order of citation, IEEE Transactions layout
acm [1], [2], … Sorted, ACM layout with small-caps names
siam [1], [2], … Sorted, SIAM layout
apalike (Knuth, 1984) Author–year, needs the apalike package

Journals and conferences often provide their own .bst file, so check the author guidelines first.

Author–year citations with natbib

For citations like Einstein et al. (1935), load the natbib package and use one of its styles, such as plainnat, abbrvnat or unsrtnat:

\usepackage[round]{natbib}
...
\citet{einstein1935can} showed ...   % Einstein et al. (1935) showed ...
... as argued before \citep{einstein1935can}.   % (Einstein et al., 1935)

\bibliographystyle{plainnat}
\bibliography{references}

The natbib styles also print doi and url fields.

BibTeX or biblatex?

biblatex is a complete reimplementation of bibliographies for LaTeX. It reads the same .bib files but formats them with LaTeX macros instead of .bst files, and it uses the biber program instead of bibtex:

\usepackage[style=authoryear]{biblatex}
\addbibresource{references.bib}   % with the extension
...
\textcite{einstein1935can} showed ... \parencite{einstein1935can}
...
\printbibliography
pdflatex paper
biber    paper
pdflatex paper

Choose biblatex if you are free to pick: it handles Unicode natively, has many more entry types and fields (@online, urldate, …), and its styles are much easier to customise. Stick to BibTeX when a journal or conference template requires a .bst style, which many still do. Your .bib file works with both.

Using BibTeX outside LaTeX

BibTeX files are a common exchange format. Reference managers like Zotero and JabRef import and export them, and can insert citations into Word or LibreOffice documents. Pandoc formats citations from a .bib file for Markdown, Word and HTML output.