[texhax] FW: Re: Implementing control sequences with key values
Uwe Lueck
uwe.lueck at web.de
Mon Nov 15 14:41:23 CET 2010
"Philip Taylor (Webmaster, Ret'd)"
wrote on 23.11.2010
-- or "will write"!? (I am also told that the e-mail address is invalid) --
at 12:51:35:
>Paul Isambert wrote:
>
>> Both solutions I have adopted in some places, instead of braces. You've
>> asked earlier why using the "=" syntax, and Phil mentioned plain TeX.
>> I'll elaborate and say: you can make do without braces in many cases,
>> something LaTeX seems to want its users to forget. I for one hate them,
>> for no good reason but anyway, and I always welcome alternatives
>> (starting with TeX's syntax for assignments).
>
>Agreed : exactly how I feel.
I seem to share some feelings without being able to determine the exact amount:
"=" may make the code more intuitive, helps to see that it is an assignment
as opposed to, say, a formatting instruction for a text argument.
I have guessed that the rationale of LaTeX's restricted syntax is
that absolute beginners should not be confused with too many
kinds of syntax. Some people have been told
"write a thesis on ... with LaTeX and give to me in six months from now!" ...
With the "Short Introduction to LaTeX", I really was able to produce
fine text after a few days.
"Paul Isambert" <zappathustra at free.fr> wrote 14.11.2010 17:28:25:
> 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.
So I realize another difference: the usual key-value syntax would be
direction=RTL
-- without the leading backslash. This observation makes me suggest a single macro \macroassignment:
\macroassignment{direction=RTL}
that eventually executes \def\direction{RTL}.
You can make an even smarter \assignment that finds out whether \direction is macro or a register.
I think you can adopt something from existing packages for this, e.g., fontspec seems to use optional macro arguments with key-value syntax.
Cheers,
Uwe.
More information about the texhax
mailing list