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 \protect \definenumber[test] \starttext \setnumber[test]{3} \getnumber[test] \setnumber[test][7] \getnumber[test] \stoptext Wolfgang
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 -----------------------------------------------------------------
Am 16.01.2012 um 19:26 schrieb Hans Hagen:
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)
+1 Wolfgang
participants (2)
-
Hans Hagen
-
Wolfgang Schuster