Unify commands

This commit is contained in:
Knoch 2021-11-01 12:14:40 +01:00
parent 633e55906a
commit b67fedc413
19 changed files with 274 additions and 223 deletions

View File

@ -34,6 +34,54 @@
\rule{\widefigurewidth}{0.4pt}
}
% Shell command
% ==============
% Mono-spaced text without syntax highlighting.
% Intended for full commands. Wrapped by empty lines.
\newcommand\shell[1]{%
\vspace{.5cm}
\noindent \hspace*{-1em}{\color{lightgray}\texttt{\$ }}\texttt{#1}
\vspace{.5cm}
}
% Command parts
% ===================
% Mono-spaced text without syntax highlighting.
% Intended for parts of shell commands.
% Displayed inline.
\newcommand\sh[1]{%
\texttt{#1}%
}
% Package names
% =============
% Mono-spaced text without syntax highlighting.
% Intended for LaTeX package names.
\newcommand\pkg[1]{%
\texttt{#1}%
}
% File paths
% ==========
% Mono-spaced text without syntax highlighting.
% Intended for file names and paths.
\newcommand\file[1]{%
\texttt{#1}%
}
% Inline code
% ===========
% Code snippets with syntax highlighting.
% TODO: Fix special character mess.
%
% Arguments:
% 1. Language.
% 2. Source code.
\newcommand\code[2]{%
% \mintinline{#1}{#2}
\texttt{#2}%
}
% Simple code examples
% ====================
% Box for example code next to the rendered example.

View File

@ -14,23 +14,24 @@ A minimal preamble should contain the following specifications:
\subsection{Document class}\label{sec:document-class}
We can define a document class by using the command \mintinline[breaklines,breakafter=-,breakaftersymbolpre={}]{latex}|\documentclass[<para-meter>]{<document class>}|.
The most commonly used document classes that are supported by default are \mintinline{latex}{article} for short documents, and \mintinline{latex}{report} for longer ones.
Furthermore, you can use \mintinline{latex}{book} for books, \mintinline{latex}{beamer}\footnote{We do not cover making presentations in \LaTeX{} in this tutorial. However, if you are interested in the topic, we recommend this introduction on Overleaf: \url{https://www.overleaf.com/learn/latex/Beamer}} for presentations, and \mintinline{latex}{letter}\footnote{We also do not cover letters in this script. An introduction can be found on WikiBooks: \url{https://en.wikibooks.org/wiki/LaTeX/Letters}} for letters.
\todo{Wie sollen wir das abbilden?}
The most commonly used document classes that are supported by default are \pkg{article} for short documents, and \pkg{report} for longer ones.
Furthermore, you can use \pkg{book} for books, \pkg{beamer}\footnote{We do not cover making presentations in \LaTeX{} in this tutorial. However, if you are interested in the topic, we recommend this introduction on Overleaf: \url{https://www.overleaf.com/learn/latex/Beamer}} for presentations, and \mintinline{latex}{letter}\footnote{We also do not cover letters in this script. An introduction can be found on WikiBooks: \url{https://en.wikibooks.org/wiki/LaTeX/Letters}} for letters.
In addition to the standard document classes, the \acro{KOMA} script classes have been developed.
They provide alternatives to the document classes mentioned above:
In lieu of \mintinline{latex}{article} you can use \mintinline{latex}{scrartcl}, \mintinline{latex}{report} is replaced by \mintinline{latex}{scrreprt},\footnote{Those vowels are indeed missing, do not try to insert them.} and \mintinline{latex}{scrbook} can be used instead of \mintinline{latex}{book}.
As a replacement for \mintinline{latex}{letter}, one can use \mintinline{latex}{scrlttr2}.
A complete list of all \acro{KOMA} script classes is available online.\footnote{Available at: \url{https://komascript.de/omascriptbestandteile}}
In lieu of \pkg{article} you can use \pkg{scrartcl}, \pkg{report} is replaced by \pkg{scrreprt},\footnote{Those vowels are indeed missing, do not try to insert them.} and \pkg{scrbook} can be used instead of \pkg{book}.
As a replacement for \pkg{letter}, one can use \pkg{scrlttr2}.
A complete list of all \acro{KOMA} script classes is available online.\footnote{Available at: \url{https://komascript.de/komascriptbestandteile}}
By using \acro{KOMA} document classes, the layout of the generated \acro{PDF} document is changed.
On top of that, they provide additional functionalities.
The standard document classes are designed according to US-American conventions
whereas \acro{KOMA} classes adhere to European norms, e.\,g., for
writing letters.
Each \mintinline{latex}{\documentclass} command can hold optional parameters in
Each \code{latex}{\textbackslash documentclass} command can hold optional parameters in
square brackets.
\mintinline{latex}{\documentclass[10pt,a5paper,landscape]{scrartcl}}, for instance, configures a \acro{KOMA} script article and sets its font size to 10\,pt,\footnote{The standard font size is 12\,pt.} the page size to A5,\footnote{The default case would be A4.} and the orientation of the page to landscape.
\code{latex}{\textbackslash documentclass[10pt,a5paper,landscape]\{scrartcl\}}, for instance, configures a \acro{KOMA} script article and sets its font size to 10\,pt,\footnote{The standard font size is 12\,pt.} the page size to A5,\footnote{The default case would be A4.} and the orientation of the page to landscape.
The language can be passed as an optional parameter, too (cf. \cref{sec:language}).
\subsection{Digression: packages}
@ -58,22 +59,22 @@ It is an American character encoding and therefore does not contain German umlau
Instead, \acro{UTF-8}\footnote{cf. \url{https://en.wikipedia.org/wiki/UTF-8}} can be used as a universal character encoding.
In \LaTeX{}, we need to specify two character encodings:
The input encoding (\mintinline{latex}{inputenc}), which refers to our source code, and the font encoding (\mintinline{latex}{fontenc}), which determines what the content of our \acro{PDF} document looks like.\footnote{Details on \mintinline{latex}{fontenc} can be found at: \url{https://tex.stackexchange.com/questions/108417/font-encoding-in-latex}}
\mintinline{latex}{T1} is an encoding that tries to cover most European languages with a limited number of characters.
The input encoding (\sh{inputenc}), which refers to our source code, and the font encoding (\sh{fontenc}), which determines what the content of our \acro{PDF} document looks like.\footnote{Details on \sh{fontenc} can be found at: \url{https://tex.stackexchange.com/questions/108417/font-encoding-in-latex}}
\pkg{T1} is an encoding that tries to cover most European languages with a limited number of characters.
\subsection{Language}\label{sec:language}
\begin{minted}{latex}
\usepackage[ngerman]{babel}
\end{minted}
The package \mintinline{latex}{babel} provides language-specific information (e.\,g., on hyphenation, special characters, changing fonts, translation of labels\footnote{cf. \cref{sec:references}} like \enquote{Chapter,} \enquote{Table of Contents,} or \enquote{Figure.}
The package \pkg{babel} provides language-specific information (e.\,g., on hyphenation, special characters, changing fonts, translation of labels\footnote{cf. \cref{sec:references}} like \enquote{Chapter,} \enquote{Table of Contents,} or \enquote{Figure.}
The desired language can be passed as an optional parameter.
\mintinline{latex}{ngerman}, for instance, is used for the new German spelling.
Some packages require that the language is already passed as an optional parameter in the \mintinline{latex}{\documentclass} command.
In this case, just leave out the optional parameter for the language within the \mintinline{latex}{babel} inclusion command.
\pkg{ngerman}, for instance, is used for the new German spelling.
Some packages require that the language is already passed as an optional parameter in the \code{latex}{\textbackslash documentclass} command.
In this case, just leave out the optional parameter for the language within the \pkg{babel} inclusion command.
We can also use multiple languages in our document.
To do so, we pass the languages, separated by commas, as an optional parameter to the babel inclusion command.
Within our document, we can switch between languages with the \mintinline{latex}{\selectlanguage{<language>}} command.
Within our document, we can switch between languages with the \code{latex}{\textbackslash selectlanguage\{<language>\}} command.
Alternatively, foreign-language text can be declared by using the following command:
\begin{minted}{latex}
@ -81,13 +82,13 @@ Alternatively, foreign-language text can be declared by using the following comm
\end{minted}
\section{Document environment}
The actual content of the \acro{PDF} document needs to be put between \mintinline{latex}{\begin{document}} and \mintinline{latex}{\end{document}}.
The actual content of the \acro{PDF} document needs to be put between \code{latex}{\textbackslash begin\{document\}} and \code{latex}{\textbackslash end\{document\}}.
\subsection{Continuous text}
The easiest content that we can integrate into the document environment is continuous text.
We can write it directly into our source code.
Line breaks and multiple consecutive spaces are ignored by \LaTeX{}.
Blank lines create a new paragraph, that is indented by default.\footnote{The automatic indentation of new paragraphs can be prevented by using the command \mintinline{latex}{\noindent}.}
Blank lines create a new paragraph, that is indented by default.\footnote{The automatic indentation of new paragraphs can be prevented by using the command \code{latex}{\textbackslash noindent}.}
Manual line breaks can be enforced with two backslashes (\textbackslash\textbackslash).
This should be avoided, though.
@ -106,7 +107,7 @@ The commands that are depicted in \cref{lst:headlines} can be used with any docu
\Example{lst:headlines}{basic-document-structure/headlines}{basic-document-structure/headlines_crop}{Heading Levels}
Some document classes provide additional commands. In a \texttt{report}, you get \mintinline{latex}{\chapter{Chapter}}, and in a \texttt{book}, additionally \mintinline{latex}{\part{Part}}.
Some document classes provide additional commands. In a \pkg{report}, you get \code{late}{\textbackslash chapter\{Chapter\}}, and in a \pkg{book}, additionally \code{latex}{\textbackslash part\{Part\}}.
You can mark the command with an asterisk if you want to omit the numbering of a section and exclude it from the table of contents:\footnote{cf. \cref{sec:table-of-contents}}
\begin{minted}{latex}
@ -120,20 +121,20 @@ An alternative title for the table of contents can be declared as an optional pa
\end{minted}
\subsection{Front matter}
A simple front matter can be created by using the command \mintinline{latex}{\maketitle}.
A simple front matter can be created by using the command \code{latex}{\textbackslash maketitle}.
The values to be inserted into the front matter must be specified within the preamble.
Multiple authors are joined by \mintinline{latex}{\and}.
If the date is not specified by the \mintinline{latex}{\date} command, the current date will be inserted by default.
Multiple authors are joined by \code{latex}{\textbackslash and}.
If the date is not specified by the \code{latex}{\textbackslash date} command, the current date will be inserted by default.
The design of the front matter depends on the specified document class.
\Example{lst:titles}{basic-document-structure/titles}{basic-document-structure/titles_crop}{The front matter}
\subsection{Indices}\label{sec:table-of-contents}
The command \mintinline{latex}{\tableofcontents} generates an automatically numbered table of contents by making use of the above-mentioned commands for dividing our text into sections and chapters (this can bee seen in \cref{lst:main-file} on \cpageref{lst:main-file}).
The command \code{latex}{\textbackslash tableofcontents} generates an automatically numbered table of contents by making use of the above-mentioned commands for dividing our text into sections and chapters (this can bee seen in \cref{lst:main-file} on \cpageref{lst:main-file}).
The numbering style and depth, and many other options can, of course, be specified manually.\footnote{We recommend the following blogpost: \url{https://texblog.org/2011/09/09/10-ways-to-customize-tocloflot/}}
For \LaTeX{} to create our table of contents properly, the project has to be compiled twice.
Besides the table of contents, you can also generate a \mintinline{latex}{\listoffigures} (list of figures) and a \mintinline{latex}{\listoftables} (list of tables).
Besides the table of contents, you can also generate a \code{latex}{\textbackslash listoffigures} (list of figures) and a \code{latex}{\textbackslash listoftables} (list of tables).
The captions of your figures and tables will appear within those indices.\footnote{cf. \cref{sec:graphics} (Graphics) and \cref{sec:tables} (Tables) for more information on captions}

View File

@ -21,9 +21,9 @@ When all the source code has been processed by the compiler, we get the final do
There are different export options, but most of the time we output the document as a \acro{PDF}\,---\,just like in Word.
As a brief example for a command, we shall use the emphasis of words or sentences.
The command is \mintinline{latex}{\emph{}}.
The command is \code{latex}{\textbackslash emph\{\}}.
We write the text we want to emphasize inside the curly braces in the source code, like this:
\mintinline{latex}{\emph{Good morning!}}.
\code{latex}{\textbackslash emph\{Good morning!\}}.
In the resulting \acro{PDF}, this text will appear in italics: \emph{Good morning!}
There is no trace of the command identifier and the special characters.
You can see, we are not writing italic text inside the source code, we just tell the compiler that certain words should be emphasized by the use of a command.
@ -31,7 +31,7 @@ You can see, we are not writing italic text inside the source code, we just tell
This simple example illustrates a strength of the \acro{WYGIWYM} principle.
We mark text elements on a semantic level and can make the associated typographic adjustments centrally\,---\,or let \LaTeX{} do the configuration itself.
For instance, if we want to change the way highlighting is done, we can configure this once.
At all places where \mintinline{latex}{\emph{}} is used, the final result will be adjusted accordingly.
At all places where \code{latex}{\textbackslash emph\{\}} is used, the final result will be adjusted accordingly.
There is no need to make adjustments at each occurrence of an emphasized word.
The principle is similar to style sheets in office programs, although more consistent and powerful.
@ -77,11 +77,11 @@ Some examples are shown in \cref{tbl:latex-commands}.
\toprule
Command & Effect \\
\midrule
\mintinline{latex}{\newpage} & inserts a new page \\
\mintinline{latex}{\textbf{Text}} & prints the text in bold font \\
\mintinline{latex}{\usepackage[utf8]{inputenc}} & sets the text encoding to \acro{UTF-8} \\
\mintinline{latex}{\documentclass[a4paper,12pt]{article}} & specifies the document class \\
\mintinline{latex}{\frac{3}{4}} & inserts a mathematical fraction \\
\code{latex}{\textbackslash newpage} & inserts a new page \\
\code{latex}{\textbackslash textbf\{Text\}} & prints the text in bold font \\
\code{latex}{\textbackslash usepackage[utf8]\{inputenc\}} & sets the text encoding to \acro{UTF-8} \\
\code{latex}{\textbackslash documentclass[a4paper,12pt]\{article\}} & specifies the document class \\
\code{latex}{\textbackslash frac\{3\}\{4\}} & inserts a mathematical fraction \\
\bottomrule
\end{tabular}
}
@ -91,7 +91,7 @@ Some examples are shown in \cref{tbl:latex-commands}.
If a command allows multiple optional parameters that accept similar inputs, it is sometimes necessary to specify which parameter is meant.
For example, the command for embedding graphics accepts optional parameters for width and height.
If \mintinline{tex}|[12cm, 4cm]| were entered, it would be unclear which value is intended for which parameter.
If \sh{[12cm, 4cm]} were entered, it would be unclear which value is intended for which parameter.
To make the assignment more concrete, it is possible to specify the parameters explicitly:
\begin{minted}{tex}
\includegraphics[width=12cm, height=4cm]{picture.png}

View File

@ -21,8 +21,8 @@ Lets start with the compiler.
(Seriously!)
We will need it to convert the source code that we are going to write into a \acro{PDF}.
There are different compilers for different operating systems;
for example, MikTeX for Windows,\footnote{\url{https://miktex.org/download}} Mac\TeX{} for macOS,\footnote{\url{http://tug.org/mactex/}} and \TeX{}Live for Linux distributions.\footnote{If you are using a Debian-based Linux distribution, you can install the compiler by executing \mintinline{bash}{sudo apt install texlive-full}
For other distributions, you find instructions on \url{https://tug.org/texlive/doc/texlive-en/texlive-en.html\#installation}.}
for example, MikTeX for Windows,\footnote{\url{https://miktex.org/download}} Mac\TeX{} for macOS,\footnote{\url{http://tug.org/mactex/}} and \TeX{}Live for Linux distributions.\footnote{If you are using a Debian-based Linux distribution, you can install the compiler by executing \sh{sudo apt install texlive-full}
For other distributions, you find instructions on \url{https://tug.org/texlive/doc/texlive-en/texlive-en.html\#installation}.}
In case you get to choose, it is best to install the full version with all packages.
\section*{Editor}
@ -36,14 +36,15 @@ One of these programs is \TeX{}studio.\footnote{You find the latest version on \
To prevent errors during the compilation of our document, you have to change the compiler command.
In \TeX{}studio, click on the \emph{Options} button and then on \emph{Configure \TeX{}studio \textellipsis}\todo{Add the correct steps for Mac (these dont apply)}.
A new window will open up.
Navigate to the \emph{Commands} area, and, next to \texttt{pdflatex}, add the flag \mintinline{bash}{-shell-escape}.
In other words: The command for \texttt{pdflatex} should look like this:
\mint{bash}{pdflatex -synctex=1 -interaction=nonstopmode -shell-escape %.tex}
Navigate to the \emph{Commands} area, and, next to \sh{pdflatex}, add the flag \sh{-shell-escape}.
In other words: The command for \sh{pdflatex} should look like this:
\shell{pdflatex -synctex=1 -interaction=nonstopmode -shell-escape \%.tex}
\section*{Compiling for the first time}
Open up the file \mintinline{bash}{main.tex} in the root directory of the project and compile it by pressing \faForward.
Open up the file \file{main.tex} in the root directory of the project and compile it by pressing \faForward.
Looking at the directory in your file explorer, you should see a few new files.
The \mintinline{bash}{main.pdf} file contains the compiled document.
The \file{main.pdf} file contains the compiled document.
The other files are auxiliary files that the compiler uses, for example, to generate the table of contents.
You are now ready to go!

View File

@ -2,17 +2,17 @@
\label{sec:footnotes}
Whenever we want to include footnotes into our \LaTeX{} document, we can use
the command \mintinline{latex}{\footnote{<text>}}. At the position where we use
the command \code{latex}{\textbackslash footnote{<text>}}. At the position where we use
the command, the correct number will be inserted automatically, and the text
within the curly braces will appear in the footer. In combination with the
package \mintinline{latex}{hyperref}, \acro{URL}s within footnotes become
clickable.\footnote{if we use the command \mintinline{latex}{\url{}}}
package \pkg{hyperref}, \acro{URL}s within footnotes become
clickable.\footnote{if we use the command \code{latex}{\textbackslash url{}}}
We can see examples for that in the whole document.
The package \mintinline{latex}{footmisc} provides us with additional options for how to display footnotes. They can be passed as optional parameters to the command \mintinline{latex}{\usepackage}:
The package \pkg{footmisc} provides us with additional options for how to display footnotes. They can be passed as optional parameters to the command \code{latex}{\textbackslash usepackage}:
\begin{itemize}
\item \mintinline{latex}{\usepackage[perpage]{footmisc}} ensures that the count of footnotes begins at 1 for each new page.
\item \mintinline{latex}{\usepackage[para]{footmisc}} lets the footnotes within the footer appear as continuous text (i.\,e., the footnotes can also appear next to each other).
\item \mintinline{latex}{\usepackage[symbol]{footmisc}} causes a numbering with symbols (e.\,g., \textdagger, \textdaggerdbl) instead of numbers.
\item \code{latex}{\textbackslash usepackage[perpage]\{footmisc\}} ensures that the count of footnotes begins at 1 for each new page.
\item \code{latex}{\textbackslash usepackage[para]\{footmisc\}} lets the footnotes within the footer appear as continuous text (i.\,e., the footnotes can also appear next to each other).
\item \code{latex}{\textbackslash usepackage[symbol]\{footmisc\}} causes a numbering with symbols (e.\,g., \textdagger, \textdaggerdbl) instead of numbers.
\end{itemize}

View File

@ -5,10 +5,10 @@
\label{sec:ragged-alignment}
By default, \LaTeX{} sets continuous text in full justification.
However, we can also switch to ragged alignment by using the commands
\mintinline{tex}|\raggedright|, \mintinline{tex}|\raggedleft|, and
\mintinline{tex}|\centering|.
\code{latex}{\textbackslash raggedright}, \code{latex}{\textbackslash raggedleft}, and
\code{latex}{\textbackslash centering}.
These commands influence the environment that they are used in, e.\,g., the
\texttt{document} environment. Correspondingly, the text within the whole
\sh{document} environment. Correspondingly, the text within the whole
document is affected.
Alternatively, we can use dedicated environments in order to influence the
formatting
@ -20,9 +20,9 @@ alignment}
\section*{Indentation and spacing}
\label{sec:indents-and-parskips}
Usually, we illustrate a new paragraph by indenting the first line of it
(\mintinline{tex}{\parindent}).
(\code{latex}{\textbackslash parindent}).
Alternatively, paragraph spacing, i.\,e., vertical space between paragraphs,
can be used (\mintinline{tex}{\parskip}).
can be used (\code{latex}{\textbackslash parskip}).
For both variants, there are adjustable parameters:
\begin{minted}{tex}
\setlength{\parindent}{0pt}
@ -32,7 +32,7 @@ For both variants, there are adjustable parameters:
}
\end{minted}
\noindent We can use \mintinline{tex}{\noindent} to turn off the indentation for only one
\noindent We can use \code{latex}{\textbackslash noindent} to turn off the indentation for only one
paragraph.
For the first paragraph after a heading, there is usually no indentation.

View File

@ -15,7 +15,7 @@ In order to be able to reference graphics, the package \texttt{graphicx} has to
\end{figure}
\end{minted}
\noindent The command \mintinline{latex}{includegraphics} can be used to change the image size. The desired height and width of the figure can be indicated separately, as illustrated by the following example:
\noindent The command \sh{includegraphics} can be used to change the image size. The desired height and width of the figure can be indicated separately, as illustrated by the following example:
\begin{minted}{latex}
\includegraphics[width=0.5\textwidth,height=5cm]{<file path>}
@ -58,5 +58,5 @@ On top of that, we can limit the positioning of our image more or less rigorousl
Besides the vertical positioning, also the horizontal orientation may be of importance.
By default, graphics are left-justified.
The command \mintinline{latex}{\centering} centers all following objects in the current environment.
If we want the centering to affect only one object, we can alternatively wrap it with \mintinline{latex}{\begin{center}} and \mintinline{latex}{\end{center}}.
The command \code{latex}{\textbackslash centering} centers all following objects in the current environment.
If we want the centering to affect only one object, we can alternatively wrap it with \code{latex}{\textbackslash begin\{center\}} and \code{latex}{\textbackslash end\{center\}}.

View File

@ -6,18 +6,18 @@ For each of these types, there are dedicated environments whose structure is ver
\example{lst:unordered-list}{lists/nested-list}{Examplary unordered list}
In \cref{lst:unordered-list-code}, different list items (\mintinline{latex}{\item}) are framed by an \mintinline{latex}{itemize} environment.
In \cref{lst:unordered-list-code}, different list items (\code{latex}{\textbackslash item}) are framed by an \sh{itemize} environment.
Within a list item, we can open a new list environment to create a nested list.
If we replace \mintinline{latex}{itemize} by \mintinline{latex}{enumerate}, the list becomes ordered without changing the source code any further.
To make use of the less common description lists, we have to specify the environment \mintinline{latex}{description}.
If we replace sh{itemize} by sh{enumerate}, the list becomes ordered without changing the source code any further.
To make use of the less common description lists, we have to specify the environment \sh{description}.
Moreover, the items need to be extended by the term to be defined, put in brackets (\cref{lst:description-list}).
\Example{lst:description-list}{lists/description-list}{lists/description-list_crop}{Exemplary description list}
The exuberant spacing between list items can be reduced by utilizing the \mintinline{latex}{paralist}\footnote{\url{https://www.ctan.org/pkg/paralist}} package.
To do so, we simply adjust the environment name: \mintinline{latex}{compactitem} replaces \mintinline{latex}{itemize}, \mintinline{latex}{compactenum} replaces \mintinline{latex}{enumerate}, and \mintinline{latex}{compactdesc} replaces \mintinline{latex}{description}.
If the list ought to appear within a text body, \mintinline{latex}{paralist} provides the extra environments \mintinline{latex}{inparaenum} and \mintinline{latex}{inparaitem}.
The exuberant spacing between list items can be reduced by utilizing the \sh{paralist}\footnote{\url{https://www.ctan.org/pkg/paralist}} package.
To do so, we simply adjust the environment name: sh{compactitem} replaces sh{itemize}, sh{compactenum} replaces sh{enumerate}, and sh{compactdesc} replaces sh{description}.
If the list ought to appear within a text body, \pkg{paralist} provides the extra environments \sh{inparaenum} and \sh{inparaitem}.
We can customize bullet and list numbering styles via the \mintinline{latex}{enumitem}\footnote{\url{https://www.ctan.org/pkg/enumitem}} package.
\mintinline{latex}{\begin{enumerate}[label=\roman*]} produces a list with Roman numerals.
The parameter \mintinline{latex}{[label=\alph*]} inserts alphabetical numbering.
We can customize bullet and list numbering styles via the \pkg{enumitem}\footnote{\url{https://www.ctan.org/pkg/enumitem}} package.
\code{latex}{\textbackslash begin\{enumerate\}[label=\textbackslash roman*]} produces a list with Roman numerals.
The parameter \code{latex}{[label=\textbackslash alph*]} inserts alphabetical numbering.

View File

@ -4,7 +4,7 @@
For typesetting our first thesis in \LaTeX{}, the last core functionality to learn is citing literature.
Our references are gathered in a bibliography file.
Once we reference one of its entries from our \LaTeX{} document, Bib\TeX{} (a
program similar to the standard \texttt{pdflatex} compiler)
program similar to the standard \sh{pdflatex} compiler)
can insert automatically generated citations.
It will format them in a bibliography style of our choice.
@ -28,7 +28,7 @@ An exemplary item can be seen in \cref{lst:bibfile-sample-entry}.
\label{lst:bibfile-sample-entry}
\end{figure}
The type of the bibliography entry is specified after the opening \texttt{@} sign (e.\,g., article, book, proceedings, …).
The type of the bibliography entry is specified after the opening \sh{@} sign (e.\,g., article, book, proceedings, …).
What follows is a list of important attributes like title and author.
Whether they are required or not depends on the type of the entry.
In any case, we will need the first entry after the opening braces: the Bib\TeX{} key.
@ -52,26 +52,26 @@ A high-quality (although, unfortunately, incomplete) source for Bib\TeX{} entrie
\section{Citing}
Bib\TeX{} extends \LaTeX{} by several commands (cf. \cref{tbl:bibtex-commands}).
Make sure to include the \mintinline{sh}{natbib} package for this purpose.
Make sure to include the \pkg{natbib} package for this purpose.
\begin{table}[H]
\centering
\begin{tabular}{ll}
\toprule
Function & Command \\ \midrule
Citing sources & \mintinline{latex}{\cite{<source>}} \\
Citing pages & \mintinline{latex}{\cite[p. 15]{<source>}} \\
Custom citations & \mintinline{latex}{\cite[<prefix>][<suffix>]{<source>}} \\
Including the bibliography & \mintinline{latex}{\bibliography{<bibliographyfile>}} \\
Setting the bibliography style & \mintinline{latex}{\bibliographystyle{<style>}} \\ \bottomrule
Citing sources & \code{latex}{\textbackslash cite\{<source>\}} \\
Citing pages & \code{latex}{\textbackslash cite[p. 15]\{<source>\}} \\
Custom citations & \code{latex}{\textbackslash cite[<prefix>][<suffix>]\{<source>\}} \\
Including the bibliography & \code{latex}{\textbackslash bibliography\{<bibliographyfile>\}} \\
Setting the bibliography style & \code{latex}{\textbackslash bibliographystyle\{<style>\}} \\ \bottomrule
\end{tabular}
\caption{Commands for citations}
\label{tbl:bibtex-commands}
\end{table}
The \mintinline{latex}{<source>} of a citation is always a Bib\TeX key.
The list of available citation styles\footnote{Head to Overleaf for a rather complete list: \url{https://www.overleaf.com/learn/latex/Biblatex_citation_styles}} includes \texttt{alpha}, \texttt{natdin}, and \texttt{apa}.
The table of references will always appear where the \mintinline{latex}{\bibliography{}} command was put.
The \mintinline{latex}{\cite} command comes with many variants.\footnote{cf. \url{https://www.economics.utoronto.ca/osborne/latex/BIBTEX.HTM}}
The \code{latex}{<source>} of a citation is always a Bib\TeX key.
The list of available citation styles\footnote{Head to Overleaf for a rather complete list: \url{https://www.overleaf.com/learn/latex/Biblatex_citation_styles}} includes \sh{alpha}, \sh{natdin}, and \sh{apa}.
The table of references will always appear where the \code{latex}{\textbackslash bibliography\{\}} command was put.
The \code{latex}{\textbackslash cite} command comes with many variants.\footnote{cf. \url{https://www.economics.utoronto.ca/osborne/latex/BIBTEX.HTM}}
\Example{lst:natdin-example}{literature/natdin-example}{literature/natdin-example_bib}{Exemplary citations in the \mintinline{latex}{natdin} style.}
\Example{lst:natdin-example}{literature/natdin-example}{literature/natdin-example_bib}{Exemplary citations in the \sh{natdin} style.}

View File

@ -4,8 +4,8 @@
Mathematical formulas are always set in \emph{math mode}, which, within a paragraph (referred to as \emph{inline}), can be turned on or off with a dollar sign.
There is also a \emph{block} environment (cf. \cref{lst:sample-math-environment}).
Important packages for mathematical features are the \texttt{amsmath},
\texttt{amsthm}, and \texttt{amssymb} packages of the American Mathematical
Society, as well as \texttt{mathtools}.
\pkg{amsthm}, and \pkg{amssymb} packages of the American Mathematical
Society, as well as \pkg{mathtools}.
As with many other environments, adding an asterisk turns off the numbering.
\example{lst:sample-math-environment}{maths/sample-math-environment}{Exemplary math environments}
@ -18,16 +18,16 @@ As with many other environments, adding an asterisk turns off the numbering.
\begin{tabular}{ll}
\toprule
Source code & Result \\ \midrule
\mintinline{latex}{\sqrt{16}} & $\sqrt{16}$ \\
\mintinline{latex}{\frac{3}{4}} & $\frac{3}{4}$ \\
\mintinline{latex}{e^{\pi}} & $e^{\pi}$ \\
\mintinline{latex}{\sum_{i=1}\^{n}x^2} & $\sum_{i=1}^{n}x^2$ \\
\mintinline{latex}{12 \leq 4 x^2 + 13} & $12 \leq 4 x^2 + 13$ \\
\mintinline{latex}{{n \choose k}} & ${n \choose k}$ \\
\code{latex}{\textbackslash sqrt\{16\}} & $\sqrt{16}$ \\
\code{latex}{\textbackslash frac\{3\}\{4\}} & $\frac{3}{4}$ \\
\code{latex}{e\textasciicircum\{\textbackslash pi\}} & $e^{\pi}$ \\
\code{latex}{\textbackslash sum\_\{i=1\}\textasciicircum\{n\}x\textasciicircum 2} & $\sum_{i=1}^{n}x^2$ \\
\code{latex}{12 \textbackslash leq 4 x\textasciicircum 2 + 13} & $12 \leq 4 x^2 + 13$ \\
\code{latex}{{n \textbackslash choose k}} & ${n \choose k}$ \\
\bottomrule
\end{tabular}
\caption{Frequently used commands (square root, fraction, power, sum, inequation, binomial coefficient).
By \mintinline{latex}{^{}} and \mintinline{latex}{_{}}, the content is set in super- or subscript.}
By \code{latex}{\textasciicircum\{\}} and \code{latex}{\_\{\}}, the content is set in super- or subscript.}
\label{tbl:maths-common-commands}
\end{table}
@ -37,13 +37,13 @@ As with many other environments, adding an asterisk turns off the numbering.
\begin{tabular}{ll}
\toprule
Source code & Result \\ \midrule
\mintinline{latex}{(x), [x], \lbrace x \rbrace, \lvert x \rvert} & $(x), [x], \lbrace x\rbrace, \lvert x\rvert$\\
\mintinline{latex}{\exists,\forall,\in,\notin,\infty} & $\exists,\forall,\in,\notin,\infty$ \\
\mintinline{latex}{\alpha, \beta, \Gamma, \Delta, \varepsilon, \pi} & $\alpha, \beta, \Gamma, \Delta, \varepsilon, \pi$ \\
\mintinline{latex}{\rightarrow, \leftarrow, \Rightarrow, \Leftarrow, \Leftrightarrow} & $\rightarrow, \leftarrow, \Rightarrow, \Leftarrow, \Leftrightarrow$ \\
\mintinline{latex}{(A \cup B) \cap C} & $(A \cup B) \cap C$ \\
\mintinline{latex}{(A \lor B) \land C} & $(A \lor B) \land C$ \\
\mintinline{latex}{(A \cdot B) \times C} & $(A \cdot B) \times C$ \\ \bottomrule
\code{latex}{(x), [x], \textbackslash lbrace x \textbackslash rbrace, \textbackslash lvert x \textbackslash rvert} & $(x), [x], \lbrace x\rbrace, \lvert x\rvert$\\
\code{latex}{\textbackslash exists,\textbackslash forall,\textbackslash in,\textbackslash notin,\textbackslash infty} & $\exists,\forall,\in,\notin,\infty$ \\
\code{latex}{\textbackslash alpha, \textbackslash beta, \textbackslash Gamma, \textbackslash Delta, \textbackslash varepsilon, \textbackslash pi} & $\alpha, \beta, \Gamma, \Delta, \varepsilon, \pi$ \\
\code{latex}{\textbackslash rightarrow, \textbackslash leftarrow, \textbackslash Rightarrow, \textbackslash Leftarrow, \textbackslash Leftrightarrow} & $\rightarrow, \leftarrow, \Rightarrow, \Leftarrow, \Leftrightarrow$ \\
\code{latex}{(A \textbackslash cup B) \textbackslash cap C} & $(A \cup B) \cap C$ \\
\code{latex}{(A \textbackslash lor B) \textbackslash land C} & $(A \lor B) \land C$ \\
\code{latex}{(A \textbackslash cdot B) \textbackslash times C} & $(A \cdot B) \times C$ \\ \bottomrule
\end{tabular}
\caption{Brackets, quantifiers, greek letters, arrows, operators}
\label{tbl:maths-logic-sets-braces}
@ -53,23 +53,23 @@ As with many other environments, adding an asterisk turns off the numbering.
\section{Growing brackets}
Especially in combination with fractions, brackets should grow according to their content.
This can be achieved by pre-pending each bracket (\mintinline{latex}{(}, \mintinline{latex}{)}, \mintinline{latex}{[}, \mintinline{latex}{]}, \mintinline{latex}{\lbrace} and \mintinline{latex}{\rbrace}) with a position marker (\mintinline{latex}{\left} or \mintinline{latex}{\right}).
This can be achieved by pre-pending each bracket (\code{latex}{(}, \code{latex}{)}, \code{latex}{[}, \code{latex}{]}, \code{latex}{\textbackslash lbrace} and \code{latex}{\textbackslash rbrace}) with a position marker (\code{latex}{\textbackslash left} or \code{latex}{\textbackslash right}).
\example{lst:growing-brackets}{maths/growing-brackets}{Example for growing brackets}
\section{Lower and upper bounds}
The \mintinline{latex}{\limits} command renders lower and upper bounds of integrals above and below the integral sign.
The \code{latex}{\textbackslash limits} command renders lower and upper bounds of integrals above and below the integral sign.
Sums, products, and limits do this
automatically (cf. \cref{lst:limits}).
For inline formulas, \mintinline{latex}{\limits} are of bounded suitability.
For inline formulas, \code{latex}{\textbackslash limits} are of bounded suitability.
\example{lst:limits}{maths/limits}{Lower and upper bounds of sums, products, limits and integrals}
\section{Aligning equations}
The \texttt{align} environment allows to align multiple equations horizontally, e.\,g., at the \texttt{=} sign (\cref{lst:math-alignment-example}).
As in tables, the \texttt{\&} sign is used to specify anchorage points.
The \sh{align} environment allows to align multiple equations horizontally, e.\,g., at the \sh{=} sign (\cref{lst:math-alignment-example}).
As in tables, the \sh{\&} sign is used to specify anchorage points.
Line breaks are denoted by two backslashes.
\Example{lst:math-alignment-example}{maths/align-example}{maths/align-example_crop}{Equations aligned at equals signs}
@ -78,6 +78,6 @@ Line breaks are denoted by two backslashes.
Sometimes sets have to be defined in terms of textual descriptions or longer function names.
The \LaTeX{} math mode assumes that letters are variables rather than text, which creates problems when they are indeed supposed to be entire words.
For this case, there is the \mintinline{latex}{\mathrm{}} command (\enquote{math roman}, c.\,f. \cref{lst:set-builder-notation}).
For this case, there is the \code{latex}{\textbackslash mathrm\{\}} command (\enquote{math roman}, c.\,f. \cref{lst:set-builder-notation}).
\example{lst:set-builder-notation}{maths/set-builder-notation}{Problems arising from intensional set notation and their solution}

View File

@ -1,26 +1,26 @@
\chapter{Project structure}
\label{sec:project-structure}
In the previous chapters we have only seen very short \LaTeX{} examples. \LaTeX{} can of course also be used to create larger documents and projects, such as a thesis.
In the previous chapters, we have only seen very short \LaTeX{} examples. \LaTeX{} can of course also be used to create larger documents and projects, such as a thesis.
In order not to lose the overview in the source code and to avoid that source files become too long, a reasonable structuring of a larger \LaTeX{} project is advisable. For this purpose, the source code is divided into different files, which will be discussed in more detail in the following sections.
\section{Main file}
In large projects, we typically use one main file, which is often called \texttt{main.tex}. It is, in a sense, the structural skeleton of the project, as it contains the basic structure including the preamble. The title, table of contents, as well as the individual chapters of a work are integrated in this main file (cf.\ \cref{lst:main-file}). The inclusion of the individual sections can be done either by \mintinline{latex}{\input{...}} or \mintinline{latex}{\include{...}}. Both require the path to the file to be included as an argument. We will discuss the differences between the two commands later (see \cref{sec:input-vs-include}).
In large projects, we typically use one main file, which is often called \file{main.tex}. It is, in a sense, the structural skeleton of the project, as it contains the basic structure including the preamble. The title, table of contents, as well as the individual chapters of a work are integrated in this main file (cf.\ \cref{lst:main-file}). The inclusion of the individual sections can be done either by \code{latex}{\textbackslash input\{...\}} or \code{latex}{\textbackslash include\{\textellipsis\}}. Both require the path to the file to be included as an argument. We will discuss the differences between the two commands later (see \cref{sec:input-vs-include}).
\example{lst:main-file}{project-structure/main-file}{Typical structure in a main file \LaTeX{}}
\section{Section files}
Section files are files that are included within the main file. In a thesis, for example, these can be individual chapters. You are free to decide how granular the division of the content into individual files should be.
The files that are included by the main file do not contain a preamble, since this is already present in the main file. Neither do the commands \mintinline{latex}{\begin{document}} and \mintinline{latex}{\end{document}} appear again.
The files that are included by the main file do not contain a preamble, since this is already present in the main file. Neither do the commands \code{latex}{\textbackslash begin\{document\}} and \code{latex}{\textbackslash end\{document\}} appear again.
\section{Input or include?}
\label{sec:input-vs-include}
Let us now turn to the differences between the two possible commands for including \LaTeX{} files. Briefly summarized, \mintinline{latex}{\include} and \mintinline{latex}{\input} have differences in the following three aspects: The way in which the path to the file to be included is specified, the possibility of nesting inclusions, and whether a new page is started for each section.
Let us now turn to the differences between the two possible commands for including \LaTeX{} files. Briefly summarized, \code{latex}{\textbackslash include} and \code{latex}{\textbackslash input} have differences in the following three aspects: The way in which the path to the file to be included is specified, the possibility of nesting inclusions, and whether a new page is started for each section.
If you use the command \mintinline{latex}{\input}, you can specify the file extension \texttt{.tex}, but it is not mandatory. It is also possible to nest the inclusion of files: A file included with \mintinline{latex}{\input} can in turn include another file with the same command. The files that have been included are inserted in the finished document without starting a new page for the included section (cf. \cref{lst:main-file}).
If you use the command \code{latex}{\textbackslash input}, you can specify the file extension \sh{.tex}, but it is not mandatory. It is also possible to nest the inclusion of files: A file included with \code{latex}{\textbackslash input} can in turn include another file with the same command. The files that have been included are inserted in the finished document without starting a new page for the included section (cf. \cref{lst:main-file}).
The command \mintinline{latex}{\include} behaves differently: Here, the file
extension \texttt{.tex} \emph{must} be omitted. Nesting of embeddings is not
The command \code{latex}{\textbackslash include} behaves differently: Here, the file
extension \sh{.tex} \emph{must} be omitted. Nesting of embeddings is not
possible. Also, a new page is created for each included file.

View File

@ -25,14 +25,14 @@ We already have presented a selection of packages. However, there are thousands
\colrules
% Left caption:
\begin{subfigure}[t]{\widefigurewidth}
\caption{Vector graphics with TikZ}
\caption{Vector graphics with \pkg{TikZ}}
\centering\tiny{\url{https://texample.net/tikz/examples/coffee-cup/}}
\label{fig:tikz-example}
\end{subfigure}
\hspace{\widefiguregap}
% Right caption:
\begin{subfigure}[t]{\widefigurewidth}
\caption{Parse trees with qtree}
\caption{Parse trees with \pkg{qtree}}
\centering\tiny{\url{https://www.ling.upenn.edu/advice/latex/qtree/}}
\label{fig:qtree-example}
\end{subfigure}
@ -53,14 +53,14 @@ We already have presented a selection of packages. However, there are thousands
\colrules
% Left caption:
\begin{subfigure}[t]{\widefigurewidth}
\caption{Proof trees with prftree}
\caption{Proof trees with \pkg{prftree}}
\centering\tiny{\url{https://ftp.gwdg.de/pub/ctan/macros/latex/contrib/prftree/}}
\label{fig:prftree-example}
\end{subfigure}
\hspace{\widefiguregap}
% Right caption:
\begin{subfigure}[t]{\widefigurewidth}
\caption{Chemical structural formulas with chemfig}
\caption{Chemical structural formulas with \pkg{chemfig}}
\centering\tiny{\url{http://latex-cookbook.net/cookbook/examples/benzene-ring/}}
\label{fig:chemfig-example}
\end{subfigure}
@ -74,25 +74,25 @@ We already have presented a selection of packages. However, there are thousands
\begin{description}
\item[Indices]
can be created automatically with \texttt{makeidx}.\footnote{\url{https://www.ctan.org/pkg/makeidx}}
By using \mintinline{tex}{\index{}}, one can mark entries for the index. With \mintinline{tex}{\printindex}, an index with references is compiled out of them.
can be created automatically with \pkg{makeidx}.\footnote{\url{https://www.ctan.org/pkg/makeidx}}
By using \code{latex}{\textbackslash index\{\}}, one can mark entries for the index. With \code{latex}{\textbackslash printindex}, an index with references is compiled out of them.
\item[Vector graphics]
(\cref{fig:tikz-example})
can be \enquote{drawn} directly in the \LaTeX{} source code with \texttt{TikZ} (recursive acronym for \emph{TikZ ist kein Zeichenprogramm}, in English: \emph{TikZ is not a drawing program}).\footnote{\url{https://www.ctan.org/pkg/pgf}}
can be \enquote{drawn} directly in the \LaTeX{} source code with \pkg{TikZ} (recursive acronym for \emph{TikZ ist kein Zeichenprogramm}, in English: \emph{TikZ is not a drawing program}).\footnote{\url{https://www.ctan.org/pkg/pgf}}
Caution: This package is very powerful, but not necessarily beginner-friendly.
Before creating vector graphics from scratch, we recommend you to experiment with some of the examples at \TeX{}ample\footnote{\url{https://texample.net/tikz/examples/}}.
Also, for certain use cases, there are special packages that are easier to handle than \enquote{raw} TikZ:
\item[Parse trees]
that divide sentences into their grammatical components (\cref{fig:qtree-example}) can be created with \texttt{qtree}.\footnote{\url{https://ctan.org/pkg/qtree}}
that divide sentences into their grammatical components (\cref{fig:qtree-example}) can be created with \pkg{qtree}.\footnote{\url{https://ctan.org/pkg/qtree}}
\item[Proof trees,]
that are often used in logics (\cref{fig:prftree-example}), can be drawn with the package \texttt{prftree}.\footnote{\url{https://www.ctan.org/pkg/prftree}}
that are often used in logics (\cref{fig:prftree-example}), can be drawn with the package \pkg{prftree}.\footnote{\url{https://www.ctan.org/pkg/prftree}}
\item[Chemical structural formulas]
(\cref{fig:chemfig-example})
can, amongst others, be created with \texttt{chemfig}.\footnote{\url{https://www.ctan.org/pkg/chemfig}}
can, amongst others, be created with \pkg{chemfig}.\footnote{\url{https://www.ctan.org/pkg/chemfig}}
\item[Colors]
for your documents are provided by \texttt{xcolor}.\footnote{\url{https://www.ctan.org/pkg/xcolor}}
for your documents are provided by \pkg{xcolor}.\footnote{\url{https://www.ctan.org/pkg/xcolor}}
\item[Notes]
that you cannot overlook can be created with \texttt{todonotes}.\footnote{\url{https://www.ctan.org/pkg/todonotes}}
that you cannot overlook can be created with \pkg{todonotes}.\footnote{\url{https://www.ctan.org/pkg/todonotes}}
With this package, you can mark what you still \todo{Please do not change. This is an example.} have to change within your document.
\item[Pages of other \acro{PDF} files]
can be integrated into the source code with \texttt{pdfpages}.\footnote{\url{https://www.ctan.org/pkg/pdfpages}}
@ -100,18 +100,18 @@ We already have presented a selection of packages. However, there are thousands
Just compile the document one more time and the appendix is up to date again, if the external program has changed something.
\item[Nested graphics]
and the positioning of captions at almost any place are provided by
\texttt{subcaption}.\footnote{\url{https://www.ctan.org/pkg/subcaption}}
\pkg{subcaption}.\footnote{\url{https://www.ctan.org/pkg/subcaption}}
We also made extensive use of this package.
\item[Tables]
can be designed much more flexibly than what we have shown here.
The following packages can help you with that:
\texttt{colortbl},\footnote{\url{https://www.ctan.org/pkg/colortbl}}
\texttt{tabularx},\footnote{\url{https://www.ctan.org/pkg/tabularx}}
\texttt{multirow},\footnote{\url{https://www.ctan.org/pkg/multirow}}
\texttt{makecell}.\footnote{\url{https://www.ctan.org/pkg/makecell}}
\pkg{colortbl},\footnote{\url{https://www.ctan.org/pkg/colortbl}}
\pkg{tabularx},\footnote{\url{https://www.ctan.org/pkg/tabularx}}
\pkg{multirow},\footnote{\url{https://www.ctan.org/pkg/multirow}}
\pkg{makecell}.\footnote{\url{https://www.ctan.org/pkg/makecell}}
\end{description}
\noindent \texttt{beamer}, which is not a package, but another document class, can be used to create \textbf{slide shows}
\noindent \sh{beamer}, which is not a package, but another document class, can be used to create \textbf{slide shows}
with \LaTeX{}. Information on the document class and examples are available at Overleaf,\footnote{\url{https://www.overleaf.com/learn/latex/Beamer}} which brings us to the next section:
\section{Help and information}

View File

@ -1,17 +1,17 @@
\chapter{References}
\label{sec:references}
If we want to make references, like \enquote{\textellipsis , which you can see in figure 21, \textellipsis}, \LaTeX{} by default provides us with the command \mintinline{latex}{\ref{<label>}}. No more adapting of the numbering for graphics, tables, etc. needed!
If we want to make references, like \enquote{\textellipsis , which you can see in figure 21, \textellipsis}, \LaTeX{} by default provides us with the command \code{latex}{\textbackslash ref\{<label>\}}. No more adapting of the numbering for graphics, tables, etc. needed!
The command expects a unique label as argument, that needs to be assigned to
the referenced element. After that, wherever we call the command, the number of
our referenced object appears in the text.
\Example{lst:fooboar-learning-latex}{references/ref}{references/ref_crop}{Example for a reference}
A smarter package for references is \texttt{cleverref}.\footnote{with only one \enquote{r}!}
It provides us with the command \mintinline{latex}{\cref{label}}, which can also handle multiple labels separated by commas.
This automatically generates elegant references like \enquote{sections 1 to 3, and 5.}\footnote{for the source code \mintinline{latex}{\cref{sec:section1,sec:section2,
sec:section3,sec:section5}}}
Furthermore, \mintinline{latex}{\ref{<label>}} automatically inserts a suited abbreviation, e.\,g., \enquote{fig.} for figures.
A smarter package for references is \pkg{cleverref}.\footnote{with only one \enquote{r}!}
It provides us with the command \code{latex}{\textbackslash cref\{<label>\}}, which can also handle multiple labels separated by commas.
This automatically generates elegant references like \enquote{sections 1 to 3, and 5.}\footnote{for the source code \code{latex}{\textbackslash cref\{sec:section1,sec:section2,
sec:section3,sec:section5\}}}
Furthermore, \code{latex}{\textbackslash ref\{<label>\}} automatically inserts a suited abbreviation, e.\,g., \enquote{fig.} for figures.
We can reference graphics, tables, sections, chapters, source code listings, and equations.
Many packages use the label in order to find out the object type of the referenced element.
@ -31,13 +31,13 @@ For this reason, it is common to insert a prefix before each label (\cref{lst:re
\label{lst:reference-prefixes}
\end{table}
Note that if we use \mintinline{latex}{\cref{label}}\,---\,for some document classes\,---\,the generated passages only appear in the desired language (e.\,g., German) when the language is specified already within the document class command:
Note that if we use \code{latex}{\textbackslash cref\{<label>\}}\,---\,for some document classes\,---\,the generated passages only appear in the desired language (e.\,g., German) when the language is specified already within the document class command:
\begin{minted}{latex}
\documentclass[ngerman]{article}
\end{minted}
\noindent Except for sections, captions\footnote{\mintinline{latex}{\caption{}}} \emph{always need to be specified and positioned before the label}\textit{.} Otherwise, they cannot be referenced later on in the text.
\noindent Except for sections, captions\footnote{\code{latex}{\textbackslash caption\{\}}} \emph{always need to be specified and positioned before the label}\textit{.} Otherwise, they cannot be referenced later on in the text.
Labels for sections are inserted directly after the command:
\begin{minted}{latex}

View File

@ -2,11 +2,11 @@
\label{sec:source-code-listings}
There are many ways in \LaTeX{} to display source code.
We have come to appreciate the package \mintinline{latex}{minted}, which causes some additional installation overhead, but generates very appealing source code renderings.
We have come to appreciate the package \pkg{minted}, which causes some additional installation overhead, but generates very appealing source code renderings.
\section{Installation}
Using \mintinline{latex}{minted} requires a working installation of the programming language Python 3 (henceforth referred to as Python).
On some operating systems, Python comes pre-installed, in which case entering the command \mintinline{bash}{python --version} or \mintinline{bash}{python3 --version} in a terminal of your choice\footnote{Opening a terminal on Windows: \faWindows\ + R → Type \enquote{cmd} → Enter} should print out the installed Python version.
Using \pkg{minted} requires a working installation of the programming language Python 3 (henceforth referred to as Python).
On some operating systems, Python comes pre-installed, in which case entering the command \sh{python --version} or \sh{python3 --version} in a terminal of your choice\footnote{Opening a terminal on Windows: \faWindows\ + R → Type \enquote{cmd} → Enter} should print out the installed Python version.
If Python is yet to be installed, then you can find the installation files on the project website\footnote{Available at \url{https://www.python.org/downloads/}.}.
There are extensive articles that cover all relevant steps to install Python on
@ -26,43 +26,39 @@ Python 3.8.5
\end{minted}
\noindent If the version number is equal to the one stated here, or higher, then everything should be set up correctly.
Next, enter the command \mintinline{bash}{pip install Pygments}\footnote{On some operating systems, you might have to use the command \mintinline{bash}{pip3 install Pygments}} in the same terminal window to install the Pygments package for Python.
Once the installation is complete, you are ready to include the \LaTeX{} package \mintinline{latex}{minted} into your documents by adding \mintinline{latex}{\usepackage{minted}} to your preamble.
Next, enter the command \sh{pip install Pygments}\footnote{On some operating systems, you might have to use the command \sh{pip3 install Pygments}} in the same terminal window to install the Pygments package for Python.
Once the installation is complete, you are ready to include the \LaTeX{} package \pkg{minted} into your documents by adding \code{latex}{\textbackslash usepackage\{minted\}} to your preamble.
\section{Changing the compiler command}
There is one last adjustment needed before you can actually compile your documents---we will have to adjust the compile command.
Out of the box, your editor will probably execute the following command after you clicked the green compile arrow:
\begin{minted}[]{bash}
$ pdflatex main.tex
\end{minted}
\shell{pdflatex main.tex}
\noindent The exact command can be found and configured in \TeX{}studio under Options → Configure \TeX{}studio → Commands.
It is stated next to the label Pdf\LaTeX{}.
The file that is to be compiled will replace the placeholder \mintinline{bash}{%.tex} upon compilation.
The file that is to be compiled will replace the placeholder \sh{\%.tex} upon compilation.
Additionally, there are typically two additional options configured.
You can recognize them by the hyphen before their names (\mintinline{bash}{-synctex=1 -interaction=nonstopmode}).
These options are called flags and configure the program \mintinline{bash}{pdflatex}.
You can recognize them by the hyphen before their names (\sh{-synctex=1 -interaction=nonstopmode}).
These options are called flags and configure the program \sh{pdflatex}.
We will have to add another flag.
Place the string \mintinline{bash}{-shell-escape} before the file placeholder (\mintinline{bash}{%.tex}):
Place the string \sh{-shell-escape} before the file placeholder (\sh{\%.tex}):
\begin{minted}[]{bash}
pdflatex -synctex=1 -interaction=nonstopmode -shell-escape %.tex
\end{minted}
\shell{pdflatex -synctex=1 -interaction=nonstopmode -shell-escape \%.tex}
\noindent After a click on \enquote{Okay} the configuration is finished.
Other editors usually provide similar options to configure the compilation command.
We recommend you to have a look at the settings or to use of a search engine to figure it out.
\paragraph{An important note on the shell-escape flag.} \mintinline{bash}{minted}'s syntax highlighting is done by a Python package, which adds the necessity to communicate between the compiler and the Python runtime.
\paragraph{An important note on the shell-escape flag.} \pkg{minted}'s syntax highlighting is done by a Python package, which adds the necessity to communicate between the compiler and the Python runtime.
The shell-escape flag adds this communication path.
When enabled, \LaTeX{} can execute any command in a terminal, which can be very useful.
Nonetheless, it would also be possible to execute malign code on your computer via \LaTeX{}, especially when you are compiling unknown documents from the Internet.
Therefore, do not compile downloaded documents with the shell-escape flag if you do not trust the authors and did not check the packages and commands they include.
\section{Defining listings}
We are finally ready to marvel at the aesthetic quality of the listings \mintinline{bash}{minted} produces.
We are finally ready to marvel at the aesthetic quality of the listings \pkg{minted} produces.
You can define listings using a dedicated environment:
\example{lst:minted-environment}{source-code-listings/minted-environment}{Exemplary source code listing}
@ -71,7 +67,7 @@ You can define listings using a dedicated environment:
\noindent There is also a shorthand and an inline variant of the command (cf.\ \cref{lst:minted-variants}).
To avoid redundancy, it may be practical to import source code directly from the source file.
To accomplish this, we only have to pass the programming language and the file path to the \mintinline{latex}{\inputminted} command (cf.\ \cref{lst:minted-external}).
To accomplish this, we only have to pass the programming language and the file path to the \code{latex}{\textbackslash inputminted} command (cf.\ \cref{lst:minted-external}).
\example{lst:minted-external}{source-code-listings/minted-import}{Including from a separate file}

View File

@ -13,10 +13,11 @@ The word space is not the only one, though\,---\,there are a few more types of s
\paragraph{English Spacing}
In documents written in English, \LaTeX{} uses traditional English Spacing by default. That is, double spaces after each sentence.
We can prevent this by using the command \mintinline{tex}|\frenchspacing| above the first paragraph.
With \mintinline{tex}|\nonfrenchspacing|, we can reset the behavior.
We can prevent this by using the command \code{tex}{\textbackslash frenchspacing} above the first paragraph.
With \code{latex}{\textbackslash nonfrenchspacing}, we can reset the behavior.
When using English Spacing, \LaTeX{} tries to recognize abbreviations and to use normal spaces after those.
We should still check this and\,---\,where necessary\,---\,enforce word spaces (\mintinline[showspaces]{tex}{.\ }) or sentence spaces (\mintinline[showspaces]{tex}{\@. }).
\todo{Wie setzen wir showspaces um?}
\section{Hyphens and dashes}
There are different kinds of horizontal lines being used as punctuation,
@ -30,9 +31,9 @@ as shown in \cref{tbl:bars}.
\toprule
Code & Character & Usage \\
\midrule
\mintinline{tex}|-| & Hyphen & a small-sized stroke \\
\mintinline{tex}|--| & En dash & a range mark (8\,--\,10\,am) or an interruptor at sentence level the latter surrounded by spaces and used in most European languages (including British English) \\
\mintinline{tex}|---| & Em dash & an interruptor at sentence level\,---\,mostly used in American English and without or with thin spaces \\
\code{latex}{-} & Hyphen & a small-sized stroke \\
\code{latex}{--} & En dash & a range mark (8\,--\,10\,am) or an interruptor at sentence level the latter surrounded by spaces and used in most European languages (including British English) \\
\code{latex}{---} & Em dash & an interrupter at sentence level\,---\,mostly used in American English and without or with thin spaces \\
\bottomrule
\caption{Hyphens and dashes in \LaTeX}
\label{tbl:bars}
@ -47,12 +48,12 @@ In case something goes wrong, we can intervene using the codes from \cref{tbl:se
Code & Explanation \\
\midrule
\endhead
\mintinline{tex}|\-| & Exclusive hyphenation: The word may only be hyphenated at this position (can also be used multiple times within one word\,---\,all of those positions are then allowed). \\
\mintinline{tex}|"-| & Additional hyphenation: The word may be hyphenated here, as well as at the default positions. \\
\mintinline{tex}|-| & Exclusive hyphen: Is only used for compound words and prevents the automatic hyphenation for the rest of the word (which is typographically desirable). \\
\mintinline{tex}|"=| & Non-exclusive hyphen: Is used for long compound words when the text wrapping would not work without additional automatic hyphenation. \\
\mintinline{tex}|""| & Cut-off point without a hyphen: Allows something like a \textsc{url} to wrap without inserting a potentially misleading hyphen. \\
\mintinline{tex}|"~| & Non-wrapping hyphen: Keeps the hyphen together with the following word, very useful in German: \foreignlanguage{ngerman}{\emph{Vorlesungszeit und "~raum}} \\
\code{latex}{\textbackslash -} & Exclusive hyphenation: The word may only be hyphenated at this position (can also be used multiple times within one word\,---\,all of those positions are then allowed). \\
\code{latex}{"-} & Additional hyphenation: The word may be hyphenated here, as well as at the default positions. \\
\code{latex}{-} & Exclusive hyphen: Is only used for compound words and prevents the automatic hyphenation for the rest of the word (which is typographically desirable). \\
\code{latex}{"=} & Non-exclusive hyphen: Is used for long compound words when the text wrapping would not work without additional automatic hyphenation. \\
\code{latex}{""} & Cut-off point without a hyphen: Allows something like a \acro{url} to wrap without inserting a potentially misleading hyphen. \\
\code{latex}{"~} & Non-wrapping hyphen: Keeps the hyphen together with the following word, very useful in German: \foreignlanguage{ngerman}{\emph{Vorlesungszeit und "~raum}} \\
\bottomrule
\caption{Exceptions for hyphenation}
\label{tbl:separators}
@ -71,19 +72,19 @@ The decisive factor is the appearance, not the semantics, which is why the Frenc
\cmidrule(lr){2-3} \cmidrule(lr){4-5}
& Code & Result & Code & Result \\
\midrule
English (\acro{A.\,E.}) & \mintinline{tex}|``...''| & ``…'' & \mintinline{tex}|`...'| & `…' \\
English (\acro{B.\,E.}) & \mintinline{tex}|`...'| & `…' & \mintinline{tex}|``...''| & ``…'' \\
German & \mintinline{tex}|\glqq...\grqq| & \glqq\grqq & \mintinline{tex}|\glq\grq| & \glq\grq \\
German (alternatively) & \mintinline{tex}|\frqq...\flqq| & \frqq\flqq & \mintinline{tex}|\frq\flq| & \frq\flq \\
English (\acro{A.\,E.}) & \code{latex}{``...''} & ``…'' & \code{latex}{`...'} & `…' \\
English (\acro{B.\,E.}) & \code{latex}{`...'} & `…' & \code{latex}{``...''} & ``…'' \\
German & \code{latex}{\glqq...\grqq} & \glqq\grqq & \code{latex}{\glq\grq} & \glq\grq \\
German (alternatively) & \code{latex}{\frqq...\flqq} & \frqq\flqq & \code{latex}{\frq\flq} & \frq\flq \\
\bottomrule
\end{tabular}
\caption{Quotation marks}
\label{tbl:quotation-marks}
\end{table}
We can get more flexibility using the \mintinline{tex}{csquote} package, which provides the \mintinline{tex}|\enquote{<quote>}| command.
We can get more flexibility using the \pkg{csquote} package, which provides the \code{latex}{\enquote{<quote>}} command.
It chooses the correct quotation marks depending on the language being used; also, nested \texttt{enquote}s automatically switch back and forth between first and second level.
When enabling the \mintinline{tex}|autostyle=true| option on package import, \mintinline{tex}|\foreignquote{<language>}{<quote>}| selects varying quotation marks for each quotation.
When enabling the \code{latex}{autostyle=true} option on package import, \code{latex}{\textbackslash foreignquote\{<language>\}\{<quote>\}} selects varying quotation marks for each quotation.
\section{Diacritics}
If we are able to insert letters with diacritics via our keyboard\,---\,e.\,g., the German Umlauts or common accents\,---\,we can do this within our source code, as well:
@ -95,12 +96,12 @@ If not, we can also create the diacritics via escape codes.
\center
\begin{tabular}{lccclccclcc}
\toprule
\verb|\`{o}| & -- & \`{o} & $\quad$ & \verb|\c{c}| & -- & \c{c} & $\quad$ & \verb|\d{u}| & -- & \d{u} \\
\verb|\'{o}| & -- & \'{o} & & \verb|\k{a}| & -- & \k{a} & & \verb|\r{a}| & -- & \r{a} \\
\verb|\^{o}| & -- & \^{o} & & \verb|\l{}| & -- & \l{} & & \verb|\u{o}| & -- & \u{o} \\
\verb|\"{o}| & -- & \"{o} & & \verb|\={o}| & -- & \={o} & & \verb|\v{s}| & -- & \v{s} \\
\verb|\H{o}| & -- & \H{o} & & \verb|\b{o}| & -- & \b{o} & & \verb|\t{oo}| & -- & \t{oo} \\
\verb|\~{o}| & -- & \~{o} & & \verb|\.{o}| & -- & \.{o} & & \verb|\o| & -- & \o \\
\code{latex}{\textbackslash `{o}} & -- & \`{o} & $\quad$ & \code{latex}{\textbackslash c{c}} & -- & \c{c} & $\quad$ & \code{latex}{\textbackslash d{u}} & -- & \d{u} \\
\code{latex}{\textbackslash '\{o\}} & -- & \'{o} & & \code{latex}{\textbackslash k\{a\}} & -- & \k{a} & & \code{latex}{\textbackslash r\{a\}} & -- & \r{a} \\
\code{latex}{\textbackslash \^\{o\}} & -- & \^{o} & & \code{latex}{\textbackslash l\{\}} & -- & \l{} & & \code{latex}{\textbackslash u\{o\}} & -- & \u{o} \\
\code{latex}{\textbackslash "\{o\}} & -- & \"{o} & & \code{latex}{\textbackslash =\{o\}} & -- & \={o} & & \code{latex}{\textbackslash v\{s\}} & -- & \v{s} \\
\code{latex}{\textbackslash H\{o\}} & -- & \H{o} & & \code{latex}{\textbackslash b\{o\}} & -- & \b{o} & & \code{latex}{\textbackslash t\{oo\}} & -- & \t{oo} \\
\code{latex}{\textbackslash ~\{o\}} & -- & \~{o} & & \code{latex}{\textbackslash .\{o\}} & -- & \.{o} & & \code{latex}{\textbackslash o} & -- & \o \\
\bottomrule
\end{tabular}
\caption{Diacritics}
@ -119,23 +120,23 @@ Please note that some of them only work in maths environments (c.\,f. \cref{sec:
Sign & Code & Remarks \\
\midrule
?`/!` & \verb|?`/!`| & \\
\textasciicircum & \verb|\textasciicircum| & \\
\textasciitilde & \verb|\textasciitilde| & \\
\textasteriskcentered & \verb|\textasteriskcentered| & \\
\textbackslash & \verb|\textbackslash| & \\
%\textbar & \verb|\textbar| & \\
%\textbullet & \verb|\textbullet| & \\
\textcopyright & \verb|\textcopyright| & \\
\textdagger & \verb|\textdagger| & \\
%\textdaggerdbl & \verb|\textdaggerdbl| & \\
\textellipsis & \verb|\textellipsis| & \\
\textless/\textgreater & \verb|\textless/\textgreater| & \\
\textperthousand & \verb|\textperthousand| & \\
\textsection & \verb|\textsection| & \\
\textasciicircum & \code{latex}{\textbackslash textasciicircum} & \\
\textasciitilde & \code{latex}{\textbackslash textasciitilde} & \\
\textasteriskcentered & \code{latex}{\textbackslash textasteriskcentered} & \\
\textbackslash & \code{latex}{\textbackslash textbackslash} & \\
%\textbar & \code{latex}{\textbackslash textbar} & \\
%\textbullet & \code{latex}{\textbackslash textbullet} & \\
\textcopyright & \code{latex}{\textbackslash textcopyright} & \\
\textdagger & \code{latex}{\textbackslash textdagger} & \\
%\textdaggerdbl & \code{latex}{\textbackslash textdaggerdbl} & \\
\textellipsis & \code{latex}{\textbackslash textellipsis} & \\
\textless/\textgreater & \code{latex}{\textbackslash textless/\textbackslash textgreater} & \\
\textperthousand & \code{latex}{\textbackslash textperthousand} & \\
\textsection & \code{latex}{\textbackslash textsection} & \\
$\delta, \pi, \Sigma$ & \verb|\delta, \pi, \Sigma|, … & only in maths environments \\
\euro & \verb|\euro| & requires the \texttt{eurosym} package \\
\textteshlig & \verb|\textteshlig| & requires the \texttt{tipa} package \\
\textmusicalnote & \verb|\textmusicalnote| & requires the \texttt{textcomp} package \\
\euro & \code{latex}{\textbackslash euro} & requires the \pkg{eurosym} package \\
\textteshlig & \code{latex}{\textbackslash textteshlig} & requires the \pkg{tipa} package \\
\textmusicalnote & \code{latex}{\textbackslash textmusicalnote} & requires the \pkg{textcomp} package \\
\bottomrule
\end{tabular}
\caption{Some special characters}

View File

@ -2,26 +2,26 @@
\label{sec:tables}
There are two fundamental environments for tables.
The first one, called \texttt{table}, is responsible for integrating the table as a whole into the document.
The first one, called \sh{table}, is responsible for integrating the table as a whole into the document.
Positioning is done the same way as it is with graphics.
The \mintinline{tex}{\caption} command is the same, as well.
The \code{latex}{\textbackslash caption} command is the same, as well.
At the table \emph{content}, the similarities end:
While graphics are embedded from external files and not interpreted by \LaTeX{},
the inner structure of tables has to be encoded explicitly.
This is done with the \texttt{tabular} environment that expects a column definition as an obligatory parameter.
This is done with the \sh{tabular} environment that expects a column definition as an obligatory parameter.
The column definition consists of one letter per column specifying its text alignment:
\texttt{l} for left-justified, \texttt{r} for right-justified, \texttt{c} for centered.
\sh{l} for left-justified, \sh{r} for right-justified, \sh{c} for centered.
Within the \texttt{tabular} environment, the actual table content follows.
Table rows are separated by \mintinline{tex}{\\}, just like line breaks, and cells by an \mintinline{tex}{&}.
Within the \sh{tabular} environment, the actual table content follows.
Table rows are separated by \code{latex}{\textbackslash \textbackslash}, just like line breaks, and cells by an \code{latex}{\&}.
For typographically pleasing tables, we recommend the \texttt{booktabs} package.\footnote{All commands previously mentioned also work without this package, but the result will look far less professional.}
This package brings along the commands \mintinline{tex}{\toprule}, \mintinline{tex}{\midrule} and \mintinline{tex}{\bottomrule} that draw appropriate horizontal lines above, within and below the table, respectively.
For typographically pleasing tables, we recommend the \pkg{booktabs} package.\footnote{All commands previously mentioned also work without this package, but the result will look far less professional.}
This package brings along the commands \code{latex}{\textbackslash toprule}, \code{tex}{\textbackslash midrule} and \code{tex}{\textbackslash bottomrule} that draw appropriate horizontal lines above, within and below the table, respectively.
Vertical lines can be inserted as a vertical bar character (\texttt{|}) in the column definition, but this is \emph{not} recommended.\footnote{The
Vertical lines can be inserted as a vertical bar character (\sh{|}) in the column definition, but this is \emph{not} recommended.\footnote{The
whitespace within the table separates the columns clearly enough, additional lines just make for visual clutter.}
If you want to remove the additional whitespace that surrounds the columns by default (e.\,g., to the left of the first column and to the right of the last), you can add the string \mintinline{tex}{@{}} at the corresponding places within the column definition.
If you want to remove the additional whitespace that surrounds the columns by default (e.\,g., to the left of the first column and to the right of the last), you can add the string \sh{@\{\}} at the corresponding places within the column definition.
A complete table can then look like the one shown in \cref{lst:sample-table}.
@ -29,8 +29,8 @@ A complete table can then look like the one shown in \cref{lst:sample-table}.
\paragraph{Excess length}
For tables exceeding one page or requiring line breaks within individual cells,
the \texttt{longtable} package can be used additionally (also supported by \texttt{booktabs}).
The \texttt{longtable} environment combines the \texttt{table} and \texttt{tabular} environments.
the \pkg{longtable} package can be used additionally (also supported by \pkg{booktabs}).
The \pkg{longtable} environment combines the \sh{table} and \sh{tabular} environments.
With it, you get the following basic structure:
\begin{samepage}
@ -44,9 +44,9 @@ With it, you get the following basic structure:
\paragraph{Excess width}
If you want to present a very wide table instead, it is preferable on pages in portrait orientation to turn the table by 90\textdegree{}.
This can be done with the help of the \texttt{rotating} package.
The only difference between this and a normal table is that the \texttt{table} environment gets replaced by a \texttt{sidewaystable} environment.
Positioning and the \texttt{tabular} stay unaffected.
This can be done with the help of the \pkg{rotating} package.
The only difference between this and a normal table is that the \sh{table} environment gets replaced by a \sh{sidewaystable} environment.
Positioning and the \sh{tabular} stay unaffected.
\paragraph{More possibilities}
Of course, \LaTeX{} offers lots of additional features for sophisticated tables, e.\,g., row- or column-spanning cells.

View File

@ -3,7 +3,7 @@
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: \mintinline{latex}{\emph{}}.
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).
@ -20,14 +20,14 @@ So do not be surprised when your carefully nested selection of four different ma
\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}{\textsl{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} \\
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, dont!) \\
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}
@ -35,8 +35,8 @@ So do not be surprised when your carefully nested selection of four different ma
\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 \acro{URL}s, it also makes them clickable and, if necessary, wraps them without adding hyphens.
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:
@ -53,15 +53,15 @@ For the rest, you can trust the default settings and avoid the visual clutter.
\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} \\
\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}

View File

@ -1,5 +1,6 @@
Make the text \enquote{March 2021} of the file \texttt{exercises/footnotes/footnotes.tex} appear as a footnote instead of in parentheses. Additionally, insert a clickable URL to the Java Development Kit as footnote.
\todo{Sollten wir dieses Beispiel aus Faulheitsgründen vielleicht ersetzen?}
\texttt{https://www.oracle.com/java/technologies/javase-downloads.html}

View File

@ -19,6 +19,9 @@
\usepackage{graphicx}
\graphicspath{graphics/}
% Text color
\usepackage{xcolor}
% Multiple captions in one figure
\usepackage{subcaption}