Merge branch '2021-translate-script' of git.stuve-bamberg.de:latex/latex-skript into 2021-translate-script
This commit is contained in:
commit
d4df68bc99
21
commands.tex
21
commands.tex
@ -117,6 +117,22 @@
|
||||
language=[LaTeX]TeX
|
||||
}
|
||||
|
||||
\lstdefinelanguage{csharp}{%
|
||||
language=[Sharp]C
|
||||
}
|
||||
|
||||
\lstdefinelanguage{bibtex}
|
||||
{keywords={%
|
||||
@article,@book,@collectedbook,@conference,@electronic,@ieeetranbstctl,%
|
||||
@inbook,@incollectedbook,@incollection,@injournal,@inproceedings,%
|
||||
@manual,@mastersthesis,@misc,@patent,@periodical,@phdthesis,@preamble,%
|
||||
@proceedings,@standard,@string,@techreport,@unpublished%
|
||||
},
|
||||
comment=[l][\itshape]{@comment},
|
||||
sensitive=false,
|
||||
}
|
||||
|
||||
|
||||
\newcommand\codeblock[2]{%
|
||||
\ifthenelse{\equal{\listingsmode}{minted}}{%
|
||||
\inputminted[breaklines]{#1}{#2}
|
||||
@ -129,7 +145,10 @@
|
||||
keywordstyle=\color{ForestGreen}\bfseries,
|
||||
emph={%
|
||||
subsection, subsubsection, url, includegraphics, toprule,
|
||||
midrule, bottomrule, cref%
|
||||
midrule, bottomrule, cref, setlength, maketitle,
|
||||
tableofcontents, foreignlanguage, paragraph, subparagraph,
|
||||
mint, mintinline, inputminted, usemintedstyle, definecolor,
|
||||
citep, enquote%
|
||||
},
|
||||
postbreak=\mbox{{$\hookrightarrow$}\space},
|
||||
emphstyle={\color{ForestGreen}\bfseries},
|
||||
|
||||
@ -40,9 +40,7 @@ The language can be passed as an optional parameter, too (cf. \cref{sec:language
|
||||
\subsection{Digression: packages}
|
||||
\label{sec:packages}
|
||||
|
||||
\begin{minted}{latex}
|
||||
\usepackage[<options>]{<packagename>}
|
||||
\end{minted}
|
||||
\codeblock{latex}{listings/basic-document-structure/packages.tex}
|
||||
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).
|
||||
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.
|
||||
|
||||
\subsection{Encoding}
|
||||
\begin{minted}{latex}
|
||||
\usepackage[utf8]{inputenc}
|
||||
\usepackage[t1]
|
||||
\end{minted}
|
||||
\codeblock{latex}{listings/basic-document-structure/encoding.tex}
|
||||
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 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.
|
||||
|
||||
\subsection{Language}\label{sec:language}
|
||||
\begin{minted}{latex}
|
||||
\usepackage[ngerman]{babel}
|
||||
\end{minted}
|
||||
\codeblock{latex}{listings/basic-document-structure/language.tex}
|
||||
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.
|
||||
\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.
|
||||
Alternatively, foreign-language text can be declared by using the following command:
|
||||
|
||||
\begin{minted}{latex}
|
||||
\foreignlanguage{<language>}{<text>}
|
||||
\end{minted}
|
||||
\codeblock{latex}{listings/basic-document-structure/foreign-language.tex}
|
||||
|
||||
\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\}}.
|
||||
@ -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\}}.
|
||||
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}
|
||||
\section*{This section is excluded from the table of contents}
|
||||
\end{minted}
|
||||
\codeblock{latex}{listings/basic-document-structure/section.tex}
|
||||
|
||||
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}
|
||||
\section[Title in the TOC]{Actual Chapter Title}
|
||||
\end{minted}
|
||||
\codeblock{latex}{listings/basic-document-structure/title-in-toc.tex}
|
||||
|
||||
\subsection{Front matter}
|
||||
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}
|
||||
\label{subsec:command-structure}
|
||||
The commands used in source code follow a general structure:
|
||||
\begin{minted}{xml}
|
||||
\<command>[<optional_parameters>]{<mandatory_parameters>}
|
||||
\end{minted}
|
||||
\codeblock{xml}{listings/basic-functionality/command-structure.xml}
|
||||
|
||||
A command can use several optional and/or mandatory parameters.
|
||||
Some commands have no mandatory parameters at all.
|
||||
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.
|
||||
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.
|
||||
To make the assignment more concrete, it is possible to specify the parameters explicitly:
|
||||
\begin{minted}{tex}
|
||||
\includegraphics[width=12cm, height=4cm]{picture.png}
|
||||
\end{minted}
|
||||
To make the assignment more concrete, it is possible to specify the parameters
|
||||
explicitly:
|
||||
\codeblock{latex}{listings/basic-functionality/parameters.tex}
|
||||
|
||||
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.
|
||||
|
||||
@ -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,
|
||||
can be used (\code{latex}{\textbackslash parskip}).
|
||||
For both variants, there are adjustable parameters:
|
||||
\begin{minted}{tex}
|
||||
\setlength{\parindent}{0pt}
|
||||
\setlength{\parskip}{1em
|
||||
plus .5em % admissible stretch
|
||||
minus .5em % admissible shrink
|
||||
}
|
||||
\end{minted}
|
||||
\codeblock{latex}{listings/formatting-paragraphs/indentation.tex}
|
||||
|
||||
\noindent We can use \code{latex}{\textbackslash noindent} to turn off the indentation for only one
|
||||
paragraph.
|
||||
|
||||
@ -7,19 +7,12 @@ Instead, we reference external image files by a command. The figure is then embe
|
||||
\section{Inserting 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:
|
||||
|
||||
\begin{minted}[tabsize=4]{latex}
|
||||
\begin{figure}
|
||||
\includegraphics{<file path>}
|
||||
\caption[<short title>]{<caption>}
|
||||
\end{figure}
|
||||
\end{minted}
|
||||
|
||||
\codeblock{latex}{listings/graphics/insert-graphics.tex}
|
||||
|
||||
\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}
|
||||
\includegraphics[width=0.5\textwidth,height=5cm]{<file path>}
|
||||
\end{minted}
|
||||
\codeblock{latex}{listings/graphics/image-size.tex}
|
||||
|
||||
\section{Positioning}
|
||||
\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}
|
||||
\end{table}
|
||||
|
||||
\begin{minted}[tabsize=4]{latex}
|
||||
\begin{figure}[<position shortcut>]
|
||||
\centering
|
||||
\includegraphics{<file path>}
|
||||
\end{figure}
|
||||
\end{minted}
|
||||
\codeblock{latex}{listings/graphics/positioning.tex}
|
||||
|
||||
Besides the vertical positioning, also the horizontal orientation may be of importance.
|
||||
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}.
|
||||
|
||||
\begin{figure}[H]
|
||||
\begin{minted}[autogobble]{latex}
|
||||
@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}
|
||||
\codeblock{bibtex}{listings/literature/bibliography-entry.bib}
|
||||
|
||||
\caption{Exemplary bibliography entry}
|
||||
\label{lst:bibfile-sample-entry}
|
||||
\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:
|
||||
|
||||
\begin{minted}{latex}
|
||||
\documentclass[ngerman]{article}
|
||||
\end{minted}
|
||||
\codeblock{latex}{listings/references/set-language.tex}
|
||||
|
||||
\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}
|
||||
\section{Comments}\label{sec:hints}
|
||||
\end{minted}
|
||||
\codeblock{latex}{listings/references/sections.tex}
|
||||
|
||||
@ -34,12 +34,7 @@ The \pkg{longtable} environment combines the \mono{table} and \mono{tabular} env
|
||||
With it, you get the following basic structure:
|
||||
|
||||
\begin{samepage}
|
||||
\begin{minted}{latex}
|
||||
\begin{longtable}
|
||||
% content
|
||||
\caption{<caption>}
|
||||
\end{longtable}
|
||||
\end{minted}
|
||||
\codeblock{latex}{listings/tables/excess-length.tex}
|
||||
\end{samepage}
|
||||
|
||||
\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.
|
||||
You can specify the body text font size with an option at the document class:
|
||||
\begin{minted}{latex}
|
||||
\documentclass[9pt]{article}
|
||||
\end{minted}
|
||||
\codeblock{latex}{listings/text-markup/font-size.tex}
|
||||
Building upon this, \LaTeX{} generates different font sizes that can be called via the commands in \cref{tbl:type-sizes}.
|
||||
It is, however, best to restrict those to title pages and similar things.
|
||||
For the rest, you can trust the default settings and avoid the visual clutter.
|
||||
|
||||
4
exercises/literature/exercise-solution.tex
Normal file
4
exercises/literature/exercise-solution.tex
Normal file
@ -0,0 +1,4 @@
|
||||
The first-mentioned book \citep{lamport1994} has been written by the creator of \LaTeX{}, Leslie Lamport himself. A more recent publication is \enquote{\LaTeX\ in 24 Hours} \citep{datta2017}. There is a plethora of further handbooks \citep*[e.\,g.,][]{goossensmittelbach2002}.
|
||||
|
||||
\bibliographystyle{natdin}
|
||||
\bibliography{exercises/literature/literature.done.bib}
|
||||
@ -1,10 +1,4 @@
|
||||
\inputminted[breaklines]{bibtex}{exercises/literature/literature.done.bib}
|
||||
%\inputminted[breaklines]{bibtex}{exercises/literature/literature.done.bib}
|
||||
\codeblock{bibtex}{./exercises/literature/literature.done.bib}
|
||||
|
||||
\begin{minted}[breaklines]{latex}
|
||||
The first-mentioned book \citep{lamport1994} has been written by the creator of \LaTeX{}, Leslie Lamport himself.
|
||||
A more recent publication is \enquote{\LaTeX\ in 24 Hours} \citep{datta2017}.
|
||||
There is a plethora of further handbooks \citep*[e.\,g.,][]{goossensmittelbach2002}.
|
||||
|
||||
\bibliographystyle{natdin}
|
||||
\bibliography{exercises/literature/literature.done.bib}
|
||||
\end{minted}
|
||||
\codeblock{latex}{./exercises/literature/exercise-solution.tex}
|
||||
|
||||
@ -1,10 +1,13 @@
|
||||
\begin{enumerate}
|
||||
\item First one
|
||||
\item
|
||||
\textbf{Put the sections of the file into separate files, named
|
||||
\file{section1.tex}, \file{section2.tex}, and \file{section3.tex}. Include
|
||||
them using the \code{latex}{\textbackslash include} command.}
|
||||
|
||||
\begin{figure}[H]
|
||||
\codeblock{latex}{exercises/project-structure/main-with-preamble.done.tex}
|
||||
\caption{\file{main.tex}}
|
||||
\end{figure}
|
||||
\item Second one
|
||||
\begin{figure}[H]
|
||||
\codeblock{latex}{exercises/project-structure/section1.done.tex}
|
||||
\caption{\file{section1.tex} (analogous for the other
|
||||
|
||||
@ -8,7 +8,7 @@ C\# is an object-oriented programming language that was developed by Microsoft i
|
||||
|
||||
The following source code listing shows a program that prints the text \enquote{Hello LaTeX friends!} to the console. Like Java, C\# makes use of classes and main methods to build executable applications.
|
||||
|
||||
\inputminted[breaklines, linenos=true]{csharp}{exercises/references/HelloLateXFriends.cs}
|
||||
\codeblock{csharp}{exercises/references/HelloLateXFriends.cs}
|
||||
|
||||
|
||||
|
||||
|
||||
2
listings/basic-document-structure/encoding.tex
Normal file
2
listings/basic-document-structure/encoding.tex
Normal file
@ -0,0 +1,2 @@
|
||||
\usepackage[utf8]{inputenc}
|
||||
\usepackage[t1]
|
||||
1
listings/basic-document-structure/foreign-language.tex
Normal file
1
listings/basic-document-structure/foreign-language.tex
Normal file
@ -0,0 +1 @@
|
||||
\foreignlanguage{<language>}{<text>}
|
||||
1
listings/basic-document-structure/language.tex
Normal file
1
listings/basic-document-structure/language.tex
Normal file
@ -0,0 +1 @@
|
||||
\usepackage[ngerman]{babel}
|
||||
1
listings/basic-document-structure/packages.tex
Normal file
1
listings/basic-document-structure/packages.tex
Normal file
@ -0,0 +1 @@
|
||||
\usepackage[<options>]{<packagename>}
|
||||
0
listings/basic-document-structure/section.tex
Normal file
0
listings/basic-document-structure/section.tex
Normal file
1
listings/basic-document-structure/title-in-toc.tex
Normal file
1
listings/basic-document-structure/title-in-toc.tex
Normal file
@ -0,0 +1 @@
|
||||
\section[Title in the TOC]{Actual Chapter Title}
|
||||
1
listings/basic-functionality/command-structure.xml
Normal file
1
listings/basic-functionality/command-structure.xml
Normal file
@ -0,0 +1 @@
|
||||
\<command>[<optional_parameters>]{<mandatory_parameters>}
|
||||
1
listings/basic-functionality/parameters.tex
Normal file
1
listings/basic-functionality/parameters.tex
Normal file
@ -0,0 +1 @@
|
||||
\includegraphics[width=12cm, height=4cm]{picture.png}
|
||||
5
listings/formatting-paragraphs/indentation.tex
Normal file
5
listings/formatting-paragraphs/indentation.tex
Normal file
@ -0,0 +1,5 @@
|
||||
\setlength{\parindent}{0pt}
|
||||
\setlength{\parskip}{1em
|
||||
plus .5em % admissible stretch
|
||||
minus .5em % admissible shrink
|
||||
}
|
||||
1
listings/graphics/image-size.tex
Normal file
1
listings/graphics/image-size.tex
Normal file
@ -0,0 +1 @@
|
||||
\includegraphics[width=0.5\textwidth,height=5cm]{<file path>}
|
||||
4
listings/graphics/insert-graphics.tex
Normal file
4
listings/graphics/insert-graphics.tex
Normal file
@ -0,0 +1,4 @@
|
||||
\begin{figure}
|
||||
\includegraphics{<file path>}
|
||||
\caption[<short title>]{<caption>}
|
||||
\end{figure}
|
||||
4
listings/graphics/positioning.tex
Normal file
4
listings/graphics/positioning.tex
Normal file
@ -0,0 +1,4 @@
|
||||
\begin{figure}[<position shortcut>]
|
||||
\centering
|
||||
\includegraphics{<file path>}
|
||||
\end{figure}
|
||||
9
listings/literature/bibliography-entry.bib
Normal file
9
listings/literature/bibliography-entry.bib
Normal file
@ -0,0 +1,9 @@
|
||||
@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}
|
||||
}
|
||||
9
listings/literature/bibliography-entry.tex
Normal file
9
listings/literature/bibliography-entry.tex
Normal file
@ -0,0 +1,9 @@
|
||||
@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}
|
||||
}
|
||||
1
listings/references/sections.tex
Normal file
1
listings/references/sections.tex
Normal file
@ -0,0 +1 @@
|
||||
\section{Comments}\label{sec:hints}
|
||||
1
listings/references/set-language.tex
Normal file
1
listings/references/set-language.tex
Normal file
@ -0,0 +1 @@
|
||||
\documentclass[ngerman]{article}
|
||||
4
listings/tables/excess-length.tex
Normal file
4
listings/tables/excess-length.tex
Normal file
@ -0,0 +1,4 @@
|
||||
\begin{longtable}
|
||||
% content
|
||||
\caption{<caption>}
|
||||
\end{longtable}
|
||||
1
listings/text-markup/font-size.tex
Normal file
1
listings/text-markup/font-size.tex
Normal file
@ -0,0 +1 @@
|
||||
\documentclass[9pt]{article}
|
||||
@ -17,6 +17,7 @@
|
||||
|
||||
% Images
|
||||
\usepackage{graphicx}
|
||||
\usepackage{float}
|
||||
\graphicspath{graphics/}
|
||||
|
||||
% Text color
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user