next up previous contents index
Next: Defining a New Page Up: Changing the Document Style Previous: Changing the Chapter Headings   Contents   Index

Adding to the Table of Contents

Starred versions of the sectioning commands are not added to the table of contents by default, but they can be added using:

\addcontentsline{<ext>}{<type>}{<text>}

<ext>
This should be the extension of the file where the contents are written. So this will be toc for the table of contents, lof for the list of figures and lot for the list of tables.

<type>
This is the type of object you are adding to the contents. e.g. chapter, section, figure.

<text>
This is the text that should go in the contents.

For example, the bibliography is generated using a starred version of the \chapter command, so it doesn't get added to the table of contents. To add it to the table of contents, you can do

\addcontentsline{toc}{chapter}{\bibname}

The counter tocdepth controls the section level depth in the table of contents. The levels corresponding to the sections are shown Table 4.2.

The report class file sets tocdepth to 2, which means that only the parts, chapters, sections and subsections will be entered into the table of contents. You can use \setcounter to change the value of tocdepth. For example, to also include the subsubsections, paragraphs and subparagraphs, do[The format of the Table of Contents, etc.]:

\setcounter{tocdepth}{5}


next up previous contents index
Next: Defining a New Page Up: Changing the Document Style Previous: Changing the Chapter Headings   Contents   Index
Nicola L. C. Talbot. School of Computing Sciences. University of East Anglia. Last Modified: 2007-11-06