Next: , Previous: , Up: Math formulas   [Contents][Index]

### 16.7 Math styles

TeX’s rules for typesetting a formula depend on the context. For example, inside a displayed equation, the input \sum_{0\leq i<n}k^m=\frac{n^{m+1}}{m+1}+\mbox{lower order terms} will give output with the summation index centered below the summation symbol. But if that input is inline then the summation index is off to the right rather than below, so it won’t push the lines apart. Similarly, in a displayed context, the symbols in the numerator and denominator will be larger than for an inline context, and in display math subscripts and superscripts are further apart then they are in inline math.

TeX uses four math styles.

• Display style is for a formula displayed on a line by itself, such as with $$...$$.
• Text style is for an inline formula, as with ‘so we have $...$’.
• Script style is for parts of a formula in a subscript or superscript.
• Scriptscript style is for parts of a formula at a second level (or more) of subscript or superscript.

TeX determines a default math style but you can override it with a declaration of \displaystyle, or \textstyle, or \scriptstyle, or \scriptscriptstyle.

In this example, the ‘Arithmetic’ line’s fraction will look scrunched.

\begin{tabular}{r|cc}
\textsc{Name}  &\textsc{Series}  &\textsc{Sum}  \\  \hline
Arithmetic     &$a+(a+b)+(a+2b)+\cdots+(a+(n-1)b)$
&$na+(n-1)n\cdot\frac{b}{2}$  \\
Geometric      &$a+ab+ab^2+\cdots+ab^{n-1}$
&$\displaystyle a\cdot\frac{1-b^n}{1-b}$  \\
\end{tabular}


But because of the \displaystyle declaration, the ‘Geometric’ line’s fraction will be easy to read, with characters the same size as in the rest of the line.

Another example is that, compared to the same input without the declaration, the result of

we get
$\pi=2\cdot{\displaystyle\int_{x=0}^1 \sqrt{1-x^2}\,dx}$


will have an integral sign that is much taller. Note that here the \displaystyle applies to only part of the formula, and it is delimited by being inside curly braces, as ‘{\displaystyle ...}’.

The last example is a continued fraction.

$$a_0+\frac{1}{ \displaystyle a_1+\frac{\mathstrut 1}{ \displaystyle a_2+\frac{\mathstrut 1}{ \displaystyle a_3}}}$$


Without the \displaystyle declarations, the denominators would be set in script style and scriptscript style. (The \mathstrut improves the height of the denominators; see \mathstrut.)