[NTG-context] numbering questions

Henning Hraban Ramm texml at fiee.net
Sat Dec 31 22:07:21 CET 2022


Am 31.12.22 um 20:41 schrieb Pablo Rodriguez via ntg-context:
> On 12/31/22 18:23, Henning Hraban Ramm via ntg-context wrote:
>> 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”?
> 
> I thought sectionsegments=section:chapter would work, but it doesn’t.
> 
>> * How can I format the segments, e.g. to get two or three digits each
>> (leading zeros)?
> 
> The easy part is to have the leading zeros, but I cannot get it working
> with numbercommand or deepnumbercommand.
> 
>    \startluacode
>    function document.leadingzeros(str)
>      local lzeros = 3-str:len()
>      return ("0"):rep(lzeros)
>    end
>    \stopluacode
>    \unexpanded\def\lzeros#1%
>      {\cldcontext{document.leadingzeros("#1")}}

Same. With numbercommand, Lua gets "\s and can’t handle it, with 
deepnumbercommand it gets "1-\m". Is this a catcode issue?


>> * I can force a section number with “ownnumber”, but the next one is
>> back in the previous scheme. Itemize has “start”. How can I start
>> section chapter numbering at 3 (or -1 or whatever; I know I can start at
>> 0 with “zero”) and let ConTeXt continue from there?
> 
> \setupheadnumber[chapter][3] % will start with 4

Thank you, that works.

> I hope it helps. »Einen guten Rutsch ins Neujahr!«

Dito!

(In proper German that would be just “Guten Rutsch” or “Guten Rutsch ins 
neue Jahr”; Neujahr ist just the name of the holiday.)

All the best,
Hraban


More information about the ntg-context mailing list