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

214 lines
5.3 KiB
Markdown

@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}$
```
Mathematic formulas are only accepted in the so-called **math mode**.
Inline-formulas must therefore be guarded by two dollar signs.
We can also use the `equation` 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><code>&bsol;sqrt{16}</code></td>
<td>$\sqrt{16}$</td>
</tr>
<tr class="fragment">
<td><code>&bsol;frac{3}{4}</code></td>
<td>$\frac{3}{4}$</td>
</tr>
<tr class="fragment">
<td><code>e^{&bsol;pi}</code></td>
<td>$e^{\pi}$</td>
</tr>
<tr class="fragment">
<td><code>&bsol;sum_{i=1}\^{n}x^2</code></td>
<td>$\sum_{i=1}^{n} x^2$</td>
</tr>
<tr class="fragment">
<td><code>12 &bsol;leq 4 x^2 + 13</code></td>
<td>$12 \leq 4 x^2 + 13$</td>
</tr>
</table>
++ `^{…}` and `_{…}` make the content between the braces appear as super- or subscript.
@slide(layout=content-only)
@title
Examples (2)
@content
<table>
<tr>
<th>source code</th>
<th>result</th>
</tr>
<tr>
<td><code>(x),&thinsp;[x],&thinsp;&bsol;lbrace x&bsol;rbrace,&thinsp;&bsol;lvert x&bsol;rvert</code></td>
<td>$(x), [x], \lbrace x\rbrace, \lvert x\rvert$</td>
</tr>
<tr>
<td><code>&bsol;exists,&thinsp;&bsol;forall,&thinsp;&bsol;in,&thinsp;&bsol;notin,&thinsp;&bsol;infty</code></td>
<td>$\exists,\forall,\in,\notin,\infty$</td>
</tr>
<tr>
<td><code>&bsol;alpha,&thinsp;&bsol;beta,&thinsp;&bsol;Gamma,&thinsp;&bsol;Delta,&thinsp;&bsol;varepsilon,&thinsp;&bsol;pi</code></td>
<td>$\alpha, \beta, \Gamma, \Delta, \varepsilon, \pi$</td>
</tr>
<tr>
<td><code>&bsol;rightarrow,&thinsp;&bsol;leftarrow,&thinsp;&bsol;Rightarrow,&thinsp;&bsol;Leftarrow,&thinsp;&bsol;Leftrightarrow</code></td>
<td>$\rightarrow, \leftarrow, \Rightarrow, \Leftarrow, \Leftrightarrow$</td>
</tr>
<tr>
<td><code>(A&thinsp;&bsol;cup&thinsp;B)&thinsp;&bsol;cap&thinsp;C</code></td>
<td>$(A \cup B) \cap C$</td>
</tr>
<tr>
<td><code>(A&thinsp;&bsol;lor&thinsp;B)&thinsp;&bsol;land&thinsp;C</code></td>
<td>$(A \lor B) \land C$</td>
</tr>
<tr>
<td><code>(A&thinsp;&bsol;cdot&thinsp;B)&thinsp;&bsol;times&thinsp;C</code></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><code>&bsol;left( &bsol;frac{1}{2} &bsol;right)</code></td>
<td>$\left(\frac{1}{2} \right)$</td>
</tr>
<tr class="fragment">
<td><code>&bsol;left&bsol;lbrace &bsol;frac{1}{2} &bsol;right&bsol;rbrace</code></td>
<td>$\left\lbrace\frac{1}{2} \right\rbrace$</td>
</tr>
<tr class="fragment">
<td><code>&bsol;left[ &bsol;frac{1}{2} &bsol;right]</code></td>
<td>$\left[\frac{1}{2} \right]$</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)
```
Caution: Don't use `\limits` inline.
@preview
![](svg/chapter-09/limits-crop.svg)
@todo
Caution-Label
@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 »=«.
``` {.lang-tex .hljs}
\begin{align}
13 \cdot (4a - 3)^2 &= 13 … \\
&= 208a^2 - 312a + 117
\end{align}
```
* ++ The equations will be aligned with regard to the ampersands (»&amp;«).
* ++ We can mark a new line using two »&bsol;«.
* ++ `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.