LaTeX: How to set the Table of Contents (TOC) depth

LaTeX question: Is there a way I can control the depth of the table of contents (\tableofcontents) using LaTeX?

I just ran into the following problem: For a technical document I’m creating with LaTeX, there are a lot of sections that have a repeated/consistent format. This is exactly what I want, but for a 160 page document I ended up with a 15-page table of contents (TOC). This made me wonder, is there are way to control the “depth” of the table of contents?

After a little research ... yes, I can. Here’s some sample code that I put in the LaTeX preamble, just before the \tablofcontents tag:


This created a much smaller TOC; only 2 pages. It created only an entry for each Chapter and Section, and did not include any Subsections, or anything else beneath the Section depth. Perfect — this is exactly what I want.

Add new comment

The content of this field is kept private and will not be shown publicly.

Anonymous format

  • Allowed HTML tags: <em> <strong> <cite> <code> <ul type> <ol start type> <li> <pre>
  • Lines and paragraphs break automatically.
By submitting this form, you accept the Mollom privacy policy.