alternative macro language for TeX?

Jonathan Fine J.Fine at open.ac.uk
Thu Jul 8 12:31:56 EDT 2004


"Andrei Alexandrescu (See Website for Email)"
<SeeWebsiteForEmail at moderncppdesign.com> wrote in message >
<snip>
> Yes, I became convinced that it can be done. Also, the keyval package
gives
> a lot of hope. So let me spell what I believe I need. I need a solid
> variable arguments package with the following features:
>
> * One should be able to define macros with an unbounded number of
arguments.
> Inside the macro, argument count can be referred to as \argcount and each
> argument can be referred to as \argvalue{n}, where n is a number.
>
> * The format of the parens () vs. {} vs. [] doesn't matter. One should,
> however, be able to invoke the macro without any paren (see below). Also,
> parens must be matched properly, e.g. "\somemacro(a + (b + c), d)" is an
> invocation with two arguments, not one.
>
> * Arguments should be separated by, say commas, but the caller should be
> able to pass commas in by bracing them, e.g. \somemacro(a, b, c {,} d) and
> \somemacro(a, b, {c , d}) would invoke \somemacro with three arguments.
>
> * Default arguments should be supported for any position. The default
> argument kicks in in one of two cases: (1) it is an unspecified trailing
> argument, like \somemacro(a, b) assuming \somemacro has a default argument
> in position 3, or (2) when the invoker passes in a special symbol, say,
> \somemacro(a, !, b) would pass the default argument in position 2.
Invoking
> \somemacro(a, {!}, b) would pass the actual exclamation mark. If the macro
> is invoked without any arguments, all arguments have their default values.
> The default values should just fill the \argvalue{n} numbers.
>
> * The framework should make writing such macros is as easy as it gets.
> Ideally it would encapsulate a lot of complexity and provide a simple
recipe
> for writing such macros.
>
> Well, if anyone is up for the challenge, or knows of a package that does
> that, let me know!


Well, I suggest using a modern object-oriented language as a front end.

And TeX (plain TeX or even plainer) as the back end.

My preference is to use Python as the front end.

See http://www.pytex.org


Some years ago I developed Active TeX, which has a novel macro
programming environment.

This was intended to provide an easier framework for writing macros.

I discontinued work on it after a while, in favour of Pytex.

See http://www.pytex.org/activetex/index.html


I've posted this to comp.lang.python as well as the original
comp.text.tex.


Jonathan





More information about the Python-list mailing list