Table of Contents

From Wiki
Jump to navigation Jump to search

Using Table of Contents

To get the default table of contents use:

\completecontent % with title
\placecontent % without title

Modifing the default Table of Contents

You can customize the appearance, number of shown levels and other attributes of predefined TOC. Please note that level parameter has recently(02/2010) no effect in Mark IV, you may use \placelist[chapter,section] instad of \setupcombinedlist[content][level=2].

% turn off numbering of some levels
% level=4, \subsubsubsections are not listed in TOC
% alternative=c, space to the page number is filled with dots
% pagestyle=normal for changing the appearance of pagenumber


\section{First section}
\subsection{First subsection}
\subsubsection{First subsubsection}
\subsubsubsection{First subsubsubsection}
\section{Second section}
\subsection{Second subsection}
\subsubsection{Second subsubsection}
\subsubsubsection{Second subsubsubsection}

Page Numbering in Table of Contents

If you have a special page numbering style it won't automatically be reflected in the table of contents. You need to set the parameters of the table of contents separately. For example,

\setuppagenumbering[way=bychapter, left=A, chapternumber=yes, numberseparator=/]

will give you pagenumbering such as A1/1, A1/2 etc. on the pages in the bodymatter. In the table of contents, however, these will show up as 1-1, 1-2 etc. The ToC needs to be formatted separately.

To get a prefix to the page numbering (like "A"), use


To get the numberseparator working, you need to know that the ToC will use the separator that is active at the time the ToC is output. So you need to set it immediately before you call the ToC command, e.g.


The above method does not work in MkIV(not anymore atleast). Hence the code below illustrates how to get it working under MkIV. It should be noted that MkIV and MkII are incompatible with respect to this feature.

As an example, consider that the frontmatter uses roman numerals and bodymatter remains unchanged. To reflect the romannumerals of the front matter in the TOC,

\definestructureconversionset[bodypart:pagenumber] [][numbers]




Dots in section numbers

Last Number Dot in Table of Contents (e.g. 2.1.3.): see Dotted_number_in_caption.

If you want to avoid a dot if there's no number, try this solution (by Wolfgang Schuster as of 2008-04-29):



Author in ToC

see setup for author/title/subtitle titling and author in ToC in Proceedings_style.

You can write "everything" to the ToC or an other list (see below) using \writetolist.

Creating other "Table of ..."

Generally all "Table (List) of ..." are defined with \definelist and \setuplist. You can "collect" several section levels in one list using \definecombinedlist, that's even explained in "ConTeXt, an excursion" (see Official_ConTeXt_Documentation).

To have some parts of your title texts not appear in the table of contents, use \nolist and have a look at mag-0001.pdf.

How the table of contents is generated by ConTeXt

(from Tobias Burnus on the mailinglist)

The mechanism is a follows:

  1. TeX is run and chapter names with pagenumbers etc. are saved into <jobname>.tui.
  2. TeXutil is run and sorts some entries in *.tui and writes *.tuo
  3. TeX is run again, reads .tuo and uses that data to produce the table of contents etc. (and produces a new .tui) As this changes the page numbers (for longer table of contents), TeXutil and TeX are re-run again.

In principle TeXExec should do this automatically.