[texhax] Parsing ^ and _

Uwe Lück uwe.lueck at web.de
Thu Sep 14 00:28:34 CEST 2006


At 11:18 12.09.06, Jonathan Fine wrote:
>"Michael Barr" <mbarr at math.mcgill.ca> wrote in message
>news:Pine.LNX.4.44.0609110952130.13459-100000 at triples.math.mcgill.ca...
> > Is there any simple way of parsing ^ and _ that mimics what TeX does, but
> > allows other procedures than just putting in super and subscripts?  For
> > example, I have a \to procedure that replaces the plain tex (which is a
> > synonym for \rightarrow) and measures the sizes of the scripts and uses
> > that information to choose the length of the arrow.  As it is, I can use
> > any of \to^{...}, \to_{...}, \to^{...}_{...} but not \to_{...}^{...}.  I
> > already have three uses of \@ifnextchar and the only way I can think to
> > implement allowing all four would use several more.  Is there a simpler
> > way of doing this.
>
>TeX macros are a suitable means for implementing
>a simple markup language.  They are not a suitable
>means for a complex markup language.
>
>I've gone down that route by making ALL characters
>active, which avoids catcode problems.  But then
>you run into problems with TeX not being good as
>a programming language (and highly application
>specific).

... aha!? astonishes me, I'd like to learn more.
I bet almost anything that a complex markup language
can be represented (processed/emulated) by suitably
complex TeX macros. TeX is so-and-so-complete,
as I think to have learnt once. E.g,
(as some diploma or doctoral thesis probably has explained),
any Turing machine can be represented (emulated)
by TeX (disregarding memory capacity).
-- Things like \@whilenum in LaTeX (ltcntrl.dtx)
should indicate that Pascal etc. can be implemented
using TeX ...

Cheers,

   Uwe.



More information about the texhax mailing list