3

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
  • 3
    Use \setcounter{tocdepth}{1} in the preamble -- this will fix the toc level down to sections only (1 means section) – user31729 Mar 14 '16 at 16:01
5

The counter tocdepth controls the depth of sectioning levels appearing in the ToC

Setting the tocdepth to the value -2 is the usual way to hide everything (unless memoir class is used, then it's -3).

From part down to subparagraph the levels are -1, 0, 1,2, 3, 4 and 5.

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'

\documentclass{book}

\setcounter{tocdepth}{1}
\begin{document}
\tableofcontents
\chapter{How to be seen}

\section{You see me}

\subsection{You won't see me in the Toc}

\end{document}

enter image description here

|improve this answer|||||

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for?Browse other questions tagged or ask your own question.