@slide(layout=chapter-slide)

@number
10

@title
References and&nbsp;footnotes


@slide(layout=content-and-preview)

@title
Footnotes <span class="emoji">📎</span>

@content
Footnotes are automatically numbered consecutively, independent of sections.

``` {.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
![](svg/references-and-footnotes/footnote-example-crop.svg)


@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{fig:fooboar}
\end{figure}

As you can see in Figure 
\ref{fig:fooboar}, …
```

@preview
![](svg/references-and-footnotes/ref-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-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{fig:fooboar}
\end{figure}

Fooboar is a young and highly committed
boar (see \Cref{fig:fooboar}).
```

The `\cref` command automatically inserts suitable prefixes.

@preview
![](svg/references-and-footnotes/cref-example-crop.svg)


@slide(layout=content-only)

@title
Things to consider

@content
*	Terms inserted by `\cref` use the language specified with the document class (or `babel`):
	
	``` {.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)

@task-number
10a

@title
Inserting footnotes

@content
*	Make the text *“as of 2025”* in file `exercises/footnotes/footnotes.tex` appear as a **footnote**.
*   Additionally, reference the **corresponding blog post** in the footnote: [https://github.blog/news-insights/octoverse/octoverse-a-new-developer-joins-github-every-second-as-ai-leads-typescript-to-1/](https://github.blog/news-insights/octoverse/octoverse-a-new-developer-joins-github-every-second-as-ai-leads-typescript-to-1/)

@slide(layout=task)

@task-number
10b

@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** and **captions** to the elements that you want to create a reference for.
*   For source code listings, adding labels and captions is a bit different. Try to apply the knowledge you gained so far to retrieve the correct version of the `\lstinputlisting` command. Use the Internet, if necessary.


@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
![](svg/references-and-footnotes/footmisc-en-crop.svg){.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
![](svg/references-and-footnotes/cref-multiple-example-crop.svg)