latex-wochenende/slides/chapter-09.en.md

213 lines
4.9 KiB
Markdown
Raw Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

@slide(layout=chapter-slide)
@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 therefore 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
![](svg/chapter-09/simple-maths-crop.svg)
@slide(layout=content-only)
@title
Examples (1)
@content
<table>
<tr>
<th>source code</th>
<th>result</th>
</tr>
<tr class="fragment">
<td>`\sqrt{16}`</td>
<td>$\sqrt{16}$</td>
</tr>
<tr class="fragment">
<td>`\frac{3}{4}`</td>
<td>$\frac{3}{4}$</td>
</tr>
<tr class="fragment">
<td>`e^{\pi}`</td>
<td>$e^{\pi}$</td>
</tr>
<tr class="fragment">
<td>`\sum_{i=1}\^{n}x^2`</td>
<td>$\sum_{i=1}^{n} x^2$</td>
</tr>
<tr class="fragment">
<td>`12 \leq 4 x^2 + 13`</td>
<td>$12 \leq 4 x^2 + 13$</td>
</tr>
</table>
++ `^{…}` and `_{…}` make the content between the braces appear as sub- or superscripted.
@slide(layout=content-only)
@title
Examples (2)
@content
<table>
<tr>
<th>source code</th>
<th>result</th>
</tr>
<tr>
<td>`(x)`, `[x]`, `\lbrace x \rbrace`, `\lvert x \rvert`</td>
<td>$(x), [x], \lbrace x\rbrace, \lvert x\rvert$</td>
</tr>
<tr>
<td>`\exists`, `\forall`, `\in`, <br />`\notin`, `\infty`</td>
<td>$\exists,\forall,\in,\notin,\infty$</td>
</tr>
<tr>
<td>`\alpha`, `\beta`, `\Gamma`, <br />`\Delta`, `\varepsilon`, `\pi`</td>
<td>$\alpha, \beta, \Gamma, \Delta, \varepsilon, \pi$</td>
</tr>
<tr>
<td>`\rightarrow`, `\leftarrow`, `\Rightarrow`, `\Leftarrow`, `\Leftrightarrow`</td>
<td>$\rightarrow, \leftarrow, \Rightarrow, \Leftarrow, \Leftrightarrow$</td>
</tr>
<tr>
<td>`(A \cup B) \cap C`</td>
<td>$(A \cup B) \cap C$</td>
</tr>
<tr>
<td>`(A \lor B) \land C`</td>
<td>$(A \lor B) \land C$</td>
</tr>
<tr>
<td>`(A \cdot B) \times C`</td>
<td>$(A \cdot B) \times C$</td>
</tr>
</table>
@slide(layout=content-only)
@title
Height-adapting braces
@content
<table>
<tr>
<th>source code</th>
<th>result</th>
</tr>
<tr class="fragment">
<td>`\left( \frac{1}{2} \right)`</td>
<td>$\left( \frac{1}{2} \right)$</td>
</tr>
<tr class="fragment">
<td>`\left[ \frac{1}{2} \right]`</td>
<td>$\left[ \frac{1}{2} \right]$</td>
</tr>
<tr class="fragment">
<td>`\left\lbrace \frac{1}{2} \right\rbrace`</td>
<td>$\left\lbrace \frac{1}{2} \right\rbrace$</td>
</tr>
</table>
``` {.lang-tex .hljs .fragment}
$4 \cdot \left( \frac{1}{2} % …
```
<p class="fragment" style="text-align: center;">$4 \cdot \left(\frac{1}{2} +\frac{3}{ 12 \cdot \left( 2 + \frac{1}{86 \cdot \left(\frac{1}{2} + 24 \right)} \right)} \right)$</p>
@slide(layout=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)
```
<p data-category="Caution!">Don't use `\limits` inline.</p>
@preview
![](svg/chapter-09/limits-crop.svg)
@slide(layout=content-and-preview)
@title
Aligning a group of equations
@content
The `align` environment permits us to align equations at certain positions like the &hairsp;=&hairsp; character.
``` {.lang-tex .hljs}
\begin{align}
13 \cdot (4a - 3)^2 &= 13 … \\
&= 208a^2 - 312a + 117
\end{align}
```
* ++ The equations will be aligned with at the ampersands (`&`).
* ++ We can mark a new line using `\\`.
* ++ `align` and `equation` will not be numbered if we add an asterisk after their names (e.g. `\begin{align*}` and `\end{align*}`).
@preview
![](svg/chapter-09/alignment-crop.svg)
@slide(layout=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 `\mathrm{}` comes into play.
<p style="text-align: center;">$\left\lbrace x \mid frequency(x) \geq 20\right\rbrace$</p>
<p style="text-align: center;" class="fragment">$\left\lbrace x \mid \mathrm{frequency}(x) \geq 20\right\rbrace$</p>
``` {.lang-tex .hljs .fragment}
$\left\lbrace x \mid \mathrm{frequency} …
```
@slide(layout=task)
@task-number
8
@title
Typesetting mathematics
@content
* Reinclude `eingabefile.tex`, `textsatz.tex`, and `mathematik.tex` by adjusting the `\includeonly` command in `l2kurz.tex`.
* Compile the entire project once again.
* Have a look at chapter 4: Insert your personal favourite **formula** in section 4.5.