Re: [NTG-context] Chapter number with Luametafun

2020-08-18 Thread Wolfgang Schuster

Fabrice Couvreur schrieb am 18.08.2020 um 16:24:

Hello,
How to get the number of the current chapter ?


\namedheadnumber{chapter}


How to get the label "Chapitre" ?


\labeltext{chapter}

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

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


[NTG-context] Chapter number with Luametafun

2020-08-18 Thread Fabrice Couvreur
Hello,
How to get the number of the current chapter ?
How to get the label "Chapitre" ?
Thanks for your help.
Fabrice

%%% Begin example

\mainlanguage[fr]

\setcharacterspacing [frenchpunctuation]

\setuplabeltext[fr][chapter=Chapitre~]

\startuseMPgraphic{fun}
  definecolor[name="Mycolor", s = 0.85 ]
  draw lmt_outline
   [
text = "1",
kind = "fillup",
fillcolor = "Mycolor",
rulethickness = 1,
   ]
  xsized 1cm;
\stopuseMPgraphic

\unexpanded\def\MyNumber#1{\useMPgraphic{fun}#1}

\unexpanded\def\Title#1#2{\framed[frame=off,width=fit,align=flushleft]
  {#1\blank#2}}

\setuphead[chapter]
  [style=\bfd,
   align={flushleft,broad},
   command=\Title,
   textcommand=\MyNumber,
   numbercommand=\groupedcommand{}{\MyNumber},
   number=no]

\starttext
\startchapter
  [title={First chapter}]
  \input knuth.tex
\stopchapter
\startchapter
  [title={Second chapter}]
  \input knuth.tex
\stopchapter
\stoptext

%%% end example
___
If your question is of interest to others as well, please add an entry to the 
Wiki!

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