# How TeX / LaTeX proportionally scales \frac, \sum super/subscripts, etc

Wondering what the scaling proportion is when you do above/below on \sum, nested fractions, or super/subscripts on something.

Wondering if it's the same in all of these different situations. It looks like it stops scaling after a certain point as well (last example).

$$\lim_{x \to \infty} \exp(-x) = 0$$
$$f(n) = n^5 + 4n^2 + 2 |_{n=17}$$
$$\frac{\frac{1}{x}+\frac{1}{y}}{y-z}$$
$$^3/_7$$
$$x^\frac{1}{2}$$
$$\sqrt[n]{1+x+x^2+x^3+\dots+x^n}$$
$$\sum_{i=1}^{10} t_i$$
$$\left(\frac{\frac{\frac{\frac{\sqrt \frac{x}{y}}{\frac{y^3}{x/{z}}}}{x}}{\frac{\sqrt \frac{x}{y}}{\frac{y^3}{x/{z}}}}}{x}\right)$$
$$\sum_{x_{r_{a^2_{b_{q_t_{z_w^3}(1)}}}}}^n x * 2$$

• shouldn't you pause and clarify the similar questions you just asked before asking multiple questions about every part of math layout to which the same comments apply, the details depend on if you are using classic tex or unicode math fonts. – David Carlisle Aug 3 '18 at 8:21
• It seems the two options are "classic tex" or "xetex/luatex and opentype math fonts", but I wouldn't mind knowing how either or both worked, I don't have a pref b/c. I guess I would think opentype math font, since that sounds more modern. – Lance Pollard Aug 3 '18 at 8:24
• Why are you asking though? If you are using pdflatex then an opentype answer is not going to help, but more generally you should wait until you get an answer for the previous questions which already cover most of this, asking multiple almost identical questions without responding to comments asking for you to clarify the early ones and without waiting for any answers seems a bit odd. – David Carlisle Aug 3 '18 at 8:27

TeX maintains styles when processing math formulas; the styles are

1. display, D
2. text, T
3. script, S
4. scriptscript, SS

together with their cramped counterparts (denoted with a prime). You can read the TeXbook or TeX by Topic for the precise rules when the cramped styles are used, here, for the sake of simplicity, I'll not distinguish between cramped and non cramped. With C I'll denote the current style, and with C↕ the style for subscripts or superscripts relative to the current style

D↕ = S, T↕ = S, S↕ = SS, SS↕ = SS

When a formula is started in line, the initial style is T; if it is a display, the initial style is D.

Clearly, a subscript or superscript is typeset in style C↕; thus $1^2$ will have 1 in style T and 2 in style S. Similarly, $1^{2^3}$ will have the same choices for 1 and 2, but 3 will be in style SS. Further exponents will continue in style SS. Similarly for subscripts.

The difference with $$1^2$$, $$1^{2^3}$$ is just that 1 will be in style D. Of course, this will make no difference in case of 1, but will in case of \sum, because all “big operators” have a larger variant which is used in style D.

There is no distinction when the subscript/superscript is eventually set above or below an operator such as \lim: the same rules will apply.

• C=D: numerator T, denominator T
• C=T: numerator S, denominator S
• C=S: numerator SS, denominator SS
• C=SS: numerator SS, denominator SS

This also holds for “generalized fractions” such as \above or \atop.

For radicals, the object under the radical sign will be set in the same style as the current one.

The current style can be overridden with the declarations \displaystyle, \textstyle, \scriptstyle and \scriptscriptstyle, whose scope holds for the current subformula (possibly delimited by { and }, not by \begingroup and \endgroup).

These declarations are used in \mathpalette (see The mysteries of \mathpalette), because in general it is not known in advance what the current style will be.

For each math family, TeX maintains a \textfont (used in styles D and T), a \scriptfont (used in style S) and a \scriptscriptfont (used in style SS). For instance, plain TeX has

\textfont0=\tenrm \scriptfont0=\sevenrm \scriptscriptfont0=\fiverm


It's the user's responsibility to assign the fonts. LaTeX does it automatically with \DeclareSymbolFont or \DeclareMathAlphabet.

• Very interesting, that simplifies the problem a lot! Wondering if there is ever a need to have more levels than just these 4. Maybe save that for later or something. – Lance Pollard Aug 3 '18 at 9:43
• Also, wondering if there is a place where I can find the actual scale ratios between D/T/S/SS. – Lance Pollard Aug 3 '18 at 9:45
• @LancePollard In plain TeX there is no predefined ratio: the standard choices are 10/7/5 points. For LaTeX you should look at the declarations \DeclareMathSizes in fontmath.ltx. – egreg Aug 3 '18 at 9:50
• @LancePollard: In addition, the LaTeX kernel defines the macros \defaultscriptratio and \defaultscriptscriptratio; the idea is that, for font sizes for which no \DeclareMathSizes declaration has been issued, the ratios text_font_size : script_font_size : scriptscript_font_size are set equal to 1 :\defaultscriptratio:\defaultscriptscriptratio. The default definitions are 0.7 and 0.5, respectively, so that the default ratios are 1 : 0.7 : 0.5, but you can redefine them in the preamble of your document (or in a package or class file). – GuM Aug 3 '18 at 10:14