Merge branch '2021-translate-script' of git.stuve-bamberg.de:latex/latex-skript into 2021-translate-script

This commit is contained in:
Fradtschuk 2022-01-08 15:05:17 +01:00
commit 03e95d1e99
14 changed files with 60 additions and 39 deletions

View File

@ -85,6 +85,15 @@
\texttt{#1}%
}
% Mono-spaced words
% =================
% Mono-spaced text without syntax highlighting.
% Intended for single words or small passages without special meaning.
% These can be environments, file extensions, and many more.
\newcommand\mono[1]{%
\texttt{#1}%
}
% Inline code
% ===========
% Code snippets with syntax highlighting.
@ -125,6 +134,7 @@
postbreak=\mbox{{$\hookrightarrow$}\space},
emphstyle={\color{ForestGreen}\bfseries},
commentstyle=\color{darkgray},
% Allow special characters in lstlistings.
literate=
{Ö}{{\"O}}1
{Ä}{{\"A}}1
@ -139,7 +149,20 @@
\lstinputlisting{#2}%
%
}{%
\lstset{language=#1}
\lstset{
language=#1,
% Allow special characters in lstlistings.
literate=
{Ö}{{\"O}}1
{Ä}{{\"A}}1
{Ü}{{\"U}}1
{ß}{{\ss}}2
{ü}{{\"u}}1
{ä}{{\"a}}1
{ö}{{\"o}}1
{é}{{\'e}}1
{}{\textellipsis}1
}
\lstinputlisting{#2}
}
@ -178,7 +201,7 @@
\colrules
% Left content: code listing:
\begin{subfigure}{\widefigurewidth}
\inputminted[breaklines]{tex}{listings/#2.tex}
\codeblock{latex}{listings/#2.tex}
\end{subfigure}
\hspace{\widefiguregap}
% Right content: image or rendered example:

View File

@ -13,10 +13,9 @@ Let's take a closer look at the preamble.
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>}|.
\todo{Wie sollen wir das abbilden?}
We can define a document class by using the command \code{latex}{\textbackslash documentclass[<para- meter>]\{<document class>\}}.
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.
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 \pkg{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:
@ -63,7 +62,7 @@ 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 (\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}}
The input encoding (\mono{inputenc}), which refers to our source code, and the font encoding (\mono{fontenc}), which determines what the content of our \acro{PDF} document looks like.\footnote{Details on \mono{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}

View File

@ -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 \sh{[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:
\begin{minted}{tex}
\includegraphics[width=12cm, height=4cm]{picture.png}

View File

@ -8,7 +8,7 @@ However, we can also switch to ragged alignment by using the commands
\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
\sh{document} environment. Correspondingly, the text within the whole
\mono{document} environment. Correspondingly, the text within the whole
document is affected.
Alternatively, we can use dedicated environments in order to influence the
formatting

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 \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:
\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>}

View File

@ -6,17 +6,17 @@ 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 (\code{latex}{\textbackslash item}) are framed by an \sh{itemize} environment.
In \cref{lst:unordered-list-code}, different list items (\code{latex}{\textbackslash item}) are framed by an \mono{itemize} environment.
Within a list item, we can open a new list environment to create a nested list.
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}.
If we replace \mono{itemize} by \mono{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 \mono{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 \sh{paralist}\footnote{\url{https://www.ctan.org/pkg/paralist}} package.
The exuberant spacing between list items can be reduced by utilizing the \mono{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}.
If the list ought to appear within a text body, \pkg{paralist} provides the extra environments \mono{inparaenum} and \mono{inparaitem}.
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.

View File

@ -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 \sh{@} sign (e.\,g., article, book, proceedings, …).
The type of the bibliography entry is specified after the opening \mono{@} 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.
@ -70,8 +70,8 @@ Make sure to include the \pkg{natbib} package for this purpose.
\end{table}
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 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 \mono{alpha}, \mono{natdin}, and \mono{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 \sh{natdin} style.}
\Example{lst:natdin-example}{literature/natdin-example}{literature/natdin-example_bib}{Exemplary citations in the \mono{natdin} style.}

View File

@ -1,4 +1,4 @@
\chapter{Mathematical Formulas}
\chapter{Mathematical formulas}
\label{sec:maths}
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.
@ -68,8 +68,8 @@ For inline formulas, \code{latex}{\textbackslash limits} are of bounded suitabil
\section{Aligning equations}
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.
The \mono{align} environment allows to align multiple equations horizontally, e.\,g., at the \mono{=} sign (\cref{lst:math-alignment-example}).
As in tables, the \mono{\&} 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}

View File

@ -19,8 +19,8 @@ The files that are included by the main file do not contain a preamble, since th
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 \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}).
If you use the command \code{latex}{\textbackslash input}, you can specify the file extension \mono{.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 \code{latex}{\textbackslash include} behaves differently: Here, the file
extension \sh{.tex} \emph{must} be omitted. Nesting of embeddings is not
extension \mono{.tex} \emph{must} be omitted. Nesting of embeddings is not
possible. Also, a new page is created for each included file.

View File

@ -111,7 +111,7 @@ We already have presented a selection of packages. However, there are thousands
\pkg{makecell}.\footnote{\url{https://www.ctan.org/pkg/makecell}}
\end{description}
\noindent \sh{beamer}, which is not a package, but another document class, can be used to create \textbf{slide shows}
\noindent \mono{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

@ -16,8 +16,7 @@ In documents written in English, \LaTeX{} uses traditional English Spacing by de
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?}
We should still check this and\,---\,where necessary\,---\,enforce word spaces (\mono{.\textbackslash}) or sentence spaces (\mono{\textbackslash @.␣}).
\section{Hyphens and dashes}
There are different kinds of horizontal lines being used as punctuation,

View File

@ -2,26 +2,26 @@
\label{sec:tables}
There are two fundamental environments for tables.
The first one, called \sh{table}, is responsible for integrating the table as a whole into the document.
The first one, called \mono{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 \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 \sh{tabular} environment that expects a column definition as an obligatory parameter.
This is done with the \mono{tabular} environment that expects a column definition as an obligatory parameter.
The column definition consists of one letter per column specifying its text alignment:
\sh{l} for left-justified, \sh{r} for right-justified, \sh{c} for centered.
\mono{l} for left-justified, \mono{r} for right-justified, \mono{c} for centered.
Within the \sh{tabular} environment, the actual table content follows.
Within the \mono{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 \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 (\sh{|}) in the column definition, but this is \emph{not} recommended.\footnote{The
Vertical lines can be inserted as a vertical bar character (\mono{|}) 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 \sh{@\{\}} 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 \mono{@\{\}} at the corresponding places within the column definition.
A complete table can then look like the one shown in \cref{lst:sample-table}.
@ -30,7 +30,7 @@ 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 \pkg{longtable} package can be used additionally (also supported by \pkg{booktabs}).
The \pkg{longtable} environment combines the \sh{table} and \sh{tabular} environments.
The \pkg{longtable} environment combines the \mono{table} and \mono{tabular} environments.
With it, you get the following basic structure:
\begin{samepage}
@ -45,8 +45,8 @@ 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 \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.
The only difference between this and a normal table is that the \mono{table} environment gets replaced by a \mono{sidewaystable} environment.
Positioning and the \mono{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

@ -14,9 +14,9 @@
\item Include the Bib\TeX{} file in a suitable location, where later on the references should be listed.
\item Cite the three handbooks in the
file\\\file{exercises/literature/literature.tex}.
\item Make use of the \sh{natdin} biliography style.
\item Make use of the \mono{natdin} biliography style.
\item \textbf{Note}: If compiling fails, it may help to remove all auxiliary
files \\(\sh{main.aux/bbl/blg/loc/out/pdf/soc/toc}) before compiling again.
files \\(\mono{main.aux/bbl/blg/loc/out/pdf/soc/toc}) before compiling again.
\end{enumerate}
\exercisematerial{exercises/literature/literature}

View File

@ -1,12 +1,12 @@
\begin{enumerate}
\item \textbf{Put the sections of the file into separate files, named
\texttt{section1.tex}, \texttt{section2.tex}, and \texttt{section3.tex}.
Include them using the \mintinline{latex}{\include} command.}
Include them using the \code{\textbackslash include} command.}
\item \textbf{Which command becomes superfluous when you use
\mintinline{latex}{\include}}
\code{\textbackslash include}}
\item \textbf{Can the preamble also be excluded? If no, why? If yes, why can
outsourcing the preamble be useful?}
\item \textbf{Add the command \mintinline{latex}{\includeonly{section2}} to
\item \textbf{Add the command \code{\textbackslash includeonly\{section2\}} to
the
preamble. Compile the document again, and check what has changed. What does
the command do and why can it be helpful in a larger project? }