Latest news 2024-07-03: Ebook sale (1st – 31st July 2024): short story cybercrime fiction Unsocial Media free; short story cybercrime fiction Smile for the Camera free; short story noir crime fiction I’ve Heard the Mermaid Sing free; crime fiction novel The Private Enemy US$1.99; illustrated children’s story The Foolish Hedgehog US$0.99.

9.4.5 Fractions

Fractions are created using the command


The amsmath package also provides the command


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.)


A simple fraction:

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


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:


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