# Setting TOC depth not working

I'm using a \documentclass[11pt]{book} document.

I have tried to define a TOC with a maximum depth of 4 with:

\setcounter{secnumdepth}{4}
\setcounter{tocdepth}{4}
\tableofcontents


The resulting pdf document doesn't take into account my setting and goes to the deepest level in my TOC.

I have not see anything relevant in the console, but I'm really a novice in LaTeX.

-
Welcome to TeX.SX! You are telling LaTeX to number sectional units introduced by \chapter (level 0), \section (level 1), \subsection (2), \subsubsection (3) and \paragraph (4), including them in the table of contents, which is produced by \tableofcontents and not by \makeindex. Please, try adding a minimal working example (MWE) that illustrates your problem. –  egreg Jun 24 '12 at 13:15
Well perhaps 4 is your deepest level (4 goes down to \paragraph). Try what happens if you use 0. If this doesn't change the toc then you probably reset the value somewhere else in your document. –  Ulrike Fischer Jun 24 '12 at 13:16
@UlrikeFisher You are right, I was misunderstanding TOC levels. A 0 level means my \chapter level was included in TOC, so for a depth of 4 like 3.2.1.3 I need to set the depth to 3. –  David Casillas Jun 24 '12 at 13:35

The sectional levels are numbered starting from 0:

\chapter is level 0
\section is level 1
\subsection is level 2
\subsubsection is level 3
\paragraph is level 4
\subparagraph is level 5

If you want to number up to four levels, you need to set

\setcounter{secnumdepth}{3}


The independent counter for the inclusion in the table of contents is tocdepth and respects the same values.

The complete truth is that there is also a level –1, which corresponds to \part. So for no numbering whatsoever, use \setcounter{secnumdepth}{-2} or a lower value.

-
With \setcounter{tocdepth}{2} I have only subsections, and with \setcounter{tocdepth}{3} I get paragraphs and subparagraphs (and this is with fully nested subparagraphs, not the skip-a-level mechanism you just showed me) showing in the TOC. Trying to get subsubsections, without paragraphs. Do you know if amsbook does this differently? –  Ben Voigt Nov 13 '14 at 18:29
Found it, amsbook uses \let\l@paragraph\l@subsubsection giving paragraphs the same depth as subsubsections. It should be \def\l@paragraph{\@tocline{4}{0pt}{1pc}{9pc}{}} –  Ben Voigt Nov 13 '14 at 18:40