LaTeX Fractions - How to Write Fractions in LaTeX
The simplest way to write fractions in LaTeX is by using the \frac
command. This command takes two arguments: the numerator and the denominator.
For example:
Inline and Display Fractions
- Inline Fractions: To write fractions within a line of text, enclose the fraction in dollar signs
$...$
. For example:$\frac{3}{4}$
. - Display Mode Fractions: For standalone fractions, use double dollar signs
$$...$$
or the\[ ... \]
environment. Example:$$\frac{a+b}{c+d}$$
Complex and Nested Fractions
You can create nested fractions by embedding one \frac
command within another.
Size Adjustments for Fractions
- Display Style: Use
\dfrac
to create larger fractions suitable for display equations. Example:\dfrac{a}{b}
. - Text Style: Use
\tfrac
for smaller fractions in inline text. Example:$\tfrac12$
.
Troubleshooting Fraction Errors
- Missing Braces: Always ensure both the numerator and denominator are enclosed in curly braces
{}
. - Spacing Issues: Use
\;
,\,
, or\:
to adjust spacing around fractions.