[texhax] FW: Re: Implementing control sequences with key values
Uwe Lueck
uwe.lueck at web.de
Mon Nov 15 13:57:20 CET 2010
"Paul Isambert" <zappathustra at free.fr>, 15.11.2010 12:34:36:
>Le 14/11/2010 22:47, Uwe Lueck a écrit :
>> Correcting my 14.11.2010 19:02:33:
>>>> Wolfgang Schuster wrote:
>>>>> \def\direction#1=#2#3
>>>>> {\def\currentdirection{#2#3}}
>> I commented:
>>> Wolfgang's code is redundant both in the definition and testing.
>>> The core of his idea is:
>>> \def\direction=#1 {\def\currentdirection{#1}}
>> But
>>
>> \def\direction=#1#2 {\def\currentdirection{#1#2}}
>>
>> is superior in allowing ("optional"!) spaces after "="
>> in using \direction.
>
PI> And Wolfgang's original
PI>
PI> \def\direction#1=#2#3 {...}
PI>
PI> also allows optional space before "=", which might happen under some
PI> circumstances.
My previous posting was the result of carefully checking this,
it turns out that the parameter at the left of "=" is not needed
for allowing
\direction = RTL
it already works with my suggestion above.
I did post code that demonstrated this --
finally this is anyway clear from TeX's parsing rules
(under usual catcodes):
"=" is the next token after \direction that TeX realizes
(I am unable to learn the "mouth/stomach" terms
for a better explanation right now, and cannot
look up the TeXbook chapter, I think this happens
already at tokenizing, i.e., the tokenizing function
is TeX's only part that knows about spaces after
"\direction".).
So the "#1=#2#3" really is redundant, I only admitted
that it is not as redundant as I had claimed before.
PI> It actually allows any "filler".
You may be right with some additional requirements,
e.g. when somebody insists that
\Direction{} = RTL
should work with
\def\Direction#1{\direction}
("! Use of \direction doesn't match its definition.")
Cheers,
Uwe.
More information about the texhax
mailing list