Fractions and Binomials
Last updated
Last updated
Using fractions and binomial coefficients in an expression is straightforward.
For these commands to work you must import the package amsmath by adding the next line to the preamble of your file
The appearance of the fraction may change depending on the context
As you may have guessed, the command \frac{1}{2}
is the one that displays the fraction. The text inside the first pair of braces is the numerator and the text inside the second pair is the denominator.
Also, the text size of the fraction changes according to the text around it. You can set this manually if you want.
The command \displaystyle
will format the fraction as if it were in mathematical display mode. On the other side, \textstyle
will change the style of the fraction as if it were part of the text.
The usage of fractions is quite flexible, they can be nested to obtain more complex expressions.
The second fraction displayed in the previous example uses the command \cfrac{}{}
provided by the package amsmath (see the introduction), this command displays nested fractions without changing the size of the font. Specially useful for continued fractions.
Binomial coefficients are common elements in mathematical expressions, the command to display them in LATEX is very similar to the one used for fractions.
As you see, the command \binom{}{}
will print the binomial coefficient using the parameters passed inside the braces.
A slightly different and more complex example of continued fractions