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

## Contents |

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

\usepackage{amsmath}

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: \[\frac{1}{2}\]

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.

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 \[ a_0+\cfrac{1}{a_1+\cfrac{1}{a_2+\cfrac{1}{a_3+\cdots}}} \]

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.

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 coefficient using the parameters passed inside the braces.

**A slightly different and more complex example of continued fractions**

Final example \newcommand*{\contfrac}[2]{% { \rlap{$\dfrac{1}{\phantom{#1}}$}% \genfrac{}{}{0pt}{0}{}{#1+#2}% } } \[ a_0 + \contfrac{a_1}{ \contfrac{a_2}{ \contfrac{a_3}{ \genfrac{}{}{0pt}{0}{}{\ddots} }}} \]

For more information see

- Creating a document in Overleaf
- Uploading a project
- Copying a project
- Creating a project from a template
- Including images in Overleaf
- Exporting your work from Overleaf
- Working offline in Overleaf
- Using Track Changes in Overleaf
- Using bibliographies in Overleaf
- Sharing your work with others
- Using the History feature
- Debugging Compilation timeout errors
- How-to guides

- Creating your first LaTeX document
- Choosing a LaTeX Compiler
- Paragraphs and new lines
- Bold, italics and underlining
- Lists
- Errors

- Mathematical expressions
- Subscripts and superscripts
- Brackets and Parentheses
- Matrices
- Fractions and Binomials
- Aligning Equations
- Operators
- Spacing in math mode
- Integrals, sums and limits
- Display style in math mode
- List of Greek letters and math symbols
- Mathematical fonts

- Inserting Images
- Tables
- Positioning Images and Tables
- Lists of Tables and Figures
- Drawing Diagrams Directly in LaTeX
- TikZ package

- Bibliography management in LaTeX
- Bibliography management with biblatex
- Biblatex bibliography styles
- Biblatex citation styles
- Bibliography management with natbib
- Natbib bibliography styles
- Natbib citation styles
- Bibliography management with bibtex
- Bibtex bibliography styles

- Multilingual typesetting on Overleaf using polyglossia and fontspec
- Multilingual typesetting on Overleaf using babel and fontspec
- International language support
- Quotations and quotation marks
- Arabic
- Chinese
- French
- German
- Greek
- Italian
- Japanese
- Korean
- Portuguese
- Russian
- Spanish

- Sections and chapters
- Table of contents
- Cross referencing sections and equations
- Indices
- Glossaries
- Nomenclatures
- Management in a large project
- Multi-file LaTeX projects
- Hyperlinks

- Lengths in LaTeX
- Headers and footers
- Page numbering
- Paragraph formatting
- Line breaks and blank spaces
- Text alignment
- Page size and margins
- Single sided and double sided documents
- Multiple columns
- Counters
- Code listing
- Code Highlighting with minted
- Using colours in LaTeX
- Footnotes
- Margin notes

- Theorems and proofs
- Chemistry formulae
- Feynman diagrams
- Molecular orbital diagrams
- Chess notation
- Knitting patterns
- CircuiTikz package
- Pgfplots package
- Typing exams in LaTeX
- Knitr
- Attribute Value Matrices

- Understanding packages and class files
- List of packages and class files
- Writing your own package
- Writing your own class
- Tips