@slide(layout=chapter-slide) @number 8 @title Typesetting mathematics @slide(layout=content-and-preview) @title Formula environments 🧮 @content ``` {.lang-tex .hljs} $2 \sqrt{\frac{\pi^2}{3} \cdot c_2}$ ``` Mathematical formulas are only accepted in the so-called **math mode.** In-line formulas must therefor be guarded by two dollar signs. We can also use the `equation` block environment: ``` {.lang-tex .hljs} \begin{equation} 2 \sqrt{\frac{\pi^2}{3} \cdot c_2} \end{equation} ``` Packages: `amsmath`, `amsthm`, `amssymb`, `mathtools` @preview  @slide(layout=content-only) @title Examples @content
| source code | result |
|---|---|
| `\sum_{i=1}^{n}x^2` | $\sum_{i=1}^{n} x^2$ |
| `12 \leq 4 x^2 + 13` | $12 \leq 4 x^2 + 13$ |
| `{n \choose k}` | ${n \choose k}$ |
| source code | result |
|---|---|
| `(x)`, `[x]`, `\lbrace x \rbrace`, `\lvert x \rvert` | $(x), [x], \lbrace x\rbrace, \lvert x\rvert$ |
| `\exists`, `\forall`, `\in`, `\notin`, `\infty` |
$\exists,\forall,\in,\notin,\infty$ |
| `\alpha`, `\beta`, `\Gamma`, `\Delta`, `\varepsilon`, `\pi` |
$\alpha, \beta, \Gamma, \Delta, \varepsilon, \pi$ |
| `\rightarrow`, `\leftarrow`, `\Rightarrow`, `\Leftarrow`, `\Leftrightarrow` | $\rightarrow, \leftarrow, \Rightarrow, \Leftarrow, \Leftrightarrow$ |
| `(A \cup B) \cap C` | $(A \cup B) \cap C$ |
| `(A \lor B) \land C` | $(A \lor B) \land C$ |
| `(A \cdot B) \times C` | $(A \cdot B) \times C$ |
| source code | result |
|---|---|
| `\left( \frac{1}{2} \right)` | $\left( \frac{1}{2} \right)$ |
| `\left[ \frac{1}{2} \right]` | $\left[ \frac{1}{2} \right]$ |
| `\left\lbrace \frac{1}{2} \right\rbrace` | $\left\lbrace \frac{1}{2} \right\rbrace$ |
$4 \cdot \left(\frac{1}{2} +\frac{3}{ 12 \cdot \left( 2 + \frac{1}{86 \cdot \left(\frac{1}{2} + 24 \right)} \right)} \right)$
@slide(layout=extra-content-and-preview) @title Depicting boundaries @content The bounds of an integral can be enforced to appear above and below the integral symbol using the `\limits` command. This is the standard behaviour for sums, products and limits. ``` {.lang-tex .hljs} \sum_{i=1}^{n^2}(x+2) \prod_{j=1}^{100}(3 \cdot x) \lim_{x \rightarrow \infty}(14x^3 - 12) \int\limits_{-12}^{4}(14x^3 - 12) ```Don't use `\limits` inline.
@preview  @slide(layout=extra-content-only) @title Set-builder notation @content In certain situations, it is more adequate to use textual predicates or long function names within the set builder notation. This is where `\text{}` comes into play.$\left\lbrace x \mid frequency(x) \geq 20\right\rbrace$
$\left\lbrace x \mid \text{frequency}(x) \geq 20\right\rbrace$
``` {.lang-tex .hljs .fragment} $\left\lbrace x \mid \text{frequency} … ```