\frac is the workhorse. In running text it shrinks, which is fine for simple fractions but not for nested ones, so \dfrac forces full size. The slash form is better inside exponents and subscripts where a stacked fraction would be unreadable.
All ways to write it
| Command | Use | Package | Copy |
|---|---|---|---|
\frac{a}{b} | stacked | none | |
\dfrac{a}{b} | force display size | amsmath | |
\tfrac{a}{b} | force text size | amsmath | |
a/b | inline slash | none | |
\sfrac{a}{b} | diagonal ᵃ⁄ᵦ | xfracnot in KaTeX | |
\binom{n}{k} | binomial coefficient | amsmath |
Commands marked with a package need that \usepackage line in a LaTeX document. “Not in KaTeX” means the command will not render in KaTeX- or MathJax-based tools such as Markdown previews, Jupyter and Confluence math apps; use one of the other forms there.
Example
e^{-x^2/2}, \qquad \binom{n}{k} = \frac{n!}{k!\,(n-k)!}A slash fraction in an exponent, and a stacked one in a definition.
Questions
Why is my fraction tiny inline?
Inline math uses text style. Use \dfrac, or move the expression to display math.
Related symbols
- Division ÷
\div - Summation ∑
\sum_{i=1}^{n}
Using fractions in Confluence
Confluence Cloud has no built-in LaTeX. With LaTeX Math for Confluence you add a math macro to any page, type \frac{a}{b} and it renders inline or as a block, with a live preview while you edit. The app uses KaTeX, so pick one of the commands above that is not marked “not in KaTeX”.