# Add the toc to the toc with the correct section numbering

I have had problems with the bibliography title and the Table-of-contents title not being numbered and not showing in the ToC. To solve it I used the tocbibind package.

\usepackage[numbib]{tocbibind}


to my preamble both the bibliography title and the ToC title appeared in the ToC. And the numbib value added a numbering to the bibliography.

I am still missing the numbering of the ToC, though:

As you can see in the ToC list the "Contents" title appears as it should but without a numbering. The "Contents" title (in red) did get a number though, when I added this package, but the number is wrong. As you can see, it has the number 2, which is already taken by the "Preface" title.

So it seems the numbering is not working properly and in any case not added to the ToC. Looking through the documentation of the tocbibind package, I couldn't find any notion of this, but if it can be fixed with this package, that would be good. Else, how can I fix this?

My code structure:

\documentclass[11pt,a4paper]{article}
\usepackage[utf8x]{inputenc}    %Character set
\usepackage[numbib]{tocbibind}
...
\begin{document}

\section{Abstract}
Text text text

\section{Preface}
Text text text

\pagebreak
\tableofcontents
\pagebreak

\section{Introduction}
Text text text
...
\end{document}


The tocbibind has no provision for numbering the table of contents. The easiest method is to redefine \tableofcontents to do it and to load tocbibind with the nottoc option in order to avoid double inclusion.

\documentclass[11pt,a4paper]{article}
\usepackage[utf8]{inputenc}    %Character set
\usepackage[numbib,nottoc]{tocbibind}

\makeatletter
\renewcommand\tableofcontents{%
\section{\contentsname}\@starttoc{toc}%
}
\makeatother

\begin{document}

\section{Abstract}
Text text text

\section{Preface}
Text text text

\clearpage
\tableofcontents
\clearpage

\section{Introduction}
Text text text
...
\end{document}


Notes. (1) Avoid utf8x. (2) If you want a page break that fills the available space, use \clearpage; \pagebreak seems to work here, but just because \raggedbottom is in force: with the twoside option you'd get surprises.

• Perfect. Thank you. Would you clarify for me why \makeatletter and \makeatother are necessary? – Steeven Jun 15 '15 at 9:55
• – egreg Jun 15 '15 at 10:01