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.
\frac{numerator}{denominator}For example:
\frac{1}{2}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.
\frac{\frac{1}{x} + y}{z}Size Adjustments for Fractions
- Display Style: Use
\dfracto create larger fractions suitable for display equations. Example:\dfrac{a}{b}. - Text Style: Use
\tfracfor 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.
