Joseph Wright wrote: > J.Fine wrote: > >> Sorry, I'm a bit lost! Which bit of the thread are we talking about? > >> (xparse as-a-concept, post-processing arguments, how to specify > >> arguments, ... ) > > > > All of the above, taken together. > > > > One starts with parsing key-value arguments in TeX macros, then further > features are required, and you start adding features to the LaTeX macros > for list processing and the like, and before you know it something has > arise that is too complicated for TeX macros. > > As I see it, the basic idea of xparse is to separate how user functions > expect input (stars, optional arguments, mandatory arguments, etc.) from > how internal functions work (fixed numbers of mandatory arguments). To > do this, the idea is to create \newcommand-on-steroids, so that complex > arguments can be processed. For example, \newcommand can't even make two > optional arguments or look for a star. > > So if we take the common example of \section, the code at present mixes > input syntax and internal workings. The plan would be to replace it with > something like: > > \DeclareDocumentCommand \section { s o m } { > % Code here > } > > where the code always has three arguments #1, #2, #3 to pass down to the > underlying structure. The idea is it is then possible to alter input > syntax without touching most of the code. [snip] There are some interesting ideas here, but why implement them in TeX macros? How will you translate LaTeX documents into XML? Surely to do this you will need a LaTeX->XML translator written in /some other language/. And once you have that, why do you need an implementation written in TeX macros? And come to that, the translator will surely want access to > \DeclareDocumentCommand \section { s o m } { > % Code here > } Perhaps you'll find, when you remove 'TeX macros' from the requirements specification you'll find that it's better not to use TeX macros for the implementation. -- Jonathan The Open University is incorporated by Royal Charter (RC 000391), an exempt charity in England & Wales and a charity registered in Scotland (SC 038302).