Fractions

Basic Fraction:
Fractions can be displayed uniformly in LaTeX when compared to having to represent them using regular text. The special command for fractions in LaTeX is \dfrac{}{}, which takes two numbers as arguments (or “input”). The first number is the numerator, and the second number is the denominator.

Basic Fraction: Example 4.1

LaTeX code: \dfrac{5}{6}

Display (once the latex brackets are added): [latex]\dfrac{5}{6}[/latex]

The command \frac{}{} also works, but \dfrac{}{} produces a larger (or “display”) fraction. Generally, it is preferable to use \dfrac{}{}, but on the rare occasion that \dfrac{}{} is too large for the expression it is being used in, it is acceptable to use \frac{}{}.

Stacked Equations:
\dfrac{}{} can also be used to put equations over top of each other, such as in:

Stacked Equations: Example 4.2

LaTeX code: \dfrac{3-x}{4-y}

Display: [latex]\dfrac{3-x}{4-y}[/latex]

Text in Fractions:
You can also use LaTeX to write text into fraction form.

Text in Fractions: Example 4.3

LaTeX code: \dfrac{\text{rise}}{\text{run}}

Display: [latex]\dfrac{\text{rise}}{\text{run}}[/latex]

 

Just like with fractions, there is a preferred method of writing parentheses. Instead of just using ( ), it is best to use \left( and \right), respectively. These versions create larger parentheses that better encapsulate fractions. Below is an example of both kinds of parentheses:

[latex](\dfrac{3}{4})[/latex]

[latex]\left(\dfrac{3}{4}\right)[/latex]

The second fraction dsiplays better. Note that \right) will not display at all unless \left( comes before it, so using \left( and \right) in arrays is not advisable if the symbols are in different columns (see Aligning Elements for more information on arrays).

License

Icon for the Creative Commons Attribution 4.0 International License

LaTeX in Pressbooks: An Introduction and Workflow Copyright © by Caroline Daniels and Arianna is licensed under a Creative Commons Attribution 4.0 International License, except where otherwise noted.

Share This Book