About
Shop
LaTeX
Software
Books
Gallery
News
Contact
Blog
Settings
Account
Latest news 2024-09-23: new blog post "Tales for Our Times: Raising Funds and Awareness for St Martins Housing Trust".


9.4.5 Fractions

Fractions are created using the command

\frac{<numerator>}{<denominator>}

The amsmath package also provides the command

\cfrac[<pos>]{<numerator>}{<denominator>}

which is designed for continued fractions. The optional argument pos can be used for left (l) or right (r) placement of any of the numerators. (The default is centred.)

Example:

A simple fraction:

\[ \frac{1}{1+x} \]

Produces:

Image of fraction with 1 as the numerator and 1+x as
the denominator.

Compare with:

In-line: $ \frac{1}{1+x} $

which produces:

Image: as before but fraction is smaller.

Example (Nested):

\[ \frac{1+\frac{1}{x}}{1+x+x^2} \]

Image of fraction with (1+1/x) as the numerator and
(1 + x + x squared as the denominator.

Example (Continued Fraction);

A continued fraction (example taken from amsmath documentation and uses \sqrt, described in §9.4.6. Roots, and \dotsb, described in §9.4.7. Mathematical Symbols):

Image of a continued fraction (the denominator has a
fraction with a fraction in its denominator etc).

Example (A Derivative):

\[ f'(x) = \frac{df}{dx} \]

Image: f'(x) = d f by d x

As with “e”, the differential operator “d” should be in an upright font as it is not a variable:

Image: as above but the letter d is upright

The above example is rather cumbersome, particularly if you have a lot of derivatives, so it might be easier to define a new command. In the preamble define:

\newcommand{\deriv}[2]{\frac{\mathrm{d}#1}{\mathrm{d}#2}}

Then in the document:

\[ f'(x) = \deriv{f}{x} \]

Image: same as before

Example (Partial Derivative):

Partial derivatives can be obtained similarly using the command \partial to display the partial derivative symbol. As in the previous example, first define a new command to format a partial derivative in the preamble:

\newcommand{\pderiv}[2]{\frac{\partial #1}\partial #2}

Then in the document:

\[ f_x = \pderiv{f}{x} \]

Image: f subscript x = partial d f by partial d x

Example (Double Partial Derivative):

Image: f subscript xy = partial d 2 f by partial d x partial d y.

Example (First principles):

\[
        f'(x) = \lim_{\Delta x \to 0}
        \frac{f(x + \Delta x)-f(x)}{\Delta x}
\]

Image showing typeset output


This book is also available as A4 PDF or 12.8cm x 9.6cm PDF or paperback (ISBN 978-1-909440-00-5).

© 2012 Dickimaw Books. "Dickimaw", "Dickimaw Books" and the Dickimaw parrot logo are trademarks. The Dickimaw parrot was painted by Magdalene Pritchett.

Terms of Use Privacy Policy Cookies Site Map FAQs