[ \newcommand{\field}[1]{\mathbb{#1}} \newcommand{\Q}{\field Q} \newcommand{\C}{\field C} \newcommand{\R}{\field R} \newcommand{\ideal}[1]{\mathfrak{#1}} \newcommand{\ggd}{\mathrm{ggd}} \DeclareMathOperator{\Tr}{Tr} \DeclareMathOperator{\ord}{ord} ]

This lesson we will introduce some important new constructions for typesetting mathematics.

## Advanced environments

Use the gather environment to put several lines in a single display. The gather environment is a mathematical environment itself so it doesn’t have to be put inside [, ] or an equation environment. A new line is inserted using \. If you use gather* instead of gather no numbers will be shown next to the formulas.

\begin{gather} f(x) = x^2 + 1 \\ g(x) = x^3 - 3 \end{gather}

If you want to align the formulas you can use align or align*. The align environment is a mathematical environment itself as well. LaTeX aligns the lines at & and lines end with \.

\begin{align} f(x) &= x^2 + 1 \\ g(x) &= x^3 - 3 \end{align}

## Matrices

Matrices can be made with the pmatrix environment. For different brackets you can use bmatrix or vmatrix.

$\begin{pmatrix} a & b & c \\ d & e & f \\ g & h & i \end{pmatrix} \qquad \begin{bmatrix} a & b & c \\ d & e & f \\ g & h & i \end{bmatrix} \qquad \begin{vmatrix} a & b & c \\ d & e & f \\ g & h & i \end{vmatrix}$

In generic matrices it is common to use dots. These can be inserted using \cdots $\cdots$, \vdots $\vdots$ en \ddots $\ddots$.

## Text inside mathematics

Text in math mode can be inserted using \text or \textnormal. The command \text uses the font of the current environment, \textnormal uses roman. You have to be careful with whitespaces when using these commands. An illustrating example can be found below.

\begin{gather*} P := \{ \text{natural numbers \$p\$ such that \$p\$ is prime} \}\$0.5em] P := \{ \text{natural numbers} p \text{ such that } p \text{ is prime} \}\\[0.5em] \end{gather*} and an example where whitespace is left out: \[ P := \{ \text{natural numbers} p \text{such that} p \text{is prime} \}$

## Cases

The following construction is used a lot when defining functions:

$f(x) = \begin{cases} x^2 & \text{if \x \geq 0\,}\\ 0 & \text{otherwise.} \end{cases}$

## Multiline subscript

To place several lines under a sum you can use \substack and \:

$\sum_{\substack{ 0<i<m \\ 0<j<n }} P (i,j)$

## References

We saw that environments like equation and align display numbers next to the formulas. We will show how to reference these formulas. Use \label to label your equations.

$$\label{eq:polynomial} f(x) = x^2 + 1$$

It is common, but not necessary, to start labels of equations with eq:. Subsequently you can reference this formula with \eqref.

The polynomial defined in \eqref{eq:polynomial} has degree 2.

If you use the package hyperref references become clickable. The document viewer then jumps to the label. The package hyperref also makes the table of contents clickable.

### Exercise

1. Typeset the next display and its references. Where do you put the labels? (You don’t have to recreate the exact numbers (6) and (7).)
Define \begin{align} q &= 10 \label{eq:vba}\\ r &= 100. \label{eq:vbb} \end{align} We will use the values in \eqref{eq:vba} and \eqref{eq:vbb}.

#2 Typeset the following mathematical expressions. For some parts there is a hint: scroll over the whitespace beneath the display to see it.

$\cos z = \frac{e^{iz} + e^{-iz}}{2}= \sum_{n=0}^{\infty} \frac{(-1)^nz^{2n}}{(2n)!}=1-\frac{z^2}{2}+\frac{z^4}{4!}~~\dots \text{ with radius of convergence }\infty$
$g(z)= \begin{cases} f(\frac{1}{z}) & \text{if }\z\ne 0\;\\ f(\infty) & \text{if \z=0\}. \end{cases} \label{eq:cont_g}$
Hint: Use the cases environment.
$\mathbb{Q}^* = \{x\in \mathbb{Q} : x\not = 0\} = \mathbb{Q} \setminus \{0\}$
Hint: The \$\Q\$ is made in the style blackboard bold.
$\begin{pmatrix} a & b\\ c & d \end{pmatrix} \cdot \begin{pmatrix} e & f\\ g & h \end{pmatrix} = \begin{pmatrix} ae+bg & af+bh\\ ce+dg & cf + dh \end{pmatrix}$
$\partial A = \overline{A} \setminus A^\circ$
Hint: This slash means something like a minus sign for sets: \$A\setminus B = \{x\in A\mid x\notin B\}\$
$\Phi_n(X) = \prod_{\substack{\zeta\in\mathbb{C}^*:\\ \text{ord}(\zeta)=n}}(X-\zeta)$
Hint: use the substack command.
$M_R = \left( \frac4\pi \right)^s \frac{n!}{n^n} \sqrt{|\Delta{(R)}|}$

Ask one of the teachers to check this exercise.

### Remember

• gather, gather*, align, align*
• How to make matrices or cases?
• How do you insert text in mathematics?
• How to refer to equations?