Fractions are fundamental in mathematical typesetting, appearing in equations, formulas, and technical documents. LaTeX provides powerful commands for creating fractions of any complexity, from simple ratios to nested multi-level fractions and specialized mathematical constructs like continued fractions and binomial coefficients.

This comprehensive guide covers the \frac command and its variants, proper sizing in different contexts, nested fractions, continued fractions, binomial coefficients, and partial derivatives—everything you need to typeset mathematical fractions professionally.

Basic Fractions with \frac

The fundamental command for creating fractions in LaTeX is \frac{numerator}{denominator}. It works in both inline math mode and display equations.

Basic Syntax

% Inline math mode
The ratio is $\frac{1}{2}$ or $\frac{a}{b}$.

% Display math mode
\[
  \frac{numerator}{denominator}
\]

% Equation environment
\begin{equation}
  \frac{x^2 + 3x + 2}{x - 1}
\end{equation}

Output: The inline version produces a smaller fraction that fits within text lines, while display mode creates larger, more readable fractions.

Simple Fraction Examples

% Basic numbers
$\frac{1}{2}$, $\frac{3}{4}$, $\frac{22}{7}$

% Variables
$\frac{x}{y}$, $\frac{a}{b}$

% Expressions
$\frac{x + 1}{x - 1}$, $\frac{x^2 - 4}{x + 2}$

% Complex expressions
$\frac{2x^2 + 3x - 5}{x^2 - 9}$

Fractions with Multiple Terms

% Addition in numerator
$\frac{a + b}{c}$

% Multiple terms
$\frac{x^2 + 2xy + y^2}{x + y}$

% Factorials and functions
$\frac{n!}{k!(n-k)!}$, $\frac{\sin(x)}{\cos(x)}$

Special Characters in Fractions

% Greek letters
$\frac{\alpha}{\beta}$, $\frac{\pi}{2}$

% Operators
$\frac{\sum_{i=1}^{n} x_i}{n}$  % Average

% Square roots
$\frac{\sqrt{a}}{\sqrt{b}}$

Display vs Inline Style

LaTeX automatically adjusts fraction size based on context. Display mode produces larger, more readable fractions, while inline mode creates compact fractions that don't disrupt text flow.

Display Style (Large Fractions)

% Equation environment (automatically display style)
\[
  \frac{x^2 + 1}{x - 1}
\]

\begin{equation}
  E = mc^2 \cdot \frac{1}{\sqrt{1 - \frac{v^2}{c^2}}}
\end{equation}

Characteristics: Large fraction bar, full-size numerator and denominator, excellent readability.

Inline Style (Compact Fractions)

The probability is $\frac{1}{6}$ for each outcome.

When we divide $\frac{a}{b}$ by $\frac{c}{d}$, we get $\frac{ad}{bc}$.

Characteristics: Smaller size, reduced vertical space, fits within text line height.

Forcing Display Style Inline

% Use \displaystyle to force large fractions in inline math
Compare $\frac{1}{2}$ (inline) with $\displaystyle\frac{1}{2}$ (display style).

The sum $\displaystyle\sum_{i=1}^{n} \frac{1}{i^2}$ uses display style.

Warning: Display style inline can create excessive line spacing. Use sparingly.

Forcing Text Style in Display

% Use \textstyle for compact fractions in display mode
\[
  \textstyle\frac{1}{2} + \textstyle\frac{1}{3} = \textstyle\frac{5}{6}
\]

Fraction Sizing Commands

LaTeX provides specialized commands for explicit control over fraction size: \dfrac (display fraction) and \tfrac (text fraction).

\dfrac - Display Fraction

% Requires amsmath package
\usepackage{amsmath}

% Force display size anywhere
Inline display fraction: $\dfrac{a}{b}$ is large.

\[
  \dfrac{x^2 + 1}{x - 1}  % Same as regular \frac in display
\]

Use case: When you need large fractions in inline math or want to be explicit about size.

\tfrac - Text Fraction

% Force text size (compact)
\[
  \tfrac{1}{2} + \tfrac{1}{3} = \tfrac{5}{6}  % Small in display mode
\]

% Useful in exponents or subscripts
$e^{\tfrac{-x^2}{2\sigma^2}}$

Use case: Compact fractions in display equations, or fractions in exponents/subscripts.

Comparison Table

\[
\begin{array}{lcl}
  \text{Command} & \text{Example} & \text{Use} \\
  \hline
  \verb|\frac| & \frac{a}{b} & \text{Auto-sized} \\
  \verb|\dfrac| & \dfrac{a}{b} & \text{Always large} \\
  \verb|\tfrac| & \tfrac{a}{b} & \text{Always compact}
\end{array}
\]

Fractions in Exponents

% Use \tfrac for readability
$e^{\tfrac{1}{2}}$ is clearer than $e^{\frac{1}{2}}$

% Or use alternative notation
$e^{1/2}$  % Slash notation (simpler)

Nested Fractions

Nested fractions occur when a fraction's numerator or denominator (or both) contains another fraction. LaTeX handles these automatically, reducing size at each level.

Basic Nested Fractions

% Fraction in numerator
\[
  \frac{\frac{a}{b}}{c} = \frac{a}{bc}
\]

% Fraction in denominator
\[
  \frac{a}{\frac{b}{c}} = \frac{ac}{b}
\]

% Fraction in both
\[
  \frac{\frac{a}{b}}{\frac{c}{d}} = \frac{ad}{bc}
\]

Complex Nested Fraction

% Triple nesting
\[
  \frac{1}{2 + \frac{1}{3 + \frac{1}{4}}}
\]

Result: LaTeX automatically makes each nested level smaller for clarity.

Controlling Nested Fraction Size

% Keep nested fractions large with \dfrac
\[
  \frac{1}{\dfrac{1}{x} + \dfrac{1}{y}}
\]

% Make all levels same size (not recommended)
\[
  \dfrac{1}{\dfrac{1}{x} + \dfrac{1}{y}}
\]

Complex Fraction Example

% Compound fraction from algebra
\[
  \frac{1 + \frac{x}{y}}{1 - \frac{x}{y}} = \frac{y + x}{y - x}
\]

Parallel Resistors (Physics)

% Total resistance formula
\[
  R_{total} = \frac{1}{\frac{1}{R_1} + \frac{1}{R_2} + \frac{1}{R_3}}
\]

Best Practices for Nested Fractions

  • Limit nesting depth: Avoid more than 2-3 levels
  • Consider alternatives: Sometimes multiplication by reciprocal is clearer: $\frac{a}{\frac{b}{c}} = a \cdot \frac{c}{b}$
  • Use parentheses: $\left(\frac{a}{b}\right) / \left(\frac{c}{d}\right)$ can be clearer
  • Simplify when possible: Show simplified form alongside complex fraction

Continued Fractions

Continued fractions are special nested fractions with a specific pattern, used in number theory and approximation theory. The amsmath package provides \cfrac command for better formatting.

Basic Continued Fraction

\usepackage{amsmath}

% Standard continued fraction
\[
  a_0 + \cfrac{1}{a_1 + \cfrac{1}{a_2 + \cfrac{1}{a_3 + \cdots}}}
\]

\cfrac vs \frac

% Compare regular \frac (poor readability)
\[
  x = a_0 + \frac{1}{a_1 + \frac{1}{a_2 + \frac{1}{a_3}}}
\]

% With \cfrac (designed for continued fractions)
\[
  x = a_0 + \cfrac{1}{a_1 + \cfrac{1}{a_2 + \cfrac{1}{a_3}}}
\]

Difference: \cfrac maintains consistent sizing and alignment for continued fraction patterns.

Golden Ratio

% Famous continued fraction
\[
  \phi = 1 + \cfrac{1}{1 + \cfrac{1}{1 + \cfrac{1}{1 + \cfrac{1}{1 + \cdots}}}}
\]

Euler's Continued Fraction for e

\[
  e = 2 + \cfrac{1}{1 + \cfrac{1}{2 + \cfrac{1}{1 + \cfrac{1}{1 + \cfrac{1}{4 + \cfrac{1}{1 + \cdots}}}}}}
\]

Square Root Continued Fraction

% sqrt(2) as continued fraction
\[
  \sqrt{2} = 1 + \cfrac{1}{2 + \cfrac{1}{2 + \cfrac{1}{2 + \cfrac{1}{2 + \cdots}}}}
\]

Finite Continued Fraction

% Rational number as continued fraction
\[
  \frac{415}{93} = 4 + \cfrac{1}{2 + \cfrac{1}{6 + \cfrac{1}{7}}}
\]

Positioning Adjustments

% Optional argument for alignment
\[
  x = a_0 + \cfrac[l]{1}{a_1 +   % [l] = left
          \cfrac[r]{1}{a_2 +     % [r] = right
          \cfrac{1}{a_3}}}       % default = center
\]

Binomial Coefficients

Binomial coefficients represent "n choose k" and appear frequently in combinatorics, probability, and algebra. LaTeX provides the \binom command for proper formatting.

Basic Binomial Syntax

\usepackage{amsmath}

% Standard binomial coefficient
$\binom{n}{k}$  % "n choose k"

% Display style
\[
  \binom{n}{k} = \frac{n!}{k!(n-k)!}
\]

Binomial Theorem

% Classic binomial theorem
\[
  (x + y)^n = \sum_{k=0}^{n} \binom{n}{k} x^{n-k} y^k
\]

Concrete Examples

% Specific values
$\binom{5}{2} = 10$

$\binom{10}{3} = \frac{10!}{3! \cdot 7!} = 120$

% Pascal's triangle identity
\[
  \binom{n}{k} = \binom{n-1}{k-1} + \binom{n-1}{k}
\]

Size Variants

% Display binomial (always large)
$\dbinom{n}{k}$  % Same as \displaystyle\binom{n}{k}

% Text binomial (always compact)
$\tbinom{n}{k}$  % Same as \textstyle\binom{n}{k}

% Comparison
Inline: $\binom{n}{k}$ vs display: $\dbinom{n}{k}$

Alternative Notations

% Using fractions (mathematically equivalent)
\[
  \binom{n}{k} = \frac{n!}{k!(n-k)!} = C(n,k) = C_k^n
\]

% Inline fraction notation
$C(n,k) = \frac{n!}{k!(n-k)!}$

Multinomial Coefficients

% Generalization of binomial
\[
  \binom{n}{k_1, k_2, \ldots, k_m} = \frac{n!}{k_1! k_2! \cdots k_m!}
\]

Probability Applications

% Probability of k successes in n trials
\[
  P(X = k) = \binom{n}{k} p^k (1-p)^{n-k}
\]

% Combinations example
\[
  \text{Ways to choose 3 from 10: } \binom{10}{3} = 120
\]

Partial Derivatives

Partial derivatives use fraction notation to represent rates of change with respect to specific variables in multivariable calculus.

Basic Partial Derivative

% Standard notation
\[
  \frac{\partial f}{\partial x}
\]

% With function evaluation
\[
  \left. \frac{\partial f}{\partial x} \right|_{x=a}
\]

Multiple Variables

% Partial derivatives with respect to different variables
\[
  \frac{\partial f}{\partial x}, \quad
  \frac{\partial f}{\partial y}, \quad
  \frac{\partial f}{\partial z}
\]

Second-Order Partial Derivatives

% Unmixed second derivatives
\[
  \frac{\partial^2 f}{\partial x^2}, \quad
  \frac{\partial^2 f}{\partial y^2}
\]

% Mixed partial derivatives
\[
  \frac{\partial^2 f}{\partial x \partial y} = 
  \frac{\partial}{\partial x}\left(\frac{\partial f}{\partial y}\right)
\]

Higher-Order Derivatives

% Third order
\[
  \frac{\partial^3 f}{\partial x^3}
\]

% General nth order
\[
  \frac{\partial^n f}{\partial x^n}
\]

Chain Rule

% Multivariable chain rule
\[
  \frac{\partial f}{\partial t} = 
  \frac{\partial f}{\partial x}\frac{\partial x}{\partial t} +
  \frac{\partial f}{\partial y}\frac{\partial y}{\partial t}
\]

Gradient Vector

% Gradient notation
\[
  \nabla f = \left(\frac{\partial f}{\partial x}, \frac{\partial f}{\partial y}, \frac{\partial f}{\partial z}\right)
\]

Laplacian

% Second-order differential operator
\[
  \nabla^2 f = \frac{\partial^2 f}{\partial x^2} + \frac{\partial^2 f}{\partial y^2} + \frac{\partial^2 f}{\partial z^2}
\]

Jacobian Matrix

% Matrix of first-order partial derivatives
\[
  J = \begin{pmatrix}
    \frac{\partial f_1}{\partial x_1} & \frac{\partial f_1}{\partial x_2} \\[8pt]
    \frac{\partial f_2}{\partial x_1} & \frac{\partial f_2}{\partial x_2}
  \end{pmatrix}
\]

Advanced Techniques

Slanted Fractions (Inline Alternative)

% Use / for simple inline fractions
The slope is $1/2$ or $a/b$.

% With parentheses for clarity
$(x+1)/(x-1)$

% Compare with \frac
Compare $a/b$ with $\frac{a}{b}$ inline.

Nicefrac Package

\usepackage{nicefrac}

% Diagonal fractions
\nicefrac{1}{2}, \nicefrac{22}{7}, \nicefrac{a}{b}

% Better inline appearance
The ratio \nicefrac{3}{4} looks cleaner than $\frac{3}{4}$.

Fractions with Units

\usepackage{siunitx}

% Physical quantities
\SI{9.8}{\meter\per\second\squared}

% Or manually
$9.8 \, \frac{\text{m}}{\text{s}^2}$

Large Fraction Bars

% Custom fraction bar thickness
\newcommand{\bigfrac}[2]{%
  \frac{\displaystyle #1}{\displaystyle #2}
}

\[
  \bigfrac{x^2 + 1}{x - 1}
\]

Fractions in Matrices

% Use \tfrac for compact fractions in matrices
\[
  \begin{pmatrix}
    \tfrac{1}{2} & \tfrac{1}{3} \\[8pt]
    \tfrac{2}{5} & \tfrac{3}{7}
  \end{pmatrix}
\]

Colored Fractions

\usepackage{xcolor}

% Highlight numerator or denominator
\[
  \frac{\textcolor{red}{x^2 + 1}}{\textcolor{blue}{x - 1}}
\]

% Entire fraction colored
\[
  \textcolor{red}{\frac{a}{b}}
\]

Fractions with Text

% Use \text for words in fractions
\[
  \frac{\text{rise}}{\text{run}} = \text{slope}
\]

\[
  \text{Speed} = \frac{\text{distance}}{\text{time}}
\]

Troubleshooting

Fraction Too Small Inline

Problem: Inline fraction is hard to read.

Solutions:

% Use \dfrac for larger inline fraction
$\dfrac{a}{b}$ instead of $\frac{a}{b}$

% Or use slash notation
$a/b$

% Or nicefrac package
\usepackage{nicefrac}
\nicefrac{a}{b}

Excessive Line Spacing

Problem: Display-style fractions inline cause large gaps between text lines.

Solution: Use \tfrac or slash notation for inline math:

Use $\tfrac{1}{2}$ not $\dfrac{1}{2}$ inline.

Nested Fractions Too Small

Problem: Deeply nested fractions become unreadable.

Solutions:

% Use \dfrac to maintain size
\[
  \frac{1}{\dfrac{1}{x} + \dfrac{1}{y}}
\]

% Or simplify the expression
\[
  \frac{xy}{x + y}  % Clearer than nested version
\]

Fraction Bar Too Short

Problem: Fraction bar doesn't extend over entire numerator/denominator.

Solution: Add spacing or use phantom:

% Add explicit spacing
\[
  \frac{a \quad}{b}  % Extra space in numerator
\]

% Or ensure proper grouping
\[
  \frac{(x + y)}{z}  % Parentheses ensure full coverage
\]

\cfrac Not Defined

Problem: ! Undefined control sequence. \cfrac

Solution: Load amsmath package:

\usepackage{amsmath}

Fractions in Exponents Look Bad

Problem: $e^{\frac{1}{2}}$ is cramped.

Solutions:

% Use \tfrac
$e^{\tfrac{1}{2}}$

% Or slash notation
$e^{1/2}$

% Or rational exponent notation
$e^{0.5}$

Frequently Asked Questions

How do I make fractions in LaTeX?

Use the \frac{numerator}{denominator} command in math mode:

% Inline math
The ratio is $\frac{1}{2}$ or $\frac{a}{b}$.

% Display math
\[
  \frac{x + 1}{x - 1}
\]

The fraction automatically adjusts size based on context (inline vs display mode).

What's the difference between \frac, \dfrac, and \tfrac?

  • \frac: Automatic sizing (large in display mode, small inline)
  • \dfrac: Always display size (large) - requires amsmath
  • \tfrac: Always text size (compact) - requires amsmath
\usepackage{amsmath}

% Auto-sized
$\frac{a}{b}$

% Force large
$\dfrac{a}{b}$

% Force compact
$\tfrac{a}{b}$

How do I create nested fractions?

Simply use \frac inside another \frac:

% Fraction in denominator
\[
  \frac{1}{\frac{1}{x} + \frac{1}{y}}
\]

% Fraction in numerator
\[
  \frac{\frac{a}{b}}{c}
\]

% Both
\[
  \frac{\frac{a}{b}}{\frac{c}{d}} = \frac{ad}{bc}
\]

LaTeX automatically reduces size at each nesting level.

How do I make continued fractions?

Use \cfrac command from amsmath package:

\usepackage{amsmath}

\[
  x = a_0 + \cfrac{1}{a_1 + \cfrac{1}{a_2 + \cfrac{1}{a_3}}}
\]

\cfrac maintains consistent sizing and alignment for continued fraction patterns, unlike regular \frac which becomes too small when nested.

How do I write binomial coefficients?

Use \binom{n}{k} command from amsmath:

\usepackage{amsmath}

% "n choose k"
$\binom{n}{k}$

% With formula
\[
  \binom{n}{k} = \frac{n!}{k!(n-k)!}
\]

% Binomial theorem
\[
  (x+y)^n = \sum_{k=0}^{n} \binom{n}{k} x^{n-k} y^k
\]

How do I write partial derivatives?

Use \frac{\partial}{\partial x} with the partial derivative symbol:

% First-order partial
\[
  \frac{\partial f}{\partial x}
\]

% Second-order partial
\[
  \frac{\partial^2 f}{\partial x^2}
\]

% Mixed partial
\[
  \frac{\partial^2 f}{\partial x \partial y}
\]

Why are my inline fractions too large?

You may have used \dfrac or \displaystyle, which forces large fractions. Solutions:

% Problem (too large)
Text with $\dfrac{a}{b}$ or $\displaystyle\frac{a}{b}$.

% Solution 1: Use regular \frac
Text with $\frac{a}{b}$.

% Solution 2: Use \tfrac for extra compact
Text with $\tfrac{a}{b}$.

% Solution 3: Use slash notation
Text with $a/b$.

How do I make slanted (diagonal) fractions?

Use the nicefrac package or xfrac package:

% nicefrac package
\usepackage{nicefrac}
\nicefrac{1}{2}, \nicefrac{3}{4}

% xfrac package
\usepackage{xfrac}
\sfrac{1}{2}, \sfrac{3}{4}

% Manual slash (simpler)
$1/2$, $3/4$

Slanted fractions work well for simple inline fractions like ½, ¾ without disrupting line spacing.

Can I put fractions in exponents?

Yes, but use \tfrac for better readability:

% Regular \frac (cramped)
$e^{\frac{1}{2}}$

% Better: \tfrac (more readable)
$e^{\tfrac{1}{2}}$

% Or use slash notation
$e^{1/2}$

% Or decimal
$e^{0.5}$

How do I simplify nested fractions for readability?

Several strategies make nested fractions clearer:

% Original nested fraction
\[
  \frac{1}{\frac{1}{x} + \frac{1}{y}}
\]

% Strategy 1: Multiply by reciprocal
\[
  \frac{1}{\frac{1}{x} + \frac{1}{y}} = \frac{xy}{x + y}
\]

% Strategy 2: Use \dfrac to maintain size
\[
  \frac{1}{\dfrac{1}{x} + \dfrac{1}{y}}
\]

% Strategy 3: Use parentheses with division
\[
  1 \bigg/ \left(\frac{1}{x} + \frac{1}{y}\right)
\]

Always show the simplified form when possible—readers appreciate clarity.

Conclusion

LaTeX's fraction commands—\frac, \dfrac, \tfrac, \cfrac, and \binom—provide complete control over mathematical fraction typesetting. Whether you're writing simple algebraic expressions, complex nested fractions, continued fractions, or partial derivatives, LaTeX handles the formatting automatically while giving you precise control when needed.

Key takeaways: Use \frac for automatic sizing in most cases, \dfrac when you need large fractions inline, \tfrac for compact fractions in displays or exponents, and \cfrac specifically for continued fractions. For binomial coefficients, always use \binom instead of manual fraction formatting.

Remember to consider readability: limit nesting depth, simplify complex fractions when possible, and choose the appropriate sizing for your context. With these tools and guidelines, you can typeset any fraction beautifully and professionally in LaTeX.