Create a bibliography in LaTeX with BibTeX (bibliographystyle, natbib)
Write \bibliographystyle{plain} and \bibliography{references} where the list should appear, and cite with \cite{key}. The program BibTeX builds the list from references.bib between the LaTeX runs.
The document
\bibliography takes the name of the .bib file, and several names separated by commas. No package is needed. The order of the runs is pdflatex, bibtex, then pdflatex twice.
Complete document:
\documentclass{article}
\begin{document}
Ultrasonic sensors measure wind speed without moving parts \cite{weber2019}.
The calibration follows \cite{schmidt2021}.
\bibliographystyle{plain}
\bibliography{references}
\end{document}The standard styles
plain sorts the list by author and numbers it. unsrt keeps the order of the first citation. abbrv is plain with initials for first names, and alpha uses labels such as [WS19] built from names and year.
Complete document:
\documentclass{article}
\begin{document}
The first citation gets the number 1 \cite{weber2019},
the second the number 2 \cite{schmidt2021}.
\bibliographystyle{unsrt}
\bibliography{references}
\end{document}Author and year with natbib
The natbib package adds \citet for a citation in the sentence, "Weber and Schmidt (2019)", and \citep for one in parentheses, "(Schmidt, 2021)". It needs one of its own styles: plainnat, abbrvnat or unsrtnat. The option round selects round parentheses; with these three styles the default is square brackets.
Complete document:
\documentclass{article}
\usepackage[round]{natbib}
\begin{document}
\citet{weber2019} tested the sensors in a wind tunnel.
The calibration is described elsewhere \citep{schmidt2021}.
\bibliographystyle{plainnat}
\bibliography{references}
\end{document}List sources that are not cited
\nocite{key} adds one entry to the list without a citation in the text, and \nocite{*} adds the whole file.
Complete document:
\documentclass{article}
\begin{document}
One source is cited \cite{weber2019}, the list shows all of them.
\nocite{*}
\bibliographystyle{plain}
\bibliography{references}
\end{document}File references.bib:
@book{schmidt2021,
author = {Schmidt, Anna},
title = {Wind Measurement in Practice},
edition = {2},
publisher = {Example Press},
address = {Berlin},
year = {2021}
}
@article{weber2019,
author = {Weber, Ben and Schmidt, Anna},
title = {Ultrasonic Sensors in Wind Tunnels},
journal = {Journal of Example Studies},
volume = {12},
number = {3},
pages = {45--67},
year = {2019}
}
@online{keller2023,
author = {Keller, Mia},
title = {Calibrating a Wind Sensor},
year = {2023},
url = {https://www.example.org/calibration},
urldate = {2025-03-01}
}Pitfalls
- For a new document,
biblatexwith Biber is the better start: it sorts names with umlauts and accents correctly, translates the list into the document language and changes its style through options, see Create a bibliography in LaTeX with biblatex and Biber. BibTeX remains the choice when a journal supplies its own.bststyle. - The standard styles do not know the entry type
@online. BibTeX warns, treats the entry like@miscand leaves the address out. - Question marks in place of citations after all runs mean that BibTeX did not run or found a problem. Its messages are in the file with the ending
.blg, see Citation `knuth84' on page 1 undefined.
Compiled with pdfLaTeX from TeX Live 2023.