Table of Contents
The table of contents (TOC) is not included by default.
The TOC is only included if the
toc attribute is set on the document.
= Document Title :doctype: book :toc: (1) == Chapter A == Chapter B
The value assigned to
toc determines the placement of the TOC.
If a value isn’t specified, like in the above example, the placement defaults to
auto, which is directly after the document title.
For documents that have the
book doctype, the TOC is inserted using discrete pages between the title page and the first page of content.
This same behavior is used for all other doctypes if the
title-page attribute is set and the value of the
toc-break-after theme key is not
Except for the aforementioned cases, the TOC is inserted in the flow of text.
If a placement is not specified, that location is between the document title and the first block of content.
While the table of contents isn’t generated by default, the PDF outline is included unless explicitly deactivated.
toclevels attribute controls the depth of both the TOC and the PDF outline, regardless of whether the TOC is enabled.
The depth of the PDF outline can be controlled independently using the outlinelevels attribute.
outlinelevels attributes can be set as a block attribute on each section to override the respective depth of the TOC or outline for that section.
You can adjust the depth of section levels that are displayed in the TOC using the
toclevels document attribute.
= Document Title :toclevels: 3 (1)
You can override the
toclevels document attribute for a specific section and its children by setting the
toclevels block attribute on the respective section.
= Document Title :toclevels: 1 == Section title Content. [toclevels=2] (1) == Section title Content. === Section title
|1||Temporarily overrides the
The block attribute temporarily changes the value of the document attribute and thus refers to the absolute depth.
Therefore, it must take into account the depth of the section on which it is set.
0 always removes the current section from the TOC.
You can add TOC entries for a preface, preamble, or imported PDF pages using the
See Hide Section Titles for more information and examples.
You can also add a TOC entry for a preface using the method described in the next section.
The preface section in a
book doctype doesn’t get a TOC entry by default.
You have to set the
preface-title document attribute and assign it a value.
= Document Title :doctype: book (1) :preface-title: Preface (2) :toc: == Preface (3) This is the preface. == Chapter A == Chapter B
|1||The doctype must be
|3||Create a preface section.|
Alternatively, if you want to hide the preface section title in the document body, but still want an entry for it in the TOC, apply the
notitle option to the preface section title.
See Add a preamble or anonymous preface to the TOC for examples and more information.
You can customize the arrangement and style of the TOC, its title, heading levels, and dot leader by extending the theme and using the Table of Contents Category Keys.