The biblatex package
Creates citations and the bibliography from a .bib file with the program Biber: \addbibresource, \parencite, \textcite and \printbibliography.
Loading the package
\usepackage[backend=biber, style=authoryear]{biblatex}In the older BibTeX workflow, a .bst file written in its own language decides how citations and bibliography look. With biblatex the formatting is done by LaTeX macros: the option style picks a citation style, and further options change details such as the number of names or the sorting.
The program Biber sorts the entries and reads the .bib file as UTF-8. The order of the runs is pdfLaTeX, Biber, then pdfLaTeX twice.
Common styles are numeric (the default, [1]), alphabetic ([Knu84]), authoryear (Knuth 1984) and authortitle. Styles such as ieee and apa come as separate packages.
Main commands
\addbibresource{references.bib} | Names the .bib file, in the preamble and with the file extension. |
\parencite[558]{lamport1978} | Citation in parentheses; the optional argument is the page and gets "p." in front. |
\textcite{knuth1984} | Citation as part of the sentence: Knuth (1984). |
\cite{knuth1984} | The plain citation of the style, without parentheses in the author-year styles. |
\footcite{knuth1984} | Citation in a footnote. |
\autocite{knuth1984} | The citation form that suits the style: parentheses for authoryear, a footnote for the verbose styles. |
\printbibliography[heading=bibintoc] | Prints the bibliography; heading=bibintoc adds it to the table of contents. |
\nocite{*} | Lists all entries of the .bib file, also the ones that are not cited. |
Complete example
\documentclass{article}
\usepackage[backend=biber, style=authoryear]{biblatex}
\addbibresource{references.bib}
\begin{document}
\textcite{knuth1984} describes the program. Logical clocks order the
events of a distributed system \parencite[558]{lamport1978}.
\printbibliography
\end{document}File references.bib:
@book{knuth1984,
author = {Donald E. Knuth},
title = {The {\TeX}book},
publisher = {Addison-Wesley},
year = {1984}
}
@article{lamport1978,
author = {Leslie Lamport},
title = {Time, Clocks, and the Ordering of Events in a Distributed System},
journal = {Communications of the ACM},
volume = {21},
number = {7},
pages = {558--565},
year = {1978}
}Compiled with pdfLaTeX from TeX Live 2023. Tools run in this order: pdflatex → biber → pdflatex → pdflatex.
Pitfalls
- Run Biber, not BibTeX. Until Biber has run, the citations show the key in bold and the log says Please (re)run Biber on the file: main and rerun LaTeX afterwards.
\addbibresource{references}without.bibmakes Biber stop withCannot find references; see Cannot find 'references.bib'!.\bibliographystyleandnatbibbelong to the BibTeX workflow and cause errors together withbiblatex. The optionnatbib=trueprovides\citetand\citepfor old documents.- Biber and
biblatexhave to come from the same release. After an update of one of them, delete the auxiliary files (.bbl,.bcf) when Biber complains about the version of the control file. - In a document with
babel, loadcsquotesas well;biblatexuses it for the quotation marks around titles.
Related pages
- How-to Create a bibliography in LaTeX with biblatex and Biber
- How-to Citation styles in LaTeX
- How-to Cite sources in LaTeX
- How-to Write a .bib file in LaTeX
- Error Please (re)run Biber on the file: main and rerun LaTeX afterwards
- How-to Add the bibliography to the table of contents in LaTeX
- How-to Cite with page numbers in LaTeX
- How-to Set up a thesis in LaTeX