Fractions in LaTeX

Use \frac{num}{den} to write fractions in LaTeX.

Quick Answer

latex
$\frac{1}{2}$          % inline fraction
\[ \frac{a + b}{c} \] % display fraction

Basic Syntax

\frac{numerator}{denominator} works in any math environment. Always enclose numerator and denominator in curly braces.

latex
\documentclass{article}
\begin{document}

Inline: $\frac{3}{4}$ of the students passed.

Display mode:
\[
  \frac{a + b}{c + d}
\]

\end{document}

Writing your thesis in LaTeX?

MonsterWriter's LaTeX Workspace gives you real-time PDF preview with no compile limits — at a fraction of Overleaf's price. Works just like Overleaf, costs 11× less.

Try MonsterWriter free

Display vs. Text Size: \dfrac and \tfrac

By default, inline fractions are typeset smaller. Use \dfrac to force display (large) style inline, or \tfrac to force text (small) style in display mode. Both require the amsmath package.

latex
\usepackage{amsmath}  % in preamble

% Force large fraction inline:
The answer is $\dfrac{1}{2}$.

% Force small fraction in display mode:
\[
  \text{approximately } \tfrac{22}{7}
\]

Nested Fractions

You can nest \frac inside itself for compound fractions. Use \dfrac at the inner level to keep them readable.

latex
\[
  \frac{\dfrac{1}{x} + y}{z}
\]

% Continued fraction:
\[
  a_0 + \cfrac{1}{a_1 + \cfrac{1}{a_2 + \cfrac{1}{a_3}}}
\]

\cfrac (from amsmath) is designed for continued fractions and keeps things nicely sized.

Fractions in Equations

latex
\usepackage{amsmath}

\begin{equation}
  \frac{\Delta y}{\Delta x} = \frac{f(x + h) - f(x)}{h}
\end{equation}

\begin{align}
  P(A|B) &= \frac{P(B|A) \cdot P(A)}{P(B)}
\end{align}

Common Mistakes

$\frac 1 2$— missing braces; may work for single chars but not reliable
$\frac{1}{2}$— always use braces

Related Topics