[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
A problem about subscripts and superscripts
- To: math-font-discuss@cogs.susx.ac.uk
- Subject: A problem about subscripts and superscripts
- From: alanje@cogs.susx.ac.uk (Alan Jeffrey)
- Date: Sun, 8 Aug 93 23:33 BST
A problem has arisen with the arrow-building kit with sub- and
super-scripts.
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
intended!
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
$X_\foo$.
This is a right pain for the arrow-building kit, since if we define:
\def\rightarrow{\mathrel{...blah...}}
then any documents which contain $X_\rightarrow$ will break with the error:
*$X_\rightarrow$
! Missing { inserted.
<to be read again>
\mathrel
\foo ->\mathrel
{...blah...}
<*> $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
\mathchardef's.
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.
Sigh...
Alan.