In my document I have several chapters with sections and subsections. In the generated contents table, it would look like
1. Chapter
1.1 Section
1.1.1 Subsection
1.1.2 Subsection
2. Chapter
2.1 Section
2.1.1 Subsection
How can I specify, that the contents table only shows up to the sections level and excludes everything deeper (subsection, etc.).
So that it looks like:
1. Chapter
1.1 Section
2. Chapter
2.1 Section
Best Answer
The counter
tocdepth
controls the depth of sectioning levels appearing in theToC
Setting the
tocdepth
to the value-2
is the usual way to hide everything (unlessmemoir
class is used, then it's-3
).From
part
down tosubparagraph
the levels are-1
,0
,1
,2
,3
,4
and5
.Here, subsections shouldn't be entering the ToC, use
\setcounter{tocdepth}{1}
(preferably in the preamble).Don't forget to compile twice, as usual with ToC related - 'problems'