Procházka Lukáš Ing. - Pontex s. r. o.
29. August 2015 16:11
Hello,

can a section head be generated with the number 0 (or less)?

Sometimes I need to prepend a section while keeping existing section head numbers...

Example:

----
\starttext
  \setupheadnumber[chapter][-1]
  \chapter{Ch0} % Getting "Ch0" instead of "0. Ch0"?
  \chapter{Ch1}
\stoptext
----

Here, "0. Ch0" is not generated, the zero is not displayed; why?
You can’t set a negative number for the start of the counter but you can change the appereance.

\defineexpandable[1]\PreviousNumber
  {\number\numexpr#1-1\relax}

\defineconversion[PreviousNumber][\PreviousNumber]

\defineconversionset[zerostart][n,PreviousNumber][n]

\setuphead[chapter,section][sectionconversionset=zerostart]

\starttext
\chapter{First chapter}
\chapter{Second chapter}
\stoptext

Wolfgang