[tex-eplain] Position of optional argument
Rodolfo Medina
rodolfo.medina at gmail.com
Thu Feb 10 21:36:12 CET 2011
On Sun, Apr 26, 2009 at 07:16:55PM +0100, Rodolfo Medina wrote:
>> I've been using the eplain \@getoptionalarg and \@optionalarg commands in a
>> certain macro. It turns out to me that the optional argument must be put
>> *before* the non optional argument.
>>
>> How can I set things - if possible - so to put it after it?
Oleg Katsitadze <olegkat at gmail.com> writes:
> Try this:
>
> \input eplain
>
> \makeatletter
>
> \def\test#1{%
> \def\test at arg{#1}%
> \@getoptionalarg\@test
> }
>
> \def\@test{%
> \message{^^JArg: \test at arg}%
> \message{^^JOptional arg: \@optionalarg}%
> }
>
> \makeatother
>
> \test{text}
> \test{text}[optional text]
>
> \bye
If, in the above code, in place of `\@getoptionalarg\@test' I put:
\ifnum0=0
\@getoptionalarg\@test
\else
\fi
then, strangely, it doesn't seem to work any more. I can't explain why. Can
anybody?
Thanks for any help
Rodolfo
More information about the tex-eplain
mailing list