[NTG-context] nesting commands with optional arguments

Hans Hagen pragma at wxs.nl
Wed Mar 28 16:51:38 CEST 2012


On 28-3-2012 16:49, Daniel Schopper wrote:
> Dear list,
> I have a question concerning nesting commands with optional arguments.
>
> I'm trying to put a command with an optional argument inside the
> optional argument of another one … For sure this is just a simple
> expansion problem but I have no clue how to handle this …
>
> Thanks for any hints!
> Daniel
>
>
> Please consider the following minimal example:
>
> \def\one{\dosingleempty\doOne}
>
> \def\doOne[#1]{%
> in 1st: \doifsomethingelse{#1}{#1}{no arg}\par%
> }
>
> \def\two{\dosingleempty\doTwo}
>
> \def\doTwo[#1]{%
> in 2nd: \doifsomethingelse{#1}{#1}{no arg}\par%
> }
>
> \def\three#1{in 3rd: #1\par}
>
> \starttext
> \one\two
> \blank
> \one[\three{myArg}]
> \blank
> \one[\two[Argument]]
> \stoptext

\one[{\two[Argument]}]

-----------------------------------------------------------------
                                           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 ntg-context mailing list