Written and maintained by CASRAI Editorial Board
Published · Last updated
On this page
\dfrac typesets a fraction in display style, even when the fraction sits inside running text. It comes from the amsmath package, which defines it as shorthand for {\displaystyle\frac ...}. If you searched for “dfrac latex”, this page shows the syntax, when to use it instead of \frac, and how to fix the usual error.
What dfrac is used for in research writing
In a LaTeX paper, thesis or preprint, a fraction written with \frac shrinks to text size when it appears inside a sentence (inline math) and is full size only on its own line (display math). \dfrac overrides that: the numerator and denominator are set at display size wherever you place it. According to the User’s Guide for the amsmath Package (section 4.11.1), “The amsmath package provides also \dfrac and \tfrac as convenient abbreviations for {\displaystyle\frac …} and {\textstyle\frac …}.”
Typical research uses are a fraction that must stay legible inside a table cell, a fraction nested inside a square root or another fraction, and an inline expression where a small fraction would be hard to read. Related display-style tools are covered in our guides to division in LaTeX and the derivative notation in LaTeX.
Install or access (official source only)
\dfrac is not part of the basic LaTeX command set; \frac is. The amsmath User’s Guide states that \frac “is in the basic command set of LaTeX”, while \dfrac and \tfrac are provided by amsmath. The amsmath package is listed on CTAN (version 2.17z, dated 2025-07-09, LPPL 1.3c, checked 2026-11-07) and is contained in TeX Live and MiKTeX, so most standard installations already include it. Load it in the preamble:
\usepackage{amsmath}
Step by step: using dfrac
- Add
\usepackage{amsmath}to the preamble, before\begin{document}. - Write the fraction with two arguments, numerator first:
\dfrac{numerator}{denominator}. - Place it in math mode, for example inline between dollar signs:
The ratio $\dfrac{a+b}{c}$ is stable. - Compile as usual. The fraction is set as if you had written
{\displaystyle\frac{a+b}{c}}.
The amsmath guide demonstrates the three variants with one expression, \frac{1}{k}\log_2 c(f), \tfrac{1}{k}\log_2 c(f), and square roots containing \frac and \dfrac. Repeating the comparison with your own expression is the quickest way to see the size difference in your document class.
Output and how to read it
With \dfrac, the numerator and denominator are the same size as in a displayed equation, so the fraction bar is longer and the line it sits on is taller. Because the line gets taller, inline use can push neighbouring lines apart. That is the main cost, and it is why many authors keep \frac inline and reserve \dfrac for cases where legibility matters more than even line spacing.
Choosing between dfrac and its alternatives
All of the commands below can be used to control fraction size. Overleaf’s Fractions and Binomials page (read 2026-11-08) explains that \textstyle is the style for maths in paragraphs and \displaystyle the style for maths on lines by themselves.
| Command | What it does | Needs amsmath | Source |
|---|---|---|---|
\frac |
Normal fraction; size follows the surrounding math style | No (basic LaTeX) | amsmath guide, 4.11.1 |
\dfrac |
Shorthand for {\displaystyle\frac ...} |
Yes | amsmath guide, 4.11.1 |
\tfrac |
Shorthand for {\textstyle\frac ...} |
Yes | amsmath guide, 4.11.1 |
\cfrac |
Designed specifically for continued fractions, for example a_0+\cfrac{1}{a_1+\cfrac{1}{a_2+\cdots}} |
Yes | Overleaf, Fractions and Binomials |
\genfrac |
Generalises \frac, \binom and variants (six arguments) |
Yes | amsmath guide, 4.11.3 |
The same display/text split exists for binomial coefficients: amsmath provides \binom, \dbinom and \tbinom (section 4.11.2). All of these commands are free; they ship with the amsmath package under the LPPL licence.
Troubleshooting
“Undefined control sequence” on dfrac
This error means LaTeX does not know the command. Since \dfrac is supplied by amsmath rather than basic LaTeX, add \usepackage{amsmath} to the preamble. Overleaf’s page notes that amsmath must likewise be loaded to use \cfrac.
Spacing between lines looks uneven
A display-size fraction in a paragraph is taller than the text line. Switch that fraction back to \frac or \tfrac, or move the equation onto its own line in a display environment.
FAQ
What is the difference between dfrac and frac in LaTeX?
\frac adapts to its context, so inline it is set small; \dfrac always uses display style. Per the amsmath guide, \dfrac is an abbreviation for {\displaystyle\frac ...}.
What is tfrac?
The opposite: an abbreviation for {\textstyle\frac ...}, forcing the compact inline size, for example in a displayed equation where a small fraction is wanted.
Does dfrac work without amsmath?
No. The command is defined by amsmath, so load the package in the preamble.
Can I use dfrac for continued fractions?
You can nest it, but Overleaf describes \cfrac as designed specifically for continued fractions, so it is the usual choice.
Sources
- American Mathematical Society and LaTeX Project, User’s Guide for the amsmath Package, section 4.11 (CTAN: mirrors.ctan.org/macros/latex/required/amsmath/amsldoc.pdf), read 2026-11-08.
- Overleaf documentation, Fractions and Binomials (overleaf.com/learn/latex/Fractions_and_Binomials), read 2026-11-08.
- CTAN package page for amsmath (ctan.org/pkg/amsmath), checked 2026-11-07.
Related reading: parentheses and brackets in LaTeX and piecewise functions with cases in LaTeX.







