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

202 lines
4.1 KiB
Markdown
Raw Blame History

This file contains ambiguous Unicode characters

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

@slide(layout=chapter-slide)
@title
References and footnotes
@slide(layout=content-and-preview)
@title
Footnotes <span class="emoji">📎</span>
@content
``` {.hljs .lang-tex}
\usepackage{hyperref}
```
The footnotes are automatically numbered consecutively, independent of sections.
``` {.hljs .lang-tex}
The wild boar (Sus scrofa), also known as
the wild swine, Common wild pig, or
simply wild pig, is a suid native to much
of the Palearctic, as well as introduced
numbers in the Americas and Southeast
Asia.
\footnote{\url{https://en.wikipedia.org/
wiki/Wild_boar}}
```
@preview
![](svg/chapter-13/footnote-example-crop.svg)
@slide(layout=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
![](svg/chapter-13/footmisc-en-crop.svg){.thin-padding}
@slide(layout=content-and-preview)
@title
Cross-references
@content
Manually (just dont!)
``` {.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
![](svg/chapter-13/ref-example-crop.svg)
@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
![](svg/chapter-13/cref-example-crop.svg)
@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-only)
@title
Things to consider
@content
* ++Passages inserted via `\cref` use the language specified at the document class:
``` {.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 sections, the label is inserted directly after the section command.
``` {.hljs .lang-tex}
\section{Notes}\label{sec:notes}
```
@slide(layout=content-and-preview)
@title
A few more things
@content
* ++If the `hyperref` package is used before `cleveref`, cross-references appear as **clickable links** in the PDF document.
* ++`\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
![](svg/chapter-13/cref-multiple-example-crop.svg)
@slide(layout=task)
@task-number
12
@title
Inserting references
@content
* Write a **footnote** for a word of your choice.
* ++On the second page of the document, insert a paragraph about the LaTeX weekend with `\cref` **references** to some of the sections youve been working on. You might have to assign labels first.
* ++Wrap a `figure` environment around the **listings from task 9** (section 2.4).
* ++Add a **label** and **caption** to each of them.
* ++Replace the reference numbers in the surrounding paragraphs by actual **references** to the listings.