[texhax] Eplain TeX: problem with \@optionalarg
Rodolfo Medina
rodolfo.medina at gmail.com
Sun Feb 13 17:44:15 CET 2011
Arnaud Schmittbuhl <aschmittbuhl at libertysurf.fr> writes:
> Le Sun, 13 Feb 2011 13:50:01 +0000,
> Rodolfo Medina <rodolfo.medina at gmail.com> a écrit :
>
Rodolfo Medina <rodolfo.medina at gmail.com> writes:
> I posted the following problem to eplain mailing list but couldn't solve it.
> Anybody there accustomed with eplain commands?
>
> At:
>
> http://tug.org/eplain/doc/eplain/Macro-arguments.html
>
> it is suggested the following code:
>
> \makeatletter
> % \mo{m}[o]
> \def\mo#1{\def\mo at arg{#1}\@getoptionalarg\fin at mo}
>
> \def\fin at mo{\vskip1pc
> \message{^^JArg: \mo at arg}%
> \message{^^JOptional arg: \@optionalarg}%
> }
>
>> Now, I wish to put a condition there:
>>
>> \ifx\@optionalarg\empty
>> \fin at mo
>> \else
>> \@getoptionalarg\fin at mo
>> \fi
>
> Hi,
> try that in \else \fi
> \expandafter\@getoptionalarg\expandafter\fin at mo
Strange: it works only with
\mo{test}[optionaltext]
\mo{test}
; instead, with
\mo{test}
\mo{test}[optionaltext]
it doesn't.
Rodolfo
More information about the texhax
mailing list