Write a fraction with \frac{numerator}{denominator} inside math mode, as in $\frac{3}{4}$. Use \dfrac when you want full display size inside inline math or inside another fraction.
Basic fractions
The fraction $\frac{3}{4}$ sits inside the sentence.
\[
\frac{a + b}{c + d}
\]
\frac, \dfrac and \tfrac
\frac picks its size from the context. In display math it is full size. In inline math it is smaller, so it does not stretch the line. amsmath adds two fixed-size variants:
\dfracalways uses display size.\tfracalways uses text size.
Inline: $\frac{1}{2} + \frac{1}{3}$ and $\dfrac{1}{2} + \dfrac{1}{3}$.
The \dfrac pair is easier to read, but it adds more space between lines.
Nested and continued fractions
Fractions can sit inside other fractions. Use \dfrac for the inner fraction when it would otherwise shrink:
\[
x = \frac{1}{1 + \dfrac{1}{x}}
\]
For continued fractions, use \cfrac from amsmath, which keeps every level at display size:
\[
\varphi = 1 + \cfrac{1}{1 + \cfrac{1}{1 + \cdots}}
\]
Text inside a fraction
Words in a fraction need \text{} from amsmath, so they stay upright and keep their spacing:
\[
\frac{\text{part}}{\text{whole}}
\]
Fractions in running text
Three options work in running text:
\sfrac{1}{4}from thexfracpackage prints a slanted fraction.\nicefrac{1}{4}from thenicefracpackage prints a small fraction with a slanted bar.- A plain slash,
1/4, works for quick notes, but it can be ambiguous in complex expressions.
Both \sfrac and \nicefrac need their package loaded. Packages for mathematics lists them with the other math tools.
Binomial coefficients
Binomial coefficients use a related command. \binom{n}{k} is part of base LaTeX. amsmath adds \dbinom for display size and \tbinom for text size:
\[
\binom{n}{k} = \frac{n!}{k!\,(n-k)!}
\]
Common mistakes
- Missing braces: each argument of
\fracneeds its own braces, or the fraction takes the wrong part of the expression. Write\frac{a+b}{c}, not\frac a+b c. \frac12works, but braces are clearer: a single-character argument can skip braces, as in\frac12. Braces avoid confusion when the argument grows.- Old form:
{a \over b}is a plain TeX form.\fracis clearer in LaTeX. - Missing $:
\fracoutside math mode gives a “Missing $ inserted” error. Wrap it in$...$or\[...\].
Fractions often sit inside roots and brackets. See square roots and nth roots and sizing brackets and parentheses. For fractions inside a piecewise definition, see piecewise functions with cases.