Background
TeX typesets each portion of a mathematical expression in one of 8 styles:
- display,
- display',
- text,
- text',
- script,
- script',
- scriptscript, or
- scriptscript'.
Knuth calls them, D, D', T, T', S, S', SS, and SS', respectively.
TeX transitions between styles for subscripts, superscripts, and for the numerators and denominators of fractions (\above
, \atop
, \over
and their \...withdelims
variants).
Four of these style are well known via \displaystyle
, \textstyle
, \scriptstyle
, and \scriptscriptstyle
. The other four are less known (in fact, I don't think I've seen any reference to them outside of the TeXbook). They are almost the same as the corresponding nonprimed style except that superscripts are typeset a bit farther down.
One simple way to see the difference is to look at the output of (the plain TeX document)
$${\atop x^y}{\atop\textstyle x^y}$$
\bye
The reason these differ is that TeX starts the math display in style D. It typesets the numerator in style T and the denominator in style T'. The \textstyle
causes TeX to typeset the denominator in style T instead.
Question
How can one force TeX to go into one of the primed styles? As the example above illustrates, even when TeX is in one of the primed styles, it moves to the nonprime variant with \textstyle
(similarly for the other three).
Motivation
This can be important when building vertical boxes in math mode. For example, see my answer to changing the shape of a fraction for a case where this is needed.
Follow up question
Is there a way to check if the current style is cramped? I thought about putting X^X
in a \vcenter
and comparing its height to the current style as determined by \mathchoice
, but this doesn't work because \vcenter
doesn't give you a box.