Time for action – adding a table of contents
We shall create a table of contents based on our numbered headings.
Let's remove the options
landscape
andtwocolumn
. We also don't load thesetspace
package. Add the command\tableofcontents
right after\begin{document}
. Our code shall now be:\documentclass[a4paper,12pt]{book} \usepackage[english]{babel} \usepackage{blindtext} \usepackage[a4paper, inner=1.5cm, outer=3cm, top=2cm, bottom=3cm, bindingoffset=1cm]{geometry} \begin{document} \tableofcontents \chapter{Exploring the page layout} In this chapter we will study the layout of pages. \section{Some filler text} \blindtext \section{A lot more filler text} More dummy text will follow. \subsection{Plenty of filler text} \blindtext[10] \end{document}
Typeset twice. Afterwards, the first page of your output will contain this table:
What just happened?
The command \tableofcontents
tells LaTeX to produce a file with the extension .toc
. This file will be used to generate a table of contents. We had to...