9 Typesetting Mathematics: Part I

9.1 In-text Formula

Three ways to create an in-text formula:

  \begin{math} ... \end{math}
  \( ... \)
  $ ... $

Input:


  Does $ x - y $ always
  equal \( - y + x \)?

Output:

Does  x - y always  equal - y + x?

Input:


  Note that x is not
  the same as $x$.

Output:

Note  that x is not the same as x.

9.2 Displayed Formula

Two ways to create a displayed formula:

  \begin{displaymath} ... \end{displaymath}
  \[ ... \]

Input:


  Let's consider the two functions
  \[ f(x)=x-(x-2)(x-4)(x-6)(x-8) \]
  and
  \[
     g(x) = x + (x - 1) (x - 3)
            (x - 5) (x - 7)
  \]
  where $x > 0$.

Output:

  Let’s consider the two functions


                       f(x) =  x-  (x -  2)(x - 4)(x - 6)(x - 8)

and
                       g(x) = x + (x - 1)(x - 3)(x - 5)(x - 7)

where x > 0.

9.3 Subscripts, Mathematical Symbols, and More

Subscripts and superscripts are produced with _ and ^

Input:


  Let $x_i = i \cdot
  h^{2^i}$.

Output:

             2i
Let xi = i .h .

Input:


  Note that $x_n+1$ is not
  the same as $x_{n+1}$.

Output:

Note  that xn + 1 is not the same as xn+1.

LaTeX defines a number of other mathematical structures and symbols.

Input:


  Making Greek letters
  is as easy as $\pi$.

Output:

Making  Greek  letters is as easy as p.

Input:


  Thus, we have
  \[
     \int_{a}^{b} f(x) \, dx =
        \lim_{\| P \| \rightarrow 0}
        \sum_{i=1}^{n} f(x_{i}^{\ast})
        \Delta x_{i}
  \]
  where \(\sum_{i=1}^{n} f(x_{i}^{\ast})
  \Delta x_{i}\) is \ldots

Output:

  Thus,  we have            integral  b                n
                              f(x) dx =  lim   sum   f(x*)Dx
                            a           ||P||-->0        i    i
       sum                                       i=1
where   ni=1 f(x*i)Dxi is ...

Note a displayed summation vs. an inline summation.

9.3.1 Spacing in Math Mode
\!negative thin space\;thick space
\,thin space \_interword space
\:medium space

Input:


  \[
     \int \int z dx dy
  \]

Output:

 integral   integral 
     zdxdy

Input:


  \[
     \int \! \! \int z
        \, dx \, dy
  \]

Output:

 integral   integral 
     zdx dy

9.3.2 Changing Type Style in Math Mode
\mathit \mathrm \mathbf \mathsf
\mathtt \mathcal

Input:


  So we have \( \mathbf{a} + b \).

Output:

So we  have a + b.

9.4 Numbered Displayed Formula

This is produced with the equation environment:

  \begin{equation} ... \end{equation}

Input:


  \begin{equation}
     \frac{\partial u}{\partial t} =
        \lambda^{2}
        \frac{\partial^{2} u}
             {\partial x^{2}}
  \end{equation}

Output:

         2
@u-=  c2@-u-                                   (1)
@t      @x2

_______________________________________________________
Last updated: October 27, 2002
Site maintained by: Clyde Clements clyde@mathstat.dal.ca
Return to my home page.