395 lines
7.9 KiB
Markdown
395 lines
7.9 KiB
Markdown
@slide(layout=chapter-slide)
|
||
|
||
@title
|
||
Basic structure of a L<sup style="font-weight: bold; font-size: 73%; margin-left: -.25em; margin-right: -.05em; position: relative; top: .2em">A</sup>T<sub style="font-size: 100%; margin-left: -.1em">E</sub>X document
|
||
|
||
|
||
@slide(layout=content-and-preview)
|
||
|
||
@title
|
||
Preamble & document environment
|
||
|
||
@content
|
||
<p style="text-indent: -1.3em"><span class="emoji">👁</span> Every LaTeX document is composed of</p>
|
||
|
||
* a **preamble:** global settings (document class, encoding, language, page format, additional packages, …) and
|
||
* a **document environment:** content of the document.
|
||
|
||
``` {.lang-tex .hljs .fragment}
|
||
\documentclass{article}
|
||
\usepackage[utf8]{inputenc}
|
||
\usepackage[T1]{fontenc}
|
||
\usepackage{babel}
|
||
|
||
\begin{document}
|
||
Hello world!
|
||
\end{document}
|
||
```
|
||
|
||
@preview
|
||

|
||
|
||
|
||
@slide(layout=wide-content)
|
||
|
||
@title
|
||
Document class
|
||
|
||
@content
|
||
``` {.lang-tex .hljs}
|
||
\documentclass[<parameter>]{<document_class>}
|
||
```
|
||
|
||
For example:
|
||
|
||
``` {.lang-tex .hljs}
|
||
\documentclass[10pt,a5paper,landscape]{scrartcl}
|
||
```
|
||
|
||
<ul class="fragment">
|
||
<li>**`scrartcl`, `article`** for short documents</li>
|
||
<li>**`scrreport`, `report`** for longer documents</li>
|
||
<li>**`scrbook`, `book`** for books</li>
|
||
<li>**`beamer`** for presentations</li>
|
||
</ul>
|
||
|
||
|
||
@slide(layout=content-only)
|
||
|
||
@title
|
||
Packages
|
||
|
||
@content
|
||
``` {.lang-tex .hljs}
|
||
\usepackage[<options>]{<package_name>}
|
||
```
|
||
|
||
* Packages provide additional commands and functionality.
|
||
* There a different packages for different use cases (e. g., formulas, lists, ...).
|
||
* Before they can be used, they have to be included **within the preamble.**
|
||
|
||
|
||
@slide(layout=content-only)
|
||
|
||
@title
|
||
Encoding
|
||
|
||
@content
|
||
``` {.lang-tex .hljs}
|
||
\usepackage[utf8]{inputenc}
|
||
\usepackage[t1]{fontenc}
|
||
```
|
||
|
||
* ++The character encoding determines which characters are available.
|
||
* ++**ASCII** contains no special characters like German umlauts.
|
||
* ++**UTF-8** is a universal encoding.
|
||
|
||
|
||
@slide(layout=content-only)
|
||
|
||
@title
|
||
Language
|
||
|
||
@content
|
||
``` {.lang-tex .hljs}
|
||
\usepackage[ngerman]{babel}
|
||
```
|
||
|
||
* The package **`babel`** provides language-specific information (e. g., hyphenation, special characters, font changes, translated labels like ‘chapter,’ ‘table of contents’ or ‘figure’).
|
||
* **`ngerman`** is the German new spelling.
|
||
|
||
|
||
@slide(layout=wide-content)
|
||
|
||
@title
|
||
Languages
|
||
|
||
@content
|
||
A document can use multiple languages at once:
|
||
|
||
``` {.lang-tex .hljs}
|
||
\usepackage[ngerman, swedish, russian, greek, english]{babel}
|
||
```
|
||
|
||
<div class="fragment">
|
||
To switch languages:
|
||
|
||
``` {.lang-tex .hljs}
|
||
\selectlanguage{<language a>}
|
||
\selectlanguage{<language b>}
|
||
```
|
||
|
||
Embedded Text in another language:
|
||
|
||
``` {.lang-tex .hljs}
|
||
\selectlanguage{<language a>}
|
||
\foreignlanguage{<language b>}{Text of language B in a Text of language A}
|
||
```
|
||
</div>
|
||
|
||
|
||
@slide(layout=content-and-preview)
|
||
|
||
@title
|
||
Languages – an example
|
||
|
||
@content
|
||
``` {.lang-tex .hljs}
|
||
\today
|
||
\selectlanguage{ngerman}
|
||
\today
|
||
\selectlanguage{swedish}
|
||
\today
|
||
\selectlanguage{russian}
|
||
\today
|
||
\selectlanguage{greek}
|
||
\today
|
||
\selectlanguage{english}
|
||
\today
|
||
```
|
||
|
||
@preview
|
||

|
||
|
||
|
||
@slide(layout=content-and-preview)
|
||
|
||
@title
|
||
Continuous Text
|
||
|
||
@content
|
||
``` {.lang-tex .hljs}
|
||
Continous text can be written directly ↲
|
||
in the source code. ↲
|
||
Simple line breaks ↲
|
||
are ignored, ↲
|
||
just as multiple space characters. ↲
|
||
↲
|
||
An empty line creates a new paragraph ↲
|
||
which has an indentation by default. ↲
|
||
Manual line breaks can be forced ↲
|
||
with two backslashes, ↲
|
||
but normally they have no business \\ ↲
|
||
in continuous text.
|
||
```
|
||
|
||
@preview
|
||

|
||
|
||
|
||
@slide(layout=content-and-preview)
|
||
|
||
@title
|
||
Reserved characters (TODO: caution!-Label)
|
||
|
||
@content
|
||
Some characters do things in LaTeX:
|
||
|
||
`# $ % ^ & _ { } ~ \`
|
||
|
||
``` {.lang-tex .hljs}
|
||
50% is the half.
|
||
```
|
||
|
||
Solution: prefix with ‘`\`’:
|
||
|
||
``` {.lang-tex .hljs}
|
||
50\% is the half.
|
||
```
|
||
|
||
Does not work with ‘`\\`’, a solution for this is shown later.
|
||
|
||
@preview
|
||

|
||
|
||
|
||
@slide(layout=content-and-preview)
|
||
|
||
@title
|
||
Sections and chapters
|
||
|
||
@content
|
||
Texts are structured by beeing subdivided in sections and chapters. Always available:
|
||
|
||
``` {.lang-tex .hljs}
|
||
\section{Level 1}
|
||
\subsection{Level 2}
|
||
\subsubsection{Level 3}
|
||
\paragraph{Level 4}
|
||
\subparagraph{Level 5}
|
||
```
|
||
|
||
Additionally, for some document classes:
|
||
|
||
``` {.lang-tex .hljs}
|
||
\chapter{Chapter}
|
||
\part{Part}
|
||
```
|
||
|
||
@preview
|
||

|
||
|
||
|
||
@slide(layout=content-and-preview)
|
||
|
||
@title
|
||
Sections and chapters
|
||
|
||
@content
|
||
With an asterisk, there is no numbering and no entry in the table of contents:
|
||
|
||
``` {.lang-tex .hljs}
|
||
\section*{No entry in table of contents}
|
||
```
|
||
|
||
You can also provide an alternative title for the table of contents:
|
||
|
||
``` {.lang-tex .hljs}
|
||
\section[Entry in table of contents]
|
||
{Actual chapter heading}
|
||
```
|
||
|
||
@preview
|
||

|
||
|
||
|
||
@slide(layout=wide-content)
|
||
|
||
@title
|
||
Front matter
|
||
|
||
@content
|
||
``` {.lang-tex .hljs data-source=title.tex}
|
||
\title{The World of Truffles}
|
||
\author{Fooboar Rüssel \\\\ Fachschaft WIAI\thanks{WIe AIn Profi},
|
||
Otto-Friedrich-Universität Bamberg}
|
||
\date{\today}
|
||
\begin{document}
|
||
\maketitle
|
||
\end{document}
|
||
```
|
||
|
||
* The values for the entries are stored in the preable.
|
||
* `\maketitle` typesets the front matter within the document environment.
|
||
* The exact appearance depends on the document class.
|
||
* Multiple authors can be joined with `\and`.
|
||
* If no date is given, the current date. A different date can be defined with `\date{}`.
|
||
|
||
|
||
@slide(layout=content-and-preview)
|
||
|
||
@title
|
||
Front matter
|
||
|
||
@content
|
||
``` {.lang-tex .hljs data-source=title.tex}
|
||
\documentclass{article}
|
||
\usepackage{babel}
|
||
\title{The World of Truffles}
|
||
\author{Fooboar Rüssel \\\\ Fachschaft
|
||
WIAI\thanks{WIe AIn Profi},
|
||
Otto-Friedrich-Universität Bamberg}
|
||
\date{\today}
|
||
\begin{document}
|
||
\maketitle
|
||
\section{Truffle hunt}
|
||
\subsection{Hunt with a pig}
|
||
\subsection{Hunt without a pig}
|
||
Why would you do that?
|
||
\section{Truffle recipes}
|
||
My favorite recipe
|
||
\end{document}
|
||
```
|
||
|
||
@preview
|
||

|
||
|
||
|
||
@slide(layout=content-only)
|
||
|
||
@title
|
||
Table of contents
|
||
|
||
@content
|
||
``` {.lang-tex .hljs}
|
||
\tableofcontents
|
||
```
|
||
|
||
* automatic numbering
|
||
* very configurable (enumeration characters and depth, automatic naming, …)
|
||
* chapters and (sub-)sections with an asterisk (`*`) are hidden from the table of contents: e. g. `\section\*{}`.
|
||
* better compile twice
|
||
|
||
|
||
@slide(layout=content-and-preview)
|
||
|
||
@title
|
||
Table of contents
|
||
|
||
@content
|
||
``` {.lang-tex .hljs data-source=title.tex}
|
||
\documentclass{article}
|
||
\usepackage{babel}
|
||
\begin{document}
|
||
\tableofcontents
|
||
\section{Truffle hunt}
|
||
The first section.
|
||
\subsection{Hunt with a pig}
|
||
A subsection.
|
||
\subsection{Hunt without a pig}
|
||
Another subsection.
|
||
\subsubsection[But why?]
|
||
{Why would you do that?}
|
||
Sub-subsection.
|
||
\section{Truffle recipes}
|
||
My favorite recipe
|
||
\end{document}
|
||
```
|
||
|
||
@preview
|
||

|
||
|
||
|
||
@slide(layout=content-only)
|
||
|
||
@title
|
||
Other indices
|
||
|
||
@content
|
||
List of figures and list of tables
|
||
|
||
``` {.lang-tex .hljs}
|
||
\listoffigures
|
||
\listoftables
|
||
```
|
||
|
||
* insert the corresponding index wherever it is called
|
||
* lists the caption of each figure or table by default, but you can also state a special list entry
|
||
|
||
|
||
@slide(layout=wide-task)
|
||
|
||
@task-number
|
||
2
|
||
|
||
@title
|
||
Structure your document and text
|
||
|
||
@content
|
||
* Download the project archive from the VC, unzip it and open the file `allgemeines.tex` in TeXStudio.
|
||
* ++Wrap the entire text (incl. comments) in `allgemeines.tex` in a **document** environment and insert the following **preamble** above, so that you can compile the document:
|
||
|
||
``` {.lang-tex .hljs .fragment}
|
||
\documentclass{scrartcl}
|
||
\usepackage[utf8]{inputenc}
|
||
\usepackage[T1]{fontenc}
|
||
\usepackage[ngerman]{babel}
|
||
\usepackage{hyperref}
|
||
\usepackage{csquotes}
|
||
```
|
||
|
||
* ++In the part that is not commented out, **paragraphs** where marked as ‘`//`’. Use real paragraphs instead.
|
||
* ++Uncomment the remaining text. Use the corresponding LaTeX commands for all **headings** (`\section` to `\subsubsection`).
|
||
* ++Add a **table of contents.**
|
||
|