# 46 How do I write a fraction in LaTeX?

Last update: Jul 13/22

The simplest commands for writing fractions are `\frac{n}{d}` and `\dfrac{n}{d}`, in which “n” is the numerator and “d” is the denominator.

The `\dfrac` command is best used when you want to write a large “display” fraction, likely on its own line. If you’re writing a fraction in running text and need it to be close to the same size as the text around it, the `\frac` command is probably better. If you’re not sure which command to use in any given case, try both and see which size is more appropriate.

Display fractions look like this:[1]

$\dfrac{13}{4a}=\dfrac{3b}{5}$

Regular fractions look like this:

If you give $\frac{3}{8}$ of the pizza to your big sister and $\frac{1}{8}$ to each of your two little brothers, you’ll have $\frac{3}{8}$ left for yourself.

LaTeX can also handle more complex fractional expressions. For example:

$\dfrac{d}{dx}(\sin x)\approx \dfrac{\sin (x+0.01)-\sin x}{0.01}$

You can also create fractional expressions using words:

$\text{slope}=\dfrac{\text{rise}}{\text{run}}$

For more commands related to fractions, see Fractions and Binomials on the Overleaf website.

1. You can right-click this expression and go to Math Settings > Math Renderer > Plain Source and then back to Common HTML to switch between seeing the original LaTeX markup and the expression in display form.