[texhax] Eplain TeX: problem with \@optionalarg
Rodolfo Medina
rodolfo.medina at gmail.com
Sun Feb 13 14:50:01 CET 2011
Hi to all TeX users.
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
, but it does not seem to work. To test, edit a file as follows:
\input eplain
\makeatletter
% \mo{m}[o]
\def\mo#1{\def\mo at arg{#1}%
\ifx\@optionalarg\empty
\fin at mo
\else
\@getoptionalarg\fin at mo
\fi
}
\def\fin at mo{\vskip1pc
\message{^^JArg: \mo at arg}%
\message{^^JOptional arg: \@optionalarg}%
}
\mo{test}[optional text]
\mo{test}
\bye
Thanks in advance for any help!
Rodolfo
More information about the texhax
mailing list