Tx · LaTeX & TikZ

How to Number a BibLaTeX Bibliography Heading

Published By the 9to5Science editorial team

At a glance

  1. 1. Use BibLaTeX’s heading

    Set the printbibliography heading option to bibnumbered.

  2. 2. Match the document class

    BibLaTeX normally uses a numbered chapter in book-style classes and a numbered section in article.

  3. 3. Avoid duplicate control

    Remove tocbibind’s numbib option when BibLaTeX prints the bibliography.

  4. 4. Check the output

    Run LaTeX and Biber as required, then rerun LaTeX to update references and the table of contents.

If your document uses BibLaTeX, tocbibind’s numbib option is not the reliable way to number the bibliography heading. BibLaTeX defines its own bibliography headings, so tell \printbibliography to use its numbered heading instead.

Use heading=bibnumbered

Add the heading=bibnumbered option to the command that prints the bibliography:

\printbibliography[heading=bibnumbered]

BibLaTeX uses a numbered heading appropriate to the document class in common classes: generally a chapter in book or report, and a section in article. A numbered heading is normally included in the table of contents as well. Whether its number is displayed or listed can also depend on class settings such as the numbering depth.

Here is a complete example. Save it as a .tex file and compile with LaTeX, Biber, then LaTeX again (usually twice):

\begin{filecontents*}{references.bib}
@book{knuth,
  author    = {Donald E. Knuth},
  title     = {The TeXbook},
  publisher = {Addison-Wesley},
  year      = {1984}
}
\end{filecontents*}

\documentclass{article}
\usepackage[backend=biber,style=authoryear]{biblatex}
\addbibresource{references.bib}

\begin{document}

A citation in the text: \cite{knuth}.

\printbibliography[heading=bibnumbered,title={References}]

\end{document}

In the example, the heading is a numbered section titled “References.” In book and report, BibLaTeX generally makes the numbered bibliography heading a chapter. The title option changes the heading text; omit it to use the class’s usual bibliography title.

If you specifically need a section in a book

The standard numbered heading follows the class’s normal bibliography level. If you are using book or report but want the bibliography as a numbered section rather than a chapter, define a custom heading in the preamble:

\defbibheading{bibsection}[\refname]{\section{#1}}

Then print it with:

\printbibliography[heading=bibsection,title={References}]

This uses the class’s \section command, so its number follows the usual section counter (for example, 3.1 when it is in chapter 3). A numbered section is ordinarily added to the table of contents automatically.

What tocbibind does here

tocbibind is designed to add standard LaTeX lists and bibliographies to the table of contents and can change the numbering of traditional bibliography headings. BibLaTeX instead manages the heading through \printbibliography and its heading option. Consequently, adding numbib to tocbibind does not reliably change a BibLaTeX bibliography’s heading.

If you only use tocbibind for other lists, you can tell it not to handle the bibliography, for example with \usepackage[notbib]{tocbibind}. Let BibLaTeX control the bibliography heading. Avoid combining both packages’ attempts to create or number that heading, since this can lead to duplicate or inconsistent entries.

If you want an unnumbered bibliography heading that still appears in the table of contents, use heading=bibintoc instead:

\printbibliography[heading=bibintoc]

Common mistakes

  • Using numbib as if BibLaTeX were using thebibliography. BibLaTeX has its own heading mechanism; set the option on \printbibliography.
  • Expecting the same heading level in every class. The standard numbered heading follows the class’s conventions. Define a custom heading if you need a different level.
  • Confusing a numbered heading with a ToC-only entry. bibnumbered makes the heading numbered; bibintoc makes an unnumbered heading and adds it to the table of contents.
  • Stopping after one LaTeX run. Bibliography processing and table-of-contents entries may need another LaTeX run to settle. Run Biber between LaTeX runs when using the Biber backend.
  • Using an incompatible bibliography workflow. This advice is for BibLaTeX and \printbibliography. Traditional BibTeX setups use different commands and may use tocbibind differently.

References

  1. The biblatex Package — CTAN
  2. The tocbibind Package — CTAN

Spotted an error? Send a correction. Read how we write and check articles in our editorial policy.