# [texhax] Parsing ^ and _

Jonathan Fine J.Fine at open.ac.uk
Tue Sep 12 11:18:21 CEST 2006

"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).

So it seems that you can continue with more of
the same, or start again from a starting point
that is more suitable for your long-term goal.

Sorry that I cannot be more helpful.

--
Jonathan