Thank you, Wolfgang!
I _knew_ ConTeXt would be able to handle my requirements! ;D
It’s wikified now (at \setuphead and \defineconversion).

Hraban

Am 01.01.23 um 11:27 schrieb Wolfgang Schuster:
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] []

\setuphead
   [section]
   [sectionset=reverse-section]

\setuphead
   [subsection]
   [sectionset=reverse-subsection]

\starttext

\startchapter [title={A}]

\startsection [title={B}]

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

\stopsection

\startsection [title={F}]

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

\stopsection

\stopchapter

\stoptext
%%%% 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
\startluacode
interfaces.implement {
     name      = "FourDigits",
     public    = true,
     arguments = "string",
     actions   = function(s) context("%04d",tonumber(s)) end
}
\stopluacode

\defineconversion [FourDigits] [\FourDigits]

\setuphead
   [chapter]
   [conversion=FourDigits]

\starttext

\startchapter [title={Chapter}] \stopchapter

\stoptext
%%%% end example

Wolfgang


___________________________________________________________________________________
If your question is of interest to others as well, please add an entry to the 
Wiki!

maillist : ntg-context@ntg.nl / https://www.ntg.nl/mailman/listinfo/ntg-context
webpage  : https://www.pragma-ade.nl / http://context.aanhet.net
archive  : https://bitbucket.org/phg/context-mirror/commits/
wiki     : https://contextgarden.net
___________________________________________________________________________________

Reply via email to