Your support for our advertisers helps cover the cost of hosting, research, and maintenance of this document

Formatting Information — An introduction to typesetting with LATEX

### Chapter 1: Writing documents

## Section 1.10: Mathematics

As explained in the para ‘Knuth, Donald originally wrote TEX to …’ in the Preface, TEX was originally written to automate the typesetting of books containing mathematics, and mathematics is typeset differently from normal text. This book does not cover mathematical typesetting, which is explained in detail in many other books and Web pages, so all we will cover here is the existence of the math mode commands, and some characters which have special meaning, so they don’t trip you up elsewhere.

In addition to the 10 special characters listed in § 1.6, there are three more characters which only have any meaning inside mathematics mode:

Key | Meaning |

| | Vertical bar |

< | Less-than |

> | Greater-than |

If you type any of these in normal text (that is, outside math mode), you will get very weird things happening and lots of error messages. If you need to print these characters, you must type them using math mode, or use the symbolic names from the textcomp package (\textbrokenbar, \textlangle, and \textrangle).

The hyphen also has a different meaning in math mode, as we saw in the previous section: it typesets as a minus sign, so if you want to write about negative numbers outside math mode, you need to type the number using inline math delimiters.

\[\bar n^*_j(s)=\frac{ \left\{s\sum^k_{i=1}n_i(0)p^*_{i,k+1}(s)+M^*(s)\right\} \sum^k_{i=1}p_{0i}p^*{ij}(s)} {1-s\sum^k_{i=1}p_{0i}p^*_{i,k+1}(s)} + \sum^k_{i=1}n_i(0)p^*_{ij}(s),\quad (j=1,2,\dots,k).\]

To use math mode inline (that is, within a paragraph),
enclose your math expression in \( and
\) commands (round parentheses). You can get
the much-quoted equation
*E=mc²* by typing \(E=mc^2\), and to
get a temperature like
*−40°* you need to type \(-40°\) in
order to get the minus sign and the right spacing.^{} Never use the math superscript and a letter o
for degrees: all that gets you is a raised italic
letter o.

To typeset a math expression as ‘displayed
math’ (centered between paragraphs, like the
huge equation above), enclose it in the commands
\[ and \] (square
brackets).^{}

Displayed equations can be auto-numbered with the equation environment instead of the \[ and \] commands.