250

I need to make my (BibTeX) references section appear in the table of contents of my LaTeX document (documentclass: article), with section numbering too.

My approach until now has been making a new section and including the bibliography (references.bib) at that point:

\section{References}
\bibliography{references}

However, the final document shows both the section title that I have written and the section title that BibTeX writes, which is quite redundant and I definitely dislike.

How can I either remove BibTeX's section title, or make the BibTeX bibliography appear in the table of contents without making a new section?

If I were to make the BibTeX bibliography appear in the table of contents without making a new section, how could I assure that the section title that BibTeX writes looks exactly like sections typeset with \section?

lockstep
  • 250,273
Genba
  • 2,603

8 Answers8

188

As Herbert has hinted, your document class may include options to control the inclusion of the bibliography in the table of contents. For standard classes (article, book, report), adding \usepackage[nottoc,numbib]{tocbibind} to your document preamble should work. See the tocbibind documentation for more details.

EDIT: Herbert's suggestion (adding \addcontentsline{toc}{section}{References}) may result in an incorrect ToC entry unless the Reference section is forced on a separate page with \clearpage:

\documentclass[11pt]{article}

\usepackage{filecontents}

\begin{filecontents}{\jobname.bib}
@misc{A01,
  author = {Author, A.},
  year = {2001},
  title = {Alpha},
}
\end{filecontents}

\usepackage{blindtext}

\begin{document}

\nocite{*}

\tableofcontents

\section{foo}

\blindtext[3]

% \clearpage

\addcontentsline{toc}{section}{References}
\bibliographystyle{plain}
\bibliography{\jobname}

\end{document}
Hans
  • 161
lockstep
  • 250,273
96

Using hyperref, one should say:

\cleardoublepage

\phantomsection

\addcontentsline{toc}{chapter}{Bibliography}

\bibliography{your_bib_archive}
Helio Rocha
  • 1,061
  • 7
  • 3
42

The following should help, I think:

\documentclass[bibliography=totocnumbered]{scrartcl}

If you don't want the bibliography to have a chapter number, use the following instead:

\documentclass[bibliography=totoc]{scrartcl}
Johannes_B
  • 24,235
  • 10
  • 93
  • 248
user34726
  • 521
42

Another simple solution with Biblatex is found at https://fr.sharelatex.com/learn/Bibliography_management_with_biblatex

\printbibliography[
heading=bibintoc,
title={Whole bibliography}
]

\printbibliography[heading=subbibintoc,type=article,title={Articles only}]
SDrolet
  • 4,908
29

Here a simple solution for biblatex. Then you can omit the heading and just add a sections as you like.

\section{References}
\printbibliography[heading=none]
9
\documentclass{article}
\begin{document}

\tableofcontents

\section{foo}
\nocite{*}% only for demo to get all entries from the bib data file

\let\Section\section 
\def\section*#1{\Section{#1}} 
\bibliographystyle{plain}
\bibliography{komoedie}

\end{document}

It is easier with a class which supports a bib entry in the table of contents, eg. the KOMA-Script classes.

  • 1
    @Herbert: This will always place the Reference section on a separate page, which may not be appropriate for the article class. – lockstep Jan 07 '11 at 16:17
  • @lockstep: sure, this is what I prefer. If one want it not start at an own page then deleting of clearpage maybe a good idea ... :-) –  Jan 07 '11 at 16:19
  • 1
    @Herbert: Assuming one deletes clearpage, could it happen that \addcontentsline will point to the wrong page if the Reference section by chance starts a new page? (I dimly remember that I stumbled upon such behaviour once, but I'm not sure about it.) – lockstep Jan 07 '11 at 16:25
  • @Herbert: I reproduced the problematic behaviour - see my edited answer. – lockstep Jan 07 '11 at 20:23
  • 2
    @lockstep: ah, a competition, I like it :-) No extra answer by me, because it didn't help the one who ask a question ... However: \let\Section\section \def\section*#1{\Section*{#1} \addcontentsline{toc}{section}{References}} \bibliography{\jobname} –  Jan 07 '11 at 20:50
  • @Herbert: If it was a competition indeed, then only because I felt this was one of the few times I had a fighting chance. ;-) – lockstep Jan 07 '11 at 21:34
  • This solution works fine, but will not number the "References" section, which is something that I require for my document. – Genba Jan 08 '11 at 13:26
  • @Genba: see edited code. –  Jan 08 '11 at 13:39
  • If I want that Bibliography not appears in TOC? – hsigrist Nov 02 '11 at 22:48
  • @hsigrist: then delete the line \addcontentsline{... –  Nov 03 '11 at 06:58
  • Thanks, the \let...\Section*{#1} block helped me. What exactely does this macro do? – Rob W Jan 11 '12 at 23:14
  • @RobW: \let\A\B creates a copy of \B named \A. If \B will be modified later, it doesn't belong to \A –  Nov 27 '13 at 17:20
0

I do not like the previous answers because it does not provides you a full control on how the Reference section appears in the table of contents.

If you use natbib (that I recommend), simple add one line after the import of the package:

\usepackage{natbib}
\renewcommand{\bibsection}{\section{\bibname}}

of course you can replace \section bu whatever you want: chapter, subsection, etc.

I found this in this answer to a similar question on the LaTeX.org forum.

lehalle
  • 185
  • Downvoted for an over ten years old link. bibtex vs. biber and biblatex vs. natbib addresses issues related to natlib.biblatex adds an option to use natlib-like macros for easy switch. Finally in biblatex, the heading options heading=bibintoc or heading=bibnumbered adds a title in ToC. The former is a non-numbered while the latter is a numbered title. Whether the added title is chapter-like or section-like depends on the document class. – Celdor Aug 06 '22 at 10:37
  • 1
    thank you for the link @Celdor, nevertheless I do not see any information related to how to do this with natbib. The link is old because natbib is an old package. – lehalle Aug 12 '22 at 16:06
0

This is the only thing that worked for me after much trial and error.

\usepackage{afterpage}
...
    \addtocontents{toc}{\protect\hypertarget{toc}{}}
    \tableofcontents
    \addcontentsline{toc}{chapter}{Table of Contents}
    \setcounter{page}{1}
...
    \cleardoublepage
    \phantomsection
    \addcontentsline{toc}{chapter}{Bibliography}
    \printbibliography
\afterpage{\phantomsection
\addcontentsline{toc}{chapter}{Acronyms}}
\printglossaries

TeamDman
  • 111