[texhax] Finding blank argument to macro

Uwe Lueck uwe.lueck at web.de
Mon Jun 28 16:58:00 CEST 2010


In tidying mailboxes, I found a mistake of mine:

-----Ursprüngliche Nachricht-----
Von: Uwe Lueck <uwe.lueck at web.de>
Gesendet: 11.06.2010 16:43:31
An: Michael Barr <barr at math.mcgill.ca>,Jim Diamond <Jim.Diamond at acadiau.ca>
Betreff: Re: [texhax] Finding blank argument to macro

> I know how to fool it, I guess you can fool any test that is expandable. Michael Barr's macro is not expandable. A non-expandable macro that is absolutely reliable is \IfEmpty with
>
>     \def\IfEmpty#1{\def\Arg{#1}\ifx\Arg\Empty\FirstOfTwo\else\SecondOfTwo\fi}

must be: 

    \def\IfEmpty#1{\def\Arg{#1}\ifx\Arg\Empty\expandafter\FirstOfTwo\else\expandafter\SecondOfTwo\fi}

Sorry, 

    Uwe. 

>
> with
>
>     \def\Empty{} \def\FirstOfTwo#1#2{#1} \def\SecondOfTwo#1#2{#2}
>
> With LaTeX, you may replace \Empty by \@empty, \FirstOfTwo by \@firstoftwo, \SecondOfTwo by \@secondoftwo without defining them.



More information about the texhax mailing list