Two ways to build a bibliography in LaTeX
LaTeX does not format references on its own. You keep your sources in a .bib database, cite them by key in your text, and a bibliography tool turns the entries into a formatted list. Two systems do this job, and you will see both in templates:
- BibTeX works with the
\bibliographystyleand\bibliographycommands. It is the older system and is still used by many journal templates, such as IEEEtran for IEEE papers and elsarticle for Elsevier journals. For author-year or superscript citations, pair it with the natbib package. - biblatex with the biber backend is the more modern option. It handles many entry fields and styles through package options, and it is a common choice for new documents.
If a template you have chosen uses one system, follow it rather than switching. Loading both systems in one document causes errors.
The .bib file
Each source is an entry in a plain-text file, usually called references.bib. This example entry is made up for illustration:
@article{smith2020,
author = {Smith, Jane and Lee, Min},
title = {Typesetting Tables in Practice},
journal = {Journal of Document Engineering},
year = {2020},
volume = {12},
pages = {45--60},
}
Three parts matter most:
- The entry type (
@article) says what kind of source this is. - The citation key (
smith2020) is the name you use in\citecommands. Keys are case-sensitive, soSmith2020andsmith2020are different keys. - The fields (
author,title,year, and so on) hold the data. Different entry types expect different fields.
Common entry types
@articlefor journal articles@bookfor books@inproceedingsfor conference papers@misc(BibTeX) or@online(biblatex) for web pages and other sources that do not fit a standard type
Reference managers can export entries in this format. For one way to set that up, see how to use Zotero with LaTeX and Overleaf.
Protecting capital letters
Bibliography styles often change the case of titles. To keep letters such as acronyms in their original case, wrap them in an extra set of braces:
title = {A Study of {GPU} Memory Models},
Citing in your text
The citation commands depend on the package you load.
With natbib (BibTeX):
\cite{key}gives the default citation for the style.\citep{key}gives a parenthetical citation.\citet{key}gives a textual citation, where the author is part of the sentence.
With biblatex:
\cite{key}gives the default citation for the style.\textcite{key}puts the author into the sentence.\parencite{key}puts the whole citation in parentheses.\autocite{key}lets the style choose a suitable form.
To cite several sources at once, separate the keys with commas and no spaces: \cite{smith2020,lee2021}.
A minimal working document
With biblatex:
\documentclass{article}
\usepackage[backend=biber,style=numeric]{biblatex}
\addbibresource{references.bib}
\begin{document}
Prior work reported this effect \autocite{smith2020}.
\printbibliography
\end{document}
With BibTeX and natbib:
\documentclass{article}
\usepackage[numbers]{natbib}
\begin{document}
Prior work reported this effect \citep{smith2020}.
\bibliographystyle{plainnat}
\bibliography{references}
\end{document}
In the BibTeX version, \bibliography{references} refers to references.bib, and the file extension is left out.
Compiling the bibliography
The bibliography tool reads your .bib file during compilation, so one LaTeX run is not enough. Run the commands in this order:
| System | Run order |
|---|---|
| BibTeX | pdflatex, bibtex, pdflatex, pdflatex |
| biblatex with biber | pdflatex, biber, pdflatex, pdflatex |
The first LaTeX run records your citations. The bibliography tool builds the list. The final LaTeX runs fill in the numbers and cross-references.
Overleaf usually runs these steps for you when it detects that a bibliography is needed. If your citations still show as question marks, run the full sequence again and read the log for errors.
Choosing a citation style
The citation style controls how citations look in the text and how entries look in the list. Common options include:
- BibTeX styles:
plain,unsrt,abbrv, andalpha. With natbib, use the natbib-compatible versions instead:plainnat,unsrtnat, andabbrvnat. - biblatex styles:
stylesets both the citation and bibliography style. Common values includenumeric,alphabetic,authoryear, andauthortitle. Thecitestyleandbibstyleoptions set them separately.
Many journals and universities supply their own style. In that case, use the settings from the template.
Linked citations with hyperref
Readers often expect a citation to link to its bibliography entry, and a URL to be clickable. The hyperref package adds these links:
\usepackage[colorlinks=true,linkcolor=blue,citecolor=blue,urlcolor=blue]{hyperref}
Load hyperref after your citation package, near the end of the preamble. If you want clickable links without colored text, use \usepackage[hidelinks]{hyperref} instead. Journals often require black text in print, so check the template before you turn on colored links.
Related guides
This cluster covers the common questions in more depth:
- Superscript and author-year citations in LaTeX for natbib citation looks
- How to make citations in Overleaf for a complete Overleaf setup
- How to cite a website in LaTeX for web sources
- How to use Zotero with LaTeX and Overleaf and using Mendeley with Overleaf for reference-manager workflows
- Is it better, Mendeley or Zotero? if you have not chosen a reference manager yet