2

Problem

The following code is used to prevent pagination from being applied to the index:

\setuphead[chapter,section][
  number=no,
  page=yes,
  continue=no,
]

\definehead[StyleIndex][chapter]
\setuphead[StyleIndex][
  page=no,
]

The index is typeset as follows:

\startbackmatter
  \chapter{Index}
  \placeindex
\stopbackmatter

That code causes the chapter title to be displayed on a new page, which I can avoid (as desired) using:

\startbackmatter
  \StyleIndex{Index}
  \placeindex
\stopbackmatter

However, that causes the Index to be removed from the table of contents (ToC), which is not desired. I had expected that it would inherit the chapter's behaviour and be included in the ToC.

Question

How would you create a distinct style for chapter headings that differs from the heading style used for an index page while having both included in the ToC?

1
  • Use \setuplist[content][list={chapter, section, StyleIndex}]
    – Marco
    Sep 21, 2013 at 7:27

1 Answer 1

2

New defined structure elements are not added to the table of contents by default. You have to add the particular entry to the list. This can be done globally with the list key of \setuplist:

\setuplist
  [content]
  [list={chapter, section, newSection}]

Or it can directly be specified as an argument to \placecombinedlist:

\starttitle [title=Contents]
  \placecombinedlist
    [content]
    [list={chapter, section, newSection}]
\stoptitle

And note that unnumbered structure elements like title, subject are not added to the table of contents when incrementnumber is not set to list, which is not the default. Here's a complete example:

\definehead
  [newSection]
  [section]

\definehead
  [newTitle]
  [title]
  [incrementnumber=list]

\setuplist
  [content]
  [list={chapter, section, newSection, newTitle}]

\starttext

\completecontent

\startsection [title=Foo]
\input knuth
\stopsection

\startnewSection [title=Bar]
\input knuth
\stopnewSection

\startnewTitle [title=newTitle]
\input knuth
\stopnewTitle

\stoptext
0

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .