Create a bibliography in LaTeX with biblatex and Biber
Store your sources in a .bib file, load biblatex, name the file with \addbibresource, cite with \cite{key} and print the list with \printbibliography. The program Biber sorts and formats the entries between the LaTeX runs.
Preamble
The snippets on this page need these lines before \begin{document}:
\usepackage[backend=biber, style=numeric]{biblatex}
\addbibresource{references.bib}The document
style sets how citations and entries look; numeric gives numbers in square brackets. \addbibresource needs the file name with the ending .bib. The list contains the sources that you cite, not the whole file.
Complete document:
\documentclass{article}
\usepackage[backend=biber, style=numeric]{biblatex}
\addbibresource{references.bib}
\begin{document}
Ultrasonic sensors measure wind speed without moving parts \cite{weber2019}.
The calibration follows \cite{schmidt2021}.
\printbibliography
\end{document}The file references.bib
Each entry starts with its type and a key; the key is what you write in \cite. The fields are described in Write a .bib file in LaTeX.
@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}
}The order of the runs
Run pdflatex, then biber, then pdflatex twice. The first LaTeX run collects the keys, Biber reads the .bib file and writes the formatted entries, and the following LaTeX runs insert the list and the citations.
A German document
biblatex takes the language from babel and translates words such as "and", "pp." and "ed." itself; with ngerman the heading reads "Literatur". Load csquotes too, otherwise biblatex warns that it is missing.
Complete document:
\documentclass{article}
\usepackage[ngerman]{babel}
\usepackage{csquotes}
\usepackage[backend=biber, style=authoryear]{biblatex}
\addbibresource{references.bib}
\begin{document}
Ultraschallsensoren arbeiten ohne bewegliche Teile \parencite{weber2019}.
\printbibliography
\end{document}List all entries or only one type
\nocite{*} adds every entry of the file to the list, cited or not. The options of \printbibliography filter and rename a list: type=book keeps the books, nottype=book everything else, and title sets the heading. With a numeric style, the package option defernumbers=true numbers the entries in the order of the printed lists.
Complete document:
\documentclass{article}
\usepackage[style=numeric, defernumbers=true]{biblatex}
\addbibresource{references.bib}
\begin{document}
\nocite{*}
\printbibliography[type=book, title={Books}]
\printbibliography[nottype=book, title={Other sources}]
\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
- If the citations appear as bold keys and the list is missing, Biber did not run. The log then says "Please (re)run Biber", see Please (re)run Biber on the file: main and rerun LaTeX afterwards.
\bibliographystylebelongs to BibTeX and stops with an error whenbiblatexis loaded. Choose the look with thestyleoption.backend=bibtexletsbiblatexwork with the older BibTeX program where Biber is not available. Features that only Biber has, such as sorting by the rules of the document language, are missing then.
Compiled with pdfLaTeX from TeX Live 2023.
Related pages
- Package
biblatex - Package
csquotes - How-to Write a .bib file in LaTeX
- How-to Citation styles in LaTeX
- Error Please (re)run Biber on the file: main and rerun LaTeX afterwards
- Package
babel