[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

A problem about subscripts and superscripts

A problem has arisen with the arrow-building kit with sub- and

At the moment, some of the arrow commands can be used in a sub- or
super-script without braces, for example $X_\rightarrow$ but not
$X_\longrightarrow$.  The reason why $X_\longrightarrow$ doesn't work is
because subscript positioning takes place in the stomach, and so
\longrightarrow expands to \relbar\joinrel\rightarrow *before* the
subscript positioning takes place, and so TeX's stomach ends up setting
$X_\relbar\joinrel\rightarrow$, which probably isn't quite what the user

As far as I can see (grits teeth) there is *no* way to write a TeX macro
\foo that is of type mathrel, and which will work when the user says

This is a right pain for the arrow-building kit, since if we define:


then any documents which contain $X_\rightarrow$ will break with the error:

   ! Missing { inserted.
   <to be read again>
   \foo ->\mathrel
   <*> $X_\rightarrow

So, if we want upwards compatibility, then any commands which are
currently \mathchardef's (as far as I can tell) *have* to stay as

For LaTeX documents we might claim that $X_\rightarrow$ was never part of
the LaTeX syntax, and users should have typed $X_{\rightarrow}$.  But
it's certainly kosher plain TeX to say $X_\rightarrow$, and I don't think
many users are going to be very happy if their documents break.

One (rather drastic) way round this would be to say:

   \def\superscript{^}  \def\subscript{_}
   \catcode`\^=\active  \catcode`\_=\active
   \edef^{\superscript} \edef_{\subscript}

Unfortunately, this means that any plain TeX documents that rely on the
active _ being \_ will break.  So I don't think we can get away with this!

I really do hope I'm wrong, and that there is some way to define a macro
of type \mathrel which will work with $X_\foo$, since if there isn't, it
means that *all* of the current arrows in the CM and AMS kit have to be
directly accessable by \mathchardef's, which destroys a lot of the point
of the arrow-building kit.

Insert standard rant about the appalling TeX syntax for superscripts and
subscripts here.