# [texhax] using latex as a preprocessor

Joe Corneli jcorneli at math.utexas.edu
Sat Jan 10 15:50:49 CET 2004

This is almost (but not quite) a follow-up to my question about how
to typeset large multi-author documents -- which Ross had very
complete off-list answer for, so thanks again to him for that!

Here's the new question: when I was thinking about possible
approaches for typesetting a multi-author document, one possibility
I thought of would be to preprocess the document I made (essentially
the concatenation of all the files I'm working with, with the
preambles sorted out and moved to the front of the document) and
translate all user-defined macros back into the commands they stand
for.  For example, if we have the command

\def\mobius#1#2#3#4#5{\frac{#2#1 + #3}{#4#1 + #5}}

then wherever you see something like

\mobius{z}{a}{b}{c}{d}

write

\frac{az + b}{cz + d}}

and so on for all the other commands. (This would eliminate
name-space conflicts.) I'm curious to know if you can do this sort
of thing with latex, or if it is best done (if at all) with some
other (programming) language.