72 lines
3.8 KiB
TeX
72 lines
3.8 KiB
TeX
\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 special 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: \code{latex}{\textbackslash 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 does not look particularly good, \LaTeX{} will not do it.
|
||
So do not be surprised when your carefully nested selection of four different markups is just ignored and does not do anything at all.
|
||
|
||
\begin{table}[H]
|
||
\center
|
||
\begin{tabular}{lll}
|
||
\toprule
|
||
Markup & Command & Rendering \\
|
||
\midrule
|
||
bold & \code{latex}{\textbackslash textbf\{bold face\}} & \textbf{bold face} \\
|
||
italics & \code{latex}{\textbackslash textit\{italics\}} & \textit{italics} \\
|
||
small caps & \code{latex}{\textbackslash textsc\{small caps\}} & \textsc{small caps} \\
|
||
monospaced & \code{latex}{\textbackslash texttt\{typewriter text\}} & \texttt{typewriter text} \\
|
||
slanted & \code{latex}{\textbackslash textsl\{slanted\}} & \textsl{slanted} (please, don’t!) \\
|
||
underlined & \code{latex}{\textbackslash underline\{underlined\}} & \underline{underlined} \\
|
||
subscript & \code{latex}{\textbackslash textsubscript\{subscript\}} & x\textsubscript{subscript} \\
|
||
superscript & \code{latex}{\textbackslash 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 \pkg{hyperref} package provides the \code{latex}{\textbackslash url\{…\}} command.
|
||
This command does not only use a mono-spaced font for \acro{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
|
||
\code{latex}{\{\textbackslash tiny tiny\}} & {\tiny tiny} \\
|
||
\code{latex}{\{\textbackslash footnotesize footnote size\}} & {\footnotesize footnote size} \\
|
||
\code{latex}{\{\textbackslash small small\}} & {\small small} \\
|
||
\code{latex}{\{\textbackslash normalsize normal\}} & {\normalsize normal} \\
|
||
\code{latex}{\{\textbackslash large large\}} & {\large large} \\
|
||
\code{latex}{\{\textbackslash Large larger\}} & {\Large larger} \\
|
||
\code{latex}{\{\textbackslash LARGE largest\}} & {\LARGE largest} \\
|
||
\code{latex}{\{\textbackslash huge largest of all\}} & {\huge largest of all} \\
|
||
\code{latex}{\{\textbackslash Huge megalomania\}} & {\Huge megalomania} \\
|
||
\bottomrule
|
||
\end{tabular}
|
||
\caption{Font size commands}
|
||
\label{tbl:type-sizes}
|
||
\end{table}
|
||
|
||
|