StartLaTeX Topics

The table of contents is one of the four important lists and serves the representation of the structure of a text or a document. The outline (heading) itself is done with up to seven different outline commands. Not every document class supports all seven commands, i.e. not every command works in every class.

A document can be structured by headings and sub-headings. The following commands are available. The first two still have a few special properties such as whether they exist or whether a new page is inserted, and if so where.

\part{ } Part

The \part{} command is an exception, since it is not used directly for structuring, as is expected for a table of contents. The class book or scrbook creates a new page at the beginning of a new part on the next free right page. The report or scrreprt class creates a new page at the beginning of a new part, but uses the next free page regardless of whether it is left or right. The class article or scrartcl does not create a new page. The beamer class does not create a new page.

\chapter{ } Chapter

The \chapter{ } command represents the top level of the outline at which this command is available. The class book or scrbook creates a new page at the beginning of a new chapter on the next free right page. The report or scrreprt class also creates a new page at the beginning of a new chapter, but uses the next free page. The class article or scrartcl does not have the commands \chapter{}. The beamer class does not create a new page.

\section{ } Section

For most classes which do not use chapter command, the section \section{ } provides the top level of the outline.

\subsection{ } Subsection

Sections can be broken down into subsections using the \subsection{ } command. For the classes that use chapters as their top level, this is the lowest level that will be added to the table of contents (by default).

\subsubsection{ } Subsubsection

The sub-subsections are the lowest level to be included in the table of contents for classes where the section is the highest level (for example article).

\paragraph{ } Paragraph

Is used for structuring paragraphs or
\subparagraph{ } Subparagraph

subparagraphs and is therefore less suitable for structuring text than for highlighting words.

 documentclass headings book (scrbook) report (scrreprt) article (scrartcl) beamer \part yes yes yes yes \chapter yes yes no no \section yes yes yes yes \subsection yes yes yes yes \subsubsection yes yes yes yes \paragraph yes yes yes no \subparagraph yes yes yes no

The table of contents is inserted into the document with the command \tableofcontents. The document must be compiled minimum twice.

...
\begin{document}
\tableofcontents
\begin{abstract}
\end{abstract}
\chapter{Introduction}
\section{What is \LaTeX ?}
some text
\subsection{\LaTeX{} for linux }
more text
\subsection{\LaTeX{} for windows}
\chapter{Project}
new chapter
....
\appendix
everthing else to mention
\end{document}



To add more or less levels to the table of contents the counter tocdepth (depth of the table of contents) can be manipulated. Where the value 1 for the level is directly below the topmost level, the value 2 for the level is two levels below the topmost level, etc... Therefore you have to consider if the top level is chapter or section.

Change with \setcounter{tocdepth}{value}
...
\begin{document}
\setcounter{tocdepth}{4}
\tableofcontents
\begin{abstract}
\end{abstract}
\chapter{Introduction}
\section{What is \LaTeX ?}
some text
\subsection{\LaTeX{} for linux }
more text
\subsubsection{\LaTeX{} \& Linux }
\subsection{\LaTeX{} for windows}
\chapter{Project}
new chapter
....
\appendix
everthing else to mention
\end{document}