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]
]
___________________________________________________________________________________
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://tex.aanhet.net
archive : http://foundry.supelec.fr/projects/contextrev/
wiki : http://contextgarden.net
___________________________________________________________________________________