static.wiai.de/latex-weekend-wise-2023/slides/special-characters.en.md
2023-11-18 01:26:09 +01:00

7.7 KiB
Raw Blame History

@slide(layout=chapter-slide)

@number 5

@title Special characters

@slide(layout=content-and-preview)

@title Spaces

@content

  • Use thin spaces (\,) and non-breaking spaces (~), where appropriate.
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

@slide(layout=content-and-preview)

@title Hyphens and dashes

@content

Name Use Code
- Hyphen compound-forming hyphen `-`
En dash *(Halbgeviert­strich)* a dash or a range: 122 p.m. `--`
Em dash *(Geviertstrich)* a dashmostly in American English `---`

@preview

@slide(layout=content-and-preview)

@title Quotes

@content The csquotes package provides, amongst others, the command \enquote.

\enquote{A \enquote{nested}
quote.}

When included with autostyle=true, foreign-language quotes use the according quotation marks:

\foreignquote{ngerman}{Ein deutsches
Zitat.}

@preview

@slide(layout=content-only)

@title Special characters & symbols

@content

Detexify to the rescue! ⛑️

@slide(layout=task)

@task-number 5

@title Insert special characters

@content

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.g.”, “i.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 spacing, i.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 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

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

@title Hyphenation

@content Most of the time, LaTeX hyphenates words correctly, if the correct language is configured. Sometimes, however, manual intervention is necessary.

Exclusive hyphenation `\-`
Additional hyphenation `"-`
Hyphen (suppressing other hyphenation) `-`
Hyphen (allowing other hyphenation) `"=`
Possible separation without hyphen `""`
Non-breaking hyphen `"~`

Some of the codes only work when you use the `babel` package.

@preview

@slide(layout=extra-content-only)

@title Manual quotation

@content

Language Command Result
English (B.E.) \`…\' ‘ … ’
2nd Level \`\`…\'\' “ … ”
English (A.E.) \`\`…\'\' “ … ”
2nd Level \`…\' ‘ … ’
German `\glqq … \grqq` „ … “
2nd Level ` \glq … \grq ` ‚ … ‘
German altern. `\frqq … \flqq` » … «
2nd Level ` \frq … \flq ` › … ‹

Other rules my apply for other languages, but most of the time its the same characters, only 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:

\\\`{o}ò   `\c{c}` ç   `\d{u}`
`\'{o}` ó `\k{a}` ą `\r{a}` å
`\^{o}` ô `\l{}` ł `\u{o}` ŏ
`\"{o}` ö `\={o}` ō `\v{s}` š
`\H{o}` ő `\b{o}` o `\t{oo}`o͡o
`\~{o}` õ `\.{o}` ȯ `\o` ø

@slide(layout=extra-content-only)

@title Special characters

@content The same is true for special characters: They can either be typed directly or created via escape codes and commands:

¿ ?\` ¡ !\`
^ `\textasciicircum` ~ `\textasciitilde`
`\textasteriskcentered` \\ `\textbackslash`
| `\textbar` `\textbullet`
`\textcopyright` `\textdagger`
`\textdaggerdbl` `\textellipsis`
< `\textless` > `\textgreater`
`\textperthousand` § `\textsection`

… and pretty much anything else.