next up previous contents index
Next: 3.2 Grouping in Math Up: 3 Typesetting Mathematical Formulae Previous: 3 Typesetting Mathematical Formulae

3.1 General

LATEX has a special mode for typesetting mathematics. Mathematical text within a paragraph is entered between ( and ),   between $ and $ or between \begin{math} and \end{math}. 


\begin{example}Add $a$\space squared and $b$\space squared 
to get $c$\space squared. Or using 
a more mathematical approach:
$c^{2}=a^{2}+b^{2}$\end{example}


\begin{example}\TeX{} is pronounced as 
$\tau\epsilon\chi$.\\ [6pt]
100~m$^{3}$\space of water\\ [6pt]
This comes from my $\heartsuit$\end{example}

It is preferable to display larger mathematical equations or formulae, that is to typeset them on separate lines. Therefore you enclose them between [ and ] or between \begin{displaymath} and \end{displaymath}. This produces formulae which are not numbered. If you want LATEX to number them, you can use the equation environment.


\begin{example}Add $a$\space squared and $b$\space squared 
to get $c$\space squ...
 ...aymath}
c^{2}=a^{2}+b^{2}
\end{displaymath}And just one more line.
\end{example}

With label and ref you can reference an equation within the text.


 \begin{example}% latex2html id marker 1644
\begin{equation}
\epsilon \gt 0
\end{equation}From (\ref{eq:eps}) we gather 
\ldots
\end{example}

Note that expressions will be typeset if a different style if displayed: contrast
\begin{example}$\lim_{n \to \infty} 
\sum_{k=1}^n \frac{1}{k^2} 
= \frac{\pi^2}{...
 ...y} 
\sum_{k=1}^n \frac{1}{k^2} 
= \frac{\pi^2}{6}
\end{displaymath}\end{example}

There are differences between math mode and text mode. For example, in math mode:

1.
Most spaces and linebreaks do not have any significance, as all spaces are either derived logically from the mathematical expressions or have to be specified using special commands such as ,, quad or qquad.


\begin{example}% latex2html id marker 1673
\begin{equation}
\forall x \in \mathbf{R}:
\qquad x^{2} \geq 0
\end{equation}\end{example}

2.
Empty lines are not allowed. Only one paragraph per formula.

3.
Each letter is considered to be the name of a variable and will be typeset as such. If you want to typeset normal text within a formula (normal upright font and normal spacing) then you have to enter the text using the \textrm{...} commands.


\begin{example}% latex2html id marker 1679
\begin{equation}
x^{2} \geq 0\qquad
\textrm{for all }x\in\mathbf{R}
\end{equation}\end{example}

Mathematicians can be very fussy about which symbols are used: it would be conventional here to use `blackboard bold'   which is obtained by mathbb from the package amsfonts or amssymb. \mathbbThe last example becomes
\begin{example}\begin{displaymath}
x^{2} \geq 0\qquad
\textrm{for all }x\in\mathbb {R}
\end{displaymath}\end{example}


next up previous contents index
Next: 3.2 Grouping in Math Up: 3 Typesetting Mathematical Formulae Previous: 3 Typesetting Mathematical Formulae
Geoff Hutchison
1997-10-22