latex-wochenende/slides/special-characters.en.md

327 lines
7.7 KiB
Markdown
Raw Permalink 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)
@number
4
@title
Special characters
@slide(layout=content-and-preview)
@title
Spaces
@content
* Use thin spaces (`\,`) and non-breaking spaces (`~`), where appropriate.
``` {.hljs .lang-tex}
Thin spaces are used in abbreviations
and before units, e.\,g., 10\,s.
Normal-width non-breaking spaces can help
keep honorary titles and names on one
line: Dr.~Fooboar.
```
* ++ Use french spacing (`\frenchspacing`) to avoid giant gaps after full stops.
@preview
![](svg/special-characters/spaces-crop.svg)
@slide(layout=content-and-preview)
@title
Hyphens and dashes
@content
<table>
<tr>
<th></th>
<th>Name</th>
<th>Use</th>
<th>Code</th>
</tr>
<tr>
<td>-</td>
<td>Hyphen</td>
<td>compound-forming hyphen</td>
<td>`-`</td>
</tr>
<tr>
<td></td>
<td>En dash *(Halbgeviert&shy;strich)*</td>
<td>a dash or a range: 12&hairsp;&hairsp;2 p.m.</td>
<td>`--`</td>
</tr>
<tr>
<td>—</td>
<td>Em dash *(Geviertstrich)*</td>
<td>a dash&hairsp;—&hairsp;mostly in American English</td>
<td>`---`</td>
</tr>
</table>
@preview
![](svg/special-characters/hyphens-and-dashes-crop.svg)
@slide(layout=content-and-preview)
@title
Quotes
@content
The `csquotes` package provides, amongst others, the command `\enquote`.
``` {.lang-tex .hljs}
\enquote{A \enquote{nested}
quote.}
```
When included with `autostyle=true`, foreign-language quotes use the according quotation marks:
``` {.lang-tex .hljs}
\foreignquote{ngerman}{Ein deutsches
Zitat.}
```
@preview
![](svg/special-characters/quotes-crop.svg)
@slide(layout=content-only)
@title
Special characters & symbols
@content
### Detexify to the rescue! <span class="emoji">⛑️</span>
* A long list of symbols to use:
[PDF on the CTAN website](http://tug.ctan.org/info/symbols/comprehensive/symbols-a4.pdf)
* Draw symbols and have them recognised:
[Detexify](http://detexify.kirelabs.org/classify.html)
@slide(layout=task)
@task-number
4
@title
Insert special characters
@content
:::{.box .warning}
From now on, compile the file `main-exercises.tex` to see your changes appear in the exercise script (in this task, see exercise 5).
:::
* Replace the spaces in `exercises/special-characters.tex` within the abbreviations (“e.&thinsp;g.”, “i.&thinsp;a.”) by **thin spaces**.
* Replace the hyphens separating the opening hours by **en dashes** (`--`), optionally surrounded by thin spaces.
* Add **quotation marks** around the words *Studi-Ticket* and *Studi-Karte* using the `\enquote` command.
@slide(layout=extra-content-and-preview)
@title
English and French spacing
@content
In English, LaTeX uses the old-fashioned *English&nbsp;spacing,* i.&thinsp;e., double sentence spacing.
If you want to be more modern, you can use `\frenchspacing` above your first paragraph. `\nonfrenchspacing` goes back to default.
If you actually use *English&nbsp;spacing,* LaTeX will still try and put normal word spacing after abbreviations. However, you should check the results and intervene where needed by
* forcing normal spaces: `.\␣`
* manually ending sentences: `\@.␣`
@preview
![](svg/special-characters/french-spacing-crop.svg)
@slide(layout=extra-content-and-preview)
@title
Hyphenation
@content
Most of the time, LaTeX hyphenates words correctly if the correct language is configured.
Sometimes, manual intervention is required.
<table>
<tr>
<td>Exclusive hyphenation</td>
<td>`\-`</td>
</tr>
<tr>
<td>Additional hyphenation</td>
<td>`"-`</td>
</tr>
<tr>
<td>Hyphen (suppressing other hyphenation)</td>
<td>`-`</td>
</tr>
<tr>
<td>Hyphen (allowing other hyphenation)</td>
<td>`"=`</td>
</tr>
<tr>
<td>Possible separation without hyphen</td>
<td>`""`</td>
</tr>
<tr>
<td>Non-breaking hyphen</td>
<td>`"~`</td>
</tr>
</table>
<p data-category="Caution!">Some of the codes only work when you use the `babel` package.</p>
@preview
![](svg/special-characters/hyphenation-crop.svg)
@slide(layout=extra-content-only)
@title
Manual quotation
@content
<table>
<tr>
<th>Language</th>
<th style="text-align: center;">Command</th>
<th style="text-align: center;">Result</th>
</tr>
<tr>
<td>English (B.&thinsp;E.)</td>
<td style="text-align: center;"><code> \`…\' </code></td>
<td style="text-align: center;">&hairsp;&hairsp;</td>
</tr>
<tr>
<td>&emsp;2nd Level</td>
<td style="text-align: center;"><code>\`\`…\'\'</code></td>
<td style="text-align: center;">&hairsp;&hairsp;</td>
</tr>
<tr>
<td>English (A.&thinsp;E.)</td>
<td style="text-align: center;"><code>\`\`…\'\'</code></td>
<td style="text-align: center;">&hairsp;&hairsp;</td>
</tr>
<tr>
<td>&emsp;2nd Level</td>
<td style="text-align: center;"><code> \`…\' </code></td>
<td style="text-align: center;">&hairsp;&hairsp;</td>
</tr>
<tr>
<td>German</td>
<td style="text-align: center;">`\glqq … \grqq`</td>
<td style="text-align: center;">&hairsp;&hairsp;</td>
</tr>
<tr>
<td>&emsp;2nd Level</td>
<td style="text-align: center;">` \glq … \grq `</td>
<td style="text-align: center;">&hairsp;&hairsp;</td>
</tr>
<tr>
<td>German altern.</td>
<td style="text-align: center;">`\frqq … \flqq`</td>
<td style="text-align: center;">»&hairsp;&hairsp;«</td>
</tr>
<tr>
<td>&emsp;2nd Level</td>
<td style="text-align: center;">` \frq … \flq `</td>
<td style="text-align: center;">&hairsp;&hairsp;</td>
</tr>
</table>
Other rules my apply for other languages (mostly: the same characters, but combined differently).
@slide(layout=extra-content-only)
@title
Diacritics
@content
Letters with diacritics can either by typed directly on the keyboard or via escape codes:
<table>
<tr>
<td><code>\\\`{o}</code></td><td>ò&emsp;&emsp;</td>
<td>`\c{c}`</td> <td>ç&emsp;&emsp;</td>
<td>`\d{u}`</td> <td></td>
</tr>
<tr>
<td>`\'{o}`</td> <td>ó</td>
<td>`\k{a}`</td> <td>ą</td>
<td>`\r{a}`</td> <td>å</td>
</tr>
<tr>
<td>`\^{o}`</td> <td>ô</td>
<td>`\l{}`</td> <td>ł</td>
<td>`\u{o}`</td> <td>ŏ</td>
</tr>
<tr>
<td>`\"{o}`</td> <td>ö</td>
<td>`\={o}`</td> <td>ō</td>
<td>`\v{s}`</td> <td>š</td>
</tr>
<tr>
<td>`\H{o}`</td> <td>ő</td>
<td>`\b{o}`</td> <td>o</td>
<td>`\t{oo}`</td><td>o͡o</td>
</tr>
<tr>
<td>`\~{o}`</td> <td>õ</td>
<td>`\.{o}`</td> <td>ȯ</td>
<td>`\o`</td> <td>ø</td>
</tr>
</table>
@slide(layout=extra-content-only)
@title
Special characters
@content
Special characters can also be typed directly or created via escape codes and commands:
<table>
<tr>
<td style="text-align: center;">¿</td> <td><code>?\`</code></td>
<td style="text-align: center;">¡</td> <td><code>!\`</code></td>
</tr>
<tr>
<td style="text-align: center;">^</td> <td>`\textasciicircum`</td>
<td style="text-align: center;">~</td> <td>`\textasciitilde`</td>
</tr>
<tr>
<td style="text-align: center;"></td> <td>`\textasteriskcentered`</td>
<td style="text-align: center;">\\</td> <td>`\textbackslash`</td>
</tr>
<tr>
<td style="text-align: center;">|</td> <td>`\textbar`</td>
<td style="text-align: center;"></td> <td>`\textbullet`</td>
</tr>
<tr>
<td style="text-align: center;"></td> <td>`\textcopyright`</td>
<td style="text-align: center;"></td> <td>`\textdagger`</td>
</tr>
<tr>
<td style="text-align: center;"></td> <td>`\textdaggerdbl`</td>
<td style="text-align: center;"></td> <td>`\textellipsis`</td>
</tr>
<tr>
<td style="text-align: center;">&lt;</td> <td>`\textless`</td>
<td style="text-align: center;">&gt;</td> <td>`\textgreater`</td>
</tr>
<tr>
<td style="text-align: center;"></td> <td>`\textperthousand`</td>
<td style="text-align: center;">§</td> <td>`\textsection`</td>
</tr>
</table>
… and pretty much anything else.