# [texhax] Parsing ^ and _

Michael Barr mbarr at math.mcgill.ca
Mon Sep 11 16:17:45 CEST 2006

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.

Michael Barr