[Tex/LaTex] Empty table of contents

table of contents

I am new to this community and the LaTeX environment.

I am learning the markup language and the use of the programmes.

In one of my first tests I got a trouble. The pdflatex compiler made not a problem but if I view my .pdf document, I don't have a Table Of Contents.

See below for a piece of my source code.

Does anyone know the solution for this?

Source Code of the beginning of my (Dutch) book:

\documentclass[a4paper,12pt]{book} %Zet documentklasse    
%Nu kies ik de te laden pakketten  
\usepackage{fancyhdr} 
\usepackage[dutch]{babel}
\usepackage[utf8]{inputenc}
\usepackage[T1]{fontenc}
%\usepackage{graphicx}
%Hieronder komt de hoofd- & voettekst
\pagestyle{fancy}%Selecteer de paginastijl
\fancyhf{}%Maak de kop- en voetteksten leeg
\fancyhead[RO,LE]{\thepage}%Zet als koptekst de paginanummers

%Hieronder komt de info over het boek 
\title{Debian met Orca; alleen als je blind bent}
\author{Jordy Deweer}
\date{Maart 2016}

\begin{document}
\pagenumbering{gobble} 
\maketitle
Copyright (C)2016 Alle rechten voorbehouden.

\pagenumbering{arabic}
\tableofcontents

\section{Inleiding}

Best Answer

One of many things one has to learn about LaTeX is that certain operations -- such as the creation of the table of contents and cross-referencing call-outs -- take more than one compilation round to complete fully. This is because LaTeX assembles the components of certain typographic objects -- such as the table of contents -- in stages, writing intermediate results to the files \jobname.aux and \jobname.toc (and, depending on the complexity, still more auxiliary files) at the end of each compilation run, and then reading those intermediate results back into memory at the start of the next compilation run. (The reasons for this asynchronous behavior are explicable nowadays mostly by referring to the sheer longevity of TeX, LaTeX, and friends. When TeX and LaTeX were first created, CPUs were still quite slow, RAM very expensive (and hence scarce), and operating systems generally not smart enough to allow all required computations to be performed in a single compilation round.)

The upshot? Whenever one adds or deletes structural elements -- such as \chapter and \section directives -- to a document, one must recompile the document twice to make sure that the structural changes are fully incorporated in the table of contents.

If having to remember to compile twice is a significant burden, do look into using front-end software that automatically performs as many rounds of compilation as are need to fully update the table of contents, the cross-references, the bibliography and all citation call-outs, etc. Unless your document is extremely long and/or your computer is very slow, each compilation run should take up very little noticeable time. Put differently, there's usually not much of a downside these days to running two compilation rounds each and every time.

If you compile the code shown below twice, you'll get the following look for the Table of Contents page:

enter image description here

\documentclass[a4paper,12pt]{book} 

%Nu kies ik de te laden pakketten
\usepackage{fancyhdr}
\usepackage[dutch]{babel}
\usepackage[utf8]{inputenc}
\usepackage[T1]{fontenc}
%\usepackage{graphicx}

%Hieronder komt de hoofd- & voettekst
\pagestyle{fancy}%Selecteer de paginastijl
\fancyhf{}%Maak de kop- en voetteksten leeg
\fancyhead[RO,LE]{\thepage}%Zet als koptekst de paginanummers

%Hieronder komt de info over het boek
\title{Debian met Orca; alleen als je blind bent}
\author{Jordy Deweer}
\date{Maart 2016}

\begin{document}
\frontmatter
\pagenumbering{roman}
\maketitle
\thispagestyle{empty}
Copyright \textcopyright\ 2016 Alle rechten voorbehouden.

\tableofcontents

\mainmatter % automatic page break
\chapter{Introduction} % just for this example
\section{Inleiding}
\end{document}
Related Question