Adjust the TOC Depth
You can adjust the depth of section levels displayed in the table of contents (TOC) using the toclevels attribute.
Set toclevels
The toclevels document attribute controls the depth of the TOC.
Accepted values are the integers 0 through 5.
These values represent the section levels.
(A section level is one less than the number of = signs the precede the title in the source.)
If the toclevels attribute is not specified, it defaults to 2.
That means the TOC displays level 1 (==) and level 2 (===) section titles and, in the case of a multipart book, level 0 (=) section titles (parts).
Let’s use the toclevels attribute to increase the depth of the TOC from 2 to 4.
= The Intrepid Chronicles
Kismet Lee; B. Steppenwolf; Pax Draeke
:toc: (1)
:toclevels: 4 (2)
== Certain Peril
Daylight trickles across the cobblestones...
=== A Recipe for Potion
We have to harvest the leaves by the light of the teal moons...
==== Searching for Ginseng
Crawling through the twisted understory...
== Dawn on the Plateau
Hanging from...
| 1 | The toc attribute must be set in order to use toclevels. |
| 2 | toclevels is set and assigned the value 4 in the document header.
The TOC will list the titles of any sections up to level 4 (i.e., ====), when the document is rendered. |
The result of Example 1 is displayed below.
In a multipart book, if you only want to see part titles (as well as any special sections at level 0) in the TOC, set toclevels to 0.
If the document does not have parts, and you set toclevels to 0, the value is coerced to 1.