replaced minted in continuous text with codeblock commands
This commit is contained in:
parent
03e95d1e99
commit
16480cd7f9
@ -40,9 +40,7 @@ The language can be passed as an optional parameter, too (cf. \cref{sec:language
|
|||||||
\subsection{Digression: packages}
|
\subsection{Digression: packages}
|
||||||
\label{sec:packages}
|
\label{sec:packages}
|
||||||
|
|
||||||
\begin{minted}{latex}
|
\codeblock{latex}{listings/basic-document-structure/packages.tex}
|
||||||
\usepackage[<options>]{<packagename>}
|
|
||||||
\end{minted}
|
|
||||||
Packages provide additional commands and functionalities that we can use within our \LaTeX{} source code.
|
Packages provide additional commands and functionalities that we can use within our \LaTeX{} source code.
|
||||||
There are numerous packages for different use cases (e.\,g., typesetting formulas, lists, \textellipsis).
|
There are numerous packages for different use cases (e.\,g., typesetting formulas, lists, \textellipsis).
|
||||||
In order to use a package, it must be included within the preamble.
|
In order to use a package, it must be included within the preamble.
|
||||||
@ -51,10 +49,7 @@ The most important \LaTeX{} packages can be found in the Comprehensive \TeX\ Arc
|
|||||||
You can also find documentation for the packages there.
|
You can also find documentation for the packages there.
|
||||||
|
|
||||||
\subsection{Encoding}
|
\subsection{Encoding}
|
||||||
\begin{minted}{latex}
|
\codeblock{latex}{listings/basic-document-structure/encoding.tex}
|
||||||
\usepackage[utf8]{inputenc}
|
|
||||||
\usepackage[t1]
|
|
||||||
\end{minted}
|
|
||||||
One use case for packages is specifying the encoding of our \LaTeX{} document.
|
One use case for packages is specifying the encoding of our \LaTeX{} document.
|
||||||
The character encoding\footnote{cf. \url{https://en.wikipedia.org/wiki/Character_encoding}} determines the available character set.
|
The character encoding\footnote{cf. \url{https://en.wikipedia.org/wiki/Character_encoding}} determines the available character set.
|
||||||
The standard encoding in \LaTeX{} is \acro{ASCII}.\footnote{cf. \url{https://en.wikipedia.org/wiki/ASCII}}
|
The standard encoding in \LaTeX{} is \acro{ASCII}.\footnote{cf. \url{https://en.wikipedia.org/wiki/ASCII}}
|
||||||
@ -66,9 +61,7 @@ The input encoding (\mono{inputenc}), which refers to our source code, and the f
|
|||||||
\pkg{T1} is an encoding that tries to cover most European languages with a limited number of characters.
|
\pkg{T1} is an encoding that tries to cover most European languages with a limited number of characters.
|
||||||
|
|
||||||
\subsection{Language}\label{sec:language}
|
\subsection{Language}\label{sec:language}
|
||||||
\begin{minted}{latex}
|
\codeblock{latex}{listings/basic-document-structure/language.tex}
|
||||||
\usepackage[ngerman]{babel}
|
|
||||||
\end{minted}
|
|
||||||
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 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.
|
The desired language can be passed as an optional parameter.
|
||||||
\pkg{ngerman}, for instance, is used for the new German spelling.
|
\pkg{ngerman}, for instance, is used for the new German spelling.
|
||||||
@ -80,9 +73,7 @@ To do so, we pass the languages, separated by commas, as an optional parameter t
|
|||||||
Within our document, we can switch between languages with the \code{latex}{\textbackslash 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:
|
Alternatively, foreign-language text can be declared by using the following command:
|
||||||
|
|
||||||
\begin{minted}{latex}
|
\codeblock{latex}{listings/basic-document-structure/foreign-language.tex}
|
||||||
\foreignlanguage{<language>}{<text>}
|
|
||||||
\end{minted}
|
|
||||||
|
|
||||||
\section{Document environment}
|
\section{Document environment}
|
||||||
The actual content of the \acro{PDF} document needs to be put between \code{latex}{\textbackslash begin\{document\}} and \code{latex}{\textbackslash 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\}}.
|
||||||
@ -113,15 +104,12 @@ The commands that are depicted in \cref{lst:headlines} can be used with any docu
|
|||||||
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\}}.
|
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}}
|
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}
|
\codeblock{latex}{listings/basic-document-structure/section.tex}
|
||||||
\section*{This section is excluded from the table of contents}
|
|
||||||
\end{minted}
|
|
||||||
|
|
||||||
An alternative title for the table of contents can be declared as an optional parameter in square brackets between the command and the actual title:
|
An alternative title for the table of contents can be declared as an optional
|
||||||
|
parameter in square brackets between the command and the actual title:
|
||||||
|
|
||||||
\begin{minted}{latex}
|
\codeblock{latex}{listings/basic-document-structure/title-in-toc.tex}
|
||||||
\section[Title in the TOC]{Actual Chapter Title}
|
|
||||||
\end{minted}
|
|
||||||
|
|
||||||
\subsection{Front matter}
|
\subsection{Front matter}
|
||||||
A simple front matter can be created by using the command \code{latex}{\textbackslash maketitle}.
|
A simple front matter can be created by using the command \code{latex}{\textbackslash maketitle}.
|
||||||
|
|||||||
@ -64,9 +64,8 @@ Unfortunately, we cannot take away the decision if you would rather wait for the
|
|||||||
\section{The commands}
|
\section{The commands}
|
||||||
\label{subsec:command-structure}
|
\label{subsec:command-structure}
|
||||||
The commands used in source code follow a general structure:
|
The commands used in source code follow a general structure:
|
||||||
\begin{minted}{xml}
|
\codeblock{xml}{listings/basic-functionality/command-structure.xml}
|
||||||
\<command>[<optional_parameters>]{<mandatory_parameters>}
|
|
||||||
\end{minted}
|
|
||||||
A command can use several optional and/or mandatory parameters.
|
A command can use several optional and/or mandatory parameters.
|
||||||
Some commands have no mandatory parameters at all.
|
Some commands have no mandatory parameters at all.
|
||||||
Some examples are shown in \cref{tbl:latex-commands}.
|
Some examples are shown in \cref{tbl:latex-commands}.
|
||||||
@ -92,10 +91,9 @@ 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.
|
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.
|
For example, the command for embedding graphics accepts optional parameters for width and height.
|
||||||
If \mono{[12cm, 4cm]} were entered, it would be unclear which value is intended for which parameter.
|
If \mono{[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:
|
To make the assignment more concrete, it is possible to specify the parameters
|
||||||
\begin{minted}{tex}
|
explicitly:
|
||||||
\includegraphics[width=12cm, height=4cm]{picture.png}
|
\codeblock{latex}{listings/basic-functionality/parameters.tex}
|
||||||
\end{minted}
|
|
||||||
|
|
||||||
As the examples already show, many different commands can be used.
|
As the examples already show, many different commands can be used.
|
||||||
Some are intended for use in mathematical formulas, others allow the inclusion of graphics.
|
Some are intended for use in mathematical formulas, others allow the inclusion of graphics.
|
||||||
|
|||||||
@ -24,13 +24,7 @@ Usually, we illustrate a new paragraph by indenting the first line of it
|
|||||||
Alternatively, paragraph spacing, i.\,e., vertical space between paragraphs,
|
Alternatively, paragraph spacing, i.\,e., vertical space between paragraphs,
|
||||||
can be used (\code{latex}{\textbackslash parskip}).
|
can be used (\code{latex}{\textbackslash parskip}).
|
||||||
For both variants, there are adjustable parameters:
|
For both variants, there are adjustable parameters:
|
||||||
\begin{minted}{tex}
|
\codeblock{latex}{listings/formatting-paragraphs/indentation.tex}
|
||||||
\setlength{\parindent}{0pt}
|
|
||||||
\setlength{\parskip}{1em
|
|
||||||
plus .5em % admissible stretch
|
|
||||||
minus .5em % admissible shrink
|
|
||||||
}
|
|
||||||
\end{minted}
|
|
||||||
|
|
||||||
\noindent We can use \code{latex}{\textbackslash 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.
|
paragraph.
|
||||||
|
|||||||
@ -7,19 +7,12 @@ Instead, we reference external image files by a command. The figure is then embe
|
|||||||
\section{Inserting graphics}
|
\section{Inserting graphics}
|
||||||
\label{sec:display-graphics}
|
\label{sec:display-graphics}
|
||||||
In order to be able to reference graphics, the package \texttt{graphicx} has to be included. For inserting a figure, we can use the following commands:
|
In order to be able to reference graphics, the package \texttt{graphicx} has to be included. For inserting a figure, we can use the following commands:
|
||||||
|
|
||||||
\begin{minted}[tabsize=4]{latex}
|
\codeblock{latex}{listings/graphics/insert-graphics.tex}
|
||||||
\begin{figure}
|
|
||||||
\includegraphics{<file path>}
|
|
||||||
\caption[<short title>]{<caption>}
|
|
||||||
\end{figure}
|
|
||||||
\end{minted}
|
|
||||||
|
|
||||||
\noindent The command \mono{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 \mono{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}
|
\codeblock{latex}{listings/graphics/image-size.tex}
|
||||||
\includegraphics[width=0.5\textwidth,height=5cm]{<file path>}
|
|
||||||
\end{minted}
|
|
||||||
|
|
||||||
\section{Positioning}
|
\section{Positioning}
|
||||||
\label{sec:graphics-placement}
|
\label{sec:graphics-placement}
|
||||||
@ -49,12 +42,7 @@ On top of that, we can limit the positioning of our image more or less rigorousl
|
|||||||
\label{tbl:placement-abbreviations}
|
\label{tbl:placement-abbreviations}
|
||||||
\end{table}
|
\end{table}
|
||||||
|
|
||||||
\begin{minted}[tabsize=4]{latex}
|
\codeblock{latex}{listings/graphics/positioning.tex}
|
||||||
\begin{figure}[<position shortcut>]
|
|
||||||
\centering
|
|
||||||
\includegraphics{<file path>}
|
|
||||||
\end{figure}
|
|
||||||
\end{minted}
|
|
||||||
|
|
||||||
Besides the vertical positioning, also the horizontal orientation may be of importance.
|
Besides the vertical positioning, also the horizontal orientation may be of importance.
|
||||||
By default, graphics are left-justified.
|
By default, graphics are left-justified.
|
||||||
|
|||||||
@ -13,17 +13,8 @@ Our \textbf{bibliography collection} consists of multiple literature entries in
|
|||||||
An exemplary item can be seen in \cref{lst:bibfile-sample-entry}.
|
An exemplary item can be seen in \cref{lst:bibfile-sample-entry}.
|
||||||
|
|
||||||
\begin{figure}[H]
|
\begin{figure}[H]
|
||||||
\begin{minted}[autogobble]{latex}
|
\codeblock{bibtex}{listings/literature/bibliography-entry.bib}
|
||||||
@article{turing1990,
|
|
||||||
title={The chemical basis of morphogenesis},
|
|
||||||
author={Turing, Alan Mathison},
|
|
||||||
journal={Bulletin of mathematical biology},
|
|
||||||
volume={52},
|
|
||||||
pages={153--197},
|
|
||||||
year={1990},
|
|
||||||
publisher={Springer}
|
|
||||||
}
|
|
||||||
\end{minted}
|
|
||||||
\caption{Exemplary bibliography entry}
|
\caption{Exemplary bibliography entry}
|
||||||
\label{lst:bibfile-sample-entry}
|
\label{lst:bibfile-sample-entry}
|
||||||
\end{figure}
|
\end{figure}
|
||||||
|
|||||||
@ -33,13 +33,9 @@ For this reason, it is common to insert a prefix before each label (\cref{lst:re
|
|||||||
|
|
||||||
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:
|
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}
|
\codeblock{latex}{listings/references/set-language.tex}
|
||||||
\documentclass[ngerman]{article}
|
|
||||||
\end{minted}
|
|
||||||
|
|
||||||
\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.
|
\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:
|
Labels for sections are inserted directly after the command:
|
||||||
|
|
||||||
\begin{minted}{latex}
|
\codeblock{latex}{listings/references/sections.tex}
|
||||||
\section{Comments}\label{sec:hints}
|
|
||||||
\end{minted}
|
|
||||||
|
|||||||
@ -20,10 +20,7 @@ or macOS.\footnote{\url{https://docs.python-guide.org/starting/install3/osx/}}
|
|||||||
|
|
||||||
After a successful installation, you should be able to execute the aforementioned command in a terminal, confirm by pressing Enter, and see approximately the following result:
|
After a successful installation, you should be able to execute the aforementioned command in a terminal, confirm by pressing Enter, and see approximately the following result:
|
||||||
|
|
||||||
\begin{minted}[]{bash}
|
\codeblock{bash}{listings/source-code-listings/python-version.sh}
|
||||||
$ python --version
|
|
||||||
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.
|
\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 \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.
|
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.
|
||||||
|
|||||||
@ -34,12 +34,7 @@ The \pkg{longtable} environment combines the \mono{table} and \mono{tabular} env
|
|||||||
With it, you get the following basic structure:
|
With it, you get the following basic structure:
|
||||||
|
|
||||||
\begin{samepage}
|
\begin{samepage}
|
||||||
\begin{minted}{latex}
|
\codeblock{latex}{listings/tables/excess-length.tex}
|
||||||
\begin{longtable}
|
|
||||||
% content
|
|
||||||
\caption{<caption>}
|
|
||||||
\end{longtable}
|
|
||||||
\end{minted}
|
|
||||||
\end{samepage}
|
\end{samepage}
|
||||||
|
|
||||||
\paragraph{Excess width}
|
\paragraph{Excess width}
|
||||||
|
|||||||
@ -40,9 +40,7 @@ This command does not only use a mono-spaced font for \acro{URL}s, it also makes
|
|||||||
|
|
||||||
The same applies for different font sizes.
|
The same applies for different font sizes.
|
||||||
You can specify the body text font size with an option at the document class:
|
You can specify the body text font size with an option at the document class:
|
||||||
\begin{minted}{latex}
|
\codeblock{latex}{listings/text-markup/font-size.tex}
|
||||||
\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}.
|
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.
|
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.
|
For the rest, you can trust the default settings and avoid the visual clutter.
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user