Four commands, one box model
Only one of these four commands changes what a fraction looks like; the other three change the style it is set in. \frac{a}{b} asks for a fraction in whatever style the surrounding maths already has — full height in a display, compressed inline. amsmath defines \dfrac and \tfrac as \frac wrapped in \displaystyle and \textstyle respectively, so \dfrac{1}{2} inside a sentence buys you the display-sized box and \tfrac{1}{2} inside a theorem display buys you the compact one. \cfrac is a display-style \frac that additionally forces its own numerator and denominator into display style, which is exactly what a continued fraction needs: without it, nesting drives each level down into scriptstyle mush.
What none of the four change is the box model. TeX builds two boxes, sets them in the style one level below the current one, lays the rule on the math axis — the height at which + and = sit, never the baseline — and then pushes the boxes apart until a per-style minimum clearance is satisfied. Those clearances (num1, num2, num3, denom1, denom2, denom3), together with axis_height and default_rule_thickness, are parameters of the math font. That is why the same source is taller in Computer Modern than in Latin Modern, and why "make fractions smaller" is not a LaTeX option: you change the style, or you change the content.
So pick the command by where the fraction lives and how tall the result may be, not by taste. In a display, \frac is already right. Inline it is usually right too, and \tfrac is what you reach for when the line is already loose. \dfrac is a repair for one specific situation — display-height material that has been forced into a text-style context: cells of cases and array, or a numerator that is itself a fraction.
\frac{a+b}{c+d}
\frac{1}{2} \qquad \dfrac{1}{2} \qquad \tfrac{1}{2}
Which style applies where
The rules are short enough to memorise. A display (\[…\], equation, align, gather, multline, displaymath) starts in displaystyle. Anything inside $…$, \(…\), equation-style inline material, or an \hbox starts in textstyle. A subscript or superscript drops one level: inside x_{…} you are in scriptstyle, and one nested level deeper gives scriptscriptstyle. Each drop both shrinks the glyphs and tightens the fraction clearances, which is why a nested fraction reads far smaller than the subscript that holds it.
Two contexts surprise people. The cells of cases and of array/matrix are typeset in textstyle, so a \frac in a piecewise branch prints compact even though the whole thing sits in a display — that is the case \dfrac exists for. And inside aligned the material next to the alignment points is in the outer style (display, inside a display), while anything you put in a sub- or superscript is scriptstyle regardless.
You can also set the style by hand: \displaystyle and \textstyle are switches that apply to the rest of the current group, so {\displaystyle \frac{1}{2}} inside a cases cell does what \dfrac does, and \scriptstyle/\scriptscriptstyle let you force the smaller ones. Prefer the amsmath wrappers \dfrac/\tfrac in prose: they are scoped to one fraction, they read as an intention, and they cannot leak past their braces and quietly enlarge the rest of the line.
\dfrac{\partial u}{\partial t} = \kappa \, \dfrac{\partial^{2} u}{\partial x^{2}}
\cfrac{1}{1+\cfrac{1}{1+\cfrac{1}{1}}}
Why a fraction collapses inside a summation limit
This is the single most-asked question about fractions, and the answer is the style inheritance above. In \sum_{k=1}^{n} \frac{1}{k} the fraction is in the body of the display, so it keeps display height. Move it into a bound — \sum_{k=1}^{\frac{n}{2}} k, or x_{\frac{1}{2}} — and it is now inside a subscript, hence scriptstyle: the glyphs shrink and num3/denom3 clamp the clearance, and the result is a smudge no reader decodes at speed.
Three fixes, in order of preference. First, restructure so the fraction is not in the limit: \sum_{k \le n/2} k with a slash, or \sum_{k=1}^{m} plus a line of text saying what m is. Second, force the size with \dfrac — legal, and TeX will happily obey — but accept the consequence: the box gets taller than the summation sign, so the bounds collide with the operator, and in an inline formula the line opens. Third, when you really need stacked multi-line bounds on a big operator, use \substack inside the limit and keep each line in scriptstyle deliberately.
The general principle is worth more than the trick: a limit, a subscript and a superscript are annotations, and the design assumes they are short. If your annotation needs a two-storey fraction, the formula is telling you to name the quantity and put the definition elsewhere.
\sum_{n=1}^{\infty} \frac{1}{n^{2}} \qquad \sum_{n=1}^{\infty} \dfrac{1}{n^{2}}
\sum\limits_{…} the bounds sit under the operator but stay in scriptstyle — \limits changes the position, never the size.x_{\frac{1}{2}} \qquad x_{\dfrac{1}{2}} \qquad \sum_{k=1}^{\frac{n}{2}} k
Arguments, braces and the \over trap
Every fraction command takes exactly two arguments, so the one-token rule applies twice. \frac12 is legitimate TeX: each argument is one token, so it reads as one half. \frac 1{x+1} is the safe shorthand for \frac{1}{x+1}. But \frac{1}{x}+1 and \frac1x+1 both mean one-over-x plus one — the +1 has left the denominator. When the numerator or denominator is anything longer than one token, brace it. Forgetting those braces is the most common cause of a formula whose tail sits at full height when it should have been under the rule.
The TeX primitive \over is nastier, because it does not take arguments at all: it divides everything to the left from everything to the right within the enclosing group. {a+1 \over b-1} is fine — the braces delimit the scan. a + {1 \over b} is fine — the inner group limits it. But a + 1 \over b silently produces a fraction whose numerator is a+1, one level taller than you meant, and inside a \frac-style macro that error propagates outward. If you inherit old TeX source, converting \over to \frac{}{} is a genuine correctness fix, not a style preference.
Deep nesting has a related failure mode: \frac{\frac{1}{2}}{3} puts the inner fraction in scriptstyle, which is small but readable; two levels down, scriptscriptstyle is not. Rewrite with a slash, or lift the inner quantity into a named symbol.
\frac{1}{x+1} \qquad \frac 1{x+1} \qquad \frac{1}{x}+1
a + {1 \over b} \qquad {a+1 \over b-1}
Fractions in running text: slash, tfrac, or none
Inline maths has one hard constraint: it must not make the line taller. A \frac in text style already costs a little leading; a \dfrac in a sentence costs a visible hole between two lines, and no reviewer will tell you that your paragraph spacing is broken — they will just feel that the page is bad. So in prose: keep \frac for genuinely structural ratios, use \tfrac when the numbers are small, and use a plain slash for simple numeric ratios.
A slash is not a cop-out. 1/2 in maths mode sets tight, with no spaces around it, and reads correctly in a sentence about the golden ratio or a half-life. Write \frac{1}{2} when the fraction is the object of discussion; write 1/2 when it is an adjective. For reciprocal powers, prefer x^{-1}, (a+b)^{-1} to a stacked fraction in a run of text — the exponent form is shorter, keeps the line, and is unambiguous once the base is bracketed.
Two package options complete the set. \sfrac{1}{2} from the xfrac package gives a real text fraction with a slash and a small stacked body, which is what most journals use for numeric ratios inline. \nicefrac{1}{2} from units/nicefrac does the same job in a slightly different design. Both are text-style only; neither belongs in a display.
\frac{1}{2} + \frac{1}{3} = \frac{5}{6} \qquad 1/2 + 1/3
\documentclass[11pt,a4paper]{article}
\usepackage[T1]{fontenc}
\usepackage{amsmath,amssymb}
\usepackage{xfrac} % \sfrac: a slashed fraction for running text
\title{Fractions: style, size and placement}
\author{A. Student}
\date{\today}
\begin{document}
\maketitle
\section{The same source in four contexts}
Inline, plain \verb|\frac|: the ratio $\frac{a+b}{c+d}$ sits on the axis
and the line opens a little. Inline, \verb|\tfrac|: the ratio
$\tfrac{a+b}{c+d}$ costs no extra leading. Inline, \verb|\dfrac|:
$\dfrac{a+b}{c+d}$ pushes the paragraph apart --- the box is taller than
the line, so TeX has no choice. Inline, \verb|\sfrac| from the
\texttt{xfrac} package: $\sfrac{a+b}{c+d}$.
\section{A display sets one storey, nesting sets two}
\[
\frac{1}{1 + \dfrac{1}{2}} = \frac{2}{3},
\qquad\text{against}\qquad
\frac{1}{1 + \frac{1}{2}} = \frac{2}{3}.
\]
Same value, different typography: a fraction's own numerator and
denominator are set one style down, so the inner \verb|\frac| collapses to
text style unless you ask for \verb|\dfrac| explicitly.
\section{Cells of cases and array are text style}
\[
g(x) =
\begin{cases}
\dfrac{x^{2}+1}{x-1} & x \ne 1,\\[4pt] % \dfrac rescues the cell
0 & x = 1.
\end{cases}
\]
\section{Continued fractions}
\[
\varphi = 1+\cfrac{1}{1+\cfrac{1}{1+\cfrac{1}{1+\ddots}}},
\qquad
\sqrt{2} = 1+\cfrac{1}{2+\cfrac{1}{2+\cfrac{1}{2+\ddots}}}
\]
\verb|\cfrac| keeps every level at display height and full width; its
optional \verb|[n]| or \verb|[d]| argument says which box is the alignment
reference when the numerator and the denominator differ in height.
\end{document}
Fractions without a bar, and with a custom one
A binomial coefficient is a fraction with the rule deleted: \binom{n}{k} is, in amsmath, a \genfrac call with parentheses, zero rule thickness and text style; \dbinom and \tbinom are the display and text variants. If you write \frac{n!}{k!(n-k)!} and then wrap it in brackets by hand you get the arithmetic right and the typography wrong, because \frac adds a rule and the brackets do not get the fence spacing a binomial needs.
\genfrac{⟨left⟩}{⟨right⟩}{⟨thickness⟩}{⟨style⟩}{⟨num⟩}{⟨denom⟩} is the general form underneath all of them, and it solves several problems people otherwise hack. Zero thickness gives a rule-less stacked pair (\genfrac{}{}{0pt}{}{a+n}{b+n}) — the honest way to write a ratio that must not look like a fraction. 0.08em gives the lighter rule common in older European typesetting. The style argument takes 0 to 3 for display through scriptscriptstyle, or -1 to mean "inherit". And delimiters are part of the call, which is how \binom gets correctly sized parens without \left and \right. Note that \genfrac is a genuine amsmath macro, so it works in your document; renderer support elsewhere is uneven, so check before you paste it into a web form.
For continued fractions, \cfrac is the whole answer, and its optional argument is the part nobody reads: it takes n or d to say which of the two boxes is the alignment reference when the numerator and denominator differ in height — 1+\cfrac[d]{1}{2+\cfrac{1}{2+\ddots}} lines the levels up on their denominators instead of centring each pair, which is what plain \dfrac nesting gets wrong.
\binom{n}{k} = \frac{n!}{k!\,(n-k)!} \qquad \dbinom{n}{k}
\genfrac delimiters are ordinary argument text: pass \langle and \rangle as the first two arguments, not \left/\right.\genfrac{}{}{0pt}{}{a+n}{b+n} \qquad \genfrac{\langle}{\rangle}{0pt}{}{x}{y}
Delimiters, collisions and the height bill
A fraction is a tall box, and everything that measures that box inherits the height. \left(\frac{a}{b}\right) is the classic case: \left sizes the fence to the whole box, so you get parentheses one or two steps larger than the surrounding maths and a visible gap around the operator. The typographically correct version picks a size by eye — \bigl(\tfrac{a}{b}\bigr) in text, \Bigl(\frac{a}{b}\Bigr) in a display. The full ladder is in the brackets lesson.
Derivative notation is the other place fractions dominate the vertical space: \frac{\mathrm{d}y}{\mathrm{d}x} and \frac{\partial^{2} f}{\partial x \, \partial y} are two-storey boxes even before you add a subscript, which is why \pd{}{}-style macros and \tfrac variants are worth defining in the preamble of any document with differential equations in it. A second-order derivative in a \left(\dots\right)_{x=0} will otherwise buy you a fence taller than the sentence.
Finally, spacing: TeX already treats a fraction as an ordinary atom, so x \frac{1}{2} needs no space command, and \frac{1}{2}x is genuinely ambiguous — do you mean half of x, or \frac{1}{2x}? Write the one you mean: \frac{x}{2} for the first, and a brace or a slash for the second. Ambiguity of that kind survives proof-reading far more often than a bad brace does.
\left(\frac{a}{b}\right)^{2} \qquad \Bigl(\frac{a}{b}\Bigr)^{2} \qquad \bigl(\tfrac{a}{b}\bigr)^{2}
\frac{\mathrm{d}y}{\mathrm{d}x} \qquad \frac{\mathrm{d}^{2}y}{\mathrm{d}x^{2}} \qquad \frac{\partial^{2} f}{\partial x \, \partial y}
\documentclass[11pt,a4paper]{article}
\usepackage[T1]{fontenc}
\usepackage{amsmath,amssymb}
\usepackage{mathtools}
% --- Derivative fractions: one macro, one size, everywhere ---
\newcommand{\pd}[2]{\frac{\partial #1}{\partial #2}} % display size
\newcommand{\vpd}[2]{\tfrac{\partial #1}{\partial #2}} % text size, for prose
\newcommand{\ppd}[2]{\frac{\partial^{2} #1}{\partial #2^{2}}}
\newcommand{\vppd}[2]{\tfrac{\partial^{2} #1}{\partial #2^{2}}}
\newcommand{\od}[2]{\frac{\mathrm{d}#1}{\mathrm{d}#2}}
\newcommand{\dd}{\mathop{}\!\mathrm{d}} % roman differential
% --- A ratio with no rule: \genfrac{L}{R}{thickness}{style}{num}{den} ---
\newcommand{\ratio}[2]{\genfrac{}{}{0pt}{}{#1}{#2}}
% --- Delimiters that remember the sizing policy ---
\DeclarePairedDelimiter{\abs}{\lvert}{\rvert} % \abs{} manual, \abs*{} auto
\DeclarePairedDelimiter{\norm}{\lVert}{\rVert}
\newcommand{\eval}[2]{\left.#1\right\vert_{#2}} % evaluation bar
\title{A fraction preamble}
\author{A. Student}
\date{\today}
\begin{document}
\maketitle
For the heat equation, prose writes $\vpd{u}{t} = \kappa\,\vppd{u}{x}$ and a
display writes
\[
\pd{u}{t} = \kappa\,\ppd{u}{x}.
\]
Defining both sizes once is what keeps a long document from setting the same
symbol three different ways. The rule-less ratio is then just
\( \ratio{a+n}{b+n} \), and a continued-fraction chain can be checked
against \verb|\cfrac| rather than rebuilt by hand.
Test the delimiter policy on identical content:
$\abs{\frac{1}{2}}$ versus $\abs*{\frac{1}{2}}$, and
\( \eval{\frac{x^{2}}{2}}{0}^{1} = \frac{1}{2} \).
\end{document}
Lesson cheat sheet
One key line of code from each section — jump to it or copy it straight from here.
\frac{a+b}{c+d}
\dfrac{\partial u}{\partial t} = \kappa \, \dfrac{\partial^{2} u}{\partial x^{2}}
\sum_{n=1}^{\infty} \frac{1}{n^{2}} \qquad \sum_{n=1}^{\infty} \dfrac{1}{n^{2}}
\frac{1}{x+1} \qquad \frac 1{x+1} \qquad \frac{1}{x}+1
\documentclass[11pt,a4paper]{article}
\binom{n}{k} = \frac{n!}{k!\,(n-k)!} \qquad \dbinom{n}{k}
Common mistakes
\dfracin running text. It is a display-size box in a line that must not grow, so the paragraph opens a hole. Use\fracor\tfracinline and keep\dfracforcases,arraycells and nested numerators.- Missing braces:
\frac 1x + 1prints one-over-x plus one, because an unbraced argument takes exactly one token. Brace both arguments whenever either is longer than a single token. - Expecting a fraction in
\sum_{k=1}^{\frac{n}{2}} korx_{\frac{1}{2}}to stay full size. Subscripts and superscripts are scriptstyle by definition; rewrite the bound with a slash, or accept the collision\dfraccauses. - Using the
\overprimitive in a larger expression:a + 1 \over bscans to the end of the enclosing group and silently builds a taller fraction than intended. Convert old source to\frac{}{}. - Hand-wrapping a fraction in brackets where a
\binombelongs, or in\left( \right)where one manual\bigl( \bigr)pair is correct — auto-sizing measures the fraction box and always overshoots. - Leaving a tall
\fracinside acasesbranch and wondering why the conditions sit at odd heights:casescells are textstyle, so the fraction needs\dfrac, and the row needs[4pt]on the line break to stop the branches touching.
Questions about this lesson
What is the difference between \frac, \dfrac and \tfrac in LaTeX?
\frac builds a fraction in the style that is already in force: display height inside \[ … \], compressed height inside $ … $. \dfrac and \tfrac are amsmath wrappers that force displaystyle and textstyle for that one fraction. Nothing else changes — same boxes, same rule on the math axis.Why is my fraction so small inside a sum limit or a subscript?
\dfrac forces the size back but makes the box taller than the operator, so bounds collide. The typographic fix is usually to rewrite the bound (k \le n/2) or to name the quantity.When should I use \cfrac instead of \frac?
\cfrac sets both arguments in display style so nested fractions keep their full width, and its optional [n] or [d] argument aligns the wider box when the two sides differ in height.How do I write a fraction without the horizontal line?
\genfrac{}{}{0pt}{}{a}{b} gives you the stacked pair with zero rule thickness; that is exactly how \binom is defined, with parentheses added as the first two arguments. For a plain inline ratio, use a slash: 1/2, or \sfrac from the xfrac package.Why are my brackets so big around a fraction?
\left and \right size the fence to the whole bounding box of what you enclosed, and a fraction is a two-storey box. Choose the size yourself — \bigl( \tfrac{1}{2} \bigr) — and the parenthesis stops competing with the maths.Do I need braces in \frac12?
\frac12 is one half and \frac 1x is one over x. You need braces as soon as an argument is longer than one token — \frac{1}{x+1} — and leaving them out is how tail terms escape a denominator.Live playground: edit the LaTeX, see it render
The preview updates as you type — break it on purpose to see how errors look.
Keep reading
Three ways into the same idea: the notation itself, the lesson that teaches it, and an article that applies it.