Clique aqui e veja a página ShareLaTeX em Inglês

[edit] ShareLaTeX guides

[edit] LaTeX Basics

[edit] Mathematics

[edit] Figures and tables

[edit] References and Citations

[edit] Languages

[edit] Document structure

[edit] Formatting

[edit] Fonts

[edit] Presentations

[edit] Commands

[edit] Field specific

[edit] Class files

Fractions and binomial coefficients are common mathematical elements with similar characteristics, one number goes on top of other. This article explains how to typeset them in LaTeX


[edit] Introduction

Using fractions and binomial coefficients in an expression is straightforward.

The binomial coefficient is defined by the next expression:
    \binom{n}{k} = \frac{n!}{k!(n-k)!}


For these commands to work you must import the package amsmath by adding the next line to the preamble of your file


  Open an example in ShareLaTeX

[edit] Displaying fractions

The appearance of the fraction may change depending on the context

Fractions can be used alongside the text, for 
example \( \frac{1}{2} \), and in a mathematical 
display style like the one below:


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.

When displaying fractions in-line, for example \(\frac{3x}{2}\) 
you can set a different display style: 
\( \displaystyle \frac{3x}{2} \).
This is also true the other way around
\[ f(x)=\frac{P(x)}{Q(x)} \ \ \textrm{and} 
\ \ f(x)=\textstyle\frac{P(x)}{Q(x)} \]


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.

  Open an example in ShareLaTeX

[edit] Continued fractions

The usage of fractions is quite flexible, they can be nested to obtain more complex expressions.

The fractions can be nested
\[ \frac{1+\frac{a}{b}}{1+\frac{1}{1+\frac{1}{a}}} \]
Now a wild example


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.

  Open an example in ShareLaTeX

[edit] Binomial coefficients

Binomial coefficients are common elements in mathematical expressions, the command to display them in LaTeX is very similar to the one used for fractions.

The binomial coefficient is defined by the next expression:
    \binom{n}{k} = \frac{n!}{k!(n-k)!}
And of course this command can be included in the normal 
text flow \(\binom{n}{k}\).


As you see, the command \binom{}{} will print the binomial coeficient using the parameters passed inside the braces.

  Open an example in ShareLaTeX

[edit] Reference guide

A slightly different and more complex example of continued fractions

Final example
  a_0 +


[edit] Further reading

For more information see