2

According to the ConTeXt wiki:

By default \part generates no title because most of the times these require special attention and a specific design. In the background however the partnumbering is active and carries out several initializations. The other section commands are set up to typeset a title.

What if I want to use the \part{} command but do not want it to produce a blank page? Instead, I want it to produce no page at all.

Is that possible?

2 Answers 2

6

I must admit that this is somewhat confusing. Part of the confusion is that, by default, part does not show the head title, so one has to guess what is going on. If you set placehead=yes in Henri Menke's code, you will see what is happening. The page is not produced by \part but is produced by the subsequent \chapter

In ConTeXt you can control the page break between a section head and its successor (i.e., page break between part and chapter or the page break between chapter and section) using the continue key. For the ease of explanation, I'll restrict to the higher level heading as part and the lower level heading as chapter, but the same applies for any two consecutive levels.

If we have

\setuphead[chapter][continue=yes, page=yes]

(which is the default), then there will be a page break between the part title and the chapter title even if there is no text after the part title. On the other hand, if we set

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

then the page break at the beginning of the chapter will be suppressed if it comes immediately after a part title.

So, all you need to do in your code is to set

\setuphead[chapter][continue=no]

Here is a full minimal example:

\setuphead
  [chapter]
  [
    continue=yes,
  ]

\starttext

\startpart[title=Part One]
  \startchapter[title=Chapter One]
  \stopchapter
  \startchapter[title=Chapter Two]
  \stopchapter
\stoppart

\startpart[title=Part Two]
  \startchapter[title=Chapter One]    
  \stopchapter
  \startchapter[title=Chapter Two]
  \stopchapter
\stoppart

\stoptext
0
3

You can set page=no in the setup for part. For reasons I don't understand, this does not work on the first page of a document, but I consider this a minor issue because the first page is usually the titlepage. I asked on the mailing list anyway (https://mailman.ntg.nl/pipermail/ntg-context/2017/090445.html).

Hans responded to my question with a list of possible fixes, which I quote here:

this relates to the fact that there has to be some node on the page that registers the part information and as chapter flushes a page that one ends up on a page then

% solution 1:

\setuphead
   [part]
   [page=no,
    placehead=hidden]

\setuptexttexts
   [\synchronizehead{part}]

% solution 2:

\setuphead
   [part]
   [page=no,
    placehead=hidden]

\appendtoks
    \synchronizehead{part}%
\to \everybeforepagebody

% solution 3 (new in beta):

\setuphead
   [part]
   [placehead=section]

This will delay the flush till the next section head gets place. It's still not 100% predictable but it might work out ok in most cases.

3
  • The ConTeXt wiki page about setuphead is indeed unclear about the page=no keyword. And you are right, I reproduced the same issue: the \part{} commands did not produce any page except for the first \part{} which produced a blank page. Commented Dec 19, 2017 at 20:40
  • @ArnaudLasnier Almost. It's not the first \part, it's only if the \part is the very first thing in the document. If you add content before the first \part the blank page is gone. Commented Dec 19, 2017 at 20:53
  • @HenriMenke: You can add placehead=yes in your code to see what is happening. See my answer for details.
    – Aditya
    Commented Dec 19, 2017 at 21:13

You must log in to answer this question.

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