renumber chapters
This commit is contained in:
parent
08ad3e9900
commit
9f96b5e6b9
@ -15,5 +15,5 @@
|
|||||||
- chapter-13
|
- chapter-13
|
||||||
- chapter-14
|
- chapter-14
|
||||||
- chapter-15
|
- chapter-15
|
||||||
- chapter-16
|
|
||||||
|
|
||||||
|
|
||||||
@ -199,3 +199,55 @@ Text hervorheben
|
|||||||
* Macht die **URL** im Text anklickbar.
|
* Macht die **URL** im Text anklickbar.
|
||||||
* Probiert euch gerne auch an den anderen Textauszeichnungs-Möglichkeiten, die ihr kennengelernt habt. Löscht diese aber wieder, wenn ihr ein sauberes Dokument haben wollt.
|
* Probiert euch gerne auch an den anderen Textauszeichnungs-Möglichkeiten, die ihr kennengelernt habt. Löscht diese aber wieder, wenn ihr ein sauberes Dokument haben wollt.
|
||||||
|
|
||||||
|
@slide(layout=extra-content-and-preview)
|
||||||
|
|
||||||
|
@title
|
||||||
|
Flattersatz
|
||||||
|
|
||||||
|
@content
|
||||||
|
Standardmäßig setzt LaTeX Fließtext im Blocksatz, aber auch Flattersatz ist möglich.
|
||||||
|
|
||||||
|
``` {.lang-tex .hljs}
|
||||||
|
\raggedright … \raggedleft …
|
||||||
|
\centering …
|
||||||
|
```
|
||||||
|
|
||||||
|
Alternativ einsetzbare Umgebungen:
|
||||||
|
|
||||||
|
``` {.lang-tex .hljs}
|
||||||
|
\begin{flushleft} Text \end{flushleft}
|
||||||
|
\begin{flushright} Text \end{flushright}
|
||||||
|
\begin{center} Text \end{center}
|
||||||
|
```
|
||||||
|
|
||||||
|
<p data-category="Achtung!">Guter Flattersatz ist noch schwieriger als guter Blocksatz, daher lieber vermeiden!</p>
|
||||||
|
|
||||||
|
@preview
|
||||||
|

|
||||||
|
|
||||||
|
|
||||||
|
@slide(layout=extra-content-and-preview)
|
||||||
|
|
||||||
|
@title
|
||||||
|
Einzüge und Abstände
|
||||||
|
|
||||||
|
@content
|
||||||
|
* Absätze werden standardmäßig durch Erstzeileneinzüge (`\parindent`) verdeutlicht
|
||||||
|
* Stattdessen (!) können auch Abstände (`\parskip`) verwendet werden
|
||||||
|
* Die beiden Parameter sind beliebig einstellbar:
|
||||||
|
|
||||||
|
``` {.lang-tex .hljs}
|
||||||
|
\setlength{\parindent}{0pt}
|
||||||
|
\setlength{\parskip}{1em
|
||||||
|
plus .5em % erlaubte Dehnung
|
||||||
|
minus .5em % erlaubte Stauchung
|
||||||
|
}
|
||||||
|
```
|
||||||
|
|
||||||
|
* Mit `\noindent` kann für nur einen Absatz der Einzug abgeschaltet werden
|
||||||
|
|
||||||
|
@preview
|
||||||
|

|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
@ -197,3 +197,55 @@ Emphasising text
|
|||||||
* Of course, you can also experiment with the other **text markup** possibilities. However, remove them afterwards, if you want to have a clean document.
|
* Of course, you can also experiment with the other **text markup** possibilities. However, remove them afterwards, if you want to have a clean document.
|
||||||
|
|
||||||
|
|
||||||
|
@slide(layout=extra-content-and-preview)
|
||||||
|
|
||||||
|
@title
|
||||||
|
Ragged alignment
|
||||||
|
|
||||||
|
@content
|
||||||
|
By default, LaTeX sets text in full justification, but it is possible to activate ragged alignment.
|
||||||
|
|
||||||
|
``` {.lang-tex .hljs}
|
||||||
|
\raggedright … \raggedleft …
|
||||||
|
\centering …
|
||||||
|
```
|
||||||
|
|
||||||
|
Alternatively, we can use dedicated environments:
|
||||||
|
|
||||||
|
``` {.lang-tex .hljs}
|
||||||
|
\begin{flushleft} Text \end{flushleft}
|
||||||
|
\begin{flushright} Text \end{flushright}
|
||||||
|
\begin{center} Text \end{center}
|
||||||
|
```
|
||||||
|
|
||||||
|
<p data-category="Caution!">Proper ragged alignment is even more difficult than good justification, so better avoid it.</p>
|
||||||
|
|
||||||
|
@preview
|
||||||
|

|
||||||
|
|
||||||
|
|
||||||
|
@slide(layout=extra-content-and-preview)
|
||||||
|
|
||||||
|
@title
|
||||||
|
Indentation and spacing
|
||||||
|
|
||||||
|
@content
|
||||||
|
* paragraphs are usually indicated by first-line indentation (`\parindent`)
|
||||||
|
* we can decide to use paragraph spacing (`\parskip`) instead (!)
|
||||||
|
* both parameters are customisable:
|
||||||
|
|
||||||
|
``` {.lang-tex .hljs}
|
||||||
|
\setlength{\parindent}{0pt}
|
||||||
|
\setlength{\parskip}{1em
|
||||||
|
plus .5em % permitted stretch
|
||||||
|
minus .5em % permitted compression
|
||||||
|
}
|
||||||
|
```
|
||||||
|
|
||||||
|
* `\noindent` allows us to disable first-line indentation for a given paragraph
|
||||||
|
|
||||||
|
@preview
|
||||||
|

|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
@ -4,55 +4,161 @@
|
|||||||
7
|
7
|
||||||
|
|
||||||
@title
|
@title
|
||||||
Absatz­formatierung
|
Aufzählungen
|
||||||
|
|
||||||
@slide(layout=content-and-preview)
|
@slide(layout=content-and-preview)
|
||||||
|
|
||||||
@title
|
@title
|
||||||
Flattersatz
|
Ungeordnete Listen 📜
|
||||||
|
|
||||||
@content
|
@content
|
||||||
Standardmäßig setzt LaTeX Fließtext im Blocksatz, aber auch Flattersatz ist möglich.
|
|
||||||
|
|
||||||
``` {.lang-tex .hljs}
|
``` {.lang-tex .hljs}
|
||||||
\raggedright … \raggedleft …
|
\begin{itemize}
|
||||||
\centering …
|
\item Nudelplatten
|
||||||
|
\item Passierte Tomaten, % …
|
||||||
|
\item Oregano, Basilikum, % …
|
||||||
|
\item Mozzarella
|
||||||
|
\item Mehl
|
||||||
|
\item Milch
|
||||||
|
\end{itemize}
|
||||||
```
|
```
|
||||||
|
|
||||||
Alternativ einsetzbare Umgebungen:
|
Die einzelnen Stichpunkte werden in jeder Aufzählungsumgebung durch den Befehl `\item` gekennzeichnet.
|
||||||
|
|
||||||
``` {.lang-tex .hljs}
|
|
||||||
\begin{flushleft} Text \end{flushleft}
|
|
||||||
\begin{flushright} Text \end{flushright}
|
|
||||||
\begin{center} Text \end{center}
|
|
||||||
```
|
|
||||||
|
|
||||||
<p data-category="Achtung!">Guter Flattersatz ist noch schwieriger als guter Blocksatz, daher lieber vermeiden!</p>
|
|
||||||
|
|
||||||
@preview
|
@preview
|
||||||

|

|
||||||
|
|
||||||
|
|
||||||
@slide(layout=content-and-preview)
|
@slide(layout=content-and-preview)
|
||||||
|
|
||||||
@title
|
@title
|
||||||
Einzüge und Abstände
|
Geordnete Listen und Definitionslisten
|
||||||
|
|
||||||
@content
|
@content
|
||||||
* Absätze werden standardmäßig durch Erstzeileneinzüge (`\parindent`) verdeutlicht
|
|
||||||
* Stattdessen (!) können auch Abstände (`\parskip`) verwendet werden
|
|
||||||
* Die beiden Parameter sind beliebig einstellbar:
|
|
||||||
|
|
||||||
``` {.lang-tex .hljs}
|
``` {.lang-tex .hljs}
|
||||||
\setlength{\parindent}{0pt}
|
\begin{enumerate}
|
||||||
\setlength{\parskip}{1em
|
\item die Zwiebeln in einem Topf % …
|
||||||
plus .5em % erlaubte Dehnung
|
\item passierte Tomaten, Möhren % …
|
||||||
minus .5em % erlaubte Stauchung
|
\item mit Kräutern und Gewürzen % …
|
||||||
}
|
% \item …
|
||||||
|
\end{enumerate}
|
||||||
```
|
```
|
||||||
|
|
||||||
* Mit `\noindent` kann für nur einen Absatz der Einzug abgeschaltet werden
|
``` {.lang-tex .hljs .fragment}
|
||||||
|
\begin{description}
|
||||||
|
\item [Béchamelsauce] Béchamel % …
|
||||||
|
\item [Lasagne] Als Lasagne % …
|
||||||
|
\end{description}
|
||||||
|
```
|
||||||
|
|
||||||
@preview
|
@preview
|
||||||

|
<img class="thin-padding" src="svg/chapter-08/enumerate-crop.svg" style="margin-bottom: 0;"/>
|
||||||
|
<img class="thin-padding fragment" src="svg/chapter-08/definition-crop.svg"/>
|
||||||
|
|
||||||
|
@slide(layout=content-and-preview)
|
||||||
|
|
||||||
|
@title
|
||||||
|
Verschachtelte Listen
|
||||||
|
|
||||||
|
@content
|
||||||
|
``` {.lang-tex .hljs}
|
||||||
|
\begin{itemize}
|
||||||
|
% …
|
||||||
|
\item Gemüse \begin{itemize}
|
||||||
|
\item Passierte Tomaten
|
||||||
|
\item Möhren
|
||||||
|
\end{itemize}
|
||||||
|
\item Kräuter \begin{enumerate}
|
||||||
|
\item Oregano
|
||||||
|
\item Basilikum
|
||||||
|
\end{enumerate}
|
||||||
|
% …
|
||||||
|
\end{itemize}
|
||||||
|
```
|
||||||
|
|
||||||
|
@preview
|
||||||
|

|
||||||
|
|
||||||
|
@slide(layout=task)
|
||||||
|
|
||||||
|
@task-number
|
||||||
|
7
|
||||||
|
|
||||||
|
@title
|
||||||
|
Aufzählungen einfügen
|
||||||
|
|
||||||
|
@content
|
||||||
|
* Formatiert das Rezept in `lists.tex` im Ordner `exercises/lists` als **ungeordnete Liste** mit den Elementen *Ingredients* und *Instructions*. Nutzt dafür den Befehl `\itemize`.
|
||||||
|
* Benutzt innerhalb dieser Liste für die Zutaten eine **ungeordnete Liste** und für die Arbeitsschritte eine **geordnete Liste**.
|
||||||
|
|
||||||
|
|
||||||
|
@slide(layout=extra-content-and-preview)
|
||||||
|
|
||||||
|
@title
|
||||||
|
Kompakte Listen
|
||||||
|
|
||||||
|
@content
|
||||||
|
Das Paket `paralist` stellt Aufzählungen ohne riesige Zwischenräume zur Verfügung.
|
||||||
|
|
||||||
|
``` {.lang-tex .hljs}
|
||||||
|
\section{Zutaten}
|
||||||
|
\begin{compactitem}
|
||||||
|
% \item …
|
||||||
|
\end{compactitem}
|
||||||
|
\section{Zubereitung}
|
||||||
|
\begin{compactenum}
|
||||||
|
% \item …
|
||||||
|
\end{compactenum}
|
||||||
|
\section{Glossar}
|
||||||
|
\begin{compactdesc}
|
||||||
|
% \item …
|
||||||
|
\end{compactdesc}
|
||||||
|
```
|
||||||
|
|
||||||
|
@preview
|
||||||
|

|
||||||
|
|
||||||
|
@slide(layout=extra-content-and-preview)
|
||||||
|
|
||||||
|
@title
|
||||||
|
Aufzählungen im Absatz
|
||||||
|
|
||||||
|
@content
|
||||||
|
Neben den kompakten Listen stellt `paralist` auch Listen zur Verfügung, die in einem Absatz stehen.
|
||||||
|
|
||||||
|
``` {.lang-tex .hljs}
|
||||||
|
Folgende Kräuter sind für % …
|
||||||
|
\begin{inparaitem}
|
||||||
|
\item Liebstöckel
|
||||||
|
\item Petersilie
|
||||||
|
\item Schnittlauch
|
||||||
|
\end{inparaitem}
|
||||||
|
```
|
||||||
|
|
||||||
|
Natürlich gibt es auch hier ein Pendant namens `inparaenum` für geordnete Listen.
|
||||||
|
|
||||||
|
@preview
|
||||||
|
<img class="thin-padding" src="svg/chapter-08/paralist-extended-crop.svg"/>
|
||||||
|
|
||||||
|
|
||||||
|
@slide(layout=extra-content-and-preview)
|
||||||
|
|
||||||
|
@title
|
||||||
|
Aufzählungsarten
|
||||||
|
|
||||||
|
@content
|
||||||
|
Die Art der Aufzählung lässt sich über den optionalen Parameter `label` ändern. Hierfür ist das Paket `enumitem` notwendig.
|
||||||
|
|
||||||
|
``` {.lang-tex .hljs}
|
||||||
|
% Römische Zahlen
|
||||||
|
\begin{enumerate}[label=\roman*]
|
||||||
|
% …
|
||||||
|
% Arabische Zahlen
|
||||||
|
\begin{enumerate}[label=\arabic*]
|
||||||
|
% …
|
||||||
|
% Alphabetisch
|
||||||
|
\begin{enumerate}[label=\alph*]
|
||||||
|
% …
|
||||||
|
```
|
||||||
|
|
||||||
|
@preview
|
||||||
|

|
||||||
@ -4,55 +4,164 @@
|
|||||||
7
|
7
|
||||||
|
|
||||||
@title
|
@title
|
||||||
Formatting paragraphs
|
Enumerations
|
||||||
|
|
||||||
@slide(layout=content-and-preview)
|
@slide(layout=content-and-preview)
|
||||||
|
|
||||||
@title
|
@title
|
||||||
Ragged alignment
|
Unordered lists 📜
|
||||||
|
|
||||||
@content
|
@content
|
||||||
By default, LaTeX sets text in full justification, but it is possible to activate ragged alignment.
|
|
||||||
|
|
||||||
``` {.lang-tex .hljs}
|
``` {.lang-tex .hljs}
|
||||||
\raggedright … \raggedleft …
|
\begin{itemize}
|
||||||
\centering …
|
\item lasagna noodles
|
||||||
|
\item crushed tomatoes, % …
|
||||||
|
\item oregano, basil, % …
|
||||||
|
\item mozzarella cheese
|
||||||
|
\item flour
|
||||||
|
\item milk
|
||||||
|
\end{itemize}
|
||||||
```
|
```
|
||||||
|
|
||||||
Alternatively, we can use dedicated environments:
|
We mark each bullet point with `\item`.
|
||||||
|
This pattern is the same for all kinds of enumerations.
|
||||||
``` {.lang-tex .hljs}
|
|
||||||
\begin{flushleft} Text \end{flushleft}
|
|
||||||
\begin{flushright} Text \end{flushright}
|
|
||||||
\begin{center} Text \end{center}
|
|
||||||
```
|
|
||||||
|
|
||||||
<p data-category="Caution!">Proper ragged alignment is even more difficult than good justification, so better avoid it.</p>
|
|
||||||
|
|
||||||
@preview
|
@preview
|
||||||

|

|
||||||
|
|
||||||
|
|
||||||
@slide(layout=content-and-preview)
|
@slide(layout=content-and-preview)
|
||||||
|
|
||||||
@title
|
@title
|
||||||
Indentation and spacing
|
Ordered and definition lists
|
||||||
|
|
||||||
@content
|
@content
|
||||||
* paragraphs are usually indicated by first-line indentation (`\parindent`)
|
|
||||||
* we can decide to use paragraph spacing (`\parskip`) instead (!)
|
|
||||||
* both parameters are customisable:
|
|
||||||
|
|
||||||
``` {.lang-tex .hljs}
|
``` {.lang-tex .hljs}
|
||||||
\setlength{\parindent}{0pt}
|
\begin{enumerate}
|
||||||
\setlength{\parskip}{1em
|
\item cook onions over medium % …
|
||||||
plus .5em % permitted stretch
|
\item add crushed tomatoes, carrots % …
|
||||||
minus .5em % permitted compression
|
\item add herbs and spices % …
|
||||||
}
|
% \item …
|
||||||
|
\end{enumerate}
|
||||||
```
|
```
|
||||||
|
|
||||||
* `\noindent` allows us to disable first-line indentation for a given paragraph
|
``` {.lang-tex .hljs .fragment}
|
||||||
|
\begin{description}
|
||||||
|
\item [Béchamel sauce] Béchamel % …
|
||||||
|
\item [Lasagne] Lasagne (singular % …
|
||||||
|
\end{description}
|
||||||
|
```
|
||||||
|
|
||||||
@preview
|
@preview
|
||||||

|
<img class="thin-padding" src="svg/chapter-08/enumerate-english-crop.svg" style="margin-bottom: 0;"/>
|
||||||
|
<img class="thin-padding fragment" src="svg/chapter-08/definition-english-crop.svg"/>
|
||||||
|
|
||||||
|
@slide(layout=content-and-preview)
|
||||||
|
|
||||||
|
@title
|
||||||
|
Nested lists
|
||||||
|
|
||||||
|
@content
|
||||||
|
``` {.lang-tex .hljs}
|
||||||
|
\begin{itemize}
|
||||||
|
% …
|
||||||
|
\item vegetables \begin{itemize}
|
||||||
|
\item crushed tomatoes
|
||||||
|
\item carrots
|
||||||
|
\end{itemize}
|
||||||
|
\item herbs \begin{enumerate}
|
||||||
|
\item oregano
|
||||||
|
\item basil
|
||||||
|
\end{enumerate}
|
||||||
|
% …
|
||||||
|
\end{itemize}
|
||||||
|
```
|
||||||
|
|
||||||
|
@preview
|
||||||
|

|
||||||
|
|
||||||
|
|
||||||
|
@slide(layout=task)
|
||||||
|
|
||||||
|
@task-number
|
||||||
|
7
|
||||||
|
|
||||||
|
@title
|
||||||
|
Adding enumerations
|
||||||
|
|
||||||
|
@content
|
||||||
|
* Turn the recipe in `lists.tex` into an **unordered list** consisting of the elements *Ingredients* and *Instructions*. You can find the file in the directory `exercises/lists`. Use the `itemize` command.
|
||||||
|
* Within this list, create a **unordered list** for the ingredients and a **ordered list** for the instructions.
|
||||||
|
|
||||||
|
|
||||||
|
@slide(layout=extra-content-and-preview)
|
||||||
|
|
||||||
|
@title
|
||||||
|
Compact lists
|
||||||
|
|
||||||
|
@content
|
||||||
|
The package `paralist` offers enumerations with less line spacing.
|
||||||
|
|
||||||
|
``` {.lang-tex .hljs}
|
||||||
|
\section{Ingredients}
|
||||||
|
\begin{compactitem}
|
||||||
|
% \item …
|
||||||
|
\end{compactitem}
|
||||||
|
\section{Preparation}
|
||||||
|
\begin{compactenum}
|
||||||
|
% \item …
|
||||||
|
\end{compactenum}
|
||||||
|
\section{Glossary}
|
||||||
|
\begin{compactdesc}
|
||||||
|
% \item …
|
||||||
|
\end{compactdesc}
|
||||||
|
```
|
||||||
|
|
||||||
|
@preview
|
||||||
|

|
||||||
|
|
||||||
|
@slide(layout=extra-content-and-preview)
|
||||||
|
|
||||||
|
@title
|
||||||
|
In-line enumerations
|
||||||
|
|
||||||
|
@content
|
||||||
|
Another feature provided by `paralist` enables us to integrate enumerations into paragraphs.
|
||||||
|
|
||||||
|
``` {.lang-tex .hljs}
|
||||||
|
The following herbs are % …
|
||||||
|
\begin{inparaitem}
|
||||||
|
\item lovage
|
||||||
|
\item parsley
|
||||||
|
\item chives
|
||||||
|
\end{inparaitem}
|
||||||
|
```
|
||||||
|
|
||||||
|
Of course, there is an accompanying list type called `inparaenum` for ordered lists.
|
||||||
|
|
||||||
|
@preview
|
||||||
|
<img class="thin-padding" src="svg/chapter-08/paralist-extended-english-crop.svg"/>
|
||||||
|
|
||||||
|
|
||||||
|
@slide(layout=extra-content-and-preview)
|
||||||
|
|
||||||
|
@title
|
||||||
|
List styles
|
||||||
|
|
||||||
|
@content
|
||||||
|
The list style type can be set using the optional parameter `label`.
|
||||||
|
To accomplish this, we need to include the package `enumitem` first.
|
||||||
|
|
||||||
|
``` {.lang-tex .hljs}
|
||||||
|
% Roman numerals
|
||||||
|
\begin{enumerate}[label=\roman*]
|
||||||
|
% …
|
||||||
|
% Arabic numerals
|
||||||
|
\begin{enumerate}[label=\arabic*]
|
||||||
|
% …
|
||||||
|
% Alphabetical
|
||||||
|
\begin{enumerate}[label=\alph*]
|
||||||
|
% …
|
||||||
|
```
|
||||||
|
|
||||||
|
@preview
|
||||||
|

|
||||||
@ -4,161 +4,225 @@
|
|||||||
8
|
8
|
||||||
|
|
||||||
@title
|
@title
|
||||||
Aufzählungen
|
Mathematische Formeln
|
||||||
|
|
||||||
@slide(layout=content-and-preview)
|
@slide(layout=content-and-preview)
|
||||||
|
|
||||||
@title
|
@title
|
||||||
Ungeordnete Listen 📜
|
Formel-Umgebungen 🧮
|
||||||
|
|
||||||
@content
|
@content
|
||||||
``` {.lang-tex .hljs}
|
``` {.lang-tex .hljs}
|
||||||
\begin{itemize}
|
$2 \sqrt{\frac{\pi^2}{3} \cdot c_2}$
|
||||||
\item Nudelplatten
|
|
||||||
\item Passierte Tomaten, % …
|
|
||||||
\item Oregano, Basilikum, % …
|
|
||||||
\item Mozzarella
|
|
||||||
\item Mehl
|
|
||||||
\item Milch
|
|
||||||
\end{itemize}
|
|
||||||
```
|
```
|
||||||
|
|
||||||
Die einzelnen Stichpunkte werden in jeder Aufzählungsumgebung durch den Befehl `\item` gekennzeichnet.
|
Mathematische Formeln können **nur im sogenannten Mathmode** gesetzt werden, der inline durch zwei Dollarzeichen aktiviert wird. Außerdem gibt es eine Blockumgebung:
|
||||||
|
|
||||||
|
``` {.lang-tex .hljs}
|
||||||
|
\begin{equation}
|
||||||
|
2 \sqrt{\frac{\pi^2}{3} \cdot c_2}
|
||||||
|
\end{equation}
|
||||||
|
```
|
||||||
|
|
||||||
|
Pakete: `amsmath`, `amsthm`, `amssymb`, `mathtools`
|
||||||
|
|
||||||
@preview
|
@preview
|
||||||

|

|
||||||
|
|
||||||
|
@slide(layout=content-only)
|
||||||
|
|
||||||
|
@title
|
||||||
|
Einige Beispiele
|
||||||
|
|
||||||
|
@content
|
||||||
|
<table>
|
||||||
|
<tr>
|
||||||
|
<th>Quelltext</th>
|
||||||
|
<th>Ergebnis</th>
|
||||||
|
</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>
|
||||||
|
<tr class="fragment">
|
||||||
|
<td>`{n \choose k}`</td>
|
||||||
|
<td>${n \choose k}$</td>
|
||||||
|
</tr>
|
||||||
|
</table>
|
||||||
|
|
||||||
|
|
||||||
@slide(layout=content-and-preview)
|
@slide(layout=content-and-preview)
|
||||||
|
|
||||||
@title
|
@title
|
||||||
Geordnete Listen und Definitionslisten
|
Ausrichtung von mehreren Gleichungen
|
||||||
|
|
||||||
@content
|
@content
|
||||||
|
Die Umgebung `align` erlaubt es, Gleichungen zum Beispiel am › = ‹ auszurichten.
|
||||||
|
|
||||||
``` {.lang-tex .hljs}
|
``` {.lang-tex .hljs}
|
||||||
\begin{enumerate}
|
\begin{align}
|
||||||
\item die Zwiebeln in einem Topf % …
|
13 \cdot (4a - 3)^2 &= 13 … \\
|
||||||
\item passierte Tomaten, Möhren % …
|
&= 208a^2 - 312a + 117
|
||||||
\item mit Kräutern und Gewürzen % …
|
\end{align}
|
||||||
% \item …
|
|
||||||
\end{enumerate}
|
|
||||||
```
|
```
|
||||||
|
|
||||||
``` {.lang-tex .hljs .fragment}
|
* ++ Ausgerichtet wird am ›`&`‹-Zeichen.
|
||||||
\begin{description}
|
* ++ Zeilenumbrüche werden mit ›`\\`‹ markiert.
|
||||||
\item [Béchamelsauce] Béchamel % …
|
* ++ Die Nummerierung kann bei `align` und `equation` durch durch ein Sternchen nach dem Umgebungsnamen (z. B. `\begin{align*}` und `\end{align*}`) unterdrückt werden.
|
||||||
\item [Lasagne] Als Lasagne % …
|
|
||||||
\end{description}
|
|
||||||
```
|
|
||||||
|
|
||||||
@preview
|
@preview
|
||||||
<img class="thin-padding" src="svg/chapter-08/enumerate-crop.svg" style="margin-bottom: 0;"/>
|

|
||||||
<img class="thin-padding fragment" src="svg/chapter-08/definition-crop.svg"/>
|
|
||||||
|
|
||||||
@slide(layout=content-and-preview)
|
|
||||||
|
|
||||||
@title
|
@slide(layout=task-without-number)
|
||||||
Verschachtelte Listen
|
|
||||||
|
|
||||||
@content
|
|
||||||
``` {.lang-tex .hljs}
|
|
||||||
\begin{itemize}
|
|
||||||
% …
|
|
||||||
\item Gemüse \begin{itemize}
|
|
||||||
\item Passierte Tomaten
|
|
||||||
\item Möhren
|
|
||||||
\end{itemize}
|
|
||||||
\item Kräuter \begin{enumerate}
|
|
||||||
\item Oregano
|
|
||||||
\item Basilikum
|
|
||||||
\end{enumerate}
|
|
||||||
% …
|
|
||||||
\end{itemize}
|
|
||||||
```
|
|
||||||
|
|
||||||
@preview
|
|
||||||

|
|
||||||
|
|
||||||
@slide(layout=task)
|
|
||||||
|
|
||||||
@task-number
|
@task-number
|
||||||
8
|
8a
|
||||||
|
|
||||||
@title
|
@title
|
||||||
Aufzählungen einfügen
|
Formeln setzen
|
||||||
|
|
||||||
@content
|
@content
|
||||||
* Formatiert das Rezept in `lists.tex` im Ordner `exercises/lists` als **ungeordnete Liste** mit den Elementen *Ingredients* und *Instructions*. Nutzt dafür den Befehl `\itemize`.
|
Setzt die folgenden Formeln in der Datei `exercises/maths/math-formulas.tex`.
|
||||||
* Benutzt innerhalb dieser Liste für die Zutaten eine **ungeordnete Liste** und für die Arbeitsschritte eine **geordnete Liste**.
|
|
||||||
|
| Bedeutung | Ergebnis |
|
||||||
|
|-----------|----------|
|
||||||
|
| Fallbeschleunigung (Deutschland) | $9,81\,\frac{m}{s^2}$ |
|
||||||
|
| pq-Formel | $x_{1,2} = - \frac{p}{2} \pm \sqrt{\left(\frac{p}{2}\right)^2 - q}$ |
|
||||||
|
| Mitternachtsformel | $x_{1,2} = \frac{-b \pm \sqrt{b^2 - 4ac}}{2a}$ |
|
||||||
|
| Catalansche Zahlen | $C_n = \frac{1}{n+1} {2n \choose n} = \frac{(2n)!}{(n+1)!n!}$ |
|
||||||
|
|
||||||
|
@slide(layout=task-without-number)
|
||||||
|
|
||||||
|
@task-number
|
||||||
|
8b
|
||||||
|
|
||||||
|
@title
|
||||||
|
Formeln setzen
|
||||||
|
|
||||||
|
@content
|
||||||
|
Setzt die folgenden Formeln in der Datei `exercises/maths/math-formulas.tex`.
|
||||||
|
|
||||||
|
| Bedeutung | Ergebnis |
|
||||||
|
|-----------|----------|
|
||||||
|
| Definition der Fakultät | $n! = \prod_{i=1}^{n} i$ |
|
||||||
|
| Menge aller ungeraden natürlichen Zahlen | $\{ x \mid x \in \mathbb{N}, \mathrm{ungerade}(x) \}$ |
|
||||||
|
| Elimination $\neg\exists x$ | $\neg\exists x . p(x) \Leftrightarrow \forall x . \neg p(x)$ |
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
@slide(layout=extra-content-only)
|
||||||
|
|
||||||
|
@title
|
||||||
|
Weitere Beispiele
|
||||||
|
|
||||||
|
@content
|
||||||
|
<table>
|
||||||
|
<tr>
|
||||||
|
<th>Quelltext</th>
|
||||||
|
<th>Ergebnis</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=extra-content-only)
|
||||||
|
|
||||||
|
@title
|
||||||
|
Mitwachsende Klammern
|
||||||
|
|
||||||
|
@content
|
||||||
|
<table>
|
||||||
|
<tr>
|
||||||
|
<th>Quelltext</th>
|
||||||
|
<th>Ergebnis</th>
|
||||||
|
</tr>
|
||||||
|
<tr>
|
||||||
|
<td>`\left( \frac{1}{2} \right)`</td>
|
||||||
|
<td>$\left( \frac{1}{2} \right)$</td>
|
||||||
|
</tr>
|
||||||
|
<tr>
|
||||||
|
<td>`\left[ \frac{1}{2} \right]`</td>
|
||||||
|
<td>$\left[ \frac{1}{2} \right]$</td>
|
||||||
|
</tr>
|
||||||
|
<tr>
|
||||||
|
<td>`\left\lbrace \frac{1}{2} \right\rbrace`</td>
|
||||||
|
<td>$\left\lbrace \frac{1}{2} \right\rbrace$</td>
|
||||||
|
</tr>
|
||||||
|
</table>
|
||||||
|
|
||||||
|
|
||||||
|
``` {.lang-tex .hljs}
|
||||||
|
$4 \cdot \left( \frac{1}{2} % …
|
||||||
|
```
|
||||||
|
|
||||||
|
<p 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=extra-content-and-preview)
|
@slide(layout=extra-content-and-preview)
|
||||||
|
|
||||||
@title
|
@title
|
||||||
Kompakte Listen
|
Darstellung von Grenzen
|
||||||
|
|
||||||
@content
|
@content
|
||||||
Das Paket `paralist` stellt Aufzählungen ohne riesige Zwischenräume zur Verfügung.
|
Mit dem Befehl `\limits` lassen sich die Grenzen von Integralen unter und über dem Integralzeichen darstellen. Bei Summen, Produkten und Grenzwerten geschieht das automatisch.
|
||||||
|
|
||||||
``` {.lang-tex .hljs}
|
``` {.lang-tex .hljs}
|
||||||
\section{Zutaten}
|
\sum_{i=1}^{n^2}(x+2)
|
||||||
\begin{compactitem}
|
\prod_{j=1}^{100}(3 \cdot x)
|
||||||
% \item …
|
\lim_{x \rightarrow \infty}(14x^3 - 12)
|
||||||
\end{compactitem}
|
\int\limits_{-12}^{4}(14x^3 - 12)
|
||||||
\section{Zubereitung}
|
|
||||||
\begin{compactenum}
|
|
||||||
% \item …
|
|
||||||
\end{compactenum}
|
|
||||||
\section{Glossar}
|
|
||||||
\begin{compactdesc}
|
|
||||||
% \item …
|
|
||||||
\end{compactdesc}
|
|
||||||
```
|
```
|
||||||
|
|
||||||
@preview
|
<p data-category="Achtung!">Der Einsatz von `\limits` sollte im Fließtext vermieden werden.</p>
|
||||||

|
|
||||||
|
|
||||||
@slide(layout=extra-content-and-preview)
|
@preview
|
||||||
|

|
||||||
|
|
||||||
|
|
||||||
|
@slide(layout=extra-content-only)
|
||||||
|
|
||||||
@title
|
@title
|
||||||
Aufzählungen im Absatz
|
Mengenschreibweise
|
||||||
|
|
||||||
@content
|
@content
|
||||||
Neben den kompakten Listen stellt `paralist` auch Listen zur Verfügung, die in einem Absatz stehen.
|
Manchmal ist es notwendig, im Zusammenhang mit der Mengenschreibweise Prädikate unter Verwendung von textuellen Beschreibungen oder längeren Funktionsnamen zu definieren.
|
||||||
|
|
||||||
|
Für diesen Fall gibt es den Befehl `\mathrm{}`.
|
||||||
|
|
||||||
|
<p style="text-align: center;">$\left\lbrace x \mid tiefe(x) \geq 20\right\rbrace$</p>
|
||||||
|
<p style="text-align: center;">$\left\lbrace x \mid \mathrm{tiefe}(x) \geq 20\right\rbrace$</p>
|
||||||
|
|
||||||
``` {.lang-tex .hljs}
|
``` {.lang-tex .hljs}
|
||||||
Folgende Kräuter sind für % …
|
$\left\lbrace x \mid \mathrm{tiefe}(x) …
|
||||||
\begin{inparaitem}
|
```
|
||||||
\item Liebstöckel
|
|
||||||
\item Petersilie
|
|
||||||
\item Schnittlauch
|
|
||||||
\end{inparaitem}
|
|
||||||
```
|
|
||||||
|
|
||||||
Natürlich gibt es auch hier ein Pendant namens `inparaenum` für geordnete Listen.
|
|
||||||
|
|
||||||
@preview
|
|
||||||
<img class="thin-padding" src="svg/chapter-08/paralist-extended-crop.svg"/>
|
|
||||||
|
|
||||||
|
|
||||||
@slide(layout=extra-content-and-preview)
|
|
||||||
|
|
||||||
@title
|
|
||||||
Aufzählungsarten
|
|
||||||
|
|
||||||
@content
|
|
||||||
Die Art der Aufzählung lässt sich über den optionalen Parameter `label` ändern. Hierfür ist das Paket `enumitem` notwendig.
|
|
||||||
|
|
||||||
``` {.lang-tex .hljs}
|
|
||||||
% Römische Zahlen
|
|
||||||
\begin{enumerate}[label=\roman*]
|
|
||||||
% …
|
|
||||||
% Arabische Zahlen
|
|
||||||
\begin{enumerate}[label=\arabic*]
|
|
||||||
% …
|
|
||||||
% Alphabetisch
|
|
||||||
\begin{enumerate}[label=\alph*]
|
|
||||||
% …
|
|
||||||
```
|
|
||||||
|
|
||||||
@preview
|
|
||||||

|
|
||||||
@ -4,164 +4,230 @@
|
|||||||
8
|
8
|
||||||
|
|
||||||
@title
|
@title
|
||||||
Enumerations
|
Typesetting mathematics
|
||||||
|
|
||||||
@slide(layout=content-and-preview)
|
@slide(layout=content-and-preview)
|
||||||
|
|
||||||
@title
|
@title
|
||||||
Unordered lists 📜
|
Formula environments 🧮
|
||||||
|
|
||||||
@content
|
@content
|
||||||
``` {.lang-tex .hljs}
|
``` {.lang-tex .hljs}
|
||||||
\begin{itemize}
|
$2 \sqrt{\frac{\pi^2}{3} \cdot c_2}$
|
||||||
\item lasagna noodles
|
|
||||||
\item crushed tomatoes, % …
|
|
||||||
\item oregano, basil, % …
|
|
||||||
\item mozzarella cheese
|
|
||||||
\item flour
|
|
||||||
\item milk
|
|
||||||
\end{itemize}
|
|
||||||
```
|
```
|
||||||
|
|
||||||
We mark each bullet point with `\item`.
|
Mathematical formulas are only accepted in the so-called **math mode.**
|
||||||
This pattern is the same for all kinds of enumerations.
|
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
|
@preview
|
||||||

|

|
||||||
|
|
||||||
|
@slide(layout=content-only)
|
||||||
|
|
||||||
|
@title
|
||||||
|
Examples
|
||||||
|
|
||||||
|
@content
|
||||||
|
<table>
|
||||||
|
<tr>
|
||||||
|
<th>source code</th>
|
||||||
|
<th>result</th>
|
||||||
|
</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>
|
||||||
|
<tr class="fragment">
|
||||||
|
<td>`{n \choose k}`</td>
|
||||||
|
<td>${n \choose k}$</td>
|
||||||
|
</tr>
|
||||||
|
</table>
|
||||||
|
|
||||||
|
|
||||||
@slide(layout=content-and-preview)
|
@slide(layout=content-and-preview)
|
||||||
|
|
||||||
@title
|
@title
|
||||||
Ordered and definition lists
|
Aligning a group of equations
|
||||||
|
|
||||||
@content
|
@content
|
||||||
|
The `align` environment permits us to align equations at certain positions like the ‘ = ’ character.
|
||||||
|
|
||||||
``` {.lang-tex .hljs}
|
``` {.lang-tex .hljs}
|
||||||
\begin{enumerate}
|
\begin{align}
|
||||||
\item cook onions over medium % …
|
13 \cdot (4a - 3)^2 &= 13 … \\
|
||||||
\item add crushed tomatoes, carrots % …
|
&= 208a^2 - 312a + 117
|
||||||
\item add herbs and spices % …
|
\end{align}
|
||||||
% \item …
|
|
||||||
\end{enumerate}
|
|
||||||
```
|
```
|
||||||
|
|
||||||
``` {.lang-tex .hljs .fragment}
|
* ++ The equations will be aligned with respect to the ampersands (‘`&`’).
|
||||||
\begin{description}
|
* ++ We can mark a new line using ‘`\\`’.
|
||||||
\item [Béchamel sauce] Béchamel % …
|
* ++ `align` and `equation` will not be numbered if we add an asterisk after their names (e. g. `\begin{align*}` and `\end{align*}`).
|
||||||
\item [Lasagne] Lasagne (singular % …
|
|
||||||
\end{description}
|
|
||||||
```
|
|
||||||
|
|
||||||
@preview
|
@preview
|
||||||
<img class="thin-padding" src="svg/chapter-08/enumerate-english-crop.svg" style="margin-bottom: 0;"/>
|

|
||||||
<img class="thin-padding fragment" src="svg/chapter-08/definition-english-crop.svg"/>
|
|
||||||
|
|
||||||
@slide(layout=content-and-preview)
|
|
||||||
|
|
||||||
@title
|
|
||||||
Nested lists
|
|
||||||
|
|
||||||
@content
|
|
||||||
``` {.lang-tex .hljs}
|
|
||||||
\begin{itemize}
|
|
||||||
% …
|
|
||||||
\item vegetables \begin{itemize}
|
|
||||||
\item crushed tomatoes
|
|
||||||
\item carrots
|
|
||||||
\end{itemize}
|
|
||||||
\item herbs \begin{enumerate}
|
|
||||||
\item oregano
|
|
||||||
\item basil
|
|
||||||
\end{enumerate}
|
|
||||||
% …
|
|
||||||
\end{itemize}
|
|
||||||
```
|
|
||||||
|
|
||||||
@preview
|
|
||||||

|
|
||||||
|
|
||||||
|
|
||||||
@slide(layout=task)
|
@slide(layout=task-without-number)
|
||||||
|
|
||||||
@task-number
|
@task-number
|
||||||
8
|
8a
|
||||||
|
|
||||||
@title
|
@title
|
||||||
Adding enumerations
|
Typesetting mathematics
|
||||||
|
|
||||||
@content
|
@content
|
||||||
* Turn the recipe in `lists.tex` into an **unordered list** consisting of the elements *Ingredients* and *Instructions*. You can find the file in the directory `exercises/lists`. Use the `itemize` command.
|
Code up the following formulas in the file `exercises/maths/math-formulas.tex`.
|
||||||
* Within this list, create a **unordered list** for the ingredients and a **ordered list** for the instructions.
|
|
||||||
|
| Meaning | Result |
|
||||||
|
|---------|--------|
|
||||||
|
| Gravitational acceleration | $9,81\,\frac{m}{s^2}$ |
|
||||||
|
| Formula to solve quadratic equations | $x_{1,2} = - \frac{p}{2} \pm \sqrt{\left(\frac{p}{2}\right)^2 - q}$ |
|
||||||
|
| Another formula to solve quadratic equations | $x_{1,2} = \frac{-b \pm \sqrt{b^2 - 4ac}}{2a}$ |
|
||||||
|
| Catalan numbers | $C_n = \frac{1}{n+1} {2n \choose n} = \frac{(2n)!}{(n+1)!n!}$ |
|
||||||
|
|
||||||
|
|
||||||
|
@slide(layout=task-without-number)
|
||||||
|
|
||||||
|
@task-number
|
||||||
|
8b
|
||||||
|
|
||||||
|
@title
|
||||||
|
Typesetting mathematics
|
||||||
|
|
||||||
|
@content
|
||||||
|
Code up the following formulas in the file `exercises/maths/math-formulas.tex`.
|
||||||
|
|
||||||
|
| Meaning | Result |
|
||||||
|
|---------|--------|
|
||||||
|
| Definition of factorial | $n! = \prod_{i=1}^{n} i$ |
|
||||||
|
| Set of all odd natural numbers | $\{ x \mid x \in \mathbb{N}, \mathrm{odd}(x) \}$ |
|
||||||
|
| Elimination $\neg\exists x$ | $\neg\exists x . p(x) \Leftrightarrow \forall x . \neg p(x)$ |
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
@slide(layout=extra-content-only)
|
||||||
|
|
||||||
|
@title
|
||||||
|
More examples
|
||||||
|
|
||||||
|
@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=extra-content-only)
|
||||||
|
|
||||||
|
@title
|
||||||
|
Height-adapting braces
|
||||||
|
|
||||||
|
@content
|
||||||
|
<table>
|
||||||
|
<tr>
|
||||||
|
<th>source code</th>
|
||||||
|
<th>result</th>
|
||||||
|
</tr>
|
||||||
|
<tr>
|
||||||
|
<td>`\left( \frac{1}{2} \right)`</td>
|
||||||
|
<td>$\left( \frac{1}{2} \right)$</td>
|
||||||
|
</tr>
|
||||||
|
<tr>
|
||||||
|
<td>`\left[ \frac{1}{2} \right]`</td>
|
||||||
|
<td>$\left[ \frac{1}{2} \right]$</td>
|
||||||
|
</tr>
|
||||||
|
<tr>
|
||||||
|
<td>`\left\lbrace \frac{1}{2} \right\rbrace`</td>
|
||||||
|
<td>$\left\lbrace \frac{1}{2} \right\rbrace$</td>
|
||||||
|
</tr>
|
||||||
|
</table>
|
||||||
|
|
||||||
|
|
||||||
|
``` {.lang-tex .hljs}
|
||||||
|
$4 \cdot \left( \frac{1}{2} % …
|
||||||
|
```
|
||||||
|
|
||||||
|
<p 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=extra-content-and-preview)
|
@slide(layout=extra-content-and-preview)
|
||||||
|
|
||||||
@title
|
@title
|
||||||
Compact lists
|
Depicting boundaries
|
||||||
|
|
||||||
@content
|
@content
|
||||||
The package `paralist` offers enumerations with less line spacing.
|
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}
|
``` {.lang-tex .hljs}
|
||||||
\section{Ingredients}
|
\sum_{i=1}^{n^2}(x+2)
|
||||||
\begin{compactitem}
|
\prod_{j=1}^{100}(3 \cdot x)
|
||||||
% \item …
|
\lim_{x \rightarrow \infty}(14x^3 - 12)
|
||||||
\end{compactitem}
|
\int\limits_{-12}^{4}(14x^3 - 12)
|
||||||
\section{Preparation}
|
|
||||||
\begin{compactenum}
|
|
||||||
% \item …
|
|
||||||
\end{compactenum}
|
|
||||||
\section{Glossary}
|
|
||||||
\begin{compactdesc}
|
|
||||||
% \item …
|
|
||||||
\end{compactdesc}
|
|
||||||
```
|
```
|
||||||
|
|
||||||
@preview
|
<p data-category="Caution!">Don't use `\limits` inline.</p>
|
||||||

|
|
||||||
|
|
||||||
@slide(layout=extra-content-and-preview)
|
|
||||||
|
@preview
|
||||||
|

|
||||||
|
|
||||||
|
|
||||||
|
@slide(layout=extra-content-only)
|
||||||
|
|
||||||
@title
|
@title
|
||||||
In-line enumerations
|
Set-builder notation
|
||||||
|
|
||||||
@content
|
@content
|
||||||
Another feature provided by `paralist` enables us to integrate enumerations into paragraphs.
|
In certain situations, it is more adequate to use textual predicates or long function names within the set builder notation.
|
||||||
|
|
||||||
``` {.lang-tex .hljs}
|
This is where `\mathrm{}` comes into play.
|
||||||
The following herbs are % …
|
|
||||||
\begin{inparaitem}
|
|
||||||
\item lovage
|
|
||||||
\item parsley
|
|
||||||
\item chives
|
|
||||||
\end{inparaitem}
|
|
||||||
```
|
|
||||||
|
|
||||||
Of course, there is an accompanying list type called `inparaenum` for ordered lists.
|
<p style="text-align: center;">$\left\lbrace x \mid frequency(x) \geq 20\right\rbrace$</p>
|
||||||
|
<p style="text-align: center;">$\left\lbrace x \mid \mathrm{frequency}(x) \geq 20\right\rbrace$</p>
|
||||||
|
|
||||||
@preview
|
``` {.lang-tex .hljs .fragment}
|
||||||
<img class="thin-padding" src="svg/chapter-08/paralist-extended-english-crop.svg"/>
|
$\left\lbrace x \mid \mathrm{frequency} …
|
||||||
|
```
|
||||||
|
|
||||||
@slide(layout=extra-content-and-preview)
|
|
||||||
|
|
||||||
@title
|
|
||||||
List styles
|
|
||||||
|
|
||||||
@content
|
|
||||||
The list style type can be set using the optional parameter `label`.
|
|
||||||
To accomplish this, we need to include the package `enumitem` first.
|
|
||||||
|
|
||||||
``` {.lang-tex .hljs}
|
|
||||||
% Roman numerals
|
|
||||||
\begin{enumerate}[label=\roman*]
|
|
||||||
% …
|
|
||||||
% Arabic numerals
|
|
||||||
\begin{enumerate}[label=\arabic*]
|
|
||||||
% …
|
|
||||||
% Alphabetical
|
|
||||||
\begin{enumerate}[label=\alph*]
|
|
||||||
% …
|
|
||||||
```
|
|
||||||
|
|
||||||
@preview
|
|
||||||

|
|
||||||
@ -4,225 +4,110 @@
|
|||||||
9
|
9
|
||||||
|
|
||||||
@title
|
@title
|
||||||
Mathematische Formeln
|
Grafiken
|
||||||
|
|
||||||
@slide(layout=content-and-preview)
|
|
||||||
|
|
||||||
@title
|
|
||||||
Formel-Umgebungen 🧮
|
|
||||||
|
|
||||||
@content
|
|
||||||
``` {.lang-tex .hljs}
|
|
||||||
$2 \sqrt{\frac{\pi^2}{3} \cdot c_2}$
|
|
||||||
```
|
|
||||||
|
|
||||||
Mathematische Formeln können **nur im sogenannten Mathmode** gesetzt werden, der inline durch zwei Dollarzeichen aktiviert wird. Außerdem gibt es eine Blockumgebung:
|
|
||||||
|
|
||||||
``` {.lang-tex .hljs}
|
|
||||||
\begin{equation}
|
|
||||||
2 \sqrt{\frac{\pi^2}{3} \cdot c_2}
|
|
||||||
\end{equation}
|
|
||||||
```
|
|
||||||
|
|
||||||
Pakete: `amsmath`, `amsthm`, `amssymb`, `mathtools`
|
|
||||||
|
|
||||||
@preview
|
|
||||||

|
|
||||||
|
|
||||||
@slide(layout=content-only)
|
@slide(layout=content-only)
|
||||||
|
|
||||||
@title
|
@title
|
||||||
Einige Beispiele
|
Grafiken abbilden <span class="emoji">🖼️</span>
|
||||||
|
|
||||||
@content
|
@content
|
||||||
|
Um Grafiken darzustellen, muss das Paket `graphicx` eingebunden werden.
|
||||||
|
|
||||||
|
``` {.lang-tex .hljs}
|
||||||
|
\begin{figure}
|
||||||
|
\includegraphics{<dateipfad>}
|
||||||
|
\caption[<kurztitel (abbildungsver-
|
||||||
|
zeichnis)>]{<bildunterschrift>}
|
||||||
|
\end{figure}
|
||||||
|
```
|
||||||
|
|
||||||
|
Bildgröße angeben:
|
||||||
|
|
||||||
|
``` {.lang-tex .hljs}
|
||||||
|
\includegraphics[width=0.5\textwidth,
|
||||||
|
height=5cm]{<dateipfad>}
|
||||||
|
```
|
||||||
|
|
||||||
|
|
||||||
|
@slide(layout=content-only)
|
||||||
|
|
||||||
|
@title
|
||||||
|
Positionierung auf der Seite
|
||||||
|
|
||||||
|
@content
|
||||||
|
|
||||||
|
``` {.lang-tex .hljs}
|
||||||
|
\begin{figure}[<positionskürzel>]
|
||||||
|
```
|
||||||
|
|
||||||
|
LaTeX positioniert Grafiken automatisch. Durch Kürzel können wir unsere Präferenzen (auch in Kombination) angeben.
|
||||||
|
|
||||||
|
|
||||||
<table>
|
<table>
|
||||||
<tr>
|
<tr>
|
||||||
<th>Quelltext</th>
|
<th style="min-width:4em">Kürzel</th>
|
||||||
<th>Ergebnis</th>
|
<th>Position</th>
|
||||||
</tr>
|
</tr>
|
||||||
<tr class="fragment">
|
<tr class="fragment">
|
||||||
<td>`\sum_{i=1}^{n}x^2`</td>
|
<td>h</td>
|
||||||
<td>$\sum_{i=1}^{n} x^2$</td>
|
<td>hier, wenn es dir recht ist</td>
|
||||||
</tr>
|
</tr>
|
||||||
<tr class="fragment">
|
<tr class="fragment">
|
||||||
<td>`12 \leq 4 x^2 + 13`</td>
|
<td>t</td>
|
||||||
<td>$12 \leq 4 x^2 + 13$</td>
|
<td>oberer Seitenrand (top)</td>
|
||||||
</tr>
|
</tr>
|
||||||
<tr class="fragment">
|
<tr class="fragment">
|
||||||
<td>`{n \choose k}`</td>
|
<td>b</td>
|
||||||
<td>${n \choose k}$</td>
|
<td>unterer Seitenrand (bottom)</td>
|
||||||
</tr>
|
</tr>
|
||||||
|
<tr class="fragment">
|
||||||
|
<td>p</td>
|
||||||
|
<td>auf einer eigenen Seite (page)</td>
|
||||||
|
</tr>
|
||||||
|
<tr class="fragment">
|
||||||
|
<td>H</td>
|
||||||
|
<td>Hier, verdammt noch mal! <br />(benötigt Paket `float`)</td>
|
||||||
|
</tr>
|
||||||
</table>
|
</table>
|
||||||
|
|
||||||
|
|
||||||
@slide(layout=content-and-preview)
|
@slide(layout=content-only)
|
||||||
|
|
||||||
@title
|
@title
|
||||||
Ausrichtung von mehreren Gleichungen
|
Zentrierte Anordnung
|
||||||
|
|
||||||
@content
|
@content
|
||||||
Die Umgebung `align` erlaubt es, Gleichungen zum Beispiel am › = ‹ auszurichten.
|
|
||||||
|
|
||||||
``` {.lang-tex .hljs}
|
``` {.lang-tex .hljs}
|
||||||
\begin{align}
|
\begin{figure}[<position>]
|
||||||
13 \cdot (4a - 3)^2 &= 13 … \\
|
\begin{center}
|
||||||
&= 208a^2 - 312a + 117
|
\includegraphics{<dateipfad>}
|
||||||
\end{align}
|
\end{center}
|
||||||
|
\end{figure}
|
||||||
```
|
```
|
||||||
|
|
||||||
* ++ Ausgerichtet wird am ›`&`‹-Zeichen.
|
Alternativ:
|
||||||
* ++ Zeilenumbrüche werden mit ›`\\`‹ markiert.
|
|
||||||
* ++ Die Nummerierung kann bei `align` und `equation` durch durch ein Sternchen nach dem Umgebungsnamen (z. B. `\begin{align*}` und `\end{align*}`) unterdrückt werden.
|
|
||||||
|
|
||||||
@preview
|
``` {.lang-tex .hljs}
|
||||||

|
\begin{figure}[<position>]
|
||||||
|
\centering
|
||||||
|
\includegraphics{<dateipfad>}
|
||||||
|
\end{figure}
|
||||||
|
```
|
||||||
|
|
||||||
|
|
||||||
@slide(layout=task-without-number)
|
@slide(layout=task)
|
||||||
|
|
||||||
@task-number
|
@task-number
|
||||||
9a
|
9
|
||||||
|
|
||||||
@title
|
@title
|
||||||
Formeln setzen
|
Grafiken einfügen
|
||||||
|
|
||||||
@content
|
@content
|
||||||
Setzt die folgenden Formeln in der Datei `exercises/maths/math-formulas.tex`.
|
* Im Ordner `exercises/graphics` findet ihr eine Bilddatei namens `latex-logo.png`.
|
||||||
|
* Fügt sie **genau** unterhalb dieser Aufgabenstellung im Skript ein.
|
||||||
| Bedeutung | Ergebnis |
|
* Das Bild soll **zentriert** auf der Seite eingebunden werden.
|
||||||
|-----------|----------|
|
* Fügt außerdem eine **Bildunterschrift** ein.
|
||||||
| Fallbeschleunigung (Deutschland) | $9,81\,\frac{m}{s^2}$ |
|
* Passt die **Größe** des Bildes an Breite der Seite (`\textwidth`) an.
|
||||||
| pq-Formel | $x_{1,2} = - \frac{p}{2} \pm \sqrt{\left(\frac{p}{2}\right)^2 - q}$ |
|
|
||||||
| Mitternachtsformel | $x_{1,2} = \frac{-b \pm \sqrt{b^2 - 4ac}}{2a}$ |
|
|
||||||
| Catalansche Zahlen | $C_n = \frac{1}{n+1} {2n \choose n} = \frac{(2n)!}{(n+1)!n!}$ |
|
|
||||||
|
|
||||||
@slide(layout=task-without-number)
|
|
||||||
|
|
||||||
@task-number
|
|
||||||
9b
|
|
||||||
|
|
||||||
@title
|
|
||||||
Formeln setzen
|
|
||||||
|
|
||||||
@content
|
|
||||||
Setzt die folgenden Formeln in der Datei `exercises/maths/math-formulas.tex`.
|
|
||||||
|
|
||||||
| Bedeutung | Ergebnis |
|
|
||||||
|-----------|----------|
|
|
||||||
| Definition der Fakultät | $n! = \prod_{i=1}^{n} i$ |
|
|
||||||
| Menge aller ungeraden natürlichen Zahlen | $\{ x \mid x \in \mathbb{N}, \mathrm{ungerade}(x) \}$ |
|
|
||||||
| Elimination $\neg\exists x$ | $\neg\exists x . p(x) \Leftrightarrow \forall x . \neg p(x)$ |
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
@slide(layout=extra-content-only)
|
|
||||||
|
|
||||||
@title
|
|
||||||
Weitere Beispiele
|
|
||||||
|
|
||||||
@content
|
|
||||||
<table>
|
|
||||||
<tr>
|
|
||||||
<th>Quelltext</th>
|
|
||||||
<th>Ergebnis</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=extra-content-only)
|
|
||||||
|
|
||||||
@title
|
|
||||||
Mitwachsende Klammern
|
|
||||||
|
|
||||||
@content
|
|
||||||
<table>
|
|
||||||
<tr>
|
|
||||||
<th>Quelltext</th>
|
|
||||||
<th>Ergebnis</th>
|
|
||||||
</tr>
|
|
||||||
<tr>
|
|
||||||
<td>`\left( \frac{1}{2} \right)`</td>
|
|
||||||
<td>$\left( \frac{1}{2} \right)$</td>
|
|
||||||
</tr>
|
|
||||||
<tr>
|
|
||||||
<td>`\left[ \frac{1}{2} \right]`</td>
|
|
||||||
<td>$\left[ \frac{1}{2} \right]$</td>
|
|
||||||
</tr>
|
|
||||||
<tr>
|
|
||||||
<td>`\left\lbrace \frac{1}{2} \right\rbrace`</td>
|
|
||||||
<td>$\left\lbrace \frac{1}{2} \right\rbrace$</td>
|
|
||||||
</tr>
|
|
||||||
</table>
|
|
||||||
|
|
||||||
|
|
||||||
``` {.lang-tex .hljs}
|
|
||||||
$4 \cdot \left( \frac{1}{2} % …
|
|
||||||
```
|
|
||||||
|
|
||||||
<p 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=extra-content-and-preview)
|
|
||||||
|
|
||||||
@title
|
|
||||||
Darstellung von Grenzen
|
|
||||||
|
|
||||||
@content
|
|
||||||
Mit dem Befehl `\limits` lassen sich die Grenzen von Integralen unter und über dem Integralzeichen darstellen. Bei Summen, Produkten und Grenzwerten geschieht das automatisch.
|
|
||||||
|
|
||||||
``` {.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="Achtung!">Der Einsatz von `\limits` sollte im Fließtext vermieden werden.</p>
|
|
||||||
|
|
||||||
@preview
|
|
||||||

|
|
||||||
|
|
||||||
|
|
||||||
@slide(layout=extra-content-only)
|
|
||||||
|
|
||||||
@title
|
|
||||||
Mengenschreibweise
|
|
||||||
|
|
||||||
@content
|
|
||||||
Manchmal ist es notwendig, im Zusammenhang mit der Mengenschreibweise Prädikate unter Verwendung von textuellen Beschreibungen oder längeren Funktionsnamen zu definieren.
|
|
||||||
|
|
||||||
Für diesen Fall gibt es den Befehl `\mathrm{}`.
|
|
||||||
|
|
||||||
<p style="text-align: center;">$\left\lbrace x \mid tiefe(x) \geq 20\right\rbrace$</p>
|
|
||||||
<p style="text-align: center;">$\left\lbrace x \mid \mathrm{tiefe}(x) \geq 20\right\rbrace$</p>
|
|
||||||
|
|
||||||
``` {.lang-tex .hljs}
|
|
||||||
$\left\lbrace x \mid \mathrm{tiefe}(x) …
|
|
||||||
```
|
|
||||||
|
|||||||
@ -4,230 +4,110 @@
|
|||||||
9
|
9
|
||||||
|
|
||||||
@title
|
@title
|
||||||
Typesetting mathematics
|
Graphics
|
||||||
|
|
||||||
@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)
|
@slide(layout=content-only)
|
||||||
|
|
||||||
@title
|
@title
|
||||||
Examples
|
Including graphics <span class="emoji">🖼️</span>
|
||||||
|
|
||||||
@content
|
@content
|
||||||
|
To display graphics, we need the `graphicx` package.
|
||||||
|
|
||||||
|
``` {.lang-tex .hljs}
|
||||||
|
\begin{figure}
|
||||||
|
\includegraphics{<file path>}
|
||||||
|
\caption[<short caption (table of
|
||||||
|
figures)>]{<full caption>}
|
||||||
|
\end{figure}
|
||||||
|
```
|
||||||
|
|
||||||
|
Specifying the size:
|
||||||
|
|
||||||
|
``` {.lang-tex .hljs}
|
||||||
|
\includegraphics[width=0.5\textwidth,
|
||||||
|
height=5cm]{<file path>}
|
||||||
|
```
|
||||||
|
|
||||||
|
|
||||||
|
@slide(layout=content-only)
|
||||||
|
|
||||||
|
@title
|
||||||
|
Layout on the page
|
||||||
|
|
||||||
|
@content
|
||||||
|
|
||||||
|
``` {.lang-tex .hljs}
|
||||||
|
\begin{figure}[<position code>]
|
||||||
|
```
|
||||||
|
|
||||||
|
LaTeX places graphics automatically. With position codes, we can express our preferences (they can be combined as well).
|
||||||
|
|
||||||
|
|
||||||
<table>
|
<table>
|
||||||
<tr>
|
<tr>
|
||||||
<th>source code</th>
|
<th style="min-width:4em">code</th>
|
||||||
<th>result</th>
|
<th>position</th>
|
||||||
</tr>
|
</tr>
|
||||||
<tr class="fragment">
|
<tr class="fragment">
|
||||||
<td>`\sum_{i=1}^{n}x^2`</td>
|
<td>h</td>
|
||||||
<td>$\sum_{i=1}^{n} x^2$</td>
|
<td>here, if you don’t mind</td>
|
||||||
</tr>
|
</tr>
|
||||||
<tr class="fragment">
|
<tr class="fragment">
|
||||||
<td>`12 \leq 4 x^2 + 13`</td>
|
<td>t</td>
|
||||||
<td>$12 \leq 4 x^2 + 13$</td>
|
<td>top of the page</td>
|
||||||
</tr>
|
</tr>
|
||||||
<tr class="fragment">
|
<tr class="fragment">
|
||||||
<td>`{n \choose k}`</td>
|
<td>b</td>
|
||||||
<td>${n \choose k}$</td>
|
<td>bottom of the page</td>
|
||||||
</tr>
|
</tr>
|
||||||
|
<tr class="fragment">
|
||||||
|
<td>p</td>
|
||||||
|
<td>on its own page</td>
|
||||||
|
</tr>
|
||||||
|
<tr class="fragment">
|
||||||
|
<td>H</td>
|
||||||
|
<td>Here, for God’s sake! <br />(`float` package required)</td>
|
||||||
|
</tr>
|
||||||
</table>
|
</table>
|
||||||
|
|
||||||
|
|
||||||
@slide(layout=content-and-preview)
|
@slide(layout=content-only)
|
||||||
|
|
||||||
@title
|
@title
|
||||||
Aligning a group of equations
|
Centred alignment
|
||||||
|
|
||||||
@content
|
@content
|
||||||
The `align` environment permits us to align equations at certain positions like the ‘ = ’ character.
|
|
||||||
|
|
||||||
``` {.lang-tex .hljs}
|
``` {.lang-tex .hljs}
|
||||||
\begin{align}
|
\begin{figure}[<position>]
|
||||||
13 \cdot (4a - 3)^2 &= 13 … \\
|
\begin{center}
|
||||||
&= 208a^2 - 312a + 117
|
\includegraphics{<path-to-file>}
|
||||||
\end{align}
|
\end{center}
|
||||||
|
\end{figure}
|
||||||
```
|
```
|
||||||
|
|
||||||
* ++ The equations will be aligned with respect to the ampersands (‘`&`’).
|
Alternatively:
|
||||||
* ++ 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
|
``` {.lang-tex .hljs}
|
||||||

|
\begin{figure}[<position>]
|
||||||
|
\centering
|
||||||
|
\includegraphics{<path-to-file>}
|
||||||
|
\end{figure}
|
||||||
|
```
|
||||||
|
|
||||||
|
|
||||||
@slide(layout=task-without-number)
|
@slide(layout=task)
|
||||||
|
|
||||||
@task-number
|
@task-number
|
||||||
9a
|
9
|
||||||
|
|
||||||
@title
|
@title
|
||||||
Typesetting mathematics
|
Inserting graphics
|
||||||
|
|
||||||
@content
|
@content
|
||||||
Code up the following formulas in the file `exercises/maths/math-formulas.tex`.
|
* In the directory `exercises/graphics` you can find an image file named `latex-logo.png`.
|
||||||
|
* **Include** the figure in `exercises/graphics/graphics.tex` and place it **exactly** where you include it.
|
||||||
| Meaning | Result |
|
* The image shall be **centered**.
|
||||||
|---------|--------|
|
* Additionally, add a **caption** for the figure.
|
||||||
| Gravitational acceleration | $9,81\,\frac{m}{s^2}$ |
|
* Adapt the **width** of the image to the width of the text (`\textwidth`).
|
||||||
| Formula to solve quadratic equations | $x_{1,2} = - \frac{p}{2} \pm \sqrt{\left(\frac{p}{2}\right)^2 - q}$ |
|
|
||||||
| Another formula to solve quadratic equations | $x_{1,2} = \frac{-b \pm \sqrt{b^2 - 4ac}}{2a}$ |
|
|
||||||
| Catalan numbers | $C_n = \frac{1}{n+1} {2n \choose n} = \frac{(2n)!}{(n+1)!n!}$ |
|
|
||||||
|
|
||||||
|
|
||||||
@slide(layout=task-without-number)
|
|
||||||
|
|
||||||
@task-number
|
|
||||||
9b
|
|
||||||
|
|
||||||
@title
|
|
||||||
Typesetting mathematics
|
|
||||||
|
|
||||||
@content
|
|
||||||
Code up the following formulas in the file `exercises/maths/math-formulas.tex`.
|
|
||||||
|
|
||||||
| Meaning | Result |
|
|
||||||
|---------|--------|
|
|
||||||
| Definition of factorial | $n! = \prod_{i=1}^{n} i$ |
|
|
||||||
| Set of all odd natural numbers | $\{ x \mid x \in \mathbb{N}, \mathrm{odd}(x) \}$ |
|
|
||||||
| Elimination $\neg\exists x$ | $\neg\exists x . p(x) \Leftrightarrow \forall x . \neg p(x)$ |
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
@slide(layout=extra-content-only)
|
|
||||||
|
|
||||||
@title
|
|
||||||
More examples
|
|
||||||
|
|
||||||
@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=extra-content-only)
|
|
||||||
|
|
||||||
@title
|
|
||||||
Height-adapting braces
|
|
||||||
|
|
||||||
@content
|
|
||||||
<table>
|
|
||||||
<tr>
|
|
||||||
<th>source code</th>
|
|
||||||
<th>result</th>
|
|
||||||
</tr>
|
|
||||||
<tr>
|
|
||||||
<td>`\left( \frac{1}{2} \right)`</td>
|
|
||||||
<td>$\left( \frac{1}{2} \right)$</td>
|
|
||||||
</tr>
|
|
||||||
<tr>
|
|
||||||
<td>`\left[ \frac{1}{2} \right]`</td>
|
|
||||||
<td>$\left[ \frac{1}{2} \right]$</td>
|
|
||||||
</tr>
|
|
||||||
<tr>
|
|
||||||
<td>`\left\lbrace \frac{1}{2} \right\rbrace`</td>
|
|
||||||
<td>$\left\lbrace \frac{1}{2} \right\rbrace$</td>
|
|
||||||
</tr>
|
|
||||||
</table>
|
|
||||||
|
|
||||||
|
|
||||||
``` {.lang-tex .hljs}
|
|
||||||
$4 \cdot \left( \frac{1}{2} % …
|
|
||||||
```
|
|
||||||
|
|
||||||
<p 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=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)
|
|
||||||
```
|
|
||||||
|
|
||||||
<p data-category="Caution!">Don't use `\limits` inline.</p>
|
|
||||||
|
|
||||||
|
|
||||||
@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 `\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;">$\left\lbrace x \mid \mathrm{frequency}(x) \geq 20\right\rbrace$</p>
|
|
||||||
|
|
||||||
``` {.lang-tex .hljs .fragment}
|
|
||||||
$\left\lbrace x \mid \mathrm{frequency} …
|
|
||||||
```
|
|
||||||
|
|||||||
@ -4,110 +4,230 @@
|
|||||||
10
|
10
|
||||||
|
|
||||||
@title
|
@title
|
||||||
Grafiken
|
Tabellen
|
||||||
|
|
||||||
|
|
||||||
@slide(layout=content-only)
|
@slide(layout=content-only)
|
||||||
|
|
||||||
@title
|
@title
|
||||||
Grafiken abbilden <span class="emoji">🖼️</span>
|
Grundstruktur <span class="emoji">🗒️</span>
|
||||||
|
|
||||||
@content
|
@content
|
||||||
Um Grafiken darzustellen, muss das Paket `graphicx` eingebunden werden.
|
Für typografisch schöne Tabellen nutzen wir das Paket `booktabs`.
|
||||||
|
|
||||||
``` {.lang-tex .hljs}
|
``` {.hljs .lang-tex}
|
||||||
\begin{figure}
|
\usepackage{booktabs}
|
||||||
\includegraphics{<dateipfad>}
|
|
||||||
\caption[<kurztitel (abbildungsver-
|
|
||||||
zeichnis)>]{<bildunterschrift>}
|
|
||||||
\end{figure}
|
|
||||||
```
|
```
|
||||||
|
|
||||||
Bildgröße angeben:
|
``` {.hljs .lang-tex}
|
||||||
|
\begin{table}[<position>]
|
||||||
``` {.lang-tex .hljs}
|
\begin{tabular}{<spaltendefinition>}
|
||||||
\includegraphics[width=0.5\textwidth,
|
% Tabelleninhalt
|
||||||
height=5cm]{<dateipfad>}
|
\end{tabular}
|
||||||
|
\caption{<tabellenunterschrift>}
|
||||||
|
\end{table}
|
||||||
```
|
```
|
||||||
|
|
||||||
|
Die Positionierung erfolgt analog zu Grafiken.
|
||||||
|
|
||||||
@slide(layout=content-only)
|
|
||||||
|
@slide(layout=content-and-preview)
|
||||||
|
|
||||||
@title
|
@title
|
||||||
Positionierung auf der Seite
|
Spaltendefinitionen
|
||||||
|
|
||||||
@content
|
@content
|
||||||
|
``` {.hljs .lang-tex}
|
||||||
``` {.lang-tex .hljs}
|
\begin{tabular}{lrcl}
|
||||||
\begin{figure}[<positionskürzel>]
|
% Tabelleninhalt
|
||||||
|
\end{tabular}
|
||||||
```
|
```
|
||||||
|
|
||||||
LaTeX positioniert Grafiken automatisch. Durch Kürzel können wir unsere Präferenzen (auch in Kombination) angeben.
|
|
||||||
|
|
||||||
|
|
||||||
<table>
|
<table>
|
||||||
<tr>
|
<tr>
|
||||||
<th style="min-width:4em">Kürzel</th>
|
<th>Kürzel</th>
|
||||||
<th>Position</th>
|
<th>Bedeutung</th>
|
||||||
</tr>
|
</tr>
|
||||||
<tr class="fragment">
|
<tr class="fragment">
|
||||||
<td>h</td>
|
<td>l</td>
|
||||||
<td>hier, wenn es dir recht ist</td>
|
<td>linksbündige Spalte</td>
|
||||||
</tr>
|
</tr>
|
||||||
<tr class="fragment">
|
<tr class="fragment">
|
||||||
<td>t</td>
|
<td>c</td>
|
||||||
<td>oberer Seitenrand (top)</td>
|
<td>zentrierte Spalte</td>
|
||||||
</tr>
|
</tr>
|
||||||
<tr class="fragment">
|
<tr class="fragment">
|
||||||
<td>b</td>
|
<td>r</td>
|
||||||
<td>unterer Seitenrand (bottom)</td>
|
<td>rechtsbündige Spalte</td>
|
||||||
</tr>
|
|
||||||
<tr class="fragment">
|
|
||||||
<td>p</td>
|
|
||||||
<td>auf einer eigenen Seite (page)</td>
|
|
||||||
</tr>
|
|
||||||
<tr class="fragment">
|
|
||||||
<td>H</td>
|
|
||||||
<td>Hier, verdammt noch mal! <br />(benötigt Paket `float`)</td>
|
|
||||||
</tr>
|
</tr>
|
||||||
</table>
|
</table>
|
||||||
|
|
||||||
|
++ Vertikale Trennlinien und doppelte horizontale Linien sind unter Typograph\*innen nicht gern gesehen und sollten vermieden werden.
|
||||||
|
|
||||||
|
@preview
|
||||||
|
{.thin-padding}
|
||||||
|
|
||||||
|
|
||||||
|
@slide(layout=content-and-preview)
|
||||||
|
|
||||||
|
@title
|
||||||
|
Tabelleninhalt
|
||||||
|
|
||||||
|
@content
|
||||||
|
``` {.hljs .lang-tex}
|
||||||
|
\begin{tabular}{lll}
|
||||||
|
\toprule
|
||||||
|
Spalte 1 & Spalte 2 & Spalte 3 \\
|
||||||
|
\midrule
|
||||||
|
Inhalt a & Inhalt b & Inhalt c \\
|
||||||
|
Inhalt e & Inhalt f & Inhalt g \\
|
||||||
|
Inhalt i & Inhalt j & Inhalt k \\
|
||||||
|
\bottomrule
|
||||||
|
\end{tabular}
|
||||||
|
```
|
||||||
|
* ++ Zellen werden durch ›`&`‹ abgetrennt.
|
||||||
|
* ++ Reihen werden durch ›`\\`‹ beendet.
|
||||||
|
* ++ `\toprule`, `\midrule` und `\bottomrule` strukturieren die Tabelle.
|
||||||
|
|
||||||
|
@preview
|
||||||
|
{.thin-padding}
|
||||||
|
|
||||||
|
|
||||||
|
@slide(layout=wide-content)
|
||||||
|
|
||||||
|
@title
|
||||||
|
Die gesamte Tabelle
|
||||||
|
|
||||||
|
@content
|
||||||
|
``` {.hljs .lang-tex}
|
||||||
|
\begin{table}[h]
|
||||||
|
\begin{tabular}{lrcl}
|
||||||
|
\toprule
|
||||||
|
Sprache & Autor & Erscheinungsjahr & Dateiendung \\
|
||||||
|
\midrule
|
||||||
|
C++ & Bjarne Stroustrup & 1985 & .cpp \\
|
||||||
|
Java & James Gosling & 1998 & .java \\
|
||||||
|
Python & Guido van Rossum & 1991 & .py \\
|
||||||
|
\bottomrule
|
||||||
|
\end{tabular}
|
||||||
|
\caption{Bekannte Programmiersprachen}
|
||||||
|
\end{table}
|
||||||
|
```
|
||||||
|
|
||||||
|
<p data-category="Hinweis">Mit `@{}` vor und nach einer Spaltendefinition wird der umgebende Weißraum unterdrückt.</p>
|
||||||
|
|
||||||
|
<p data-category="Beispiel">`\begin{tabular}{@{}lrcl@{}}` beschränkt die Linien auf die Breite des Tabelleninhalts.</p>
|
||||||
|
|
||||||
|
|
||||||
@slide(layout=content-only)
|
@slide(layout=content-only)
|
||||||
|
|
||||||
@title
|
@title
|
||||||
Zentrierte Anordnung
|
Mehr Komfort
|
||||||
|
|
||||||
@content
|
@content
|
||||||
``` {.lang-tex .hljs}
|
Der [Tables Generator](https://tablesgenerator.com/) ist ein wunderbares Werkzeug, um schnell Tabellen verschiedener Formate zu erstellen.
|
||||||
\begin{figure}[<position>]
|
|
||||||
\begin{center}
|
|
||||||
\includegraphics{<dateipfad>}
|
|
||||||
\end{center}
|
|
||||||
\end{figure}
|
|
||||||
```
|
|
||||||
|
|
||||||
Alternativ:
|
[](https://tablesgenerator.com/)
|
||||||
|
|
||||||
``` {.lang-tex .hljs}
|
|
||||||
\begin{figure}[<position>]
|
|
||||||
\centering
|
|
||||||
\includegraphics{<dateipfad>}
|
|
||||||
\end{figure}
|
|
||||||
```
|
|
||||||
|
|
||||||
|
|
||||||
@slide(layout=task)
|
@slide(layout=task)
|
||||||
|
|
||||||
@task-number
|
@task-number
|
||||||
11
|
10
|
||||||
|
|
||||||
@title
|
@title
|
||||||
Grafiken einfügen
|
Tabellen setzen
|
||||||
|
|
||||||
@content
|
@content
|
||||||
* Im Ordner `exercises/graphics` findet ihr eine Bilddatei namens `latex-logo.png`.
|
* Die Liste in der Datei `exercises/tables/tables.tex` enthält Infos zu ein paar Lehrveranstaltung an der Fakultät WIAI.
|
||||||
* Fügt sie **genau** unterhalb dieser Aufgabenstellung im Skript ein.
|
* Wandelt die Liste in eine **Tabelle** um.
|
||||||
* Das Bild soll **zentriert** auf der Seite eingebunden werden.
|
* Die Tabelle soll Spalten für den *Namen*, das *Kürzel* und das *Semester* der Vorlesungen haben.
|
||||||
* Fügt außerdem eine **Bildunterschrift** ein.
|
* Fügt außerdem eine **zentrierte Spalte** ganz links in der Tabelle hinzu, in der ihr die Lehrveranstaltungen **nummeriert**.
|
||||||
* Passt die **Größe** des Bildes an Breite der Seite (`\textwidth`) an.
|
|
||||||
|
|
||||||
|
|
||||||
|
@slide(layout=extra-content-only)
|
||||||
|
|
||||||
|
@title
|
||||||
|
Besonders lange Tabellen
|
||||||
|
|
||||||
|
@content
|
||||||
|
Tabellen, die über eine Seite hinaus gehen, werden von `tabular` einfach abgeschnitten. Die Lösung bietet hier das Paket `longtable`:
|
||||||
|
|
||||||
|
``` {.hljs .lang-tex}
|
||||||
|
\usepackage{longtable}
|
||||||
|
```
|
||||||
|
|
||||||
|
``` {.hljs .lang-tex}
|
||||||
|
\begin{longtable}{<spaltendefinition>}
|
||||||
|
% Tabelleninhalt
|
||||||
|
\caption{<tabellenunterschrift>}
|
||||||
|
\label{<label>}
|
||||||
|
\end{longtable}
|
||||||
|
```
|
||||||
|
|
||||||
|
|
||||||
|
@slide(layout=extra-content-only)
|
||||||
|
|
||||||
|
@title
|
||||||
|
Hinweise zu `longtable`
|
||||||
|
|
||||||
|
@content
|
||||||
|
``` {.hljs .lang-tex}
|
||||||
|
\begin{longtable}{<spaltendefinition>}
|
||||||
|
% Tabelleninhalt
|
||||||
|
\caption{<tabellenunterschrift>}
|
||||||
|
\label{<label>}
|
||||||
|
\end{longtable}
|
||||||
|
```
|
||||||
|
* Die `longtable`-Umgebung vereint die `tabular`-Umgebung und die `table`-Umgebung.
|
||||||
|
* Titel und Label können deshalb direkt unter dem Tabelleninhalt stehen.
|
||||||
|
* Sofern das Paket `booktabs` eingebunden ist, stehen seine Features auch in `longtable` zur Verfügung.
|
||||||
|
|
||||||
|
|
||||||
|
@slide(layout=extra-content-only)
|
||||||
|
|
||||||
|
@title
|
||||||
|
Besonders breite Tabellen
|
||||||
|
|
||||||
|
@content
|
||||||
|
Sollte die Tabelle einmal zu breit für eine Seite werden, kann sie auch im Querformat dargestellt werden:
|
||||||
|
|
||||||
|
``` {.hljs .lang-tex}
|
||||||
|
\usepackage{rotating}
|
||||||
|
```
|
||||||
|
|
||||||
|
``` {.hljs .lang-tex}
|
||||||
|
\begin{sidewaystable}[<position>]
|
||||||
|
\begin{tabular}{<spaltendef.>}
|
||||||
|
% Tabelleninhalt
|
||||||
|
\end{tabular}
|
||||||
|
\end{sidewaystable}
|
||||||
|
```
|
||||||
|
|
||||||
|
|
||||||
|
@slide(layout=extra-content-and-preview)
|
||||||
|
|
||||||
|
@title
|
||||||
|
Weiterführendes Beispiel
|
||||||
|
|
||||||
|
@content
|
||||||
|
``` {.hljs .lang-tex}
|
||||||
|
\begin{table}[h]
|
||||||
|
\begin{tabular}{llr}
|
||||||
|
\toprule
|
||||||
|
Struktur & \multicolumn{2}{l}{Zeitkomplexität für Zugriff} \\ \cmidrule(r){2-3}
|
||||||
|
& Average & Worst \\
|
||||||
|
\midrule
|
||||||
|
Stack & $\mathcal{O}(n)$ & $\mathcal{O}(n)$ \\
|
||||||
|
Binärbaum & $\mathcal{O}(log(n))$ & $\mathcal{O}(log(n))$ \\
|
||||||
|
AVL-Baum & $\mathcal{O}(log(n))$ & $\mathcal{O}(log(n))$ \\
|
||||||
|
\bottomrule
|
||||||
|
\end{tabular}
|
||||||
|
\end{table}
|
||||||
|
```
|
||||||
|
|
||||||
|
[<span class="emoji">🔗</span> Dokumentation zu Booktabs](http://packages.oth-regensburg.de/ctan/macros/latex/contrib/booktabs/booktabs.pdf)
|
||||||
|
|
||||||
|
@preview
|
||||||
|
{.thin-padding}
|
||||||
@ -4,110 +4,233 @@
|
|||||||
10
|
10
|
||||||
|
|
||||||
@title
|
@title
|
||||||
Graphics
|
Tables
|
||||||
|
|
||||||
|
|
||||||
@slide(layout=content-only)
|
@slide(layout=content-only)
|
||||||
|
|
||||||
@title
|
@title
|
||||||
Including graphics <span class="emoji">🖼️</span>
|
Basic structure <span class="emoji">🗒️</span>
|
||||||
|
|
||||||
@content
|
@content
|
||||||
To display graphics, we need the `graphicx` package.
|
For typographically pleasing tables, we use the `booktabs` package.
|
||||||
|
|
||||||
``` {.lang-tex .hljs}
|
``` {.hljs .lang-tex}
|
||||||
\begin{figure}
|
\usepackage{booktabs}
|
||||||
\includegraphics{<file path>}
|
|
||||||
\caption[<short caption (table of
|
|
||||||
figures)>]{<full caption>}
|
|
||||||
\end{figure}
|
|
||||||
```
|
```
|
||||||
|
|
||||||
Specifying the size:
|
``` {.hljs .lang-tex}
|
||||||
|
\begin{table}[<position>]
|
||||||
``` {.lang-tex .hljs}
|
\begin{tabular}{<column definition>}
|
||||||
\includegraphics[width=0.5\textwidth,
|
% table content
|
||||||
height=5cm]{<file path>}
|
\end{tabular}
|
||||||
|
\caption{<caption>}
|
||||||
|
\end{table}
|
||||||
```
|
```
|
||||||
|
|
||||||
|
Positioning works just like with graphics.
|
||||||
|
|
||||||
@slide(layout=content-only)
|
|
||||||
|
@slide(layout=content-and-preview)
|
||||||
|
|
||||||
@title
|
@title
|
||||||
Layout on the page
|
Column definitions
|
||||||
|
|
||||||
@content
|
@content
|
||||||
|
``` {.hljs .lang-tex}
|
||||||
``` {.lang-tex .hljs}
|
\begin{tabular}{lrcl}
|
||||||
\begin{figure}[<position code>]
|
% table content
|
||||||
|
\end{tabular}
|
||||||
```
|
```
|
||||||
|
|
||||||
LaTeX places graphics automatically. With position codes, we can express our preferences (they can be combined as well).
|
|
||||||
|
|
||||||
|
|
||||||
<table>
|
<table>
|
||||||
<tr>
|
<tr>
|
||||||
<th style="min-width:4em">code</th>
|
<th>letter</th>
|
||||||
<th>position</th>
|
<th>meaning</th>
|
||||||
</tr>
|
</tr>
|
||||||
<tr class="fragment">
|
<tr class="fragment">
|
||||||
<td>h</td>
|
<td>l</td>
|
||||||
<td>here, if you don’t mind</td>
|
<td>left-justified column</td>
|
||||||
</tr>
|
</tr>
|
||||||
<tr class="fragment">
|
<tr class="fragment">
|
||||||
<td>t</td>
|
<td>c</td>
|
||||||
<td>top of the page</td>
|
<td>centred column</td>
|
||||||
</tr>
|
</tr>
|
||||||
<tr class="fragment">
|
<tr class="fragment">
|
||||||
<td>b</td>
|
<td>r</td>
|
||||||
<td>bottom of the page</td>
|
<td>right-justified column</td>
|
||||||
</tr>
|
|
||||||
<tr class="fragment">
|
|
||||||
<td>p</td>
|
|
||||||
<td>on its own page</td>
|
|
||||||
</tr>
|
|
||||||
<tr class="fragment">
|
|
||||||
<td>H</td>
|
|
||||||
<td>Here, for God’s sake! <br />(`float` package required)</td>
|
|
||||||
</tr>
|
</tr>
|
||||||
</table>
|
</table>
|
||||||
|
|
||||||
|
++ Vertical separator lines and double horizontal lines are frowned upon by typographers and should be avoided.
|
||||||
|
|
||||||
|
@preview
|
||||||
|
{.thin-padding}
|
||||||
|
|
||||||
|
|
||||||
|
@slide(layout=content-and-preview)
|
||||||
|
|
||||||
|
@title
|
||||||
|
Table content
|
||||||
|
|
||||||
|
@content
|
||||||
|
``` {.hljs .lang-tex}
|
||||||
|
\begin{tabular}{lll}
|
||||||
|
\toprule
|
||||||
|
Column 1 & Column 2 & Column 3 \\
|
||||||
|
\midrule
|
||||||
|
Content a & Content b & Content c \\
|
||||||
|
Content e & Content f & Content g \\
|
||||||
|
Content i & Content j & Content k \\
|
||||||
|
\bottomrule
|
||||||
|
\end{tabular}
|
||||||
|
```
|
||||||
|
* ++ Columns are separated by ’`&`’.
|
||||||
|
* ++ Rows are ended by ‘`\\`’.
|
||||||
|
* ++ `\toprule`, `\midrule` and `\bottomrule` structure the table.
|
||||||
|
|
||||||
|
@preview
|
||||||
|
{.thin-padding}
|
||||||
|
|
||||||
|
|
||||||
|
@slide(layout=wide-content)
|
||||||
|
|
||||||
|
@title
|
||||||
|
The entire table
|
||||||
|
|
||||||
|
@content
|
||||||
|
``` {.hljs .lang-tex}
|
||||||
|
\begin{table}[h]
|
||||||
|
\begin{tabular}{lrcl}
|
||||||
|
\toprule
|
||||||
|
Language & Author & Year & Filename extension \\
|
||||||
|
\midrule
|
||||||
|
C++ & Bjarne Stroustrup & 1985 & .cpp \\
|
||||||
|
Java & James Gosling & 1998 & .java \\
|
||||||
|
Python & Guido van Rossum & 1991 & .py \\
|
||||||
|
\bottomrule
|
||||||
|
\end{tabular}
|
||||||
|
\caption{Well-known programming languages}
|
||||||
|
\end{table}
|
||||||
|
```
|
||||||
|
|
||||||
|
<p data-category="Note">`@{}` to the left and right of a column definition removes the padding of the corresponding column.</p>
|
||||||
|
|
||||||
|
<p data-category="Example">`\begin{tabular}{@{}lrcl@{}}` limits the row separators to the width of the table content</p>
|
||||||
|
|
||||||
|
|
||||||
@slide(layout=content-only)
|
@slide(layout=content-only)
|
||||||
|
|
||||||
@title
|
@title
|
||||||
Centred alignment
|
More comfort
|
||||||
|
|
||||||
@content
|
@content
|
||||||
``` {.lang-tex .hljs}
|
The [Tables Generator](https://tablesgenerator.com/) is a wonderful tool to quickly create tables of different formats.
|
||||||
\begin{figure}[<position>]
|
|
||||||
\begin{center}
|
|
||||||
\includegraphics{<path-to-file>}
|
|
||||||
\end{center}
|
|
||||||
\end{figure}
|
|
||||||
```
|
|
||||||
|
|
||||||
Alternatively:
|
[](https://tablesgenerator.com/)
|
||||||
|
|
||||||
``` {.lang-tex .hljs}
|
|
||||||
\begin{figure}[<position>]
|
|
||||||
\centering
|
|
||||||
\includegraphics{<path-to-file>}
|
|
||||||
\end{figure}
|
|
||||||
```
|
|
||||||
|
|
||||||
|
|
||||||
@slide(layout=task)
|
@slide(layout=task)
|
||||||
|
|
||||||
@task-number
|
@task-number
|
||||||
11
|
10
|
||||||
|
|
||||||
@title
|
@title
|
||||||
Inserting graphics
|
Typesetting tables
|
||||||
|
|
||||||
@content
|
@content
|
||||||
* In the directory `exercises/graphics` you can find an image file named `latex-logo.png`.
|
* The list in file `exercises/tables/tables.tex` stores information on a few modules of the WIAI faculty.
|
||||||
* **Include** the figure in `exercises/graphics/graphics.tex` and place it **exactly** where you include it.
|
* Transform the list into a **table**.
|
||||||
* The image shall be **centered**.
|
* The table shall have colums for the *name*, the *abbreviation* (Kürzel) and the *semester* of the lectures.
|
||||||
* Additionally, add a **caption** for the figure.
|
* Add a **column** with **center-aligned text** on the left side of the table in order to **number** the lectures.
|
||||||
* Adapt the **width** of the image to the width of the text (`\textwidth`).
|
* Add a **caption** for the table.
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
@slide(layout=extra-content-only)
|
||||||
|
|
||||||
|
@title
|
||||||
|
Particularly long tables
|
||||||
|
|
||||||
|
@content
|
||||||
|
Tables that exceed one page are simply cut off by `tabular`. A solution is offered by the `longtable` package:
|
||||||
|
|
||||||
|
``` {.hljs .lang-tex}
|
||||||
|
\usepackage{longtable}
|
||||||
|
```
|
||||||
|
|
||||||
|
``` {.hljs .lang-tex}
|
||||||
|
\begin{longtable}{<column definition>}
|
||||||
|
% table content
|
||||||
|
\caption{<caption>}
|
||||||
|
\label{<label>}
|
||||||
|
\end{longtable}
|
||||||
|
```
|
||||||
|
|
||||||
|
|
||||||
|
@slide(layout=extra-content-only)
|
||||||
|
|
||||||
|
@title
|
||||||
|
Notes on `longtable`
|
||||||
|
|
||||||
|
@content
|
||||||
|
``` {.hljs .lang-tex}
|
||||||
|
\begin{longtable}{<column definition>}
|
||||||
|
% table content
|
||||||
|
\caption{<caption>}
|
||||||
|
\label{<label>}
|
||||||
|
\end{longtable}
|
||||||
|
```
|
||||||
|
* The `longtable` environment merges the `tabular` and `table` environments.
|
||||||
|
* Caption and label can therefore be inserted directly under the table content.
|
||||||
|
* As long as the `booktabs` package is used, its features are also provided in `longtable`.
|
||||||
|
|
||||||
|
|
||||||
|
@slide(layout=extra-content-only)
|
||||||
|
|
||||||
|
@title
|
||||||
|
Particularly wide tables
|
||||||
|
|
||||||
|
@content
|
||||||
|
If you need a table to be wider than a page, you can display it in landscape orientation:
|
||||||
|
|
||||||
|
``` {.hljs .lang-tex}
|
||||||
|
\usepackage{rotating}
|
||||||
|
```
|
||||||
|
|
||||||
|
``` {.hljs .lang-tex}
|
||||||
|
\begin{sidewaystable}[<position>]
|
||||||
|
\begin{tabular}{<column def.>}
|
||||||
|
% table content
|
||||||
|
\end{tabular}
|
||||||
|
\end{sidewaystable}
|
||||||
|
```
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
@slide(layout=extra-content-and-preview)
|
||||||
|
|
||||||
|
@title
|
||||||
|
An advanced example
|
||||||
|
|
||||||
|
@content
|
||||||
|
``` {.hljs .lang-tex}
|
||||||
|
\begin{table}[h]
|
||||||
|
\begin{tabular}{llr}
|
||||||
|
\toprule
|
||||||
|
Structure & \multicolumn{2}{l}{Access time complexity} \\ \cmidrule(r){2-3}
|
||||||
|
& Average & Worst \\
|
||||||
|
\midrule
|
||||||
|
Stack & $\mathcal{O}(n)$ & $\mathcal{O}(n)$ \\
|
||||||
|
Binary tree & $\mathcal{O}(log(n))$ & $\mathcal{O}(n)$ \\
|
||||||
|
AVL tree & $\mathcal{O}(log(n))$ & $\mathcal{O}(log(n))$ \\
|
||||||
|
\bottomrule
|
||||||
|
\end{tabular}
|
||||||
|
\end{table}
|
||||||
|
```
|
||||||
|
|
||||||
|
[<span class="emoji">🔗</span> Booktabs documentation](http://packages.oth-regensburg.de/ctan/macros/latex/contrib/booktabs/booktabs.pdf)
|
||||||
|
|
||||||
|
@preview
|
||||||
|
{.thin-padding}
|
||||||
@ -4,230 +4,105 @@
|
|||||||
11
|
11
|
||||||
|
|
||||||
@title
|
@title
|
||||||
Tabellen
|
Quelltext-Listings
|
||||||
|
|
||||||
|
|
||||||
@slide(layout=content-only)
|
|
||||||
|
|
||||||
@title
|
|
||||||
Grundstruktur <span class="emoji">🗒️</span>
|
|
||||||
|
|
||||||
@content
|
|
||||||
Für typografisch schöne Tabellen nutzen wir das Paket `booktabs`.
|
|
||||||
|
|
||||||
``` {.hljs .lang-tex}
|
|
||||||
\usepackage{booktabs}
|
|
||||||
```
|
|
||||||
|
|
||||||
``` {.hljs .lang-tex}
|
|
||||||
\begin{table}[<position>]
|
|
||||||
\begin{tabular}{<spaltendefinition>}
|
|
||||||
% Tabelleninhalt
|
|
||||||
\end{tabular}
|
|
||||||
\caption{<tabellenunterschrift>}
|
|
||||||
\end{table}
|
|
||||||
```
|
|
||||||
|
|
||||||
Die Positionierung erfolgt analog zu Grafiken.
|
|
||||||
|
|
||||||
|
|
||||||
@slide(layout=content-and-preview)
|
@slide(layout=content-and-preview)
|
||||||
|
|
||||||
@title
|
@title
|
||||||
Spaltendefinitionen
|
Code im LaTeX-Quelltext
|
||||||
|
|
||||||
@content
|
@content
|
||||||
``` {.hljs .lang-tex}
|
In einer eigenen Umgebung:
|
||||||
\begin{tabular}{lrcl}
|
|
||||||
% Tabelleninhalt
|
``` {.lang-tex .hljs}
|
||||||
\end{tabular}
|
\section*{Haskell-Magie}
|
||||||
|
Quadrate aller geraden % …
|
||||||
|
\begin{lstlisting}[language=Haskell]
|
||||||
|
[x^2 | x <- [1..200], even x]
|
||||||
|
\end{lstlisting}
|
||||||
```
|
```
|
||||||
|
|
||||||
<table>
|
|
||||||
<tr>
|
|
||||||
<th>Kürzel</th>
|
|
||||||
<th>Bedeutung</th>
|
|
||||||
</tr>
|
|
||||||
<tr class="fragment">
|
|
||||||
<td>l</td>
|
|
||||||
<td>linksbündige Spalte</td>
|
|
||||||
</tr>
|
|
||||||
<tr class="fragment">
|
|
||||||
<td>c</td>
|
|
||||||
<td>zentrierte Spalte</td>
|
|
||||||
</tr>
|
|
||||||
<tr class="fragment">
|
|
||||||
<td>r</td>
|
|
||||||
<td>rechtsbündige Spalte</td>
|
|
||||||
</tr>
|
|
||||||
</table>
|
|
||||||
|
|
||||||
++ Vertikale Trennlinien und doppelte horizontale Linien sind unter Typograph\*innen nicht gern gesehen und sollten vermieden werden.
|
|
||||||
|
|
||||||
@preview
|
@preview
|
||||||
{.thin-padding}
|

|
||||||
|
|
||||||
|
|
||||||
@slide(layout=content-and-preview)
|
@slide(layout=content-and-preview)
|
||||||
|
|
||||||
@title
|
@title
|
||||||
Tabelleninhalt
|
Externer Code
|
||||||
|
|
||||||
@content
|
@content
|
||||||
``` {.hljs .lang-tex}
|
Praktischerweise bietet `listings` einen Befehl zum Einfügen externen Codes:
|
||||||
\begin{tabular}{lll}
|
|
||||||
\toprule
|
``` {.lang-tex .hljs}
|
||||||
Spalte 1 & Spalte 2 & Spalte 3 \\
|
\section*{Einfache Java-Anwendung}
|
||||||
\midrule
|
\lstinputlisting[language=Java]{Test.java}
|
||||||
Inhalt a & Inhalt b & Inhalt c \\
|
```
|
||||||
Inhalt e & Inhalt f & Inhalt g \\
|
|
||||||
Inhalt i & Inhalt j & Inhalt k \\
|
``` {.lang-java .hljs data-sourcefile="Test.java"}
|
||||||
\bottomrule
|
public class Test {
|
||||||
\end{tabular}
|
public static void main(/*…*/) {
|
||||||
|
System.out.println(/*…*/);
|
||||||
|
}
|
||||||
|
}
|
||||||
```
|
```
|
||||||
* ++ Zellen werden durch ›`&`‹ abgetrennt.
|
|
||||||
* ++ Reihen werden durch ›`\\`‹ beendet.
|
|
||||||
* ++ `\toprule`, `\midrule` und `\bottomrule` strukturieren die Tabelle.
|
|
||||||
|
|
||||||
@preview
|
@preview
|
||||||
{.thin-padding}
|

|
||||||
|
|
||||||
|
|
||||||
@slide(layout=wide-content)
|
|
||||||
|
|
||||||
@title
|
|
||||||
Die gesamte Tabelle
|
|
||||||
|
|
||||||
@content
|
|
||||||
``` {.hljs .lang-tex}
|
|
||||||
\begin{table}[h]
|
|
||||||
\begin{tabular}{lrcl}
|
|
||||||
\toprule
|
|
||||||
Sprache & Autor & Erscheinungsjahr & Dateiendung \\
|
|
||||||
\midrule
|
|
||||||
C++ & Bjarne Stroustrup & 1985 & .cpp \\
|
|
||||||
Java & James Gosling & 1998 & .java \\
|
|
||||||
Python & Guido van Rossum & 1991 & .py \\
|
|
||||||
\bottomrule
|
|
||||||
\end{tabular}
|
|
||||||
\caption{Bekannte Programmiersprachen}
|
|
||||||
\end{table}
|
|
||||||
```
|
|
||||||
|
|
||||||
<p data-category="Hinweis">Mit `@{}` vor und nach einer Spaltendefinition wird der umgebende Weißraum unterdrückt.</p>
|
|
||||||
|
|
||||||
<p data-category="Beispiel">`\begin{tabular}{@{}lrcl@{}}` beschränkt die Linien auf die Breite des Tabelleninhalts.</p>
|
|
||||||
|
|
||||||
|
|
||||||
@slide(layout=content-only)
|
@slide(layout=content-only)
|
||||||
|
|
||||||
@title
|
@title
|
||||||
Mehr Komfort
|
Themen und Stile
|
||||||
|
|
||||||
@content
|
@content
|
||||||
Der [Tables Generator](https://tablesgenerator.com/) ist ein wunderbares Werkzeug, um schnell Tabellen verschiedener Formate zu erstellen.
|
`listings` stellt keine eigenen Themes zur Verfügung. Dies kann aber durch die vielen Konfigurationsoptionen ausgeglichen werden.
|
||||||
|
|
||||||
[](https://tablesgenerator.com/)
|
``` {.lang-tex .hljs}
|
||||||
|
\begin{lstlisting}[
|
||||||
|
language=Java,
|
||||||
|
basicstyle=\footnotesize\ttfamily,
|
||||||
|
breaklines=true,
|
||||||
|
keywordstyle=\color{ForestGreen},
|
||||||
|
commentstyle=\color{DarkGray},
|
||||||
|
literate={ö}{{\"o}}
|
||||||
|
]
|
||||||
|
% …
|
||||||
|
\end{lstlisting}
|
||||||
|
```
|
||||||
|
|
||||||
|
Für die Erstellung eigener Themes ist der Befehl `\lstset` nützlich.
|
||||||
|
|
||||||
|
|
||||||
|
@slide(layout=content-only)
|
||||||
|
|
||||||
|
@title
|
||||||
|
Weitere Materialien
|
||||||
|
|
||||||
|
@content
|
||||||
|
* [Einführung](https://www.overleaf.com/learn/latex/Code_listing#Reference_guide) in das Paket
|
||||||
|
* offizielle [Dokumentation](https://www.overleaf.com/learn/latex/Code_listing#Reference_guide)
|
||||||
|
* das Paket [`xcolor`](https://www.overleaf.com/learn/latex/Using_colours_in_LaTeX) für Farben
|
||||||
|
* zwei [Themes](https://github.com/jez/latex-solarized) im solarized-Stil für `listings`
|
||||||
|
|
||||||
|
|
||||||
@slide(layout=task)
|
@slide(layout=task)
|
||||||
|
|
||||||
@task-number
|
@task-number
|
||||||
12
|
11
|
||||||
|
|
||||||
@title
|
@title
|
||||||
Tabellen setzen
|
Listings
|
||||||
|
|
||||||
@content
|
@content
|
||||||
* Die Liste in der Datei `exercises/tables/tables.tex` enthält Infos zu ein paar Lehrveranstaltung an der Fakultät WIAI.
|
* Im Ordner `exercises/source-code-listings` findet ihr eine Datei namens `Source.java`.
|
||||||
* Wandelt die Liste in eine **Tabelle** um.
|
* **Bindet** den Java-Quelltext in der Datei `source-code-listings.tex` **ein**. (Beachtet, dass der Dateipfad relativ zu `main.tex` ist.)
|
||||||
* Die Tabelle soll Spalten für den *Namen*, das *Kürzel* und das *Semester* der Vorlesungen haben.
|
* Aktiviert das **Syntax-Highlighting** durch Angabe der Sprache Java.
|
||||||
* Fügt außerdem eine **zentrierte Spalte** ganz links in der Tabelle hinzu, in der ihr die Lehrveranstaltungen **nummeriert**.
|
* **Nummeriert** die Zeilen und aktiviert **Umbrüche**.
|
||||||
|
* Setzt mit dem Parameter `basicstyle` eine dicktengleiche Schrift (`\ttfamily \small`).
|
||||||
|
* Ändert die Schlüsselwortfarbe zu Blau.
|
||||||
|
* Verbergt die Sonderzeichen, die **Leerzeichen in Zeichenketten** markieren.
|
||||||
|
|
||||||
|
Seht bei Fragen in der Dokumentation des Paketes `listings` nach.
|
||||||
|
|
||||||
@slide(layout=extra-content-only)
|
|
||||||
|
|
||||||
@title
|
|
||||||
Besonders lange Tabellen
|
|
||||||
|
|
||||||
@content
|
|
||||||
Tabellen, die über eine Seite hinaus gehen, werden von `tabular` einfach abgeschnitten. Die Lösung bietet hier das Paket `longtable`:
|
|
||||||
|
|
||||||
``` {.hljs .lang-tex}
|
|
||||||
\usepackage{longtable}
|
|
||||||
```
|
|
||||||
|
|
||||||
``` {.hljs .lang-tex}
|
|
||||||
\begin{longtable}{<spaltendefinition>}
|
|
||||||
% Tabelleninhalt
|
|
||||||
\caption{<tabellenunterschrift>}
|
|
||||||
\label{<label>}
|
|
||||||
\end{longtable}
|
|
||||||
```
|
|
||||||
|
|
||||||
|
|
||||||
@slide(layout=extra-content-only)
|
|
||||||
|
|
||||||
@title
|
|
||||||
Hinweise zu `longtable`
|
|
||||||
|
|
||||||
@content
|
|
||||||
``` {.hljs .lang-tex}
|
|
||||||
\begin{longtable}{<spaltendefinition>}
|
|
||||||
% Tabelleninhalt
|
|
||||||
\caption{<tabellenunterschrift>}
|
|
||||||
\label{<label>}
|
|
||||||
\end{longtable}
|
|
||||||
```
|
|
||||||
* Die `longtable`-Umgebung vereint die `tabular`-Umgebung und die `table`-Umgebung.
|
|
||||||
* Titel und Label können deshalb direkt unter dem Tabelleninhalt stehen.
|
|
||||||
* Sofern das Paket `booktabs` eingebunden ist, stehen seine Features auch in `longtable` zur Verfügung.
|
|
||||||
|
|
||||||
|
|
||||||
@slide(layout=extra-content-only)
|
|
||||||
|
|
||||||
@title
|
|
||||||
Besonders breite Tabellen
|
|
||||||
|
|
||||||
@content
|
|
||||||
Sollte die Tabelle einmal zu breit für eine Seite werden, kann sie auch im Querformat dargestellt werden:
|
|
||||||
|
|
||||||
``` {.hljs .lang-tex}
|
|
||||||
\usepackage{rotating}
|
|
||||||
```
|
|
||||||
|
|
||||||
``` {.hljs .lang-tex}
|
|
||||||
\begin{sidewaystable}[<position>]
|
|
||||||
\begin{tabular}{<spaltendef.>}
|
|
||||||
% Tabelleninhalt
|
|
||||||
\end{tabular}
|
|
||||||
\end{sidewaystable}
|
|
||||||
```
|
|
||||||
|
|
||||||
|
|
||||||
@slide(layout=extra-content-and-preview)
|
|
||||||
|
|
||||||
@title
|
|
||||||
Weiterführendes Beispiel
|
|
||||||
|
|
||||||
@content
|
|
||||||
``` {.hljs .lang-tex}
|
|
||||||
\begin{table}[h]
|
|
||||||
\begin{tabular}{llr}
|
|
||||||
\toprule
|
|
||||||
Struktur & \multicolumn{2}{l}{Zeitkomplexität für Zugriff} \\ \cmidrule(r){2-3}
|
|
||||||
& Average & Worst \\
|
|
||||||
\midrule
|
|
||||||
Stack & $\mathcal{O}(n)$ & $\mathcal{O}(n)$ \\
|
|
||||||
Binärbaum & $\mathcal{O}(log(n))$ & $\mathcal{O}(log(n))$ \\
|
|
||||||
AVL-Baum & $\mathcal{O}(log(n))$ & $\mathcal{O}(log(n))$ \\
|
|
||||||
\bottomrule
|
|
||||||
\end{tabular}
|
|
||||||
\end{table}
|
|
||||||
```
|
|
||||||
|
|
||||||
[<span class="emoji">🔗</span> Dokumentation zu Booktabs](http://packages.oth-regensburg.de/ctan/macros/latex/contrib/booktabs/booktabs.pdf)
|
|
||||||
|
|
||||||
@preview
|
|
||||||
{.thin-padding}
|
|
||||||
|
|||||||
@ -4,233 +4,105 @@
|
|||||||
11
|
11
|
||||||
|
|
||||||
@title
|
@title
|
||||||
Tables
|
Source code listings
|
||||||
|
|
||||||
|
|
||||||
@slide(layout=content-only)
|
|
||||||
|
|
||||||
@title
|
|
||||||
Basic structure <span class="emoji">🗒️</span>
|
|
||||||
|
|
||||||
@content
|
|
||||||
For typographically pleasing tables, we use the `booktabs` package.
|
|
||||||
|
|
||||||
``` {.hljs .lang-tex}
|
|
||||||
\usepackage{booktabs}
|
|
||||||
```
|
|
||||||
|
|
||||||
``` {.hljs .lang-tex}
|
|
||||||
\begin{table}[<position>]
|
|
||||||
\begin{tabular}{<column definition>}
|
|
||||||
% table content
|
|
||||||
\end{tabular}
|
|
||||||
\caption{<caption>}
|
|
||||||
\end{table}
|
|
||||||
```
|
|
||||||
|
|
||||||
Positioning works just like with graphics.
|
|
||||||
|
|
||||||
|
|
||||||
@slide(layout=content-and-preview)
|
@slide(layout=content-and-preview)
|
||||||
|
|
||||||
@title
|
@title
|
||||||
Column definitions
|
In-situ listings
|
||||||
|
|
||||||
@content
|
@content
|
||||||
``` {.hljs .lang-tex}
|
Within a dedicated environment:
|
||||||
\begin{tabular}{lrcl}
|
|
||||||
% table content
|
``` {.lang-tex .hljs}
|
||||||
\end{tabular}
|
\section*{Haskell Magic}
|
||||||
|
Squares of all even % …
|
||||||
|
\begin{lstlisting}[language=Haskell]
|
||||||
|
[x^2 | x <- [1..200], even x]
|
||||||
|
\end{lstlisting}
|
||||||
```
|
```
|
||||||
|
|
||||||
<table>
|
|
||||||
<tr>
|
|
||||||
<th>letter</th>
|
|
||||||
<th>meaning</th>
|
|
||||||
</tr>
|
|
||||||
<tr class="fragment">
|
|
||||||
<td>l</td>
|
|
||||||
<td>left-justified column</td>
|
|
||||||
</tr>
|
|
||||||
<tr class="fragment">
|
|
||||||
<td>c</td>
|
|
||||||
<td>centred column</td>
|
|
||||||
</tr>
|
|
||||||
<tr class="fragment">
|
|
||||||
<td>r</td>
|
|
||||||
<td>right-justified column</td>
|
|
||||||
</tr>
|
|
||||||
</table>
|
|
||||||
|
|
||||||
++ Vertical separator lines and double horizontal lines are frowned upon by typographers and should be avoided.
|
|
||||||
|
|
||||||
@preview
|
@preview
|
||||||
{.thin-padding}
|

|
||||||
|
|
||||||
|
|
||||||
@slide(layout=content-and-preview)
|
@slide(layout=content-and-preview)
|
||||||
|
|
||||||
@title
|
@title
|
||||||
Table content
|
External source code
|
||||||
|
|
||||||
@content
|
@content
|
||||||
``` {.hljs .lang-tex}
|
Conveniently, `listings` offers an import command:
|
||||||
\begin{tabular}{lll}
|
|
||||||
\toprule
|
``` {.lang-tex .hljs}
|
||||||
Column 1 & Column 2 & Column 3 \\
|
\section*{Simple Java Application}
|
||||||
\midrule
|
\lstinputlisting[language=Java]{Test.java}
|
||||||
Content a & Content b & Content c \\
|
```
|
||||||
Content e & Content f & Content g \\
|
|
||||||
Content i & Content j & Content k \\
|
``` {.lang-java .hljs data-sourcefile="Test.java"}
|
||||||
\bottomrule
|
public class Test {
|
||||||
\end{tabular}
|
public static void main(/*…*/) {
|
||||||
|
System.out.println(/*…*/);
|
||||||
|
}
|
||||||
|
}
|
||||||
```
|
```
|
||||||
* ++ Columns are separated by ’`&`’.
|
|
||||||
* ++ Rows are ended by ‘`\\`’.
|
|
||||||
* ++ `\toprule`, `\midrule` and `\bottomrule` structure the table.
|
|
||||||
|
|
||||||
@preview
|
@preview
|
||||||
{.thin-padding}
|

|
||||||
|
|
||||||
|
|
||||||
@slide(layout=wide-content)
|
|
||||||
|
|
||||||
@title
|
|
||||||
The entire table
|
|
||||||
|
|
||||||
@content
|
|
||||||
``` {.hljs .lang-tex}
|
|
||||||
\begin{table}[h]
|
|
||||||
\begin{tabular}{lrcl}
|
|
||||||
\toprule
|
|
||||||
Language & Author & Year & Filename extension \\
|
|
||||||
\midrule
|
|
||||||
C++ & Bjarne Stroustrup & 1985 & .cpp \\
|
|
||||||
Java & James Gosling & 1998 & .java \\
|
|
||||||
Python & Guido van Rossum & 1991 & .py \\
|
|
||||||
\bottomrule
|
|
||||||
\end{tabular}
|
|
||||||
\caption{Well-known programming languages}
|
|
||||||
\end{table}
|
|
||||||
```
|
|
||||||
|
|
||||||
<p data-category="Note">`@{}` to the left and right of a column definition removes the padding of the corresponding column.</p>
|
|
||||||
|
|
||||||
<p data-category="Example">`\begin{tabular}{@{}lrcl@{}}` limits the row separators to the width of the table content</p>
|
|
||||||
|
|
||||||
|
|
||||||
@slide(layout=content-only)
|
@slide(layout=content-only)
|
||||||
|
|
||||||
@title
|
@title
|
||||||
More comfort
|
Themes and styles
|
||||||
|
|
||||||
@content
|
@content
|
||||||
The [Tables Generator](https://tablesgenerator.com/) is a wonderful tool to quickly create tables of different formats.
|
`listings` does not provide any themes by default, but can be configured extensively.
|
||||||
|
|
||||||
[](https://tablesgenerator.com/)
|
``` {.lang-tex .hljs}
|
||||||
|
\begin{lstlisting}[
|
||||||
|
language=Java,
|
||||||
|
basicstyle=\footnotesize\ttfamily,
|
||||||
|
breaklines=true,
|
||||||
|
keywordstyle=\color{ForestGreen},
|
||||||
|
commentstyle=\color{DarkGray},
|
||||||
|
literate={ö}{{\"o}}
|
||||||
|
]
|
||||||
|
% …
|
||||||
|
\end{lstlisting}
|
||||||
|
```
|
||||||
|
|
||||||
|
Have a look at the `\lstset` command for creating your own themes.
|
||||||
|
|
||||||
|
|
||||||
|
@slide(layout=content-only)
|
||||||
|
|
||||||
|
@title
|
||||||
|
Further resources
|
||||||
|
|
||||||
|
@content
|
||||||
|
* [introduction](https://www.overleaf.com/learn/latex/Code_listing#Reference_guide) to the package
|
||||||
|
* official [documentation](https://www.overleaf.com/learn/latex/Code_listing#Reference_guide)
|
||||||
|
* [`xcolor` package](https://www.overleaf.com/learn/latex/Using_colours_in_LaTeX) for colors
|
||||||
|
* two [solarized themes](https://github.com/jez/latex-solarized) for `listings`
|
||||||
|
|
||||||
|
|
||||||
@slide(layout=task)
|
@slide(layout=task)
|
||||||
|
|
||||||
@task-number
|
@task-number
|
||||||
12
|
11
|
||||||
|
|
||||||
@title
|
@title
|
||||||
Typesetting tables
|
Listings
|
||||||
|
|
||||||
@content
|
@content
|
||||||
* The list in file `exercises/tables/tables.tex` stores information on a few modules of the WIAI faculty.
|
* In the directory `exercises/source-code-listings` you can find a file named `Source.java`.
|
||||||
* Transform the list into a **table**.
|
* **Include** it in the file `source-code-listings.tex`. (Keep in mind that the file path is relative to the main LaTeX document, i. e., to `main.tex`.)
|
||||||
* The table shall have colums for the *name*, the *abbreviation* (Kürzel) and the *semester* of the lectures.
|
* Activate **syntax highlighting** by stating the programming language Java.
|
||||||
* Add a **column** with **center-aligned text** on the left side of the table in order to **number** the lectures.
|
* **Number** the code lines.
|
||||||
* Add a **caption** for the table.
|
* Set the `basicstyle` to a proper mono-spaced font (`\ttfamily \small`)
|
||||||
|
* Change the **keyword color** to blue.
|
||||||
|
* Don't show special characters for **spaces in strings**.
|
||||||
|
|
||||||
|
If you have questions, try to consult the documentation of the `listings` package.
|
||||||
|
|
||||||
@slide(layout=extra-content-only)
|
|
||||||
|
|
||||||
@title
|
|
||||||
Particularly long tables
|
|
||||||
|
|
||||||
@content
|
|
||||||
Tables that exceed one page are simply cut off by `tabular`. A solution is offered by the `longtable` package:
|
|
||||||
|
|
||||||
``` {.hljs .lang-tex}
|
|
||||||
\usepackage{longtable}
|
|
||||||
```
|
|
||||||
|
|
||||||
``` {.hljs .lang-tex}
|
|
||||||
\begin{longtable}{<column definition>}
|
|
||||||
% table content
|
|
||||||
\caption{<caption>}
|
|
||||||
\label{<label>}
|
|
||||||
\end{longtable}
|
|
||||||
```
|
|
||||||
|
|
||||||
|
|
||||||
@slide(layout=extra-content-only)
|
|
||||||
|
|
||||||
@title
|
|
||||||
Notes on `longtable`
|
|
||||||
|
|
||||||
@content
|
|
||||||
``` {.hljs .lang-tex}
|
|
||||||
\begin{longtable}{<column definition>}
|
|
||||||
% table content
|
|
||||||
\caption{<caption>}
|
|
||||||
\label{<label>}
|
|
||||||
\end{longtable}
|
|
||||||
```
|
|
||||||
* The `longtable` environment merges the `tabular` and `table` environments.
|
|
||||||
* Caption and label can therefore be inserted directly under the table content.
|
|
||||||
* As long as the `booktabs` package is used, its features are also provided in `longtable`.
|
|
||||||
|
|
||||||
|
|
||||||
@slide(layout=extra-content-only)
|
|
||||||
|
|
||||||
@title
|
|
||||||
Particularly wide tables
|
|
||||||
|
|
||||||
@content
|
|
||||||
If you need a table to be wider than a page, you can display it in landscape orientation:
|
|
||||||
|
|
||||||
``` {.hljs .lang-tex}
|
|
||||||
\usepackage{rotating}
|
|
||||||
```
|
|
||||||
|
|
||||||
``` {.hljs .lang-tex}
|
|
||||||
\begin{sidewaystable}[<position>]
|
|
||||||
\begin{tabular}{<column def.>}
|
|
||||||
% table content
|
|
||||||
\end{tabular}
|
|
||||||
\end{sidewaystable}
|
|
||||||
```
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
@slide(layout=extra-content-and-preview)
|
|
||||||
|
|
||||||
@title
|
|
||||||
An advanced example
|
|
||||||
|
|
||||||
@content
|
|
||||||
``` {.hljs .lang-tex}
|
|
||||||
\begin{table}[h]
|
|
||||||
\begin{tabular}{llr}
|
|
||||||
\toprule
|
|
||||||
Structure & \multicolumn{2}{l}{Access time complexity} \\ \cmidrule(r){2-3}
|
|
||||||
& Average & Worst \\
|
|
||||||
\midrule
|
|
||||||
Stack & $\mathcal{O}(n)$ & $\mathcal{O}(n)$ \\
|
|
||||||
Binary tree & $\mathcal{O}(log(n))$ & $\mathcal{O}(n)$ \\
|
|
||||||
AVL tree & $\mathcal{O}(log(n))$ & $\mathcal{O}(log(n))$ \\
|
|
||||||
\bottomrule
|
|
||||||
\end{tabular}
|
|
||||||
\end{table}
|
|
||||||
```
|
|
||||||
|
|
||||||
[<span class="emoji">🔗</span> Booktabs documentation](http://packages.oth-regensburg.de/ctan/macros/latex/contrib/booktabs/booktabs.pdf)
|
|
||||||
|
|
||||||
@preview
|
|
||||||
{.thin-padding}
|
|
||||||
|
|||||||
@ -4,105 +4,209 @@
|
|||||||
12
|
12
|
||||||
|
|
||||||
@title
|
@title
|
||||||
Quelltext-Listings
|
Referenzen und Fußnoten
|
||||||
|
|
||||||
|
|
||||||
@slide(layout=content-and-preview)
|
@slide(layout=content-and-preview)
|
||||||
|
|
||||||
@title
|
@title
|
||||||
Code im LaTeX-Quelltext
|
Fußnoten <span class="emoji">📎</span>
|
||||||
|
|
||||||
@content
|
@content
|
||||||
In einer eigenen Umgebung:
|
``` {.hljs .lang-tex}
|
||||||
|
\usepackage{hyperref}
|
||||||
|
```
|
||||||
|
|
||||||
``` {.lang-tex .hljs}
|
Die Nummerierung erfolgt automatisch und ist fortlaufend, unabhängig davon, ob ein neuer Abschnitt beginnt.
|
||||||
\section*{Haskell-Magie}
|
|
||||||
Quadrate aller geraden % …
|
``` {.hljs .lang-tex}
|
||||||
\begin{lstlisting}[language=Haskell]
|
Eber, beim Hausschwein insbesondere
|
||||||
[x^2 | x <- [1..200], even x]
|
oberdeutsch Saubär, beim Wildschwein
|
||||||
\end{lstlisting}
|
Keiler, bezeichnet das männliche
|
||||||
|
Geschlecht des Schweins.
|
||||||
|
\footnote{\url{https://de.wikipedia.org/
|
||||||
|
wiki/Eber}}
|
||||||
```
|
```
|
||||||
|
|
||||||
@preview
|
@preview
|
||||||

|

|
||||||
|
|
||||||
|
|
||||||
@slide(layout=content-and-preview)
|
@slide(layout=content-and-preview)
|
||||||
|
|
||||||
@title
|
@title
|
||||||
Externer Code
|
Querverweise
|
||||||
|
|
||||||
@content
|
@content
|
||||||
Praktischerweise bietet `listings` einen Befehl zum Einfügen externen Codes:
|
Manuell (Just don’t!)
|
||||||
|
|
||||||
``` {.lang-tex .hljs}
|
``` {.hljs .lang-tex}
|
||||||
\section*{Einfache Java-Anwendung}
|
Wie man in Abbildung 23 sieht, …
|
||||||
\lstinputlisting[language=Java]{Test.java}
|
|
||||||
```
|
```
|
||||||
|
|
||||||
``` {.lang-java .hljs data-sourcefile="Test.java"}
|
Mit dem Befehl `\ref`:
|
||||||
public class Test {
|
|
||||||
public static void main(/*…*/) {
|
``` {.hljs .lang-tex}
|
||||||
System.out.println(/*…*/);
|
\begin{figure}[H]
|
||||||
}
|
\includegraphics % …
|
||||||
}
|
\caption{Unser Maskottchen Fooboar}
|
||||||
|
\label{img:fooboar}
|
||||||
|
\end{figure}
|
||||||
|
|
||||||
|
Wie man in Abbildung \ref{img:fooboar} …
|
||||||
```
|
```
|
||||||
|
|
||||||
@preview
|
@preview
|
||||||

|

|
||||||
|
|
||||||
|
|
||||||
@slide(layout=content-only)
|
@slide(layout=content-and-preview)
|
||||||
|
|
||||||
@title
|
@title
|
||||||
Themen und Stile
|
Referenzen
|
||||||
|
|
||||||
@content
|
@content
|
||||||
`listings` stellt keine eigenen Themes zur Verfügung. Dies kann aber durch die vielen Konfigurationsoptionen ausgeglichen werden.
|
Mit dem Paket `cleveref` (mit *einem* ›r‹!):
|
||||||
|
|
||||||
``` {.lang-tex .hljs}
|
``` {.hljs .lang-tex}
|
||||||
\begin{lstlisting}[
|
\begin{figure}[H]
|
||||||
language=Java,
|
\includegraphics % …
|
||||||
basicstyle=\footnotesize\ttfamily,
|
\caption{Unser Maskottchen Fooboar}
|
||||||
breaklines=true,
|
\label{img:fooboar}
|
||||||
keywordstyle=\color{ForestGreen},
|
\end{figure}
|
||||||
commentstyle=\color{DarkGray},
|
|
||||||
literate={ö}{{\"o}}
|
Fooboar ist ein sehr engagierter
|
||||||
]
|
Jungeber (siehe \Cref{img:fooboar}).
|
||||||
% …
|
|
||||||
\end{lstlisting}
|
|
||||||
```
|
```
|
||||||
|
|
||||||
Für die Erstellung eigener Themes ist der Befehl `\lstset` nützlich.
|
Der Befehl `\cref` fügt selbstständig die passende Abkürzung ein.
|
||||||
|
|
||||||
|
@preview
|
||||||
|

|
||||||
|
|
||||||
|
|
||||||
@slide(layout=content-only)
|
@slide(layout=content-only)
|
||||||
|
|
||||||
@title
|
@title
|
||||||
Weitere Materialien
|
Label vergeben
|
||||||
|
|
||||||
@content
|
@content
|
||||||
* [Einführung](https://www.overleaf.com/learn/latex/Code_listing#Reference_guide) in das Paket
|
Beide Referenzierungsbefehle funktionieren mit **Abschnitten, Bildern, Tabellen, Listings und Gleichungen,** sofern die richtigen Label vergeben wurden.
|
||||||
* offizielle [Dokumentation](https://www.overleaf.com/learn/latex/Code_listing#Reference_guide)
|
|
||||||
* das Paket [`xcolor`](https://www.overleaf.com/learn/latex/Using_colours_in_LaTeX) für Farben
|
Label müssen **eindeutig** sein. Zur Strukturierung ist das Voranstellen von Kürzeln üblich, denn einige Pakete ziehen aus den Kürzeln Informationen.
|
||||||
* zwei [Themes](https://github.com/jez/latex-solarized) im solarized-Stil für `listings`
|
|
||||||
|
<table>
|
||||||
|
<tr>
|
||||||
|
<td>`fig:` Abbildungen</td>
|
||||||
|
<td>`tbl:` Tabellen</td>
|
||||||
|
</tr>
|
||||||
|
<tr>
|
||||||
|
<td>`sec:` Abschnitte</td>
|
||||||
|
<td>`subsec:` Unter­abschnitte</td>
|
||||||
|
</tr>
|
||||||
|
<tr>
|
||||||
|
<td>`ch:` Kapitel</td>
|
||||||
|
<td>`itm:` Aufzählungs­elemente</td>
|
||||||
|
</tr>
|
||||||
|
<tr>
|
||||||
|
<td>`eq:` Gleichungen</td>
|
||||||
|
<td>`lst:` Quelltext­listings</td>
|
||||||
|
</tr>
|
||||||
|
</table>
|
||||||
|
|
||||||
|
|
||||||
|
@slide(layout=content-only)
|
||||||
|
|
||||||
|
@title
|
||||||
|
Dinge, die zu beachten sind
|
||||||
|
|
||||||
|
@content
|
||||||
|
* ++ Durch `\cref` eingefügte Passagen tauchen in einigen Dokumentklassen erst dann auf Deutsch auf, wenn bereits in der Dokumentklasse die Sprache festgelegt wurde:
|
||||||
|
|
||||||
|
``` {.hljs .lang-tex}
|
||||||
|
\documentclass[ngerman]{article}
|
||||||
|
```
|
||||||
|
|
||||||
|
* ++ Beschriftungen (`\caption{…}`) müssen, von Abschnitten abgesehen, **immer und vor dem Label** vergeben werden.
|
||||||
|
|
||||||
|
* ++ Bei Abschnitten wird das Label direkt hinter dem Befehl angefügt.
|
||||||
|
|
||||||
|
``` {.hljs .lang-tex}
|
||||||
|
\section{Hinweise}\label{sec:hinweise}
|
||||||
|
```
|
||||||
|
|
||||||
|
|
||||||
@slide(layout=task)
|
@slide(layout=task)
|
||||||
|
|
||||||
@task-number
|
@task-number
|
||||||
10
|
12a
|
||||||
|
|
||||||
@title
|
@title
|
||||||
Listings
|
Fußnoten einfügen
|
||||||
|
|
||||||
@content
|
@content
|
||||||
* Im Ordner `exercises/source-code-listings` findet ihr eine Datei namens `Source.java`.
|
* Pack den Text *March 2021* in der Datei `exercises/footnotes/footnotes.tex` in eine **Fußnote**.
|
||||||
* **Bindet** den Java-Quelltext in der Datei `source-code-listings.tex` **ein**. (Beachtet, dass der Dateipfad relativ zu `main.tex` ist.)
|
* Fügt zusätzlich eine **klickbare URL**, die zur Download-Seite des Java Development Kit führt (`https://www.oracle.com/java/technologies/javase-downloads.html`), als Fußnote ein.
|
||||||
* Aktiviert das **Syntax-Highlighting** durch Angabe der Sprache Java.
|
|
||||||
* **Nummeriert** die Zeilen und aktiviert **Umbrüche**.
|
|
||||||
* Setzt mit dem Parameter `basicstyle` eine dicktengleiche Schrift (`\ttfamily \small`).
|
|
||||||
* Ändert die Schlüsselwortfarbe zu Blau.
|
@slide(layout=task)
|
||||||
* Verbergt die Sonderzeichen, die **Leerzeichen in Zeichenketten** markieren.
|
|
||||||
|
@task-number
|
||||||
|
12b
|
||||||
|
|
||||||
|
@title
|
||||||
|
Referenzen einfügen
|
||||||
|
|
||||||
|
@content
|
||||||
|
* Ersetzt im Text in der Datei `references.tex` im Ordner `exercises/references` *In the figure* und *The following source code listing* durch eine **Referenz** auf das Bild bzw. auf das Quelltext-Listing.
|
||||||
|
* Nutzt dafür den Befehl `\Cref`.
|
||||||
|
* Achtet darauf, zuerst **Labels** für die Elemente, die ihr referenzieren wollt, zu vergeben.
|
||||||
|
* Packt dafür das Quelltext-Listing in eine **Umgebung** namens `listing`.
|
||||||
|
* Fügt noch eine **Beschriftung** zum Listing hinzu.
|
||||||
|
|
||||||
|
|
||||||
|
@slide(layout=extra-content-and-preview)
|
||||||
|
|
||||||
|
@title
|
||||||
|
Konfiguration von Fußnoten
|
||||||
|
|
||||||
|
@content
|
||||||
|
Das Paket `footmisc` stellt verschiedene weitere Optionen für die Darstellung von Fußnoten zur Verfügung, die als optionale Parameter an den Befehl `\usepackage` übergeben werden können.
|
||||||
|
|
||||||
|
``` {.hljs .lang-tex}
|
||||||
|
% Zählung auf jeder Seite neu beginnen:
|
||||||
|
\usepackage[perpage]{footmisc}
|
||||||
|
|
||||||
|
% Fußnoten inline anzeigen lassen:
|
||||||
|
\usepackage[para]{footmisc}
|
||||||
|
|
||||||
|
% Symbole statt Nummerierung verwenden:
|
||||||
|
\usepackage[symbol]{footmisc}
|
||||||
|
```
|
||||||
|
|
||||||
|
@preview
|
||||||
|
{.thin-padding}
|
||||||
|
|
||||||
|
|
||||||
|
@slide(layout=extra-content-and-preview)
|
||||||
|
|
||||||
|
@title
|
||||||
|
Weiterführend
|
||||||
|
|
||||||
|
@content
|
||||||
|
* Wurde vor dem Paket `cleveref` das Paket `hyperref` eingebunden, entsteht ein **klickbarer Link** im fertigen PDF.
|
||||||
|
* Mehrere Referenzen können in `\cref` kommagetrennt angegeben werden.
|
||||||
|
|
||||||
|
``` {.hljs .lang-tex}
|
||||||
|
\section{Ein Einstieg}
|
||||||
|
\label{sec:section1}
|
||||||
|
% …
|
||||||
|
Hier sei verwiesen auf
|
||||||
|
\cref{sec:section1,sec:section2,
|
||||||
|
sec:section3,sec:section5}.
|
||||||
|
```
|
||||||
|
|
||||||
|
@preview
|
||||||
|

|
||||||
|
|
||||||
Seht bei Fragen in der Dokumentation des Paketes `listings` nach.
|
|
||||||
|
|||||||
@ -4,105 +4,211 @@
|
|||||||
12
|
12
|
||||||
|
|
||||||
@title
|
@title
|
||||||
Source code listings
|
References and footnotes
|
||||||
|
|
||||||
|
|
||||||
@slide(layout=content-and-preview)
|
@slide(layout=content-and-preview)
|
||||||
|
|
||||||
@title
|
@title
|
||||||
In-situ listings
|
Footnotes <span class="emoji">📎</span>
|
||||||
|
|
||||||
@content
|
@content
|
||||||
Within a dedicated environment:
|
``` {.hljs .lang-tex}
|
||||||
|
\usepackage{hyperref}
|
||||||
|
```
|
||||||
|
|
||||||
``` {.lang-tex .hljs}
|
Footnotes are automatically numbered consecutively, independent of sections.
|
||||||
\section*{Haskell Magic}
|
|
||||||
Squares of all even % …
|
(Here, `hyperref` is used for the `\url` command, it is not necessary for footnotes per se.)
|
||||||
\begin{lstlisting}[language=Haskell]
|
|
||||||
[x^2 | x <- [1..200], even x]
|
``` {.hljs .lang-tex}
|
||||||
\end{lstlisting}
|
The wild boar (\textit{Sus scrofa}), also
|
||||||
|
known as the wild swine, common wild pig,
|
||||||
|
or simply wild pig, is a suid native to
|
||||||
|
much of Eurasia and North Africa, and has
|
||||||
|
been introduced to the Americas and Oceania.
|
||||||
|
\footnote{\url{https://en.wikipedia.org/
|
||||||
|
wiki/Wild_boar}}
|
||||||
```
|
```
|
||||||
|
|
||||||
@preview
|
@preview
|
||||||

|

|
||||||
|
|
||||||
|
|
||||||
@slide(layout=content-and-preview)
|
@slide(layout=content-and-preview)
|
||||||
|
|
||||||
@title
|
@title
|
||||||
External source code
|
Cross-references
|
||||||
|
|
||||||
@content
|
@content
|
||||||
Conveniently, `listings` offers an import command:
|
Manually (just don’t!)
|
||||||
|
|
||||||
``` {.lang-tex .hljs}
|
``` {.hljs .lang-tex}
|
||||||
\section*{Simple Java Application}
|
As you can see in figure 23, …
|
||||||
\lstinputlisting[language=Java]{Test.java}
|
|
||||||
```
|
```
|
||||||
|
|
||||||
``` {.lang-java .hljs data-sourcefile="Test.java"}
|
Using the `\ref` command:
|
||||||
public class Test {
|
|
||||||
public static void main(/*…*/) {
|
``` {.hljs .lang-tex}
|
||||||
System.out.println(/*…*/);
|
\begin{figure}[H]
|
||||||
}
|
\includegraphics % …
|
||||||
}
|
\caption{Our mascot Fooboar}
|
||||||
|
\label{img:fooboar}
|
||||||
|
\end{figure}
|
||||||
|
|
||||||
|
As you can see in figure
|
||||||
|
\ref{img:fooboar}, …
|
||||||
```
|
```
|
||||||
|
|
||||||
@preview
|
@preview
|
||||||

|

|
||||||
|
|
||||||
|
|
||||||
@slide(layout=content-only)
|
@slide(layout=content-only)
|
||||||
|
|
||||||
@title
|
@title
|
||||||
Themes and styles
|
Assigning labels
|
||||||
|
|
||||||
@content
|
@content
|
||||||
`listings` does not provide any themes by default, but can be configured extensively.
|
Both cross-reference commands work with **sections, figures, tables, listings, and equations,** as long as you use correct labels.
|
||||||
|
|
||||||
``` {.lang-tex .hljs}
|
Labels have to be **unambiguous.** For clarity, certain prefixes are common, and some packages use them to derive information.
|
||||||
\begin{lstlisting}[
|
|
||||||
language=Java,
|
<table>
|
||||||
basicstyle=\footnotesize\ttfamily,
|
<tr>
|
||||||
breaklines=true,
|
<td>`fig:` Figures</td>
|
||||||
keywordstyle=\color{ForestGreen},
|
<td>`tbl:` Tables</td>
|
||||||
commentstyle=\color{DarkGray},
|
</tr>
|
||||||
literate={ö}{{\"o}}
|
<tr>
|
||||||
]
|
<td>`sec:` Sections</td>
|
||||||
% …
|
<td>`subsec:` Subsections</td>
|
||||||
\end{lstlisting}
|
</tr>
|
||||||
|
<tr>
|
||||||
|
<td>`ch:` Chapters</td>
|
||||||
|
<td>`itm:` Enumeration items</td>
|
||||||
|
</tr>
|
||||||
|
<tr>
|
||||||
|
<td>`eq:` Equations</td>
|
||||||
|
<td>`lst:` Source code listings</td>
|
||||||
|
</tr>
|
||||||
|
</table>
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
@slide(layout=content-and-preview)
|
||||||
|
|
||||||
|
@title
|
||||||
|
Cross-references
|
||||||
|
|
||||||
|
@content
|
||||||
|
Using the `cleveref` package (with *one* ‘r’!):
|
||||||
|
|
||||||
|
``` {.hljs .lang-tex}
|
||||||
|
\begin{figure}[H]
|
||||||
|
\includegraphics % …
|
||||||
|
\caption{Our mascot Fooboar}
|
||||||
|
\label{img:fooboar}
|
||||||
|
\end{figure}
|
||||||
|
|
||||||
|
Fooboar is a young and highly engaged
|
||||||
|
boar (see \Cref{img:fooboar}).
|
||||||
```
|
```
|
||||||
|
|
||||||
Have a look at the `\lstset` command for creating your own themes.
|
The `\cref` command automatically inserts suitable prefixes.
|
||||||
|
|
||||||
|
@preview
|
||||||
|

|
||||||
|
|
||||||
|
|
||||||
@slide(layout=content-only)
|
@slide(layout=content-only)
|
||||||
|
|
||||||
@title
|
@title
|
||||||
Further resources
|
Things to consider
|
||||||
|
|
||||||
@content
|
@content
|
||||||
* [introduction](https://www.overleaf.com/learn/latex/Code_listing#Reference_guide) to the package
|
* Terms inserted by `\cref` use the language specified with the document class (or `babel`):
|
||||||
* official [documentation](https://www.overleaf.com/learn/latex/Code_listing#Reference_guide)
|
|
||||||
* [`xcolor` package](https://www.overleaf.com/learn/latex/Using_colours_in_LaTeX) for colors
|
``` {.hljs .lang-tex}
|
||||||
* two [solarized themes](https://github.com/jez/latex-solarized) for `listings`
|
\documentclass[english]{article}
|
||||||
|
```
|
||||||
|
|
||||||
|
* Apart from sections, referenced elements need captions (`\caption{…}`), and the **captions have to be placed before the label.**
|
||||||
|
|
||||||
|
* For sectioning commands, the label is inserted directly after the section command.
|
||||||
|
|
||||||
|
``` {.hljs .lang-tex}
|
||||||
|
\section{Notes}\label{sec:notes}
|
||||||
|
```
|
||||||
|
|
||||||
|
|
||||||
@slide(layout=task)
|
@slide(layout=task)
|
||||||
|
|
||||||
@task-number
|
@task-number
|
||||||
10
|
12a
|
||||||
|
|
||||||
@title
|
@title
|
||||||
Listings
|
Inserting footnotes
|
||||||
|
|
||||||
@content
|
@content
|
||||||
* In the directory `exercises/source-code-listings` you can find a file named `Source.java`.
|
* Make the text *March 2021* in file `exercises/footnotes/footnotes.tex` appear as a **footnote**.
|
||||||
* **Include** it in the file `source-code-listings.tex`. (Keep in mind that the file path is relative to the main LaTeX document, i. e., to `main.tex`.)
|
* Additionally, insert a **clickable URL** that leads to the download page for the Java Development Kit (`https://www.oracle.com/java/technologies/javase-downloads.html`).
|
||||||
* Activate **syntax highlighting** by stating the programming language Java.
|
|
||||||
* **Number** the code lines.
|
|
||||||
* Set the `basicstyle` to a proper mono-spaced font (`\ttfamily \small`)
|
|
||||||
* Change the **keyword color** to blue.
|
|
||||||
* Don't show special characters for **spaces in strings**.
|
|
||||||
|
|
||||||
If you have questions, try to consult the documentation of the `listings` package.
|
|
||||||
|
@slide(layout=task)
|
||||||
|
|
||||||
|
@task-number
|
||||||
|
12b
|
||||||
|
|
||||||
|
@title
|
||||||
|
Inserting references
|
||||||
|
|
||||||
|
@content
|
||||||
|
* In file `exercises/references/references.tex`, replace *In the figure* and *The following source code listing* by **references** to the figure and to the source code listing.
|
||||||
|
* Use the command `\Cref` for the references.
|
||||||
|
* Make sure to add **labels** to the elements that you want to create a reference for.
|
||||||
|
* To do so, wrap the source code listing in a `listing` **environment**.
|
||||||
|
* Additionally, add a **caption** to the source code listing.
|
||||||
|
|
||||||
|
|
||||||
|
@slide(layout=extra-content-and-preview)
|
||||||
|
|
||||||
|
@title
|
||||||
|
Configuring footnotes
|
||||||
|
|
||||||
|
@content
|
||||||
|
The `footmisc` package provides additional options for the presentation of footnotes that can be activated by adding parameters to the `\usepackage` command.
|
||||||
|
|
||||||
|
``` {.hljs .lang-tex}
|
||||||
|
% Reset the counter on each page:
|
||||||
|
\usepackage[perpage]{footmisc}
|
||||||
|
|
||||||
|
% Display footnotes in-line:
|
||||||
|
\usepackage[para]{footmisc}
|
||||||
|
|
||||||
|
% Use symbols instead of numbers:
|
||||||
|
\usepackage[symbol]{footmisc}
|
||||||
|
```
|
||||||
|
|
||||||
|
@preview
|
||||||
|
{.thin-padding}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
@slide(layout=extra-content-and-preview)
|
||||||
|
|
||||||
|
@title
|
||||||
|
A few more things
|
||||||
|
|
||||||
|
@content
|
||||||
|
* It is recommended that you include the package `hyperref` before `cleveref`.
|
||||||
|
* `\cref` can take multiple references at once, separated by commas.
|
||||||
|
|
||||||
|
``` {.hljs .lang-tex}
|
||||||
|
\section{An introduction}
|
||||||
|
\label{sec:section1}
|
||||||
|
% …
|
||||||
|
Reference be made to
|
||||||
|
\cref{sec:section1,sec:section2,
|
||||||
|
sec:section3,sec:section5}.
|
||||||
|
```
|
||||||
|
|
||||||
|
@preview
|
||||||
|

|
||||||
@ -4,209 +4,111 @@
|
|||||||
13
|
13
|
||||||
|
|
||||||
@title
|
@title
|
||||||
Referenzen und Fußnoten
|
Literatur­verwaltung
|
||||||
|
|
||||||
|
|
||||||
@slide(layout=content-and-preview)
|
|
||||||
|
|
||||||
@title
|
|
||||||
Fußnoten <span class="emoji">📎</span>
|
|
||||||
|
|
||||||
@content
|
|
||||||
``` {.hljs .lang-tex}
|
|
||||||
\usepackage{hyperref}
|
|
||||||
```
|
|
||||||
|
|
||||||
Die Nummerierung erfolgt automatisch und ist fortlaufend, unabhängig davon, ob ein neuer Abschnitt beginnt.
|
|
||||||
|
|
||||||
``` {.hljs .lang-tex}
|
|
||||||
Eber, beim Hausschwein insbesondere
|
|
||||||
oberdeutsch Saubär, beim Wildschwein
|
|
||||||
Keiler, bezeichnet das männliche
|
|
||||||
Geschlecht des Schweins.
|
|
||||||
\footnote{\url{https://de.wikipedia.org/
|
|
||||||
wiki/Eber}}
|
|
||||||
```
|
|
||||||
|
|
||||||
@preview
|
|
||||||

|
|
||||||
|
|
||||||
|
|
||||||
@slide(layout=content-and-preview)
|
|
||||||
|
|
||||||
@title
|
|
||||||
Querverweise
|
|
||||||
|
|
||||||
@content
|
|
||||||
Manuell (Just don’t!)
|
|
||||||
|
|
||||||
``` {.hljs .lang-tex}
|
|
||||||
Wie man in Abbildung 23 sieht, …
|
|
||||||
```
|
|
||||||
|
|
||||||
Mit dem Befehl `\ref`:
|
|
||||||
|
|
||||||
``` {.hljs .lang-tex}
|
|
||||||
\begin{figure}[H]
|
|
||||||
\includegraphics % …
|
|
||||||
\caption{Unser Maskottchen Fooboar}
|
|
||||||
\label{img:fooboar}
|
|
||||||
\end{figure}
|
|
||||||
|
|
||||||
Wie man in Abbildung \ref{img:fooboar} …
|
|
||||||
```
|
|
||||||
|
|
||||||
@preview
|
|
||||||

|
|
||||||
|
|
||||||
|
|
||||||
@slide(layout=content-and-preview)
|
|
||||||
|
|
||||||
@title
|
|
||||||
Referenzen
|
|
||||||
|
|
||||||
@content
|
|
||||||
Mit dem Paket `cleveref` (mit *einem* ›r‹!):
|
|
||||||
|
|
||||||
``` {.hljs .lang-tex}
|
|
||||||
\begin{figure}[H]
|
|
||||||
\includegraphics % …
|
|
||||||
\caption{Unser Maskottchen Fooboar}
|
|
||||||
\label{img:fooboar}
|
|
||||||
\end{figure}
|
|
||||||
|
|
||||||
Fooboar ist ein sehr engagierter
|
|
||||||
Jungeber (siehe \Cref{img:fooboar}).
|
|
||||||
```
|
|
||||||
|
|
||||||
Der Befehl `\cref` fügt selbstständig die passende Abkürzung ein.
|
|
||||||
|
|
||||||
@preview
|
|
||||||

|
|
||||||
|
|
||||||
|
|
||||||
@slide(layout=content-only)
|
@slide(layout=content-only)
|
||||||
|
|
||||||
@title
|
@title
|
||||||
Label vergeben
|
Was brauchen wir dafür?
|
||||||
|
|
||||||
@content
|
@content
|
||||||
Beide Referenzierungsbefehle funktionieren mit **Abschnitten, Bildern, Tabellen, Listings und Gleichungen,** sofern die richtigen Label vergeben wurden.
|
* eine **Bibliographiedatei** (nachfolgend `.bib`-Datei) zur Speicherung von Literaturverweisen
|
||||||
|
* **BibTeX** als Schnittstelle zwischen der Literatur und LaTeX
|
||||||
|
|
||||||
Label müssen **eindeutig** sein. Zur Strukturierung ist das Voranstellen von Kürzeln üblich, denn einige Pakete ziehen aus den Kürzeln Informationen.
|
|
||||||
|
|
||||||
<table>
|
@slide(layout=wide-content)
|
||||||
<tr>
|
|
||||||
<td>`fig:` Abbildungen</td>
|
@title
|
||||||
<td>`tbl:` Tabellen</td>
|
Was ist diese ominöse `.bib`-Datei?
|
||||||
</tr>
|
|
||||||
<tr>
|
@content
|
||||||
<td>`sec:` Abschnitte</td>
|
* Sammlung von Literatureinträgen im BibTeX-Format
|
||||||
<td>`subsec:` Unter­abschnitte</td>
|
* Beispielhafter Literatureintrag:
|
||||||
</tr>
|
|
||||||
<tr>
|
``` {.hljs .lang-tex}
|
||||||
<td>`ch:` Kapitel</td>
|
@article{turing1990, % Art des Dokuments und Bezeichner für den \cite Befehl
|
||||||
<td>`itm:` Aufzählungs­elemente</td>
|
title={The chemical basis of morphogenesis}, % Titel
|
||||||
</tr>
|
author={Turing, Alan Mathison}, % Autor
|
||||||
<tr>
|
journal={Bulletin of mathematical biology}, % Titel des Journals
|
||||||
<td>`eq:` Gleichungen</td>
|
volume={52}, % Band des Journals
|
||||||
<td>`lst:` Quelltext­listings</td>
|
pages={153--197}, % Seitenzahl im Journal
|
||||||
</tr>
|
year={1990}, % Erscheinungsjahr
|
||||||
</table>
|
publisher={Springer} % Verleger des Journals
|
||||||
|
}
|
||||||
|
```
|
||||||
|
|
||||||
|
|
||||||
@slide(layout=content-only)
|
@slide(layout=content-only)
|
||||||
|
|
||||||
@title
|
@title
|
||||||
Dinge, die zu beachten sind
|
Wie wird das verwendet?
|
||||||
|
|
||||||
@content
|
@content
|
||||||
* ++ Durch `\cref` eingefügte Passagen tauchen in einigen Dokumentklassen erst dann auf Deutsch auf, wenn bereits in der Dokumentklasse die Sprache festgelegt wurde:
|
Durch BibTeX wird LaTeX um einige Befehle zum Zitieren erweitert. Außerdem benötigt wird das Paket `natbib`.
|
||||||
|
|
||||||
``` {.hljs .lang-tex}
|
* ++ Zitieren eines Autors: `\citeauthor{<quelle>}`
|
||||||
\documentclass[ngerman]{article}
|
* ++ Zitieren einer Quelle: `\cite{<quelle>}`
|
||||||
```
|
* ++ Zitieren einer Seite: `\cite[S. 15]{<quelle>}`
|
||||||
|
* ++ Zitieren mit weiteren Zusätzen:<br/>`\cite[<präfix>][<suffix>]{<quelle>}`
|
||||||
|
* ++ Verweis auf die genutzte `.bib`-Datei: `\bibliography{<.bib-datei>}`
|
||||||
|
* ++ Angabe des genutzten Zitierstils: <br/>`\bibliographystyle{<zitierstil>}`
|
||||||
|
|
||||||
* ++ Beschriftungen (`\caption{…}`) müssen, von Abschnitten abgesehen, **immer und vor dem Label** vergeben werden.
|
> Zwei Dinge sind unendlich. Das Universum und die Auswahl an Zitierstilen.<cite>Unbekannt</cite>
|
||||||
|
|
||||||
* ++ Bei Abschnitten wird das Label direkt hinter dem Befehl angefügt.
|
|
||||||
|
|
||||||
``` {.hljs .lang-tex}
|
|
||||||
\section{Hinweise}\label{sec:hinweise}
|
|
||||||
```
|
|
||||||
|
|
||||||
|
|
||||||
@slide(layout=task)
|
@slide(layout=preview-only)
|
||||||
|
|
||||||
|
@preview
|
||||||
|
{.large .thin-padding}
|
||||||
|
|
||||||
|
|
||||||
|
@slide(layout=preview-only)
|
||||||
|
|
||||||
|
@preview
|
||||||
|
{.large .thin-padding}
|
||||||
|
|
||||||
|
|
||||||
|
@slide(layout=preview-only)
|
||||||
|
|
||||||
|
@preview
|
||||||
|
{.large}
|
||||||
|
|
||||||
|
|
||||||
|
@slide(layout=preview-only)
|
||||||
|
|
||||||
|
@preview
|
||||||
|
{.large}
|
||||||
|
|
||||||
|
|
||||||
|
@slide(layout=preview-only)
|
||||||
|
|
||||||
|
@preview
|
||||||
|
{.large}
|
||||||
|
|
||||||
|
|
||||||
|
@slide(layout=preview-only)
|
||||||
|
|
||||||
|
@preview
|
||||||
|
{.large}
|
||||||
|
|
||||||
|
|
||||||
|
@slide(layout=wide-task)
|
||||||
|
|
||||||
@task-number
|
@task-number
|
||||||
13
|
13
|
||||||
|
|
||||||
@title
|
@title
|
||||||
Fußnoten einfügen
|
Ein Literaturverzeichnis erstellen und einfügen
|
||||||
|
|
||||||
@content
|
@content
|
||||||
* Pack den Text *March 2021* in der Datei `exercises/footnotes/footnotes.tex` in eine **Fußnote**.
|
* Erstellt im Ordner `exercises/literature` eine neue BibTeX-Datei `literature.bib`.
|
||||||
* Fügt zusätzlich eine **klickbare URL**, die zur Download-Seite des Java Development Kit führt (`https://www.oracle.com/java/technologies/javase-downloads.html`), als Fußnote ein.
|
* Sucht bei Google Scholar oder dblp.org die BibTeX-Einträge für folgende $\LaTeX$-Handbücher:
|
||||||
|
* Dilip Datta (2017): $\LaTeX$ in 24 Hours. A Practical Guide for Scientific Writing.
|
||||||
|
* Frank Mittelbach / Michel Goossens (2012): Der $\LaTeX$-Begleiter.
|
||||||
|
* Fügt die BibTeX-Einträge in die BibTeX-Datei ein.
|
||||||
@slide(layout=task)
|
* Vergebt aussagekräftige BibTeX-Keys.
|
||||||
|
* Bindet die BibTeX-Datei an einer geeigneten Stelle ein, an der später auch das Literaturverzeichnis zu sehen sein soll.
|
||||||
@task-number
|
* Zitiert die zwei Handbücher im Text in der Datei `exercises/literature/literature.tex`.
|
||||||
14
|
* Wählt den Bibliographiestil `plain`.
|
||||||
|
|
||||||
@title
|
|
||||||
Referenzen einfügen
|
|
||||||
|
|
||||||
@content
|
|
||||||
* Ersetzt im Text in der Datei `references.tex` im Ordner `exercises/references` *In the figure* und *The following source code listing* durch eine **Referenz** auf das Bild bzw. auf das Quelltext-Listing.
|
|
||||||
* Nutzt dafür den Befehl `\Cref`.
|
|
||||||
* Achtet darauf, zuerst **Labels** für die Elemente, die ihr referenzieren wollt, zu vergeben.
|
|
||||||
* Packt dafür das Quelltext-Listing in eine **Umgebung** namens `listing`.
|
|
||||||
* Fügt noch eine **Beschriftung** zum Listing hinzu.
|
|
||||||
|
|
||||||
|
|
||||||
@slide(layout=extra-content-and-preview)
|
|
||||||
|
|
||||||
@title
|
|
||||||
Konfiguration von Fußnoten
|
|
||||||
|
|
||||||
@content
|
|
||||||
Das Paket `footmisc` stellt verschiedene weitere Optionen für die Darstellung von Fußnoten zur Verfügung, die als optionale Parameter an den Befehl `\usepackage` übergeben werden können.
|
|
||||||
|
|
||||||
``` {.hljs .lang-tex}
|
|
||||||
% Zählung auf jeder Seite neu beginnen:
|
|
||||||
\usepackage[perpage]{footmisc}
|
|
||||||
|
|
||||||
% Fußnoten inline anzeigen lassen:
|
|
||||||
\usepackage[para]{footmisc}
|
|
||||||
|
|
||||||
% Symbole statt Nummerierung verwenden:
|
|
||||||
\usepackage[symbol]{footmisc}
|
|
||||||
```
|
|
||||||
|
|
||||||
@preview
|
|
||||||
{.thin-padding}
|
|
||||||
|
|
||||||
|
|
||||||
@slide(layout=extra-content-and-preview)
|
|
||||||
|
|
||||||
@title
|
|
||||||
Weiterführend
|
|
||||||
|
|
||||||
@content
|
|
||||||
* Wurde vor dem Paket `cleveref` das Paket `hyperref` eingebunden, entsteht ein **klickbarer Link** im fertigen PDF.
|
|
||||||
* Mehrere Referenzen können in `\cref` kommagetrennt angegeben werden.
|
|
||||||
|
|
||||||
``` {.hljs .lang-tex}
|
|
||||||
\section{Ein Einstieg}
|
|
||||||
\label{sec:section1}
|
|
||||||
% …
|
|
||||||
Hier sei verwiesen auf
|
|
||||||
\cref{sec:section1,sec:section2,
|
|
||||||
sec:section3,sec:section5}.
|
|
||||||
```
|
|
||||||
|
|
||||||
@preview
|
|
||||||

|
|
||||||
|
|
||||||
|
|||||||
@ -4,211 +4,111 @@
|
|||||||
13
|
13
|
||||||
|
|
||||||
@title
|
@title
|
||||||
References and footnotes
|
Reference management
|
||||||
|
|
||||||
|
|
||||||
@slide(layout=content-and-preview)
|
|
||||||
|
|
||||||
@title
|
|
||||||
Footnotes <span class="emoji">📎</span>
|
|
||||||
|
|
||||||
@content
|
|
||||||
``` {.hljs .lang-tex}
|
|
||||||
\usepackage{hyperref}
|
|
||||||
```
|
|
||||||
|
|
||||||
Footnotes are automatically numbered consecutively, independent of sections.
|
|
||||||
|
|
||||||
(Here, `hyperref` is used for the `\url` command, it is not necessary for footnotes per se.)
|
|
||||||
|
|
||||||
``` {.hljs .lang-tex}
|
|
||||||
The wild boar (\textit{Sus scrofa}), also
|
|
||||||
known as the wild swine, common wild pig,
|
|
||||||
or simply wild pig, is a suid native to
|
|
||||||
much of Eurasia and North Africa, and has
|
|
||||||
been introduced to the Americas and Oceania.
|
|
||||||
\footnote{\url{https://en.wikipedia.org/
|
|
||||||
wiki/Wild_boar}}
|
|
||||||
```
|
|
||||||
|
|
||||||
@preview
|
|
||||||

|
|
||||||
|
|
||||||
|
|
||||||
@slide(layout=content-and-preview)
|
|
||||||
|
|
||||||
@title
|
|
||||||
Cross-references
|
|
||||||
|
|
||||||
@content
|
|
||||||
Manually (just don’t!)
|
|
||||||
|
|
||||||
``` {.hljs .lang-tex}
|
|
||||||
As you can see in figure 23, …
|
|
||||||
```
|
|
||||||
|
|
||||||
Using the `\ref` command:
|
|
||||||
|
|
||||||
``` {.hljs .lang-tex}
|
|
||||||
\begin{figure}[H]
|
|
||||||
\includegraphics % …
|
|
||||||
\caption{Our mascot Fooboar}
|
|
||||||
\label{img:fooboar}
|
|
||||||
\end{figure}
|
|
||||||
|
|
||||||
As you can see in figure
|
|
||||||
\ref{img:fooboar}, …
|
|
||||||
```
|
|
||||||
|
|
||||||
@preview
|
|
||||||

|
|
||||||
@slide(layout=content-only)
|
|
||||||
|
|
||||||
@title
|
|
||||||
Assigning labels
|
|
||||||
|
|
||||||
@content
|
|
||||||
Both cross-reference commands work with **sections, figures, tables, listings, and equations,** as long as you use correct labels.
|
|
||||||
|
|
||||||
Labels have to be **unambiguous.** For clarity, certain prefixes are common, and some packages use them to derive information.
|
|
||||||
|
|
||||||
<table>
|
|
||||||
<tr>
|
|
||||||
<td>`fig:` Figures</td>
|
|
||||||
<td>`tbl:` Tables</td>
|
|
||||||
</tr>
|
|
||||||
<tr>
|
|
||||||
<td>`sec:` Sections</td>
|
|
||||||
<td>`subsec:` Subsections</td>
|
|
||||||
</tr>
|
|
||||||
<tr>
|
|
||||||
<td>`ch:` Chapters</td>
|
|
||||||
<td>`itm:` Enumeration items</td>
|
|
||||||
</tr>
|
|
||||||
<tr>
|
|
||||||
<td>`eq:` Equations</td>
|
|
||||||
<td>`lst:` Source code listings</td>
|
|
||||||
</tr>
|
|
||||||
</table>
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
@slide(layout=content-and-preview)
|
|
||||||
|
|
||||||
@title
|
|
||||||
Cross-references
|
|
||||||
|
|
||||||
@content
|
|
||||||
Using the `cleveref` package (with *one* ‘r’!):
|
|
||||||
|
|
||||||
``` {.hljs .lang-tex}
|
|
||||||
\begin{figure}[H]
|
|
||||||
\includegraphics % …
|
|
||||||
\caption{Our mascot Fooboar}
|
|
||||||
\label{img:fooboar}
|
|
||||||
\end{figure}
|
|
||||||
|
|
||||||
Fooboar is a young and highly engaged
|
|
||||||
boar (see \Cref{img:fooboar}).
|
|
||||||
```
|
|
||||||
|
|
||||||
The `\cref` command automatically inserts suitable prefixes.
|
|
||||||
|
|
||||||
@preview
|
|
||||||

|
|
||||||
|
|
||||||
|
|
||||||
@slide(layout=content-only)
|
@slide(layout=content-only)
|
||||||
|
|
||||||
@title
|
@title
|
||||||
Things to consider
|
What do we need?
|
||||||
|
|
||||||
@content
|
@content
|
||||||
* Terms inserted by `\cref` use the language specified with the document class (or `babel`):
|
* a **bibliography file** (hereafter `.bib` file) for storing references
|
||||||
|
* **BibTeX** as an interface between the references and LaTeX
|
||||||
``` {.hljs .lang-tex}
|
|
||||||
\documentclass[english]{article}
|
|
||||||
```
|
|
||||||
|
|
||||||
* Apart from sections, referenced elements need captions (`\caption{…}`), and the **captions have to be placed before the label.**
|
|
||||||
|
|
||||||
* For sectioning commands, the label is inserted directly after the section command.
|
|
||||||
|
|
||||||
``` {.hljs .lang-tex}
|
|
||||||
\section{Notes}\label{sec:notes}
|
|
||||||
```
|
|
||||||
|
|
||||||
|
|
||||||
@slide(layout=task)
|
@slide(layout=wide-content)
|
||||||
|
|
||||||
|
@title
|
||||||
|
What is this mysterious `.bib` file?
|
||||||
|
|
||||||
|
@content
|
||||||
|
* collection of references in BibTeX format
|
||||||
|
* example:
|
||||||
|
|
||||||
|
``` {.hljs .lang-tex}
|
||||||
|
@article{turing1990, % the type of the document and an identifier for the \cite command
|
||||||
|
title={The chemical basis of morphogenesis}, % information
|
||||||
|
author={Turing, Alan Mathison}, % about
|
||||||
|
journal={Bulletin of mathematical biology}, % the
|
||||||
|
volume={52}, % literature
|
||||||
|
pages={153--197}, % work
|
||||||
|
year={1990}, % follows
|
||||||
|
publisher={Springer} % …
|
||||||
|
}
|
||||||
|
```
|
||||||
|
|
||||||
|
|
||||||
|
@slide(layout=content-only)
|
||||||
|
|
||||||
|
@title
|
||||||
|
How is it used?
|
||||||
|
|
||||||
|
@content
|
||||||
|
BibTeX adds some citation commands to LaTeX. In addition, we need the `natbib` package.
|
||||||
|
|
||||||
|
* ++ Citing an author: `\citeauthor{<source>}`
|
||||||
|
* ++ Citing a source: `\cite{<source>}`
|
||||||
|
* ++ Citing a page: `\cite[p. 15]{<source>}`
|
||||||
|
* ++ Citing with additional text:<br/>`\cite[<prefix>][<suffix>]{<source>}`
|
||||||
|
* ++ Referencing the `.bib` file: `\bibliography{<.bib file>}`
|
||||||
|
* ++ Choosing a citation style: <br/>`\bibliographystyle{<citation style>}`
|
||||||
|
|
||||||
|
> Two things are infinite: the universe and the assortment of citation styles.<cite>Unknown</cite>
|
||||||
|
|
||||||
|
|
||||||
|
@slide(layout=preview-only)
|
||||||
|
|
||||||
|
@preview
|
||||||
|
{.large .thin-padding}
|
||||||
|
|
||||||
|
|
||||||
|
@slide(layout=preview-only)
|
||||||
|
|
||||||
|
@preview
|
||||||
|
{.large .thin-padding}
|
||||||
|
|
||||||
|
|
||||||
|
@slide(layout=preview-only)
|
||||||
|
|
||||||
|
@preview
|
||||||
|
{.large}
|
||||||
|
|
||||||
|
|
||||||
|
@slide(layout=preview-only)
|
||||||
|
|
||||||
|
@preview
|
||||||
|
{.large}
|
||||||
|
|
||||||
|
|
||||||
|
@slide(layout=preview-only)
|
||||||
|
|
||||||
|
@preview
|
||||||
|
{.large}
|
||||||
|
|
||||||
|
|
||||||
|
@slide(layout=preview-only)
|
||||||
|
|
||||||
|
@preview
|
||||||
|
{.large}
|
||||||
|
|
||||||
|
|
||||||
|
@slide(layout=wide-task)
|
||||||
|
|
||||||
@task-number
|
@task-number
|
||||||
13
|
13
|
||||||
|
|
||||||
@title
|
@title
|
||||||
Inserting footnotes
|
|
||||||
|
Creating and inserting references
|
||||||
|
|
||||||
@content
|
@content
|
||||||
* Make the text *March 2021* in file `exercises/footnotes/footnotes.tex` appear as a **footnote**.
|
* Create a new BibTeX file called `literature.bib` in the `exercises/literature` folder.
|
||||||
* Additionally, insert a **clickable URL** that leads to the download page for the Java Development Kit (`https://www.oracle.com/java/technologies/javase-downloads.html`).
|
* Use Google Scholar or dblp.org to retrieve BibTeX references for the following $\LaTeX$ handbooks:
|
||||||
|
* Dilip Datta (2017): $\LaTeX$ in 24 Hours. A Practical Guide for Scientific Writing.
|
||||||
|
* Frank Mittelbach / Michel Goossens (2012): Der $\LaTeX$-Begleiter.
|
||||||
@slide(layout=task)
|
* Add the BibTeX entries to the BibTeX file.
|
||||||
|
* Assign unique and meaningful BibTeX keys.
|
||||||
@task-number
|
* Include the BibTeX file in a suitable location, where later on the references should be listed.
|
||||||
14
|
* Cite the two handbooks in the file `exercises/literature/literature.tex`.
|
||||||
|
* Make use of the `plain` bibliography style.
|
||||||
@title
|
|
||||||
Inserting references
|
|
||||||
|
|
||||||
@content
|
|
||||||
* In file `exercises/references/references.tex`, replace *In the figure* and *The following source code listing* by **references** to the figure and to the source code listing.
|
|
||||||
* Use the command `\Cref` for the references.
|
|
||||||
* Make sure to add **labels** to the elements that you want to create a reference for.
|
|
||||||
* To do so, wrap the source code listing in a `listing` **environment**.
|
|
||||||
* Additionally, add a **caption** to the source code listing.
|
|
||||||
|
|
||||||
|
|
||||||
@slide(layout=extra-content-and-preview)
|
|
||||||
|
|
||||||
@title
|
|
||||||
Configuring footnotes
|
|
||||||
|
|
||||||
@content
|
|
||||||
The `footmisc` package provides additional options for the presentation of footnotes that can be activated by adding parameters to the `\usepackage` command.
|
|
||||||
|
|
||||||
``` {.hljs .lang-tex}
|
|
||||||
% Reset the counter on each page:
|
|
||||||
\usepackage[perpage]{footmisc}
|
|
||||||
|
|
||||||
% Display footnotes in-line:
|
|
||||||
\usepackage[para]{footmisc}
|
|
||||||
|
|
||||||
% Use symbols instead of numbers:
|
|
||||||
\usepackage[symbol]{footmisc}
|
|
||||||
```
|
|
||||||
|
|
||||||
@preview
|
|
||||||
{.thin-padding}
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
@slide(layout=extra-content-and-preview)
|
|
||||||
|
|
||||||
@title
|
|
||||||
A few more things
|
|
||||||
|
|
||||||
@content
|
|
||||||
* It is recommended that you include the package `hyperref` before `cleveref`.
|
|
||||||
* `\cref` can take multiple references at once, separated by commas.
|
|
||||||
|
|
||||||
``` {.hljs .lang-tex}
|
|
||||||
\section{An introduction}
|
|
||||||
\label{sec:section1}
|
|
||||||
% …
|
|
||||||
Reference be made to
|
|
||||||
\cref{sec:section1,sec:section2,
|
|
||||||
sec:section3,sec:section5}.
|
|
||||||
```
|
|
||||||
|
|
||||||
@preview
|
|
||||||

|
|
||||||
|
|||||||
@ -4,111 +4,211 @@
|
|||||||
14
|
14
|
||||||
|
|
||||||
@title
|
@title
|
||||||
Literatur­verwaltung
|
Paket in Sicht!
|
||||||
|
|
||||||
|
@slide(layout=content-and-preview)
|
||||||
@slide(layout=content-only)
|
|
||||||
|
|
||||||
@title
|
@title
|
||||||
Was brauchen wir dafür?
|
Stichwortverzeichnis anlegen
|
||||||
|
|
||||||
@content
|
@content
|
||||||
* eine **Bibliographiedatei** (nachfolgend `.bib`-Datei) zur Speicherung von Literaturverweisen
|
```{.lang-tex .hljs}
|
||||||
* **BibTeX** als Schnittstelle zwischen der Literatur und LaTeX
|
\usepackage{makeidx}
|
||||||
|
\makeindex
|
||||||
|
\begin{document}
|
||||||
@slide(layout=wide-content)
|
\maketitle
|
||||||
|
\section{Was ist LaTeX\index{LaTeX}?}
|
||||||
@title
|
LaTeX\index{LaTeX} ist ein
|
||||||
Was ist diese ominöse `.bib`-Datei?
|
Textsatzsystem\index{Textsatzsystem}.
|
||||||
|
\newpage \section{TeX\index{TeX} vs.
|
||||||
@content
|
LaTeX\index{LaTeX}} Es basiert auf
|
||||||
* Sammlung von Literatureinträgen im BibTeX-Format
|
TeX\index{TeX}, einer Erfindung von
|
||||||
* Beispielhafter Literatureintrag:
|
Donald Knuth\index{Knuth, Donald}.
|
||||||
|
Da TeX\index{TeX} in seiner Syntax sehr
|
||||||
``` {.hljs .lang-tex}
|
viel komplexer als LaTeX\index{LaTeX}
|
||||||
@article{turing1990, % Art des Dokuments und Bezeichner für den \cite Befehl
|
ist, ist LaTeX\index{LaTeX} wesentlich
|
||||||
title={The chemical basis of morphogenesis}, % Titel
|
weiter verbreitet.
|
||||||
author={Turing, Alan Mathison}, % Autor
|
\printindex
|
||||||
journal={Bulletin of mathematical biology}, % Titel des Journals
|
|
||||||
volume={52}, % Band des Journals
|
|
||||||
pages={153--197}, % Seitenzahl im Journal
|
|
||||||
year={1990}, % Erscheinungsjahr
|
|
||||||
publisher={Springer} % Verleger des Journals
|
|
||||||
}
|
|
||||||
```
|
```
|
||||||
|
|
||||||
|
@preview
|
||||||
|

|
||||||
|
|
||||||
|
@slide(layout=content-and-preview)
|
||||||
|
|
||||||
|
@title
|
||||||
|
Präsentationen gestalten
|
||||||
|
|
||||||
|
@content
|
||||||
|
Für Präsentationen gibt es die Dokumentenklasse `beamer` sowie zahlreiche [Vorlagen und Themes](https://www.overleaf.com/learn/latex/Beamer).
|
||||||
|
|
||||||
|
```{.lang-tex .hljs .small-text}
|
||||||
|
\documentclass{beamer}
|
||||||
|
\usetheme{Frankfurt}
|
||||||
|
\usecolortheme{seahorse}
|
||||||
|
\usepackage[utf8]{inputenc}
|
||||||
|
|
||||||
|
\begin{document}
|
||||||
|
\begin{frame}
|
||||||
|
\frametitle{Zitronensorbet}
|
||||||
|
\framesubtitle{Inkarnation des Guten?}
|
||||||
|
\begin{definition}
|
||||||
|
Ein Zitronensorbet ist eine
|
||||||
|
halbgefrorene \textbf{Speiseeiscreme}
|
||||||
|
auf Basis von \textit{Zitronen}.
|
||||||
|
\end{definition}
|
||||||
|
\end{frame}
|
||||||
|
\end{document}
|
||||||
|
```
|
||||||
|
|
||||||
|
@preview
|
||||||
|
<img src="svg/chapter-15/beamer-orig.svg" style="width: 100%; margin: 0;"/>
|
||||||
|
|
||||||
|
|
||||||
|
@slide(layout=content-and-preview)
|
||||||
|
|
||||||
|
@title
|
||||||
|
Grafiken erstellen
|
||||||
|
|
||||||
|
@content
|
||||||
|
`TikZ` (»TikZ ist kein Zeichenprogramm«) ist ein umfangreiches Paket zur Erstellung von Vektorgrafiken.
|
||||||
|
|
||||||
|
```{.lang-tex .hljs .small-text .scroll-one-half}
|
||||||
|
% …
|
||||||
|
\tikzstyle{every node}=[draw=black,thick,anchor=west]
|
||||||
|
\tikzstyle{selected}=[draw=red,fill=red!30]
|
||||||
|
\tikzstyle{dir}=[fill=gray!50]
|
||||||
|
\tikzstyle{relativeTo}=[fill=blue!70]
|
||||||
|
\begin{tikzpicture}[%
|
||||||
|
grow via
|
||||||
|
three points={one child at (0.5,-0.7) and
|
||||||
|
two children at
|
||||||
|
(0.5,-0.7) and (0.5,-1.4)},
|
||||||
|
edge from
|
||||||
|
parent path={(\tikzparentnode.south)
|
||||||
|
|- (\tikzchildnode.west)}]
|
||||||
|
\node {/ oder C:}
|
||||||
|
child { node {home}
|
||||||
|
child { node {knut}
|
||||||
|
child { node {pictures}}
|
||||||
|
child { node {docs}
|
||||||
|
child { node [dir] {latex}
|
||||||
|
child { node [relativeTo] {main.tex}
|
||||||
|
child { node [selected] {part1.tex}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
};
|
||||||
|
\end{tikzpicture}
|
||||||
|
```
|
||||||
|
|
||||||
|
@preview
|
||||||
|

|
||||||
|
|
||||||
|
|
||||||
|
@slide(layout=content-and-preview)
|
||||||
|
|
||||||
|
@title
|
||||||
|
Linguistik
|
||||||
|
|
||||||
|
@content
|
||||||
|
Mit dem Paket `qtree` lassen sich Konstituentenbäume erstellen:
|
||||||
|
|
||||||
|
```{.lang-tex .hljs}
|
||||||
|
\Tree [.S [.NP LaTeX ]
|
||||||
|
[.VP [.V is ] [.NP fun ] ] ]
|
||||||
|
```
|
||||||
|
|
||||||
|
@preview
|
||||||
|

|
||||||
|
|
||||||
|
@slide(layout=content-and-preview)
|
||||||
|
|
||||||
|
@title
|
||||||
|
Mathematische Beweisführung
|
||||||
|
|
||||||
|
@content
|
||||||
|
Beweisbäume lassen sich mit dem Paket `prftree` einwandfrei darstellen.
|
||||||
|
|
||||||
|
```{.hljs .lang-tex .small-text .scroll-one-half}
|
||||||
|
\begin{displaymath}
|
||||||
|
\prftree[l,r]{}{[comp$\_{ns}$]}
|
||||||
|
{
|
||||||
|
\prftree[l,r]{}{[comp$\_{ns}$]}
|
||||||
|
{
|
||||||
|
\prftree[l,r]{}{[ass$\_{ns}$]}
|
||||||
|
{
|
||||||
|
-
|
||||||
|
}
|
||||||
|
{
|
||||||
|
(\texttt{m:=a}, \sigma\_{\bot,\bot})
|
||||||
|
\rightarrow \sigma\_{48,\bot}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
{
|
||||||
|
\prftree[l,r]{}{[ass$\_{ns}$]}
|
||||||
|
{
|
||||||
|
-
|
||||||
|
}
|
||||||
|
{
|
||||||
|
(\texttt{n:=b}, \sigma\_{48,\bot})
|
||||||
|
\rightarrow \sigma\_{48,18}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
{
|
||||||
|
(\texttt{m:=a; n:=b}, \sigma\_{\bot,\bot})
|
||||||
|
\rightarrow \sigma\_{48,18}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
{
|
||||||
|
\prftree[l,r]{}{}
|
||||||
|
{
|
||||||
|
\dots
|
||||||
|
}
|
||||||
|
{
|
||||||
|
\textbf{[1]}\ (\texttt{LOOP}, \sigma\_{48,18})
|
||||||
|
\rightarrow \sigma\_{6,6}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
{
|
||||||
|
(\texttt{m:=a; n:=b; LOOP}, \sigma\_{\bot,\bot})
|
||||||
|
\rightarrow \sigma\_{6,6}
|
||||||
|
}
|
||||||
|
\end{displaymath}
|
||||||
|
```
|
||||||
|
|
||||||
|
@preview
|
||||||
|
<img class="thin-padding" src="svg/chapter-15/prftree-crop.svg"/>
|
||||||
|
|
||||||
@slide(layout=content-only)
|
@slide(layout=content-only)
|
||||||
|
|
||||||
@title
|
@title
|
||||||
Wie wird das verwendet?
|
Weitere nützliche Pakete
|
||||||
|
|
||||||
@content
|
@content
|
||||||
Durch BibTeX wird LaTeX um einige Befehle zum Zitieren erweitert. Außerdem benötigt wird das Paket `natbib`.
|
<table>
|
||||||
|
<tr>
|
||||||
* ++ Zitieren eines Autors: `\citeauthor{<quelle>}`
|
<th>Paket</th>
|
||||||
* ++ Zitieren einer Quelle: `\cite{<quelle>}`
|
<th>Anwendung</th>
|
||||||
* ++ Zitieren einer Seite: `\cite[S. 15]{<quelle>}`
|
</tr>
|
||||||
* ++ Zitieren mit weiteren Zusätzen:<br/>`\cite[<präfix>][<suffix>]{<quelle>}`
|
<tr class="fragment">
|
||||||
* ++ Verweis auf die genutzte `.bib`-Datei: `\bibliography{<.bib-datei>}`
|
<td><a href="https://www.ctan.org/pkg/xcolor"><code>xcolor</code></a></td>
|
||||||
* ++ Angabe des genutzten Zitierstils: <br/>`\bibliographystyle{<zitierstil>}`
|
<td>Mach’s mit Farbe</td>
|
||||||
|
</tr>
|
||||||
> Zwei Dinge sind unendlich. Das Universum und die Auswahl an Zitierstilen.<cite>Unbekannt</cite>
|
<tr class="fragment">
|
||||||
|
<td><a href="https://www.ctan.org/pkg/todonotes"><code>todonotes</code></a></td>
|
||||||
|
<td>ToDo-Markierungen und Liste der ToDos</td>
|
||||||
@slide(layout=preview-only)
|
</tr>
|
||||||
|
<tr class="fragment">
|
||||||
@preview
|
<td><a href="https://www.ctan.org/pkg/pdfpages"><code>pdfpages</code></a></td>
|
||||||
{.large .thin-padding}
|
<td>Einbinden von PDF-Dateien</td>
|
||||||
|
</tr>
|
||||||
|
<tr class="fragment">
|
||||||
@slide(layout=preview-only)
|
<td><a href="https://www.ctan.org/pkg/subcaption"><code>subcaption</code></a></td>
|
||||||
|
<td>Verschachtelte Abbildungen und ausgefeilte Bildunterschriften</td>
|
||||||
@preview
|
</tr>
|
||||||
{.large .thin-padding}
|
<tr class="fragment">
|
||||||
|
<td><a href="https://www.ctan.org/pkg/colortbl"><code>colortbl</code></a>, <a href="https://www.ctan.org/pkg/tabularx"><code>tabularx</code></a>, <a href="https://www.ctan.org/pkg/multirow"><code>multirow</code></a>, <a href="https://www.ctan.org/pkg/makecell"><code>makecell</code></a></td>
|
||||||
|
<td>Gestalten von Tabellen</td>
|
||||||
@slide(layout=preview-only)
|
</tr>
|
||||||
|
</table>
|
||||||
@preview
|
|
||||||
{.large}
|
|
||||||
|
|
||||||
|
|
||||||
@slide(layout=preview-only)
|
|
||||||
|
|
||||||
@preview
|
|
||||||
{.large}
|
|
||||||
|
|
||||||
|
|
||||||
@slide(layout=preview-only)
|
|
||||||
|
|
||||||
@preview
|
|
||||||
{.large}
|
|
||||||
|
|
||||||
|
|
||||||
@slide(layout=preview-only)
|
|
||||||
|
|
||||||
@preview
|
|
||||||
{.large}
|
|
||||||
|
|
||||||
|
|
||||||
@slide(layout=wide-task)
|
|
||||||
|
|
||||||
@task-number
|
|
||||||
15
|
|
||||||
|
|
||||||
@title
|
|
||||||
Ein Literaturverzeichnis erstellen und einfügen
|
|
||||||
|
|
||||||
@content
|
|
||||||
* Erstellt im Ordner `exercises/literature` eine neue BibTeX-Datei `literature.bib`.
|
|
||||||
* Sucht bei Google Scholar oder dblp.org die BibTeX-Einträge für folgende $\LaTeX$-Handbücher:
|
|
||||||
* Dilip Datta (2017): $\LaTeX$ in 24 Hours. A Practical Guide for Scientific Writing.
|
|
||||||
* Frank Mittelbach / Michel Goossens (2012): Der $\LaTeX$-Begleiter.
|
|
||||||
* Fügt die BibTeX-Einträge in die BibTeX-Datei ein.
|
|
||||||
* Vergebt aussagekräftige BibTeX-Keys.
|
|
||||||
* Bindet die BibTeX-Datei an einer geeigneten Stelle ein, an der später auch das Literaturverzeichnis zu sehen sein soll.
|
|
||||||
* Zitiert die zwei Handbücher im Text in der Datei `exercises/literature/literature.tex`.
|
|
||||||
* Wählt den Bibliographiestil `plain`.
|
|
||||||
|
|
||||||
|
|||||||
@ -4,111 +4,212 @@
|
|||||||
14
|
14
|
||||||
|
|
||||||
@title
|
@title
|
||||||
Reference management
|
Package in sight!
|
||||||
|
|
||||||
|
@slide(layout=content-and-preview)
|
||||||
@slide(layout=content-only)
|
|
||||||
|
|
||||||
@title
|
@title
|
||||||
What do we need?
|
Creating an index
|
||||||
|
|
||||||
@content
|
@content
|
||||||
* a **bibliography file** (hereafter `.bib` file) for storing references
|
```{.lang-tex .hljs}
|
||||||
* **BibTeX** as an interface between the references and LaTeX
|
\usepackage{makeidx}
|
||||||
|
\makeindex
|
||||||
|
\begin{document}
|
||||||
@slide(layout=wide-content)
|
\maketitle
|
||||||
|
\section{What is LaTeX\index{LaTeX}?}
|
||||||
@title
|
LaTeX\index{LaTeX} is a typesetting
|
||||||
What is this mysterious `.bib` file?
|
system\index{Typesetting system}.
|
||||||
|
\newpage \section{TeX\index{TeX} vs.
|
||||||
@content
|
LaTeX\index{LaTeX}} It is based on
|
||||||
* collection of references in BibTeX format
|
TeX\index{TeX}, an invention by
|
||||||
* example:
|
Donald Knuth\index{Knuth, Donald}.
|
||||||
|
As TeX\index{TeX} is way more complex
|
||||||
``` {.hljs .lang-tex}
|
syntactically than LaTeX\index{LaTeX},
|
||||||
@article{turing1990, % the type of the document and an identifier for the \cite command
|
LaTeX\index{LaTeX} is much more
|
||||||
title={The chemical basis of morphogenesis}, % information
|
popular.
|
||||||
author={Turing, Alan Mathison}, % about
|
\printindex
|
||||||
journal={Bulletin of mathematical biology}, % the
|
|
||||||
volume={52}, % literature
|
|
||||||
pages={153--197}, % work
|
|
||||||
year={1990}, % follows
|
|
||||||
publisher={Springer} % …
|
|
||||||
}
|
|
||||||
```
|
```
|
||||||
|
|
||||||
|
@preview
|
||||||
|

|
||||||
|
|
||||||
|
@slide(layout=content-and-preview)
|
||||||
|
|
||||||
|
@title
|
||||||
|
Designing presentation slides
|
||||||
|
|
||||||
|
@content
|
||||||
|
For slides, there is the `beamer` document class, as well as numerous [templates and themes](https://www.overleaf.com/learn/latex/Beamer).
|
||||||
|
|
||||||
|
```{.lang-tex .hljs .small-text}
|
||||||
|
\documentclass{beamer}
|
||||||
|
\usetheme{Frankfurt}
|
||||||
|
\usecolortheme{seahorse}
|
||||||
|
\usepackage[utf8]{inputenc}
|
||||||
|
|
||||||
|
\begin{document}
|
||||||
|
\begin{frame}
|
||||||
|
\frametitle{Lemon sorbet}
|
||||||
|
\framesubtitle{Incarnation of good?}
|
||||||
|
\begin{definition}
|
||||||
|
A lemon sorbet is a
|
||||||
|
semi-frozen \textbf{dessert}
|
||||||
|
on \textit{lemon} base.
|
||||||
|
\end{definition}
|
||||||
|
\end{frame}
|
||||||
|
\end{document}
|
||||||
|
```
|
||||||
|
|
||||||
|
@preview
|
||||||
|
<img src="svg/chapter-15/beamer-orig.svg" style="width: 100%; margin: 0;"/>
|
||||||
|
|
||||||
|
|
||||||
|
@slide(layout=content-and-preview)
|
||||||
|
|
||||||
|
@title
|
||||||
|
Drawing images
|
||||||
|
|
||||||
|
@content
|
||||||
|
`TikZ` (“TikZ ist kein Zeichenprogramm” — “TikZ is no drawing software”) is a powerful package for drawing vector graphics.
|
||||||
|
|
||||||
|
```{.lang-tex .hljs .small-text .scroll-one-half}
|
||||||
|
% …
|
||||||
|
\tikzstyle{every node}=[draw=black,thick,anchor=west]
|
||||||
|
\tikzstyle{selected}=[draw=red,fill=red!30]
|
||||||
|
\tikzstyle{dir}=[fill=gray!50]
|
||||||
|
\tikzstyle{relativeTo}=[fill=blue!70]
|
||||||
|
\begin{tikzpicture}[%
|
||||||
|
grow via
|
||||||
|
three points={one child at (0.5,-0.7) and
|
||||||
|
two children at
|
||||||
|
(0.5,-0.7) and (0.5,-1.4)},
|
||||||
|
edge from
|
||||||
|
parent path={(\tikzparentnode.south)
|
||||||
|
|- (\tikzchildnode.west)}]
|
||||||
|
\node {/ or C:}
|
||||||
|
child { node {home}
|
||||||
|
child { node {knut}
|
||||||
|
child { node {pictures}}
|
||||||
|
child { node {docs}
|
||||||
|
child { node [dir] {latex}
|
||||||
|
child { node [relativeTo] {main.tex}
|
||||||
|
child { node [selected] {part1.tex}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
};
|
||||||
|
\end{tikzpicture}
|
||||||
|
```
|
||||||
|
|
||||||
|
@preview
|
||||||
|

|
||||||
|
|
||||||
|
|
||||||
|
@slide(layout=content-and-preview)
|
||||||
|
|
||||||
|
@title
|
||||||
|
Linguistics
|
||||||
|
|
||||||
|
@content
|
||||||
|
The `qtree` package can render constituent-based parse trees:
|
||||||
|
|
||||||
|
```{.lang-tex .hljs}
|
||||||
|
\Tree [.S [.NP LaTeX ]
|
||||||
|
[.VP [.V is ] [.NP fun ] ] ]
|
||||||
|
```
|
||||||
|
|
||||||
|
@preview
|
||||||
|

|
||||||
|
|
||||||
|
@slide(layout=content-and-preview)
|
||||||
|
|
||||||
|
@title
|
||||||
|
Mathematical proofs
|
||||||
|
|
||||||
|
@content
|
||||||
|
Logical tableaux can be renderd using the `prftree` package.
|
||||||
|
|
||||||
|
```{.hljs .lang-tex .small-text .scroll-one-half}
|
||||||
|
\begin{displaymath}
|
||||||
|
\prftree[l,r]{}{[comp$\_{ns}$]}
|
||||||
|
{
|
||||||
|
\prftree[l,r]{}{[comp$\_{ns}$]}
|
||||||
|
{
|
||||||
|
\prftree[l,r]{}{[ass$\_{ns}$]}
|
||||||
|
{
|
||||||
|
-
|
||||||
|
}
|
||||||
|
{
|
||||||
|
(\texttt{m:=a}, \sigma\_{\bot,\bot})
|
||||||
|
\rightarrow \sigma\_{48,\bot}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
{
|
||||||
|
\prftree[l,r]{}{[ass$\_{ns}$]}
|
||||||
|
{
|
||||||
|
-
|
||||||
|
}
|
||||||
|
{
|
||||||
|
(\texttt{n:=b}, \sigma\_{48,\bot})
|
||||||
|
\rightarrow \sigma\_{48,18}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
{
|
||||||
|
(\texttt{m:=a; n:=b}, \sigma\_{\bot,\bot})
|
||||||
|
\rightarrow \sigma\_{48,18}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
{
|
||||||
|
\prftree[l,r]{}{}
|
||||||
|
{
|
||||||
|
\dots
|
||||||
|
}
|
||||||
|
{
|
||||||
|
\textbf{[1]}\ (\texttt{LOOP}, \sigma\_{48,18})
|
||||||
|
\rightarrow \sigma\_{6,6}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
{
|
||||||
|
(\texttt{m:=a; n:=b; LOOP}, \sigma\_{\bot,\bot})
|
||||||
|
\rightarrow \sigma\_{6,6}
|
||||||
|
}
|
||||||
|
\end{displaymath}
|
||||||
|
```
|
||||||
|
|
||||||
|
@preview
|
||||||
|
<img class="thin-padding" src="svg/chapter-15/prftree-crop.svg"/>
|
||||||
|
|
||||||
@slide(layout=content-only)
|
@slide(layout=content-only)
|
||||||
|
|
||||||
@title
|
@title
|
||||||
How is it used?
|
Other useful packages
|
||||||
|
|
||||||
@content
|
@content
|
||||||
BibTeX adds some citation commands to LaTeX. In addition, we need the `natbib` package.
|
<table>
|
||||||
|
<tr>
|
||||||
|
<th>Package</th>
|
||||||
|
<th>Use case</th>
|
||||||
|
</tr>
|
||||||
|
<tr class="fragment">
|
||||||
|
<td><a href="https://www.ctan.org/pkg/xcolor"><code>xcolor</code></a></td>
|
||||||
|
<td>colours</td>
|
||||||
|
</tr>
|
||||||
|
<tr class="fragment">
|
||||||
|
<td><a href="https://www.ctan.org/pkg/todonotes"><code>todonotes</code></a></td>
|
||||||
|
<td>todo annotations and index</td>
|
||||||
|
</tr>
|
||||||
|
<tr class="fragment">
|
||||||
|
<td><a href="https://www.ctan.org/pkg/pdfpages"><code>pdfpages</code></a></td>
|
||||||
|
<td>embedding PDF files</td>
|
||||||
|
</tr>
|
||||||
|
<tr class="fragment">
|
||||||
|
<td><a href="https://www.ctan.org/pkg/subcaption"><code>subcaption</code></a></td>
|
||||||
|
<td>Nested figures and fine-tuned captions</td>
|
||||||
|
</tr>
|
||||||
|
<tr class="fragment">
|
||||||
|
<td><a href="https://www.ctan.org/pkg/colortbl"><code>colortbl</code></a>, <a href="https://www.ctan.org/pkg/tabularx"><code>tabularx</code></a>, <a href="https://www.ctan.org/pkg/multirow"><code>multirow</code></a>, <a href="https://www.ctan.org/pkg/makecell"><code>makecell</code></a></td>
|
||||||
|
<td>Table tuning</td>
|
||||||
|
</tr>
|
||||||
|
</table>
|
||||||
|
|
||||||
* ++ Citing an author: `\citeauthor{<source>}`
|
|
||||||
* ++ Citing a source: `\cite{<source>}`
|
|
||||||
* ++ Citing a page: `\cite[p. 15]{<source>}`
|
|
||||||
* ++ Citing with additional text:<br/>`\cite[<prefix>][<suffix>]{<source>}`
|
|
||||||
* ++ Referencing the `.bib` file: `\bibliography{<.bib file>}`
|
|
||||||
* ++ Choosing a citation style: <br/>`\bibliographystyle{<citation style>}`
|
|
||||||
|
|
||||||
> Two things are infinite: the universe and the assortment of citation styles.<cite>Unknown</cite>
|
|
||||||
|
|
||||||
|
|
||||||
@slide(layout=preview-only)
|
|
||||||
|
|
||||||
@preview
|
|
||||||
{.large .thin-padding}
|
|
||||||
|
|
||||||
|
|
||||||
@slide(layout=preview-only)
|
|
||||||
|
|
||||||
@preview
|
|
||||||
{.large .thin-padding}
|
|
||||||
|
|
||||||
|
|
||||||
@slide(layout=preview-only)
|
|
||||||
|
|
||||||
@preview
|
|
||||||
{.large}
|
|
||||||
|
|
||||||
|
|
||||||
@slide(layout=preview-only)
|
|
||||||
|
|
||||||
@preview
|
|
||||||
{.large}
|
|
||||||
|
|
||||||
|
|
||||||
@slide(layout=preview-only)
|
|
||||||
|
|
||||||
@preview
|
|
||||||
{.large}
|
|
||||||
|
|
||||||
|
|
||||||
@slide(layout=preview-only)
|
|
||||||
|
|
||||||
@preview
|
|
||||||
{.large}
|
|
||||||
|
|
||||||
|
|
||||||
@slide(layout=wide-task)
|
|
||||||
|
|
||||||
@task-number
|
|
||||||
15
|
|
||||||
|
|
||||||
@title
|
|
||||||
|
|
||||||
Creating and inserting references
|
|
||||||
|
|
||||||
@content
|
|
||||||
* Create a new BibTeX file called `literature.bib` in the `exercises/literature` folder.
|
|
||||||
* Use Google Scholar or dblp.org to retrieve BibTeX references for the following $\LaTeX$ handbooks:
|
|
||||||
* Dilip Datta (2017): $\LaTeX$ in 24 Hours. A Practical Guide for Scientific Writing.
|
|
||||||
* Frank Mittelbach / Michel Goossens (2012): Der $\LaTeX$-Begleiter.
|
|
||||||
* Add the BibTeX entries to the BibTeX file.
|
|
||||||
* Assign unique and meaningful BibTeX keys.
|
|
||||||
* Include the BibTeX file in a suitable location, where later on the references should be listed.
|
|
||||||
* Cite the two handbooks in the file `exercises/literature/literature.tex`.
|
|
||||||
* Make use of the `plain` bibliography style.
|
|
||||||
|
|||||||
@ -4,211 +4,100 @@
|
|||||||
15
|
15
|
||||||
|
|
||||||
@title
|
@title
|
||||||
Paket in Sicht!
|
Hilfe und Informationen
|
||||||
|
|
||||||
@slide(layout=content-and-preview)
|
|
||||||
|
|
||||||
@title
|
|
||||||
Stichwortverzeichnis anlegen
|
|
||||||
|
|
||||||
@content
|
|
||||||
```{.lang-tex .hljs}
|
|
||||||
\usepackage{makeidx}
|
|
||||||
\makeindex
|
|
||||||
\begin{document}
|
|
||||||
\maketitle
|
|
||||||
\section{Was ist LaTeX\index{LaTeX}?}
|
|
||||||
LaTeX\index{LaTeX} ist ein
|
|
||||||
Textsatzsystem\index{Textsatzsystem}.
|
|
||||||
\newpage \section{TeX\index{TeX} vs.
|
|
||||||
LaTeX\index{LaTeX}} Es basiert auf
|
|
||||||
TeX\index{TeX}, einer Erfindung von
|
|
||||||
Donald Knuth\index{Knuth, Donald}.
|
|
||||||
Da TeX\index{TeX} in seiner Syntax sehr
|
|
||||||
viel komplexer als LaTeX\index{LaTeX}
|
|
||||||
ist, ist LaTeX\index{LaTeX} wesentlich
|
|
||||||
weiter verbreitet.
|
|
||||||
\printindex
|
|
||||||
```
|
|
||||||
|
|
||||||
@preview
|
|
||||||

|
|
||||||
|
|
||||||
@slide(layout=content-and-preview)
|
|
||||||
|
|
||||||
@title
|
|
||||||
Präsentationen gestalten
|
|
||||||
|
|
||||||
@content
|
|
||||||
Für Präsentationen gibt es die Dokumentenklasse `beamer` sowie zahlreiche [Vorlagen und Themes](https://www.overleaf.com/learn/latex/Beamer).
|
|
||||||
|
|
||||||
```{.lang-tex .hljs .small-text}
|
|
||||||
\documentclass{beamer}
|
|
||||||
\usetheme{Frankfurt}
|
|
||||||
\usecolortheme{seahorse}
|
|
||||||
\usepackage[utf8]{inputenc}
|
|
||||||
|
|
||||||
\begin{document}
|
|
||||||
\begin{frame}
|
|
||||||
\frametitle{Zitronensorbet}
|
|
||||||
\framesubtitle{Inkarnation des Guten?}
|
|
||||||
\begin{definition}
|
|
||||||
Ein Zitronensorbet ist eine
|
|
||||||
halbgefrorene \textbf{Speiseeiscreme}
|
|
||||||
auf Basis von \textit{Zitronen}.
|
|
||||||
\end{definition}
|
|
||||||
\end{frame}
|
|
||||||
\end{document}
|
|
||||||
```
|
|
||||||
|
|
||||||
@preview
|
|
||||||
<img src="svg/chapter-15/beamer-orig.svg" style="width: 100%; margin: 0;"/>
|
|
||||||
|
|
||||||
|
|
||||||
@slide(layout=content-and-preview)
|
|
||||||
|
|
||||||
@title
|
|
||||||
Grafiken erstellen
|
|
||||||
|
|
||||||
@content
|
|
||||||
`TikZ` (»TikZ ist kein Zeichenprogramm«) ist ein umfangreiches Paket zur Erstellung von Vektorgrafiken.
|
|
||||||
|
|
||||||
```{.lang-tex .hljs .small-text .scroll-one-half}
|
|
||||||
% …
|
|
||||||
\tikzstyle{every node}=[draw=black,thick,anchor=west]
|
|
||||||
\tikzstyle{selected}=[draw=red,fill=red!30]
|
|
||||||
\tikzstyle{dir}=[fill=gray!50]
|
|
||||||
\tikzstyle{relativeTo}=[fill=blue!70]
|
|
||||||
\begin{tikzpicture}[%
|
|
||||||
grow via
|
|
||||||
three points={one child at (0.5,-0.7) and
|
|
||||||
two children at
|
|
||||||
(0.5,-0.7) and (0.5,-1.4)},
|
|
||||||
edge from
|
|
||||||
parent path={(\tikzparentnode.south)
|
|
||||||
|- (\tikzchildnode.west)}]
|
|
||||||
\node {/ oder C:}
|
|
||||||
child { node {home}
|
|
||||||
child { node {knut}
|
|
||||||
child { node {pictures}}
|
|
||||||
child { node {docs}
|
|
||||||
child { node [dir] {latex}
|
|
||||||
child { node [relativeTo] {main.tex}
|
|
||||||
child { node [selected] {part1.tex}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
};
|
|
||||||
\end{tikzpicture}
|
|
||||||
```
|
|
||||||
|
|
||||||
@preview
|
|
||||||

|
|
||||||
|
|
||||||
|
|
||||||
@slide(layout=content-and-preview)
|
|
||||||
|
|
||||||
@title
|
|
||||||
Linguistik
|
|
||||||
|
|
||||||
@content
|
|
||||||
Mit dem Paket `qtree` lassen sich Konstituentenbäume erstellen:
|
|
||||||
|
|
||||||
```{.lang-tex .hljs}
|
|
||||||
\Tree [.S [.NP LaTeX ]
|
|
||||||
[.VP [.V is ] [.NP fun ] ] ]
|
|
||||||
```
|
|
||||||
|
|
||||||
@preview
|
|
||||||

|
|
||||||
|
|
||||||
@slide(layout=content-and-preview)
|
|
||||||
|
|
||||||
@title
|
|
||||||
Mathematische Beweisführung
|
|
||||||
|
|
||||||
@content
|
|
||||||
Beweisbäume lassen sich mit dem Paket `prftree` einwandfrei darstellen.
|
|
||||||
|
|
||||||
```{.hljs .lang-tex .small-text .scroll-one-half}
|
|
||||||
\begin{displaymath}
|
|
||||||
\prftree[l,r]{}{[comp$\_{ns}$]}
|
|
||||||
{
|
|
||||||
\prftree[l,r]{}{[comp$\_{ns}$]}
|
|
||||||
{
|
|
||||||
\prftree[l,r]{}{[ass$\_{ns}$]}
|
|
||||||
{
|
|
||||||
-
|
|
||||||
}
|
|
||||||
{
|
|
||||||
(\texttt{m:=a}, \sigma\_{\bot,\bot})
|
|
||||||
\rightarrow \sigma\_{48,\bot}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
{
|
|
||||||
\prftree[l,r]{}{[ass$\_{ns}$]}
|
|
||||||
{
|
|
||||||
-
|
|
||||||
}
|
|
||||||
{
|
|
||||||
(\texttt{n:=b}, \sigma\_{48,\bot})
|
|
||||||
\rightarrow \sigma\_{48,18}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
{
|
|
||||||
(\texttt{m:=a; n:=b}, \sigma\_{\bot,\bot})
|
|
||||||
\rightarrow \sigma\_{48,18}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
{
|
|
||||||
\prftree[l,r]{}{}
|
|
||||||
{
|
|
||||||
\dots
|
|
||||||
}
|
|
||||||
{
|
|
||||||
\textbf{[1]}\ (\texttt{LOOP}, \sigma\_{48,18})
|
|
||||||
\rightarrow \sigma\_{6,6}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
{
|
|
||||||
(\texttt{m:=a; n:=b; LOOP}, \sigma\_{\bot,\bot})
|
|
||||||
\rightarrow \sigma\_{6,6}
|
|
||||||
}
|
|
||||||
\end{displaymath}
|
|
||||||
```
|
|
||||||
|
|
||||||
@preview
|
|
||||||
<img class="thin-padding" src="svg/chapter-15/prftree-crop.svg"/>
|
|
||||||
|
|
||||||
@slide(layout=content-only)
|
@slide(layout=content-only)
|
||||||
|
|
||||||
@title
|
@title
|
||||||
Weitere nützliche Pakete
|
[Wikibooks](https://de.wikibooks.org/wiki/LaTeX-Kompendium)
|
||||||
|
|
||||||
@content
|
@content
|
||||||
<table>
|
Das Wikibook zu LaTeX enthält eine große Anzahl interessanter Artikel und ist auch in deutscher Sprache verfügbar.
|
||||||
<tr>
|
|
||||||
<th>Paket</th>
|

|
||||||
<th>Anwendung</th>
|
|
||||||
</tr>
|
@slide(layout=content-only)
|
||||||
<tr class="fragment">
|
|
||||||
<td><a href="https://www.ctan.org/pkg/xcolor"><code>xcolor</code></a></td>
|
@title
|
||||||
<td>Mach’s mit Farbe</td>
|
[CTAN](https://ctan.org)
|
||||||
</tr>
|
|
||||||
<tr class="fragment">
|
@content
|
||||||
<td><a href="https://www.ctan.org/pkg/todonotes"><code>todonotes</code></a></td>
|
Das »Comprehensive TeX Archive Network« ist die zentrale Quelle für LaTeX-Pakete und ihre Dokumentation.
|
||||||
<td>ToDo-Markierungen und Liste der ToDos</td>
|
|
||||||
</tr>
|

|
||||||
<tr class="fragment">
|
|
||||||
<td><a href="https://www.ctan.org/pkg/pdfpages"><code>pdfpages</code></a></td>
|
@slide(layout=content-only)
|
||||||
<td>Einbinden von PDF-Dateien</td>
|
|
||||||
</tr>
|
@title
|
||||||
<tr class="fragment">
|
[Overleaf](https://www.overleaf.com)
|
||||||
<td><a href="https://www.ctan.org/pkg/subcaption"><code>subcaption</code></a></td>
|
|
||||||
<td>Verschachtelte Abbildungen und ausgefeilte Bildunterschriften</td>
|
@content
|
||||||
</tr>
|
Ein Online-LaTeX-Editor, der das kollaboratives Arbeiten an Dokumenten ermöglicht.
|
||||||
<tr class="fragment">
|
|
||||||
<td><a href="https://www.ctan.org/pkg/colortbl"><code>colortbl</code></a>, <a href="https://www.ctan.org/pkg/tabularx"><code>tabularx</code></a>, <a href="https://www.ctan.org/pkg/multirow"><code>multirow</code></a>, <a href="https://www.ctan.org/pkg/makecell"><code>makecell</code></a></td>
|
Außerdem findest du auf der Seite verschiedene Tutorials und unter <a href="https://www.overleaf.com/templates">»Templates«</a> LaTeX-Vorlagen für viele Gelegenheiten (Lebenslauf, Abschlussarbeiten, …).
|
||||||
<td>Gestalten von Tabellen</td>
|
|
||||||
</tr>
|

|
||||||
</table>
|
|
||||||
|
@slide(layout=content-only)
|
||||||
|
|
||||||
|
@title
|
||||||
|
[StackExchange](https://tex.stackexchange.com)
|
||||||
|
|
||||||
|
@content
|
||||||
|
Frage-Forum zu LaTeX.
|
||||||
|
|
||||||
|

|
||||||
|
|
||||||
|
@slide(layout=content-only)
|
||||||
|
|
||||||
|
@title
|
||||||
|
[TeXample](https://www.texample.net)
|
||||||
|
|
||||||
|
@content
|
||||||
|
Webseite mit zahlreichen LaTeX-Beispielvorlagen, vor allem zu TikZ.
|
||||||
|
|
||||||
|

|
||||||
|
|
||||||
|
@slide(layout=preview-only)
|
||||||
|
|
||||||
|
@preview
|
||||||
|
)](svg/chapter-16/klassisches-beispiel.jpg)
|
||||||
|
|
||||||
|
@slide(layout=preview-only)
|
||||||
|
|
||||||
|
@preview
|
||||||
|
)](svg/chapter-16/klassischeres-beispiel.jpg)
|
||||||
|
|
||||||
|
@slide(layout=preview-only)
|
||||||
|
|
||||||
|
@preview
|
||||||
|
)](svg/chapter-16/anderes-beispiel.jpg)
|
||||||
|
|
||||||
|
@slide(layout=content-only)
|
||||||
|
|
||||||
|
@title
|
||||||
|
[Fachschaft WIAI](https://www.uni-bamberg.de/wiai/fs/)
|
||||||
|
|
||||||
|
@content
|
||||||
|
Wenn ihr sonst noch Fragen oder Probleme habt, kommt gerne bei uns vorbei oder schreibt uns eine Mail!
|
||||||
|
<p><span style="display: inline-block; width: 2em;" class="emoji">📍</span>WE5/02.104 <br/>
|
||||||
|
<span style="display: inline-block; width: 2em;" class="emoji">☎️</span>0951 863 1219 <br/>
|
||||||
|
<span style="display: inline-block; width: 2em;" class="emoji">📧</span><a href="mailto:fachschaft-wiai.stuve@uni-bamberg.de">fachschaft-wiai.stuve@uni-bamberg.de</a>
|
||||||
|
</p>
|
||||||
|
<img src="images/logo-fachschaft.jpg" style="width:40%; margin: 0 auto; margin-top: 2em;
|
||||||
|
display:block;"/>
|
||||||
|
|
||||||
|
@slide(layout=content-only)
|
||||||
|
|
||||||
|
@title
|
||||||
|
Kurzes Feedback
|
||||||
|
|
||||||
|
@content
|
||||||
|
* Was hat euch gut gefallen?
|
||||||
|
* Was hätten wir besser machen können?
|
||||||
|
* Was hättet ihr euch gewünscht?
|
||||||
|
|
||||||
|
@slide(layout=preview-only)
|
||||||
|
|
||||||
|
@preview
|
||||||
|
<img src="svg/chapter-16/fooboar-latex-tut.jpg" style="width:80%; margin:0 auto; display: block;"/>
|
||||||
|
|||||||
@ -4,212 +4,101 @@
|
|||||||
15
|
15
|
||||||
|
|
||||||
@title
|
@title
|
||||||
Package in sight!
|
Getting help and information
|
||||||
|
|
||||||
@slide(layout=content-and-preview)
|
|
||||||
|
|
||||||
@title
|
|
||||||
Creating an index
|
|
||||||
|
|
||||||
@content
|
|
||||||
```{.lang-tex .hljs}
|
|
||||||
\usepackage{makeidx}
|
|
||||||
\makeindex
|
|
||||||
\begin{document}
|
|
||||||
\maketitle
|
|
||||||
\section{What is LaTeX\index{LaTeX}?}
|
|
||||||
LaTeX\index{LaTeX} is a typesetting
|
|
||||||
system\index{Typesetting system}.
|
|
||||||
\newpage \section{TeX\index{TeX} vs.
|
|
||||||
LaTeX\index{LaTeX}} It is based on
|
|
||||||
TeX\index{TeX}, an invention by
|
|
||||||
Donald Knuth\index{Knuth, Donald}.
|
|
||||||
As TeX\index{TeX} is way more complex
|
|
||||||
syntactically than LaTeX\index{LaTeX},
|
|
||||||
LaTeX\index{LaTeX} is much more
|
|
||||||
popular.
|
|
||||||
\printindex
|
|
||||||
```
|
|
||||||
|
|
||||||
@preview
|
|
||||||

|
|
||||||
|
|
||||||
@slide(layout=content-and-preview)
|
|
||||||
|
|
||||||
@title
|
|
||||||
Designing presentation slides
|
|
||||||
|
|
||||||
@content
|
|
||||||
For slides, there is the `beamer` document class, as well as numerous [templates and themes](https://www.overleaf.com/learn/latex/Beamer).
|
|
||||||
|
|
||||||
```{.lang-tex .hljs .small-text}
|
|
||||||
\documentclass{beamer}
|
|
||||||
\usetheme{Frankfurt}
|
|
||||||
\usecolortheme{seahorse}
|
|
||||||
\usepackage[utf8]{inputenc}
|
|
||||||
|
|
||||||
\begin{document}
|
|
||||||
\begin{frame}
|
|
||||||
\frametitle{Lemon sorbet}
|
|
||||||
\framesubtitle{Incarnation of good?}
|
|
||||||
\begin{definition}
|
|
||||||
A lemon sorbet is a
|
|
||||||
semi-frozen \textbf{dessert}
|
|
||||||
on \textit{lemon} base.
|
|
||||||
\end{definition}
|
|
||||||
\end{frame}
|
|
||||||
\end{document}
|
|
||||||
```
|
|
||||||
|
|
||||||
@preview
|
|
||||||
<img src="svg/chapter-15/beamer-orig.svg" style="width: 100%; margin: 0;"/>
|
|
||||||
|
|
||||||
|
|
||||||
@slide(layout=content-and-preview)
|
|
||||||
|
|
||||||
@title
|
|
||||||
Drawing images
|
|
||||||
|
|
||||||
@content
|
|
||||||
`TikZ` (“TikZ ist kein Zeichenprogramm” — “TikZ is no drawing software”) is a powerful package for drawing vector graphics.
|
|
||||||
|
|
||||||
```{.lang-tex .hljs .small-text .scroll-one-half}
|
|
||||||
% …
|
|
||||||
\tikzstyle{every node}=[draw=black,thick,anchor=west]
|
|
||||||
\tikzstyle{selected}=[draw=red,fill=red!30]
|
|
||||||
\tikzstyle{dir}=[fill=gray!50]
|
|
||||||
\tikzstyle{relativeTo}=[fill=blue!70]
|
|
||||||
\begin{tikzpicture}[%
|
|
||||||
grow via
|
|
||||||
three points={one child at (0.5,-0.7) and
|
|
||||||
two children at
|
|
||||||
(0.5,-0.7) and (0.5,-1.4)},
|
|
||||||
edge from
|
|
||||||
parent path={(\tikzparentnode.south)
|
|
||||||
|- (\tikzchildnode.west)}]
|
|
||||||
\node {/ or C:}
|
|
||||||
child { node {home}
|
|
||||||
child { node {knut}
|
|
||||||
child { node {pictures}}
|
|
||||||
child { node {docs}
|
|
||||||
child { node [dir] {latex}
|
|
||||||
child { node [relativeTo] {main.tex}
|
|
||||||
child { node [selected] {part1.tex}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
};
|
|
||||||
\end{tikzpicture}
|
|
||||||
```
|
|
||||||
|
|
||||||
@preview
|
|
||||||

|
|
||||||
|
|
||||||
|
|
||||||
@slide(layout=content-and-preview)
|
|
||||||
|
|
||||||
@title
|
|
||||||
Linguistics
|
|
||||||
|
|
||||||
@content
|
|
||||||
The `qtree` package can render constituent-based parse trees:
|
|
||||||
|
|
||||||
```{.lang-tex .hljs}
|
|
||||||
\Tree [.S [.NP LaTeX ]
|
|
||||||
[.VP [.V is ] [.NP fun ] ] ]
|
|
||||||
```
|
|
||||||
|
|
||||||
@preview
|
|
||||||

|
|
||||||
|
|
||||||
@slide(layout=content-and-preview)
|
|
||||||
|
|
||||||
@title
|
|
||||||
Mathematical proofs
|
|
||||||
|
|
||||||
@content
|
|
||||||
Logical tableaux can be renderd using the `prftree` package.
|
|
||||||
|
|
||||||
```{.hljs .lang-tex .small-text .scroll-one-half}
|
|
||||||
\begin{displaymath}
|
|
||||||
\prftree[l,r]{}{[comp$\_{ns}$]}
|
|
||||||
{
|
|
||||||
\prftree[l,r]{}{[comp$\_{ns}$]}
|
|
||||||
{
|
|
||||||
\prftree[l,r]{}{[ass$\_{ns}$]}
|
|
||||||
{
|
|
||||||
-
|
|
||||||
}
|
|
||||||
{
|
|
||||||
(\texttt{m:=a}, \sigma\_{\bot,\bot})
|
|
||||||
\rightarrow \sigma\_{48,\bot}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
{
|
|
||||||
\prftree[l,r]{}{[ass$\_{ns}$]}
|
|
||||||
{
|
|
||||||
-
|
|
||||||
}
|
|
||||||
{
|
|
||||||
(\texttt{n:=b}, \sigma\_{48,\bot})
|
|
||||||
\rightarrow \sigma\_{48,18}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
{
|
|
||||||
(\texttt{m:=a; n:=b}, \sigma\_{\bot,\bot})
|
|
||||||
\rightarrow \sigma\_{48,18}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
{
|
|
||||||
\prftree[l,r]{}{}
|
|
||||||
{
|
|
||||||
\dots
|
|
||||||
}
|
|
||||||
{
|
|
||||||
\textbf{[1]}\ (\texttt{LOOP}, \sigma\_{48,18})
|
|
||||||
\rightarrow \sigma\_{6,6}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
{
|
|
||||||
(\texttt{m:=a; n:=b; LOOP}, \sigma\_{\bot,\bot})
|
|
||||||
\rightarrow \sigma\_{6,6}
|
|
||||||
}
|
|
||||||
\end{displaymath}
|
|
||||||
```
|
|
||||||
|
|
||||||
@preview
|
|
||||||
<img class="thin-padding" src="svg/chapter-15/prftree-crop.svg"/>
|
|
||||||
|
|
||||||
@slide(layout=content-only)
|
@slide(layout=content-only)
|
||||||
|
|
||||||
@title
|
@title
|
||||||
Other useful packages
|
[Wikibooks](https://en.wikibooks.org/wiki/LaTeX)
|
||||||
|
|
||||||
@content
|
@content
|
||||||
<table>
|
The LaTeX Wikibook offers numerous interesting articles and is available in English and German (among others).
|
||||||
<tr>
|
|
||||||
<th>Package</th>
|

|
||||||
<th>Use case</th>
|
|
||||||
</tr>
|
@slide(layout=content-only)
|
||||||
<tr class="fragment">
|
|
||||||
<td><a href="https://www.ctan.org/pkg/xcolor"><code>xcolor</code></a></td>
|
@title
|
||||||
<td>colours</td>
|
[CTAN](https://ctan.org)
|
||||||
</tr>
|
|
||||||
<tr class="fragment">
|
@content
|
||||||
<td><a href="https://www.ctan.org/pkg/todonotes"><code>todonotes</code></a></td>
|
The “Comprehensive TeX Archive Network” is the central source for LaTeX packages and their documentation.
|
||||||
<td>todo annotations and index</td>
|
|
||||||
</tr>
|

|
||||||
<tr class="fragment">
|
|
||||||
<td><a href="https://www.ctan.org/pkg/pdfpages"><code>pdfpages</code></a></td>
|
@slide(layout=content-only)
|
||||||
<td>embedding PDF files</td>
|
|
||||||
</tr>
|
@title
|
||||||
<tr class="fragment">
|
[Overleaf](https://www.overleaf.com)
|
||||||
<td><a href="https://www.ctan.org/pkg/subcaption"><code>subcaption</code></a></td>
|
|
||||||
<td>Nested figures and fine-tuned captions</td>
|
@content
|
||||||
</tr>
|
Overleaf is a collaborative online LaTeX editor.
|
||||||
<tr class="fragment">
|
|
||||||
<td><a href="https://www.ctan.org/pkg/colortbl"><code>colortbl</code></a>, <a href="https://www.ctan.org/pkg/tabularx"><code>tabularx</code></a>, <a href="https://www.ctan.org/pkg/multirow"><code>multirow</code></a>, <a href="https://www.ctan.org/pkg/makecell"><code>makecell</code></a></td>
|
It also offers a multiple tutorials and templates for different occasions (CV, theses, …): <a href="https://www.overleaf.com/templates">»Templates«</a>.
|
||||||
<td>Table tuning</td>
|
|
||||||
</tr>
|

|
||||||
</table>
|
|
||||||
|
@slide(layout=content-only)
|
||||||
|
|
||||||
|
@title
|
||||||
|
[StackExchange](https://tex.stackexchange.com)
|
||||||
|
|
||||||
|
@content
|
||||||
|
Question-and-answer website for LaTeX.
|
||||||
|
|
||||||
|

|
||||||
|
|
||||||
|
@slide(layout=content-only)
|
||||||
|
|
||||||
|
@title
|
||||||
|
[TeXample](https://www.texample.net)
|
||||||
|
|
||||||
|
@content
|
||||||
|
A collection of LaTeX examples, especially with TikZ.
|
||||||
|
|
||||||
|

|
||||||
|
|
||||||
|
@slide(layout=preview-only)
|
||||||
|
|
||||||
|
@preview
|
||||||
|
)](svg/chapter-16/klassisches-beispiel.jpg)
|
||||||
|
|
||||||
|
@slide(layout=preview-only)
|
||||||
|
|
||||||
|
@preview
|
||||||
|
)](svg/chapter-16/klassischeres-beispiel.jpg)
|
||||||
|
|
||||||
|
@slide(layout=preview-only)
|
||||||
|
|
||||||
|
@preview
|
||||||
|
)](svg/chapter-16/anderes-beispiel.jpg)
|
||||||
|
|
||||||
|
@slide(layout=content-only)
|
||||||
|
|
||||||
|
@title
|
||||||
|
[Fachschaft WIAI](https://www.uni-bamberg.de/wiai/fs/)
|
||||||
|
|
||||||
|
@content
|
||||||
|
If you have any other questions or problems, just come over or write us an e-mail!
|
||||||
|
<p><span style="display: inline-block; width: 2em;" class="emoji">📍</span>WE5/02.104 <br/>
|
||||||
|
<span style="display: inline-block; width: 2em;" class="emoji">☎️</span>0951 863 1219 <br/>
|
||||||
|
<span style="display: inline-block; width: 2em;" class="emoji">📧</span><a href="mailto:fachschaft-wiai.stuve@uni-bamberg.de">fachschaft-wiai.stuve@uni-bamberg.de</a>
|
||||||
|
</p>
|
||||||
|
<img src="images/logo-fachschaft.jpg" style="width:40%; margin: 0 auto; margin-top: 2em;
|
||||||
|
display:block;"/>
|
||||||
|
|
||||||
|
@slide(layout=content-only)
|
||||||
|
|
||||||
|
@title
|
||||||
|
A short feedback round
|
||||||
|
|
||||||
|
@content
|
||||||
|
* What did you like?
|
||||||
|
* What could we have done better?
|
||||||
|
* What did you wish for?
|
||||||
|
|
||||||
|
@slide(layout=preview-only)
|
||||||
|
|
||||||
|
@preview
|
||||||
|
<img src="svg/chapter-16/fooboar-latex-tut.jpg" style="width:80%; margin:0 auto; display: block;"/>
|
||||||
|
|
||||||
|
|||||||
@ -1,103 +0,0 @@
|
|||||||
@slide(layout=chapter-slide)
|
|
||||||
|
|
||||||
@number
|
|
||||||
16
|
|
||||||
|
|
||||||
@title
|
|
||||||
Hilfe und Informationen
|
|
||||||
|
|
||||||
@slide(layout=content-only)
|
|
||||||
|
|
||||||
@title
|
|
||||||
[Wikibooks](https://de.wikibooks.org/wiki/LaTeX-Kompendium)
|
|
||||||
|
|
||||||
@content
|
|
||||||
Das Wikibook zu LaTeX enthält eine große Anzahl interessanter Artikel und ist auch in deutscher Sprache verfügbar.
|
|
||||||
|
|
||||||

|
|
||||||
|
|
||||||
@slide(layout=content-only)
|
|
||||||
|
|
||||||
@title
|
|
||||||
[CTAN](https://ctan.org)
|
|
||||||
|
|
||||||
@content
|
|
||||||
Das »Comprehensive TeX Archive Network« ist die zentrale Quelle für LaTeX-Pakete und ihre Dokumentation.
|
|
||||||
|
|
||||||

|
|
||||||
|
|
||||||
@slide(layout=content-only)
|
|
||||||
|
|
||||||
@title
|
|
||||||
[Overleaf](https://www.overleaf.com)
|
|
||||||
|
|
||||||
@content
|
|
||||||
Ein Online-LaTeX-Editor, der das kollaboratives Arbeiten an Dokumenten ermöglicht.
|
|
||||||
|
|
||||||
Außerdem findest du auf der Seite verschiedene Tutorials und unter <a href="https://www.overleaf.com/templates">»Templates«</a> LaTeX-Vorlagen für viele Gelegenheiten (Lebenslauf, Abschlussarbeiten, …).
|
|
||||||
|
|
||||||

|
|
||||||
|
|
||||||
@slide(layout=content-only)
|
|
||||||
|
|
||||||
@title
|
|
||||||
[StackExchange](https://tex.stackexchange.com)
|
|
||||||
|
|
||||||
@content
|
|
||||||
Frage-Forum zu LaTeX.
|
|
||||||
|
|
||||||

|
|
||||||
|
|
||||||
@slide(layout=content-only)
|
|
||||||
|
|
||||||
@title
|
|
||||||
[TeXample](https://www.texample.net)
|
|
||||||
|
|
||||||
@content
|
|
||||||
Webseite mit zahlreichen LaTeX-Beispielvorlagen, vor allem zu TikZ.
|
|
||||||
|
|
||||||

|
|
||||||
|
|
||||||
@slide(layout=preview-only)
|
|
||||||
|
|
||||||
@preview
|
|
||||||
)](svg/chapter-16/klassisches-beispiel.jpg)
|
|
||||||
|
|
||||||
@slide(layout=preview-only)
|
|
||||||
|
|
||||||
@preview
|
|
||||||
)](svg/chapter-16/klassischeres-beispiel.jpg)
|
|
||||||
|
|
||||||
@slide(layout=preview-only)
|
|
||||||
|
|
||||||
@preview
|
|
||||||
)](svg/chapter-16/anderes-beispiel.jpg)
|
|
||||||
|
|
||||||
@slide(layout=content-only)
|
|
||||||
|
|
||||||
@title
|
|
||||||
[Fachschaft WIAI](https://www.uni-bamberg.de/wiai/fs/)
|
|
||||||
|
|
||||||
@content
|
|
||||||
Wenn ihr sonst noch Fragen oder Probleme habt, kommt gerne bei uns vorbei oder schreibt uns eine Mail!
|
|
||||||
<p><span style="display: inline-block; width: 2em;" class="emoji">📍</span>WE5/02.104 <br/>
|
|
||||||
<span style="display: inline-block; width: 2em;" class="emoji">☎️</span>0951 863 1219 <br/>
|
|
||||||
<span style="display: inline-block; width: 2em;" class="emoji">📧</span><a href="mailto:fachschaft-wiai.stuve@uni-bamberg.de">fachschaft-wiai.stuve@uni-bamberg.de</a>
|
|
||||||
</p>
|
|
||||||
<img src="images/logo-fachschaft.jpg" style="width:40%; margin: 0 auto; margin-top: 2em;
|
|
||||||
display:block;"/>
|
|
||||||
|
|
||||||
@slide(layout=content-only)
|
|
||||||
|
|
||||||
@title
|
|
||||||
Kurzes Feedback
|
|
||||||
|
|
||||||
@content
|
|
||||||
* Was hat euch gut gefallen?
|
|
||||||
* Was hätten wir besser machen können?
|
|
||||||
* Was hättet ihr euch gewünscht?
|
|
||||||
|
|
||||||
@slide(layout=preview-only)
|
|
||||||
|
|
||||||
@preview
|
|
||||||
<img src="svg/chapter-16/fooboar-latex-tut.jpg" style="width:80%; margin:0 auto; display: block;"/>
|
|
||||||
@ -1,104 +0,0 @@
|
|||||||
@slide(layout=chapter-slide)
|
|
||||||
|
|
||||||
@number
|
|
||||||
16
|
|
||||||
|
|
||||||
@title
|
|
||||||
Getting help and information
|
|
||||||
|
|
||||||
@slide(layout=content-only)
|
|
||||||
|
|
||||||
@title
|
|
||||||
[Wikibooks](https://en.wikibooks.org/wiki/LaTeX)
|
|
||||||
|
|
||||||
@content
|
|
||||||
The LaTeX Wikibook offers numerous interesting articles and is available in English and German (among others).
|
|
||||||
|
|
||||||

|
|
||||||
|
|
||||||
@slide(layout=content-only)
|
|
||||||
|
|
||||||
@title
|
|
||||||
[CTAN](https://ctan.org)
|
|
||||||
|
|
||||||
@content
|
|
||||||
The “Comprehensive TeX Archive Network” is the central source for LaTeX packages and their documentation.
|
|
||||||
|
|
||||||

|
|
||||||
|
|
||||||
@slide(layout=content-only)
|
|
||||||
|
|
||||||
@title
|
|
||||||
[Overleaf](https://www.overleaf.com)
|
|
||||||
|
|
||||||
@content
|
|
||||||
Overleaf is a collaborative online LaTeX editor.
|
|
||||||
|
|
||||||
It also offers a multiple tutorials and templates for different occasions (CV, theses, …): <a href="https://www.overleaf.com/templates">»Templates«</a>.
|
|
||||||
|
|
||||||

|
|
||||||
|
|
||||||
@slide(layout=content-only)
|
|
||||||
|
|
||||||
@title
|
|
||||||
[StackExchange](https://tex.stackexchange.com)
|
|
||||||
|
|
||||||
@content
|
|
||||||
Question-and-answer website for LaTeX.
|
|
||||||
|
|
||||||

|
|
||||||
|
|
||||||
@slide(layout=content-only)
|
|
||||||
|
|
||||||
@title
|
|
||||||
[TeXample](https://www.texample.net)
|
|
||||||
|
|
||||||
@content
|
|
||||||
A collection of LaTeX examples, especially with TikZ.
|
|
||||||
|
|
||||||

|
|
||||||
|
|
||||||
@slide(layout=preview-only)
|
|
||||||
|
|
||||||
@preview
|
|
||||||
)](svg/chapter-16/klassisches-beispiel.jpg)
|
|
||||||
|
|
||||||
@slide(layout=preview-only)
|
|
||||||
|
|
||||||
@preview
|
|
||||||
)](svg/chapter-16/klassischeres-beispiel.jpg)
|
|
||||||
|
|
||||||
@slide(layout=preview-only)
|
|
||||||
|
|
||||||
@preview
|
|
||||||
)](svg/chapter-16/anderes-beispiel.jpg)
|
|
||||||
|
|
||||||
@slide(layout=content-only)
|
|
||||||
|
|
||||||
@title
|
|
||||||
[Fachschaft WIAI](https://www.uni-bamberg.de/wiai/fs/)
|
|
||||||
|
|
||||||
@content
|
|
||||||
If you have any other questions or problems, just come over or write us an e-mail!
|
|
||||||
<p><span style="display: inline-block; width: 2em;" class="emoji">📍</span>WE5/02.104 <br/>
|
|
||||||
<span style="display: inline-block; width: 2em;" class="emoji">☎️</span>0951 863 1219 <br/>
|
|
||||||
<span style="display: inline-block; width: 2em;" class="emoji">📧</span><a href="mailto:fachschaft-wiai.stuve@uni-bamberg.de">fachschaft-wiai.stuve@uni-bamberg.de</a>
|
|
||||||
</p>
|
|
||||||
<img src="images/logo-fachschaft.jpg" style="width:40%; margin: 0 auto; margin-top: 2em;
|
|
||||||
display:block;"/>
|
|
||||||
|
|
||||||
@slide(layout=content-only)
|
|
||||||
|
|
||||||
@title
|
|
||||||
A short feedback round
|
|
||||||
|
|
||||||
@content
|
|
||||||
* What did you like?
|
|
||||||
* What could we have done better?
|
|
||||||
* What did you wish for?
|
|
||||||
|
|
||||||
@slide(layout=preview-only)
|
|
||||||
|
|
||||||
@preview
|
|
||||||
<img src="svg/chapter-16/fooboar-latex-tut.jpg" style="width:80%; margin:0 auto; display: block;"/>
|
|
||||||
|
|
||||||
Loading…
x
Reference in New Issue
Block a user