latex-skript/content/text-markup.tex

72 lines
3.7 KiB
TeX
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.

\chapter{Text markup}
Text markup can be done in two ways: semantically or visually.
We recommend that you use semantic markup whenever possible.
In contrast to visual markup, it only states \emph{why} something is \todo{better word here}marked and entrusts to \LaTeX{} \emph{how} it is going to look.
The simplest semantic markup, that was also used in the previous sentence, is an emphasis: \mintinline{latex}{\emph{}}.
By default, this command sets text in italics.
When it is nested, the second level of emphasis is set straight again.
This kind of formatting is only perceived when reading the text and does not attract attention beforehand, as colored or bold text does (which is more appropriate for higher-level structuring purposes).
Some types of visual markup are listed in \cref{tbl:visual-markup}, but you should use them very carefully.
In principle, they can also be nested, however, for some combinations, the corresponding fonts will be missing.
Many other programs try to distort existing fonts to imitate the missing one.
As this \todo{Are we doing synaereses?}doesnt look particularly good, \LaTeX{} will not do it.
So dont be surprised when your carefully nested selection of four different markups is just ignored and doesnt do anything at all.
\begin{table}[H]
\center
\begin{tabular}{lll}
\toprule
Markup & Command & Rendering \\
\midrule
bold & \mintinline{latex}{\textbf{bold face}} & \textbf{bold face} \\
italics & \mintinline{latex}{\textit{italics}} & \textit{italics} \\
small caps & \mintinline{latex}{\textsc{small caps}} & \textsc{small caps} \\
monospaced & \mintinline{latex}{\texttt{typewriter text}} & \texttt{typewriter text} \\
slanted & \mintinline{latex}{\texttt{slanted}} & \textsl{slanted} (please, dont!) \\
underlined & \mintinline{latex}{\underline{underlined}} & \underline{underlined} \\
subscript & \mintinline{latex}{\textsubscript{subscript}} & x\textsubscript{subscript} \\
superscript & \mintinline{latex}{\textsubscript{superscript}} & x\textsuperscript{superscript} \\
\bottomrule
\end{tabular}
\caption{Visual markup commands}
\label{tbl:visual-markup}
\end{table}
Usually, you should not need these commands too often, as they appear by themselves when you are using semantic markup.
For instance, the \texttt{hyperref} package provides the \mintinline{latex}{\url{}} command.
This command does not only use a monospaced font for \textsc{URL}s, it also makes them clickable and, if necessary, wraps them without adding hyphens.
The same applies for different font sizes.
You can specify the body text font size with an option at the document class:
\begin{minted}{latex}
\documentclass[9pt]{article}
\end{minted}
Building upon this, \LaTeX{} generates different font sizes that can be called via the commands in \cref{tbl:type-sizes}.
It is, however, best to restrict those to title pages and similar things.
For the rest, you can trust the default settings and avoid the visual clutter.
\begin{table}[H]
\center
\begin{tabular}{ll}
\toprule
Command & Rendering \\
\midrule
\mintinline{latex}{{\tiny tiny}} & {\tiny tiny} \\
\mintinline{latex}{{\footnotesize footnote size}} & {\footnotesize footnote size} \\
\mintinline{latex}{{\small small}} & {\small small} \\
\mintinline{latex}{{\normalsize normal}} & {\normalsize normal} \\
\mintinline{latex}{{\large large}} & {\large large} \\
\mintinline{latex}{{\Large larger}} & {\Large larger} \\
\mintinline{latex}{{\LARGE largest}} & {\LARGE largest} \\
\mintinline{latex}{{\huge largest of all}} & {\huge largest of all} \\
\mintinline{latex}{{\Huge megalomania}} & {\Huge megalomania} \\
\bottomrule
\end{tabular}
\caption{Font size commands}
\label{tbl:type-sizes}
\end{table}