[NTG-pdftex] a dream about options

Hans Hagen pragma at wxs.nl
Sun Nov 13 21:59:06 CET 2005


Pawel Jackowski wrote:

> Hello,
>
> I suppose the issue was discussed before but couldn't find that is 
> archives.
>
> Making high level macros in (pure) TeX encounters problem of 
> optionality; the number of macro `properties' (agruments) is limited 
> and making parameters *optional* needs some trickery. And yes, syntax 
> like
>
>     \macro[...,...,...]{...}
>
> is quite robust ConTeXt or LaTeX but is also time, space and resource 
> consuming. Must be, since there is no robust way to build macros with 
> parameters organized similar to <rulespec>,
>
>     \macro key1 val1 key2=val2 key3{val3} ...
>
> at least not with optional key-val pairs.
>
> In pure TeX, such optional parameter text is rather exceptional, but 
> in pdfTeX it becomes quite common. Would it be possible to implement 
> some extension to definition building mechanism that allows to create 
> macros with rulespec-like shape? I admit for the moment I can't even 
> imagine a consistent syntax for such a feature. Macro parameters rules 
> are Knuthish enough :)

in the previosu century taco made some extensiong dealing with key/val 
parsing (and other kinds of parsing); at that time we did quite some 
testing with speed issues, and the price to pay was higher that the 
gain; keep in mind that in tex catcodes and expansion always kind of 
interfere in such things; ok, if you limit key/val parsing to 'strings' 
only (i.e. no expansion, no catcode support) then it can be faster, but 
at the same time it also becomes useless for everyday usage; as with 
more tex things, because tex is rather optimized, hard coded 
alternatives (extensions to the language) not always pay off; also 
consider implementation issues like namespacing, scope of keys, etc

Hans


More information about the ntg-pdftex mailing list