2

How can I tell ConTeXt not to insert a page break before \completecontent? I'm trying to keep A title on the same page as the table of contents:

\starttext

  \startfrontmatter
    A title
    \completecontent
  \stopfrontmatter

  \startbodymatter

    \startchapter [title=Foo]
    \stopchapter

  \stopbodymatter

\stoptext

2 Answers 2

1

The \completecontent command uses \title to place the the title for the table of contents. To get rid of the pagebreak at the start of it you can either disable the pagebreak with

\setuphead
  [title]
  [page=no]

but this isn't recommended because the setting affects all \title commands. While it is possible to limit the setup to the frontmatter a better solution is to create a new heading

\definehead
  [contenttitle]
  [title]

and disable the pagebreak onl for this heading

\setuphead
  [contenttitle]
  [page=no]

The next is is to remove the \completecontent command from your document and replace it with a combination of the new heading followed by a table of contents without the automatic title.

\contenttitle{\headtext{content}}
\placecontent

With \headtext{content} you can access the language dependant title for the table of contents but there is nothing wrong to set a fixed text instead (\contenttitle{Contents}).

0

Although it isn't perfectly explicit about this, the Wiki (https://wiki.contextgarden.net/Table_of_Contents) suggests the following:

\completecontent % with title
\placecontent % without title

You should find that replacing \completecontent with \placecontent will do the trick.

3
  • I know but as you pointed out \placecontent gets rid of the title. I want to keep the title but remove the page break.
    – noibe
    Aug 18, 2021 at 9:24
  • 1
    The title for \completecontent is placed with the \title command which forces a pagebreak with the default settings. While you can disable the pagebreak it is better to create a new heading (e.g. \definehead [contenttitle] [title]) where you disable it (e.g. \setuphead [contenttitle] [page=no]). Afterwards you can use \contenttitle{\headtext[content]} followed by \placecontent to flush the table of contents. Aug 19, 2021 at 10:16
  • @noibe I guess I assumed that since you were already providing "A title" in your example, then the title provided by \placecontent would be extraneous... But seems like Wolfgang has already offered a more complete solution
    – ssokolen
    Aug 19, 2021 at 22:28

You must log in to answer this question.

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