[texhax] Implementing control sequences with key values

Philip Taylor (Webmaster, Ret'd) P.Taylor at Rhul.Ac.Uk
Sun Nov 14 17:54:33 CET 2010

Paul Isambert wrote:

> If the direction is always made of three letters, as I think it is, then
> \def\direction=#1#2#3{...}
> might work well. Of course it forbids
> \direction={RTL}
> Anyway, Vafa, are you trying to mimick TeX assignments or key-value's? In the
> former case (which is investigated here), nothing will be perfect. In the
> latter, though, the "key = value" pair is normally well delimited (e.g. by a
> comma or the end of the list), so the value can be easily retrieved.

Yes, it is possible to define a reasonably robust solution to

	\direction{ }={ }ABC

but my real point was "should one do so ?".  Unless processing
an existing file within which immutable strings of the form
RTL and LTR already exist, it is (IMHO) better to stick to normal
TeX paradigms and to program either

	\let \direction = <control sequence>


	\direction = {brace-delimited balanced text}

If you are willing to adopt \magnification hacks, then
the former can be simplified to

	\direction = <control sequence>

Such solutions will almost certainly be cleaner and more robust
than any attempt to handle \direction = ABC directly.

** Phil.

More information about the texhax mailing list