[NTG-context] Chapter number retrieval
śrīrāma
citturs at gmail.com
Tue Mar 22 03:29:08 CET 2022
On Tuesday, March 22, 2022 2:17 AM Willi Egger via ntg-context wrote:
> I would like to typeset the chapter title without number in the text. — However I still would need to retrieve the number for a calculation in a MetaFun graphic. I assume, that even though this number is not typeset, it is kept in the background. How to retrieve it?
>
Hi,
On Tuesday, March 22, 2022 2:17 AM Willi Egger via ntg-context wrote:
>
> I would like to typeset the chapter title without number in the text. — However I still would need to retrieve the number for a calculation in a MetaFun graphic. I assume, that even though this number is not typeset, it is kept in the background. How to retrieve it?
>
Hi,
You can define a custom command for the chapter, where the first argument (i.e, the number) is 'ignored' –
\define[2]\ChapterTitle{#2}
\setuphead[chapter][command=\ChapterTitle]
It will still appeared as numbered in any lists (ToC, etc). Also, it can be accessed using \headnumber[...][...]. An example graphic –
\startuseMPgraphic {graphic:chapter}
picture cg;
cg := outlinetext.d
("\ssbfd \headnumber[chapter]")
(withcolor transparent(1,0.5,blue));
fill boundingcircle cg withcolor transparent(1, 0.5, lightgray);
draw cg;
\stopuseMPgraphic
Using \headnumber[..][..] any 'conversion' applied to the chapter number (romannumerals, words, etc) are also preserved.
Best,
Sreeram
More information about the ntg-context
mailing list