How to Write a LaTeX Fraction
A LaTeX fraction is written with \frac{numerator}{denominator} in math mode: $\frac{1}{2}$ gives ½ as a stacked fraction. Both parts can hold any math, including other fractions and roots.
Half of the class is $\frac{1}{2}$, and the slope is $\frac{\Delta y}{\Delta x}$.
\[ x = \frac{-b \pm \sqrt{b^2 - 4ac}}{2a} \]Full document you can compile
\documentclass{article}
\begin{document}
Half of the class is $\frac{1}{2}$, and the slope is $\frac{\Delta y}{\Delta x}$.
\[ x = \frac{-b \pm \sqrt{b^2 - 4ac}}{2a} \]
\end{document}Why is my fraction so small in a sentence?
Inside $…$, LaTeX shrinks \frac so it doesn't push the lines of the paragraph apart. In a displayed equation it is full size. That is on purpose, and for most inline math the small size is right.
How do you make a fraction bigger or smaller?
With amsmath, \dfrac forces the display size and \tfrac the small text size, wherever they appear. Use \dfrac inline only when the fraction must be easy to read, since it widens the line gap.
Inline \verb|\frac|: $\frac{a}{b}$, \quad inline \verb|\dfrac|: $\dfrac{a}{b}$
\[ \frac{a}{b} \qquad \tfrac{a}{b} \]Needs \usepackage{amsmath} in the preamble.
Full document you can compile
\documentclass{article}
\usepackage{amsmath}
\begin{document}
Inline \verb|\frac|: $\frac{a}{b}$, \quad inline \verb|\dfrac|: $\dfrac{a}{b}$
\[ \frac{a}{b} \qquad \tfrac{a}{b} \]
\end{document}How do you write a slashed fraction like ½?
For a simple ratio, a slash is fine: $a/b$. For a neat slanted fraction like those in recipes and measurements, load xfrac and use \sfrac{1}{2}; it works in text and in math.
Slash: $a/b$, \quad \verb|\sfrac|: $\sfrac{1}{2}$ cup of sugar, \quad in text: \sfrac{3}{4} inch.Needs \usepackage{xfrac} in the preamble.
Full document you can compile
\documentclass{article}
\usepackage{xfrac}
\begin{document}
Slash: $a/b$, \quad \verb|\sfrac|: $\sfrac{1}{2}$ cup of sugar, \quad in text: \sfrac{3}{4} inch.
\end{document}How do you write a continued fraction?
Nest \cfrac from amsmath. Unlike nested \frac, it keeps every level at full size, so the deep parts stay readable.
\[ \sqrt{2} = 1 + \cfrac{1}{2 + \cfrac{1}{2 + \cfrac{1}{2 + \dotsb}}} \]Needs \usepackage{amsmath} in the preamble.
Full document you can compile
\documentclass{article}
\usepackage{amsmath}
\begin{document}
\[ \sqrt{2} = 1 + \cfrac{1}{2 + \cfrac{1}{2 + \cfrac{1}{2 + \dotsb}}} \]
\end{document}Is a binomial coefficient a LaTeX fraction?
No. It looks like one without the bar, but it has its own command: \binom{n}{k} from amsmath. Don't fake it with \frac or \atop.
\[ \binom{n}{k} = \frac{n!}{k!\,(n-k)!} \]Needs \usepackage{amsmath} in the preamble.
Full document you can compile
\documentclass{article}
\usepackage{amsmath}
\begin{document}
\[ \binom{n}{k} = \frac{n!}{k!\,(n-k)!} \]
\end{document}Why does a LaTeX fraction give an error?
Missing braces. \frac12 happens to work because each part is one character, but \frac10 3 reads as 1 over 0. Always brace both parts. Outside math mode, \frac stops the compile with ! Missing $ inserted.
How do you build fractions without typing the code?
The online equation editor has a fraction button and a live preview. The ± and √ in the quadratic formula above have their own pages: the plus or minus sign and the square root symbol. Fractions also sit inside the brace of piecewise functions.
Sources
- User’s Guide for the amsmath Package (CTAN), read Nov 28, 2026
- xfrac package documentation (CTAN), read Nov 28, 2026
Text drafted with AI from the cited documentation; every example compiled with TeX Live 2026; checked by Cem Demir. See the editorial policy.