[dev-context] \setnumber

Hans Hagen pragma at wxs.nl
Mon Jan 16 19:26:19 CET 2012


On 16-1-2012 16:06, Wolfgang Schuster wrote:
> Hi,
>
> can the \setnumber/\setstructurecounter syntax be changed to allow also
>
>    \setnumber[…][3]
>
> besides the current
>
>    \setnumber[…]{3}
>
> The first form fits better with the other setup commands etc.
>
>
> \unprotect
>
> \unexpanded\def\setstructurecounter
>    {\dodoubleempty\dosetstructurecounter}
>
> \def\dosetstructurecounter
>    {\ifsecondargument
>       \expandafter\dosetstructurecounteryes
>     \else
>       \expandafter\dosetstructurecounternop
>     \fi}
>
> \def\dosetstructurecounteryes[#1][#2]{\ctxcommand{setstructurecounter    ("\@@thestructurecounter{#1}",1,\number#2)}}
> \def\dosetstructurecounternop[#1][]#2{\ctxcommand{setstructurecounter    ("\@@thestructurecounter{#1}",1,\number#2)}}
>
> \let\setnumber\setstructurecounter

another option is to combine them with the subs and have three arguments 
(one being optional) and drop the {} variant (not used that often in the 
core anyway and I will provide a fast {}{} variant anyway)


-----------------------------------------------------------------
                                           Hans Hagen | PRAGMA ADE
               Ridderstraat 27 | 8061 GH Hasselt | The Netherlands
     tel: 038 477 53 69 | voip: 087 875 68 74 | www.pragma-ade.com
                                              | www.pragma-pod.nl
-----------------------------------------------------------------


More information about the dev-context mailing list