\frac{numerator}{denominator} and a binomial coefficient with \binom{n}{k} (which requires \usepackage{amsmath}). For inline division, write a/b or a \div b.
Basic fractions and binomial coefficients
\frac is built into the LaTeX kernel and adapts its size to the surrounding math mode: compact in inline math ($...$) and full-sized in display math (\[...\] or equation). \binom from amsmath follows the same sizing rule and draws tall parentheses with no fraction bar.
fractions.tex
Ready to use this syntax? Continue in the browser editor when you want to adapt the example in a real project.Open LaTeX Cloud Studio
Controlling size: \dfrac, \tfrac, \dbinom, and \tbinom
When automatic sizing is not what you want, amsmath provides explicit display-style and text-style variants:
\tfrac is useful for numerical coefficients such as \tfrac{1}{2} x^2 inside display equations. Use \dfrac sparingly inside paragraphs because tall fractions push adjacent lines apart.
sizes.tex
Continued fractions with \cfrac
Nesting \frac inside another \frac steps each level down one math style (text style to script style to scriptscript style), so a fraction inside a fraction gets smaller and quickly becomes hard to read. Use \cfrac (from amsmath) to keep every level in display style. Numerators are centered by default; pass [l] or [r] to align a numerator left or right.
cfrac.tex
Inline division and diagonal fractions
In exponents (e^{-x/2}), subscripts, and dense running prose, a plain slash a/b is usually easier to read than a stacked fraction. Use \div when you specifically need the division sign, or load xfrac and write \sfrac{1}{2} for a diagonal fraction.
division.tex
Common mistakes
- Using
\binom,\dfrac,\tfrac, or\cfracwithoutamsmath: Only\fracis defined by the LaTeX kernel; the others raiseUndefined control sequenceunless\usepackage{amsmath}is in your preamble. - Putting a slash inside
\frac:\frac{1/2}passes only one braced group, so LaTeX consumes the next token as the denominator. Pass two braced groups:\frac{1}{2}. - Using plain-TeX
\overor\choose: Writing{a \over b}or{n \choose k}triggers anamsmathforeign-command warning and interacts poorly with LaTeX macros. Use\frac{a}{b}and\binom{n}{k}instead. - Overusing
\dfracin inline paragraphs: Forcing display fractions inside body text creates uneven line spacing; prefer\frac{a}{b}ora/binline.
Try it in the editor
Bothamsmath and xfrac are installed in LaTeX Cloud Studio’s TeX Live 2026 environment. Start from the Basic Article template in LaTeX Cloud Studio and replace main.tex with fractions.tex or division.tex above.
