nesting commands with optional arguments
![](https://secure.gravatar.com/avatar/b12df59411515e6737a4d3b35c3ee642.jpg?s=120&d=mm&r=g)
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 This is what I get: ! Use of \doOne doesn't match its definition. system > tex > error on line 18 in file testOpt.tex: Use of ... \doifnextoptionalelse ...xt_optional_command_yes { #1}\def \next_optional_com... <argument> \two [Argument \doifsomethingelse #1->\edef \!!stringa {#1 }\ifx \!!stringa \empty \expandaf... \doOne [#1]->in 1st: \doifsomethingelse {#1} {#1}{no arg}\par l.18 \one[\two[Argument] ]
![](https://secure.gravatar.com/avatar/49e63acb01f2ca80efce7eed08310ce8.jpg?s=120&d=mm&r=g)
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 -----------------------------------------------------------------
![](https://secure.gravatar.com/avatar/b12df59411515e6737a4d3b35c3ee642.jpg?s=120&d=mm&r=g)
Of course, should have tried that … thanks! btw. since when is this working? (I tried it with a pretty old minimal from 2011-08, where I got this error) Am 28.03.12 16:51, schrieb Hans Hagen:
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 -----------------------------------------------------------------
![](https://secure.gravatar.com/avatar/49e63acb01f2ca80efce7eed08310ce8.jpg?s=120&d=mm&r=g)
On 28-3-2012 17:29, Daniel Schopper wrote:
Of course, should have tried that … thanks!
btw. since when is this working? (I tried it with a pretty old minimal from 2011-08, where I got this error)
the {} has always worked Hans ----------------------------------------------------------------- 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 -----------------------------------------------------------------
participants (2)
-
Daniel Schopper
-
Hans Hagen