# Stretchable glue in (script)scriptstyle (subscripts, superscripts, fractions)

If $a+b$ appears in a paragraph, the spacing around + will depend on how stretched/compressed the line is. If ${a+b}$ is used, then the formula will have its natural width regardless of how stretched/compressed the line is. However, the stretchable space (glue) around + is still present, as can be seen from \showlists:

\tracingonline=1
${a+b}$
\showlists
\bye


shows (with plain TeX)

\mathon
\hbox(6.94444+0.83333)x21.79968
.\teni a
.\glue(\medmuskip) 2.22217 plus 1.11108 minus 2.22217
.\tenrm +
.\glue(\medmuskip) 2.22217 plus 1.11108 minus 2.22217
.\teni b
\mathoff


On the other hand, there is no such glue in \scriptstyle: the code above with the addition of \scriptstyle after the dollar (or after the brace) gives

\mathon
\hbox(4.8611+0.83334)x13.99323
.\seveni a
.\sevenrm +
.\seveni b
\mathoff


Does (La)TeX ever insert glue (in particular stretchable/shrinkable glue) in \scriptstyle (and \scriptscriptstyle)? I'm interested in what happens in real-life documents (e.g., using ams(La)TeX and other macro packages).

-
spaces such as \> are not guarded by \nonscript so insert stretch glue in script styles. – David Carlisle Jul 16 '14 at 22:07

According to the description on page 170 of the TeXbook, automatic glue around math atoms can be “conditional”, that is, inserted only in display and text styles:

Here 0, 1, 2, and 3 stand for no space, thin space, medium space, and thick space, respectively; the table entry is parenthesized if the space is to be inserted only in display and text styles, not in script and scriptscript styles. For example, many of the entries in the Rel row and the Rel column are ‘(3)’; this means that thick spaces are normally inserted before and after relational symbols like ‘=’, but not in subscripts.

The same happens if an explicitly inserted glue is preceded by \nonscript; this case, will be denoted in \showlists by \glue(\nonscript); for instance

$a\nonscript\hskip2pt b$\showlists


will print

\mathon
\seveni a
\glue(\nonscript)
\glue 2.0
\seveni b
\mathoff


while

$\scriptstyle a\nonscript\hskip2pt b$\showlists


will print

\mathon
\seveni a
\glue(\nonscript)
\seveni b
\mathoff


and the effect would be exactly the same as if no glue had been added.

Relevant modules in “TeX the program” are 732 (for \nonscript), 764 (for the table at page 170 of the TeXbook), 765 and 766.

If one uses LaTeX and amsmath, the glue will “magically” reappear with

$a_{\text{$b+c$}}$


because the subscript will be typeset in text style in a \fontsize{\sf@size} context (where \sf@size is computed from the current text font size).

-
I looked at that table, and it is interesting to note that only 0 and 1 appear without parentheses, which means that only "no space" or \thinmuskip are inserted in scriptstyle and scriptscriptstyle. So you could get stretchable glue in subscripts via \thinmuskip=3mu plus 1mu\relax $x_{a\prod}$\tracingonline=1\showlists. – Bruno Le Floch Jul 16 '14 at 22:15
@BrunoLeFloch A space between “log” and “x” is needed independently of the style, so that \thinmuskip can't be conditional. However glue never stretches when a subformula is typeset. Thus \hbox to 3cm{\thinmuskip=3mu plus 1fill$\left(a\prod\right)$} will be underfull, while \hbox to 3cm{\thinmuskip=3mu plus 1fill$\scriptstyle a\prod$} won't – egreg Jul 16 '14 at 22:25