[NTG-context] numbering questions

Wolfgang Schuster wolfgang.schuster.lists at gmail.com
Sun Jan 1 11:27:26 CET 2023

Henning Hraban Ramm via ntg-context schrieb am 31.12.2022 um 18:23:
> A happy new year to everyone!
> I’m playing with some examples of section numbering.
> * Is there a setup to influence the order of number segments? I.e. can 
> I have “section.chapter.part“ instead of “part.chapter.section”?

You need a new prefix-set to rearrange the order of the sections.

%%%% begin example
\defineprefixset [reverse-section]    [section,chapter] []
\defineprefixset [reverse-subsection] [subsection,section,chapter] []




\startchapter [title={A}]

\startsection [title={B}]

\startsubsection [title={C}] \stopsubsection
\startsubsection [title={D}] \stopsubsection
\startsubsection [title={E}] \stopsubsection


\startsection [title={F}]

\startsubsection [title={G}] \stopsubsection
\startsubsection [title={H}] \stopsubsection
\startsubsection [title={I}] \stopsubsection



%%%% end example

> * How can I format the segments, e.g. to get two or three digits each 
> (leading zeros)?

You can create your own conversion format.

%%%% begin example
interfaces.implement {
     name      = "FourDigits",
     public    = true,
     arguments = "string",
     actions   = function(s) context("%04d",tonumber(s)) end

\defineconversion [FourDigits] [\FourDigits]



\startchapter [title={Chapter}] \stopchapter

%%%% end example


More information about the ntg-context mailing list