LaTeX Questions Answered

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]

[latex]\dfrac{13}{4a}=\dfrac{3b}{5}[/latex]

Regular fractions look like this:

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

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

[latex]\dfrac{d}{dx}(\sin x)\approx \dfrac{\sin (x+0.01)-\sin x}{0.01}[/latex]

You can also create fractional expressions using words:

[latex]\text{slope}=\dfrac{\text{rise}}{\text{run}}[/latex]

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.

License

Icon for the Creative Commons Attribution 4.0 International License

Pressbooks Guide by OER Production Team is licensed under a Creative Commons Attribution 4.0 International License, except where otherwise noted.

Share This Book