# Code

Minimum working example (MWE):

\setuphead[chapter][number=yes,]
\setuphead[section][number=no,]
\setuphead[subsection][placehead=hidden,]

\definehead[scenesubsection][subsection]

\starttext
\dorecurse{5}{
\chapter{Chapter Name}
\section{Section Name}
\startscenesubsection
\input tufte
\stopscenesubsection
}
\stoptext


# Problem

The chapter headings should be enumerated 1 through 5, but some chapter numbers are either hidden or enumerated incorrectly.

The following figure shows the MWE output:

# Question

How can the problems with chapter numbering be resolved?

# Additional Details

\$ context --version
mtx-context     | current version: 2017.05.14 19:09


# Work Around

Using placehead=no causes the spacing to change when framing an entire section:

• I get the same weird behaviour, and don't understand it. I wonder though, do you really need \startscenesubsection ... \stopscenesubsection—with placehead=hidden the scenesubsection headers might as well not be there, and removing them seems to resolve the issue. – 9tTn9B May 19 '17 at 9:04
• Could you use placehead=no instead of hidden? – Henri Menke May 19 '17 at 10:58
• Seems to be not yet fully implemented. There is a todo in the code. – Henri Menke May 19 '17 at 11:08
• \startscenesubsection\getheadsyncs works for me on TL2016. I was not yet able to track it down though. – Henri Menke May 21 '17 at 0:29

## 1 Answer

Use a custom counter:

\definecounter[ChapterNumber][
way=bytext,
prefix=no,
]

\define[1]\CustomChapter{%
\incrementcounter[ChapterNumber]
\rawcountervalue[ChapterNumber]
\hspace[medium]
#1
}

\setuphead[chapter][
align=middle,
number=no,
textcommand=\CustomChapter,
]

\setuphead[section][
align=middle,
number=no,
]

\setuphead[subsection][
placehead=hidden,
number=no,
]

\definehead[scenesubsection][subsection]