translate basic document structure

This commit is contained in:
Fradtschuk 2021-07-08 10:07:06 +02:00
parent 166e01dcf9
commit e0e3bb6366
4 changed files with 43 additions and 49 deletions

View File

@ -1,20 +1,16 @@
\chapter{Basic Document Structure} \chapter{Basic Document Structure}
\label{sec:basic-document-structure} \label{sec:basic-document-structure}
How does a \LaTeX{} document look like?
In essence, every \LaTeX{} document is composed of two parts: the first part is In essence, every \LaTeX{} document is composed of two parts: the first part is
the preamble and is followed by the second part, the document environment. the preamble. It is directly followed by the second part, the document environment.
We call the first commands within our \LaTeX{} document a \emph{preamble}. It We call the first commands within our \LaTeX{} document a \emph{preamble}. It
contains global information about our document, such as the document class that contains global information about our document, such as the document class, the encoding, the language, the page format, and additional packages that we want to use.
we want to use, the encoding, the language, the page format, and additional
packages.
The \emph{document environment}, on the other hand, contains the actual content The \emph{document environment}, on the other hand, contains the actual content
of our document, that is, the things that we will later see in our generated of our document, that is, the things that we will later see in our generated
\acro{PDF} file. \acro{PDF} file.
\Example{lst:latex-document-basic-structure}{basic-document-structure/hello-world}{basic-document-structure/hello-world_crop}{Beispielhafter \Example{lst:latex-document-basic-structure}{basic-document-structure/hello-world}{basic-document-structure/hello-world_crop}{Exemplary structure of a simple \LaTeX{} document with preamble and document
Structure of a simple \LaTeX{} document with preamble and document
environment} environment}
\section{Preamble} \section{Preamble}
@ -23,7 +19,7 @@ A minimal preamble should contain the following specifications:
\subsection{Document Class}\label{sec:document-class} \subsection{Document Class}\label{sec:document-class}
We can define a document class by using the command We can define a document class by using the command
\mintinline{latex}|\documentclass[<parameter>]{<document class>}|. The most \mintinline[breaklines,breakafter=\]]{latex}|\documentclass[<parameter>]{<document class>}|. The most
commonly used document classes that are supported by default are commonly used document classes that are supported by default are
\mintinline{latex}{article} for short documents, and \mintinline{latex}{report} \mintinline{latex}{article} for short documents, and \mintinline{latex}{report}
for longer ones. Furthermore, you can use \mintinline{latex}{book} for books, for longer ones. Furthermore, you can use \mintinline{latex}{book} for books,
@ -35,8 +31,7 @@ for longer ones. Furthermore, you can use \mintinline{latex}{book} for books,
script. An introduction can be found on WikiBooks: script. An introduction can be found on WikiBooks:
\url{https://en.wikibooks.org/wiki/LaTeX/Letters}} for letters. \url{https://en.wikibooks.org/wiki/LaTeX/Letters}} for letters.
In addition to the standard document classes, the \acro{KOMA} script classes In addition to the standard document classes, the \acro{KOMA} script classes have developed. They provide alternatives to the document classes
developed over time. They provide alternatives to the document classes
mentioned above: In lieu of \mintinline{latex}{article} you can use mentioned above: In lieu of \mintinline{latex}{article} you can use
\mintinline{latex}{scrartcl}, \mintinline{latex}{report} is replaced by \mintinline{latex}{scrartcl}, \mintinline{latex}{report} is replaced by
\mintinline{latex}{scrreport}, and \mintinline{latex}{scrbook} can be used \mintinline{latex}{scrreport}, and \mintinline{latex}{scrbook} can be used
@ -56,7 +51,7 @@ square brackets.
\mintinline{latex}{\documentclass[10pt,a5paper,landscape]{scrartcl}}, for \mintinline{latex}{\documentclass[10pt,a5paper,landscape]{scrartcl}}, for
instance, configures a \acro{KOMA} script article and sets its font size 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 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 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. landscape. The language can be passed as an optional parameter, too (cf.
\cref{sec:language}). \cref{sec:language}).
@ -67,11 +62,11 @@ landscape. The language can be passed as an optional parameter, too (cf.
\end{minted} \end{minted}
Packages provide additional commands and functionalities that we can use within Packages provide additional commands and functionalities that we can use within
our \LaTeX{} source code. There are numerous packages for different use cases our \LaTeX{} source code. There are numerous packages for different use cases
(e.\,g. typesetting forumlas, lists, \textellipsis). (e.\,g., typesetting forumlas, lists, \textellipsis).
In order make use of a package, it must be included within the preamble. To do In order make use of a package, it must be included within the preamble. To do
so, the above-mentioned command is used. so, the above-mentioned command is used.
The most important \LaTeX{} packages can be found n the Comprehensive \TeX\ The most important \LaTeX{} packages can be found in the Comprehensive \TeX\
Archive Network,\footnote{Available at: \url{https://www.ctan.org/}}, short: Archive Network\footnote{Available at: \url{https://www.ctan.org/}}, short:
\acro{CTAN}. You can also find the documentations for the packages there. \acro{CTAN}. You can also find the documentations for the packages there.
\subsection{Encoding} \subsection{Encoding}
@ -85,7 +80,7 @@ The character encoding\footnote{cf.
\url{https://en.wikipedia.org/wiki/Character_encoding}} determines the \url{https://en.wikipedia.org/wiki/Character_encoding}} determines the
available character set. available character set.
The standard encoding in \LaTeX{} is \acro{ASCII}.\footnote{cf. The standard encoding in \LaTeX{} is \acro{ASCII}.\footnote{cf.
\url{https://de.wikipedia.org/wiki/American_Standard_Code_for_Information_Interchange}} \url{https://en.wikipedia.org/wiki/ASCII}}
It is an American character encoding and therefore does, for instance, not It is an American character encoding and therefore does, for instance, not
contain German umlauts, or other special characters, which makes it unsuitable contain German umlauts, or other special characters, which makes it unsuitable
for most use cases. for most use cases.
@ -94,14 +89,14 @@ As a consequence, \acro{UTF-8}\footnote{cf.
character character
encoding. encoding.
In \LaTeX{} we need to specify two character encodings: In \LaTeX{}, we need to specify two character encodings:
The input encoding (short: \mintinline{latex}{inputenc}), which refers to our The input encoding (short: \mintinline{latex}{inputenc}), which refers to our
source code, and the font encoding (short: \mintinline{latex}{fontenc}), which source code, and the font encoding (short: \mintinline{latex}{fontenc}), which
concerns the choice of the file that is used to portray the content within our concerns the choice of the file that is used to portray the content within our
\acro{PDF} document, since we also need special characters \acro{PDF} document, since we also need special characters
there.\footnote{Details on how there.\footnote{Details on
\mintinline{latex}{fontenc} works can be found at: \mintinline{latex}{fontenc} can be found at:
\url{https://www.texwelt.de/fragen/5537/was-macht-eigentlich-usepackaget1fontenc}} \url{https://tex.stackexchange.com/questions/108417/font-encoding-in-latex}}
\mintinline{latex}{T1} is an enconding that tries to cover most European \mintinline{latex}{T1} is an enconding that tries to cover most European
language with a limited number of characters. language with a limited number of characters.
@ -111,10 +106,10 @@ language with a limited number of characters.
\end{minted} \end{minted}
The package \mintinline{latex}{babel} provides language-specific information The package \mintinline{latex}{babel} provides language-specific information
(e.\,g. on hyphenation, special characters, changing fonts, translation of (e.\,g., on hyphenation, special characters, changing fonts, translation of
labels\footnote{cf. \cref{sec:references}} like \enquote{Chapter}, labels\footnote{cf. \cref{sec:references}} like \enquote{Chapter},
\enquote{Table of Contents}, or \enquote{Figure}). \enquote{Table of Contents}, or \enquote{Figure}, \textellipsis).
The language that you want to use can be passed as an optional parameter. The desired language can be passed as an optional parameter.
\mintinline{latex}{ngerman}, for instance, is used for the new German spelling. \mintinline{latex}{ngerman}, for instance, is used for the new German spelling.
Some packages require that the language is already passed as optional parameter Some packages require that the language is already passed as optional parameter
in the \mintinline{latex}{\documentclass} command. In this case, just leave out in the \mintinline{latex}{\documentclass} command. In this case, just leave out
@ -122,41 +117,41 @@ the
optional parameter for the language within the \mintinline{latex}{babel} optional parameter for the language within the \mintinline{latex}{babel}
command. command.
You can also use multiple languages in your document. To do so, pass the We can also use multiple languages in your document. To do so, we pass the
languages, languages,
separated by commas, as optional parameter to the \mintinline{latex}{\babel} separated by commas, as optional parameter to the \mintinline{latex}{\babel}
command. Within your document, you can switch between langauges with the command. Within your document, we can switch between languages with the
\mintinline{latex}{\selectlanguage{<language>}} command. Alternatively, you can \mintinline{latex}{\selectlanguage{<language>}} command. Alternatively,foreign-language text
include foreign-language text by using the following command: can be included by using the following command:
\begin{minted}{latex} \begin{minted}{latex}
\foreignlanguage{<language>}{<text>} \foreignlanguage{<language>}{<text>}
\end{minted} \end{minted}
\section{Document Environment} \section{Document Environment}
The actual content of your \acro{PDF} document needs to be put between The actual content of the \acro{PDF} document needs to be put between
\mintinline{latex}{\begin{document}} and \mintinline{latex}{\end{document}}. \mintinline{latex}{\begin{document}} and \mintinline{latex}{\end{document}}.
\subsection{Continuous Text} \subsection{Continuous Text}
The easiest content that you can integrate into the document environment is The easiest content that we can integrate into the document environment is
continuous continuous
text. You can write it directly into your source code. Line breaks and multiple text. We can write it directly into our source code. Line breaks and multiple
spaces are ignored by \LaTeX{}. Blank lines create a new paragraph, which is spaces are ignored by \LaTeX{}. Blank lines create a new paragraph, that is
indented by default.\footnote{The automatic indentation of new paragraphs can indented by default.\footnote{The automatic indentation of new paragraphs can
be prevented by using the command \mintinline{latex}{\noindent}.} be prevented by using the command \mintinline{latex}{\noindent}.}
Manual linebreaks can be forced with two backslashes Manual line breaks can be forced with two backslashes
(\textbackslash\textbackslash). This should be avoided, though. (\textbackslash\textbackslash). This should be avoided, though.
\subsection{Comments} \subsection{Comments}
Some characters are reserved for \LaTeX-specific commands, like, for instance, Some characters are reserved for \LaTeX-specific commands, for instance,
the percent sign. Using a percent sign tells the \LaTeX compiler to ignore the the percent sign. Using a percent sign tells the \LaTeX{} compiler to ignore the
rest of the line, i.\,e., the text after the percent character will not appear rest of the line, i.\,e., the text after the percent character will not appear
in your generated \acro{PDF} document. in the generated \acro{PDF} document.
This can be useful in order to take notes while working on your document This can be useful in order to take notes while working on a document
without affecting the document itself. This is called a comment. without affecting the document itself. This is called a comment.
However, if you want the percent sign to actually appear in your text, you can However, if we want the percent sign to actually appear in the text, we can
achieve this by using a backslash: \mintinline{latex}{\%}. achieve this by using a backslash: \mintinline{latex}{\%}.
This solution is also called escaping and also works for other reserved This solution is called escaping and also works for other reserved
characters, like \#, \$, \&, \_, \{ and \}. characters, like \#, \$, \&, \_, \{ and \}.
In order to escape the backslash, the command In order to escape the backslash, the command
@ -169,7 +164,7 @@ sections and chapters. Needless to say, \LaTeX{} provides us with commands for
that. that.
The commands that are depicted in \cref{lst:headlines} can be used with any The commands that are depicted in \cref{lst:headlines} can be used with any
document class. document class.
\Example{lst:headlines}{basic-document-structure/headlines}{basic-document-structure/headlines_crop}{Überschriftenebenen} \Example{lst:headlines}{basic-document-structure/headlines}{basic-document-structure/headlines_crop}{Heading Levels}
Depending on your specified document class the commands Depending on your specified document class the commands
\mintinline{latex}{\chapter{Chapter}} and \mintinline{latex}{\part{Part}} are \mintinline{latex}{\chapter{Chapter}} and \mintinline{latex}{\part{Part}} are
additionally available -- for instance in books. additionally available -- for instance in books.
@ -182,7 +177,7 @@ a section and exclude it from the table of contents\footnote{cf.
\end{minted} \end{minted}
An alternative title for the table of contents can be declared as an optional 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. parameter in square brackets between the command and the actual title:
\begin{minted}{latex} \begin{minted}{latex}
\section[Title in the TOC]{Actual Chapter Title} \section[Title in the TOC]{Actual Chapter Title}
@ -198,8 +193,7 @@ current date
will be inserted by default. will be inserted by default.
The design of the front matter depends on the specified document class. The design of the front matter depends on the specified document class.
\Example{lst:titles}{basic-document-structure/titles}{basic-document-structure/titles_crop}{Die \Example{lst:titles}{basic-document-structure/titles}{basic-document-structure/titles_crop}{The Front Matter}
Titelei}
\subsection{Indices}\label{sec:table-of-contents} \subsection{Indices}\label{sec:table-of-contents}
The command \mintinline{latex}{\tableofcontents} generates an automatically The command \mintinline{latex}{\tableofcontents} generates an automatically
@ -219,4 +213,4 @@ Besides the table of contents, you can also generate a
\mintinline{latex}{\listoftables} (list of tables). The captions of your \mintinline{latex}{\listoftables} (list of tables). The captions of your
figures and tables will appear within those indices.\footnote{cf. figures and tables will appear within those indices.\footnote{cf.
\cref{sec:graphics} (Graphics) and \cref{sec:tables} (Tables) for more \cref{sec:graphics} (Graphics) and \cref{sec:tables} (Tables) for more
information on captions.} information on captions}

View File

@ -1,10 +1,10 @@
\section{Ebene 1} \section{Level 1}
Lorem ipsum % Lorem ipsum %
\subsection{Ebene 2} \subsection{Level 2}
Lorem ipsum % Lorem ipsum %
\subsubsection{Ebene 3} \subsubsection{Level 3}
Lorem ipsum % Lorem ipsum %
\paragraph{Ebene 4} \paragraph{Level 4}
Lorem ipsum % Lorem ipsum %
\subparagraph{Ebene 5} \subparagraph{Level 5}
Lorem ipsum % Lorem ipsum %

View File

@ -5,5 +5,5 @@
\begin{document} \begin{document}
\thispagestyle{empty} \thispagestyle{empty}
Hallo, Welt! Hello World!
\end{document} \end{document}

View File

@ -3,7 +3,7 @@
\usepackage[T1]{fontenc} \usepackage[T1]{fontenc}
\usepackage[ngerman]{babel} \usepackage[ngerman]{babel}
\title{Die Welt der Trüffel} \title{Die World of Truffles}
\author{Fooboar Rüssel \and Fachschaft WIAI} \author{Fooboar Rüssel \and Fachschaft WIAI}
\date{\today} \date{\today}