[NTG-context] \setupheadnumber and zero

Wolfgang Schuster schuster.wolfgang at gmail.com
Tue Sep 8 21:10:51 CEST 2015


> Procházka Lukáš Ing. - Pontex s. r. o. <mailto:LPr at pontex.cz>
> 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
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://www.ntg.nl/pipermail/ntg-context/attachments/20150908/cee16450/attachment.html>


More information about the ntg-context mailing list