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.
Using macros is somewhat less efficient than doing the same stuff in compiled code, but the gain is not very big, because most of the TeX commands that are executed have to be executed anyway (parsing argument texts, defining \csnames for the options). Anyway, if you want to have a look at what I did, the code is still on-line: http://tex.aanhet.net/eetex/ It is not my best change file ever (I was still learning how to program in web when I wrote it). However it should be fairly easy to understand the code. If I had to do it again it would be quite different, though.
Must be, since there is no robust way to build macros with parameters organized similar to <rulespec>,
\macro key1 val1 key2=val2 key3{val3} ...
I've learned to dislike the scan_keyword() stuff. It is a nightmare to fake these primitives in macros, and it is hard to jump over them in the output of \the.
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
The thing is: it shouldn't be hard to implement such a feature, *assuming* there was a clear functional specification. But ... Cheers, Taco