Changes

Jump to navigation Jump to search
73 bytes removed ,  15:13, 16 August 2017
some cleanup WRT MkII/IV
{{cmd|setupheadtext|[content=All my contents]}}.
You can customize the appearance, number of shown levels and other attributes of predefined ToC. <span style="color:red; font-weight: bold;"> Please note that the <code>level</code> parameter has recently (02/2010) no effect in [[Mark IV]]MkIV, however you can set the number of levels used in the table of contents with the list option (see the next section)</span>, you . You may use {{cmd|placelist|[chapter,section]}} (optionally adding {{cmd|title|{Contents}}} before) instead of {{cmd|setupcombinedlist|[content][level=2]}}.
<context source="yes">
% ToC
% level=4, \subsubsubsections are not listed in ToC
% alternative=c, space to the page number is filled with dots
\setupcombinedlist[content][levellist=4{chapter,section,subsection,subsubsection}, alternative=c,]% in MkII replace list with level=4: \subsubsubsections are not listed in ToC
%\setuplist[chapter][width=5mm, style=bold]
</context>
== Setting the number of sections in the ToC in [[Mark IV]] ==
To set the number of sections included in the table of contents you can explicitly set the list of items included in the 'contents' list. To include chapter, section, and subsection, in the table of contents use:
<context mode=mkiv source="yes">
\starttext
Or to include subsubsection in the table of contents as well use:
<context mode=mkiv source="yes">
\starttext
\stoptext
</context>
 
In MkII this was achieved with the <code>level</code> parameter.
== Including unnumbered heads in the ToC ==
% Set area in which number is placed:
% distance from margin to left edge of title
% NB: recent versions of MkIV may ignore `width`
% for unnumbered entries, and may require
% you to set `margin`, instead.
<texcode>
% MkII
\setuppagenumbering[numberseparator=/]
\placecombinedlist[MyContentsList]
</texcode>
<span style="color:red; font-weight: bold;">'''The above method does not work in MkIV (not anymore at least).</span> ''' Hence the code below illustrates how to get it working under MkIV. (Seems the example got lost?) 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,
== How ConTeXt MkII generates the ToC ==
(from Tobias Burnus [http://archive.contextgarden.net/message/20060809.162652.8f517267.en.html on the mailinglist])
In principle TeXExec should do this automatically.
 
MkIV uses *.tuc files and uses less runs.
== ToC (and other lists) via project structures ==
As of November 25, 2011, ConTeXt [[Mark IV]] supports the generation of lists via [[Project structure]]. Thus, given a product (possibly within some project), and given two or more components in that product with its own sections (chapters, sections, etc) or floats (figures, tables, etc); then each component can have its own list of contents independent of the other. This is done by setting ''criterium=component''. For example, create three files, one product and two components (slightly modified version of a sample posted by Hansin 2011):
<texcode>
\stoptext
</texcode>
texcode>
\setuppagenumbering[numberseparator=/]
\placecombinedlist[MyContentsList]

Navigation menu