Integrated corrections as discussed, chapters 0–4

This commit is contained in:
Kremitzl 2021-09-29 00:05:31 +02:00
parent 984b492dfb
commit bfb3fee06c
7 changed files with 42 additions and 72 deletions

View File

@ -3,7 +3,7 @@
In essence, every \LaTeX{} document is composed of two parts:
We call the first commands within our \LaTeX{} document the \emph{preamble}.
It \replaced[id=F]{specifies global properties of}{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.
It specifies global properties of our document, such as the document class, the encoding, the language, the page format, and additional packages that we want to use.
The \emph{document environment}, on the other hand, contains the actual content of our document, i.\,e., the things that we will later see in our generated \acro{PDF} file.
\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 environment}
@ -13,19 +13,18 @@ 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=\]]{latex}|\documentclass[<parameter>]{<document class>}|.
\todo{Was verursacht diese komische Klammer nach dem Befehl?}
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.
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},\todo{Auf die fehlenden Vokale hinweisen? Anscheinend führt das zu Fehlern …} and \mintinline{latex}{scrbook} can be used instead of \mintinline{latex}{book}.
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}}
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 \replaced[id=C]{US-American conventions}{the American-English standards}
The standard document classes are designed according to US-American conventions
whereas \acro{KOMA} classes adhere to European norms, e.\,g., for
writing letters.
@ -36,18 +35,16 @@ The language can be passed as an optional parameter, too (cf. \cref{sec:language
\subsection{Digression: packages}
\label{sec:packages}
\todo{Muss ``packages'' hier jetzt groß oder klein?}
\todo{Sollte beides gehen}
\begin{minted}{latex}
\usepackage[<options>]{<packagename>}
\end{minted}
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).
\replaced[id=C]{For a package to be used}{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.
To do so, the above-mentioned command is used.
The most important \LaTeX{} packages can be found in the Comprehensive \TeX\ Archive Network, short: \acro{CTAN}.\footnote{Available at: \url{https://www.ctan.org/}}
You can also find \deleted[id=C]{the }documentation for the packages there.
You can also find documentation for the packages there.
\subsection{Encoding}
\begin{minted}{latex}
@ -57,14 +54,11 @@ You can also find \deleted[id=C]{the }documentation for the packages there.
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}}
It is an American character encoding and therefore does\deleted[id=C]{, for instance,} not contain German umlauts\deleted[id=C]{,} or \added[id=C]{most }other special characters, which makes it unsuitable \replaced[id=C]{at least for non-english}{for most} use cases.
\replaced[id=C]{Instead}{As a consequence}, \acro{UTF-8}\footnote{cf. \url{https://en.wikipedia.org/wiki/UTF-8}} can be used as a universal character encoding.
It is an American character encoding and therefore does not contain German umlauts or most other special characters, which makes it unsuitable at least for non-english use cases.
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 (short: \mintinline{latex}{inputenc}), which refers to our 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 \acro{PDF} document, since we also need special characters there.
\todo{fontenc wird hier sehr umständlich beschrieben bzw. ist in dieser Detailtiefe nicht unbedingt relevant}
\todo{Wie wäre es mit \enquote{\[...\] and the font encoding, which determines how the content of our PDF document looks like.} oder so ähnlich?}
\footnote{Details on \mintinline{latex}{fontenc} can be found at: \url{https://tex.stackexchange.com/questions/108417/font-encoding-in-latex}}
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.
\subsection{Language}\label{sec:language}
@ -75,10 +69,10 @@ The package \mintinline{latex}{babel} provides language-specific information (e.
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} \added[id=F]{inclusion} command.
In this case, just leave out the optional parameter for the language within the \mintinline{latex}{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 \replaced[id=F]{babel inclusion}{\mintinline{latex}{\babel}} command.
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.
Alternatively, foreign-language text can be declared by using the following command:
@ -92,24 +86,18 @@ The actual content of the \acro{PDF} document needs to be put between \mintinlin
\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 \added[id=F]{consecutive} spaces are ignored by \LaTeX{}.
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}.}
Manual line breaks can be enforced with two backslashes (\textbackslash\textbackslash).
This should be avoided, though.
\subsection{Comments}
Some characters are reserved for \LaTeX-specific commands, for instance, the percent sign.
Using a percent sign tells the \LaTeX{} compiler to ignore the rest of the line, \replaced[id=C]{so}{i.\,e.,} the text after the percent character will not appear in the generated \acro{PDF} document.
This can be useful in order to take notes while working on a document without affecting the document itself.
\replaced[id=F]{It}{This} is called a \emph{comment}\textit{.}
Using a percent sign tells the \LaTeX{} compiler to ignore the rest of the line, so the text after the percent character will not appear in the generated \acro{PDF} document.
This is called a \emph{comment}\textit{,}
and it can be useful to take notes while working on a document without affecting the document itself.
\todo{Ab da wird es redundant zu Abschnitt 5.5. Reicht da nicht ein Verweis?}
However, if we want the percent sign to actually appear in the text, we can achieve this by using a backslash: \mintinline{latex}{\%}.
This solution is called escaping and also works for other reserved characters, like \#, \$, \&, \_, \{ and \}.
\todo{Und spätestens hier hat es nichts mehr mit Kommentaren zu tun :D}
In order to escape the backslash, the command \mintinline{latex}{\textbackslash} must be used.
\footnote{An overview of additional special characters can be found in \cref{sec:special-characters}.}
There are a few more of these reserved characters, as we will see and learn to deal with in \cref{sec:more-special-characters}.
\subsection{Sections and chapters}
Continuous text can be structured by headings that divide the document into sections and chapters.
@ -117,12 +105,8 @@ Needless to say, \LaTeX{} provides us with commands for that.
The commands that are depicted in \cref{lst:headlines} can be used with any document class.
\Example{lst:headlines}{basic-document-structure/headlines}{basic-document-structure/headlines_crop}{Heading Levels}
\todo{Beispiele neu generieren.}
\added[id=C]{Komisches Konstrukt, weil \texttt{replaced} nicht mit enthaltenen mint-Dingen klarkommt. Geändert:} 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}}.
\added[id=C]{Vorher:}
Depending on your specified document class, the commands \mintinline{latex}{\chapter{Chapter}} and \mintinline{latex}{\part{Part}} are additionally available -- for instance in books.
\added[id=C]{Ende der Änderung.}
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}}.
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}
@ -137,7 +121,7 @@ An alternative title for the table of contents can be declared as an optional pa
\subsection{Front matter}
A simple front matter can be created by using the command \mintinline{latex}{\maketitle}.
The values \replaced[id=F]{to be}{that get} inserted into the front matter must be specified within the preamble.
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.
The design of the front matter depends on the specified document class.

View File

@ -1,40 +1,35 @@
\chapter{How does \LaTeX{} function?}
\chapter{How does \LaTeX{} work?}
\label{sec:basic-functionality}
\todo{Really ``function'', not ``work''?}
\todo{Id prefer “work,” too.}
Word processing and document creation programs have to decide how to translate user input into a document layout.
There are different concepts to approach this topic.
When working with Microsoft Word, the rule is: a document exported as \acro{PDF} looks exactly like the source document in Word.
Where a graphic is placed in Word, it is also found in the \acro{PDF}.
Adjustments to the appearance in Word and other popular programs thus result in a direct visual change.
This type of formatting is called \emph{What you see is what you get} (\acro{WYSIWYG} for short).
Content and \replaced[id=C]{formatting}{structure} are closely linked.
Content and formatting are closely linked.
\LaTeX{}, on the other hand, works according to the principle \emph{What you get is what you mean} (\acro{WYGIWYM} for short).
Content and \replaced[id=C]{formatting}{structure} are separated more clearly.
Content and formatting are separated more clearly.
The content is placed in a document in plain text form, together with so-called \emph{commands}.
The combination of text content and commands is also called \emph{source} \replaced[id=C]{code}{text}.
\todo{Nicht source code?}
The combination of text content and commands is also called \emph{source} code.
To customize the presentation of the content, we do not change the text content itself but add appropriate commands instead.
\todo{Vielleicht lieber Gegenüberstellung: Statt über eine GUI Styles zu vergeben, annotieren wir explizit mit Commands und zwar hauptsächlich semantisch.}
To customize the presentation of the content, we do not set the text appearance itself but add appropriate commands instead.
These are processed by a \emph{compiler}, which adjusts the resulting appearance depending on the command.
Line by line, the compiler processes text and commands from our source code.
When all the source code has been processed by the compiler, we get the final document.
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 \replaced[id=C]{emphasis}{highlighting} of words or sentences.
As a brief example for a command, we shall use the emphasis of words or sentences.
The command is \mintinline{latex}{\emph{}}.
We write the text we want to \replaced[id=C]{emphasize}{highlight} inside the curly braces in the source code, like this:
We write the text we want to emphasize inside the curly braces in the source code, like this:
\mintinline{latex}{\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 \replaced[id=C]{emphasized}{highlighted} by the use of a command.
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.
This simple example illustrates a strength of the \acro{WYGIWYM} principle.
We mark text elements on \replaced[id=C]{a}{the} semantic level and can make the associated typographic adjustments centrally\,---\,or let \LaTeX{} do the configuration itself.
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.
There is no need to make adjustments at each occurrence of an emphasized word.
@ -48,26 +43,23 @@ One to create the source code, and a second one to process the source code.
The latter is the already mentioned compiler.
In principle, a simple text editing program is sufficient for creating the source code.
Most\todo{Is there one that doesnt?} operating systems provide such programs out of the box.
Most operating systems provide such programs out of the box.
Maybe you are already used to applications like Notepad++,\footnote{Available at \url{https://notepad-plus-plus.org/}.} these are usable as well.
Then there are advanced programs like \TeX{}studio\footnote{Available at \url{https://www.texstudio.org/}.} or Texmaker\footnote{Available at \url{https://www.xm1math.net/texmaker/}.} which integrate additional functions that facilitate the use of commands.
You \replaced[id=C]{have free choice}{are free to choose}.
\todo{Hier nochmal, analog zum Vorwort, auf unsere Empfehlung verweisen?}
You are free to choose, but we recommend to use \TeX{}studio.
As mentioned before, we need a compiler to be able to compile our source code.
The compiler is usually part of a collection of \emph{programs} and \emph{packages} which are together called a \LaTeX-\emph{distribution}.
The compiler is usually part of a collection of \emph{programs} and \emph{packages} which are together called a \LaTeX{} \emph{distribution}\textit{.}
The included packages provide various additional commands.
For now, we will skip over the many programs.\footnote{We will get to know one of these helper programs later on, in \ref{sec:literature}, when we are citing literature.}
Multiple different \LaTeX{} distributions exist.
Some of the well-known ones are MiK\TeX,\footnote{For Windows, macOS and Linux. Available at \url{https://miktex.org/}.} Mac\TeX,\footnote{For macOS and Linux. Available at \url{https://www.tug.org/mactex/}.} and \TeX{} Live.\footnote{For Windows, macOS, and Linux. Available at \url{https://www.tug.org/texlive/}.}\todo{Hier tobt ein Edit War … Fußnoten bitte immer *nach* Satzzeichen!}
Some of the well-known ones are MiK\TeX,\footnote{For Windows, macOS and Linux. Available at \url{https://miktex.org/}.} Mac\TeX,\footnote{For macOS and Linux. Available at \url{https://www.tug.org/mactex/}.} and \TeX{} Live.\footnote{For Windows, macOS, and Linux. Available at \url{https://www.tug.org/texlive/}.}
It is best to install one of them right away.
The installation may take several hours.
For this reason, some distributions are available for download in a small and a full version.
The full version contains all packages, while the small version downloads packages only when they are needed.
Unfortunately, we cannot take away the decision if you would rather wait for the download at the beginning or later while you are working.
\todo{Ich sehe entsetzte Gesichter von Leuten mit kleinen Festplatten, die glauben, sie brauchen alle Packages.}
\todo{:D Ich hätte gedacht, wir sollten vielleicht durchaus das Runterladen empfehlen, damit sie im Tut weniger warten müssen. Bringt aber den Windows-Leuten wohl eh nix}
\section{The commands}
\label{subsec:command-structure}
@ -100,9 +92,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.
To make the assignment more concrete, \replaced[id=C]{it is possible to}{we can} specify the parameters explicitly:
\todo{Can or have to?}
\todo{Grundsätzlich can, aber es ist nicht unsere Entscheidung, deswegen würde ich das impersonal formulieren}
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}
@ -110,6 +100,5 @@ To make the assignment more concrete, \replaced[id=C]{it is possible to}{we can}
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.
In the beginning, it will take some getting used to.
\todo{So klingt es vielleicht nicht ganz so bedrohlich …}
\replaced[id=C]{However, you dont have to learn every single command by heart: As soon as you remember the most important commands, you can easily create simple documents and look up everything else.}{Remembering all the relevant commands is hard, but after some practice and patience, simple documents can be created in no time.}
However, you dont have to learn every single command by heart: As soon as you remember the most important commands, you can easily create simple documents and look up everything else.

View File

@ -21,8 +21,6 @@ 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;
\todo{Ist das Semikolon hier richtig? (F)}
\todo{Ziemlich egal, würde ich sagen. Doppelpunkt oder Komma würde auch gehen, aber da gefällts mir so fast besser.}
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}.}
In case you get to choose, it is best to install the full version with all packages.
@ -38,8 +36,8 @@ 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 \emph{PdfLaTeX}, add the flag \mintinline{bash}{-shell-escape}.
In other words: The command for \emph{PdfLaTeX} should look like this:
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}
\section*{Compiling for the first time}

View File

@ -107,7 +107,7 @@ If not, we can also create the diacritics via escape codes.
\label{tbl:diacritics}
\end{table}
\section{More special characters}
\section{More special characters}\label{sec:more-special-characters}
Some special characters, like the percent sign, are reserved as part of the \LaTeX{} syntax and cannot be used as normal characters.
These and many, many more can be created by their own commands.
Please note that some of them only work in maths environments (c.\,f. \cref{sec:maths}), others might require additional packages.

View File

@ -1,5 +1,5 @@
\chapter{\replaced[id=C]{Why use}{What is} \LaTeX?}
\label{sec:what-is-latex}
\chapter{Why use \LaTeX?}
\label{sec:why-uses-latex}
In the early 1960s, a rather talented American Ph.D. student was asked by a big publishing company whether he wanted to write a book on compilers.
He did.
@ -10,7 +10,7 @@ In 1968, the first volume was published, at that time still printed using mechan
This method was just disappearing then, and being replaced by new methods.
However, the author did not like the results of those new methods, so,
at the end of the 70s, he began to develop his own typesetting system \TeX{}
(pronounced as \emph{tech}\todo{is that a valid transliteration in english?}\todo{we could also use the IPA transcription: [tek])} named after the ancient Greek word \texttau$\mathrm{\acute{\varepsilon}}$\textchi\textnu\texteta{} (technē) meaning \emph{art, craft}.
(pronounced as \textipa{[tEx]}, \textipa{[tE\c{c}]} or \textipa{[tEk]}, named after the ancient Greek word \texttau$\mathrm{\acute{\varepsilon}}$\textchi\textnu\texteta{} \textipa{['tExnE:]} meaning \emph{art, craft}).
Today, Donald Knuth (that is the former students name) is a retired professor of computer science and his compiler book has grown to become the multi-volume standard work \emph{The Art of Computer Programming}\,\,three volumes of which are still to be written, among them the one on compilers.
Unlike the book, however, \TeX{} is the rare occurrence of a software system that may actually be called \emph{complete} without meaning \emph{dead}.
@ -28,8 +28,7 @@ As the \TeX{} code is stored in plain text files (cf. \cref{sec:basic-functional
even more advantages arise:
You can structure your projects clearly (cf. \cref{sec:project-structure}),
and whenever you undo changes in the source code, you can always rely on getting exactly the same output as before
\added[id=C]{rather than some more or less similar reconstruction}.
\todo{Klingt für mich, als würden Undos nichts bewirken. (F)}
rather than some more or less similar reconstruction.
On a larger scale, this does also work in connection with Git or other source code versioning tools.
Furthermore, you can trust your source code to be readable long-term, without any specific software.
It can always be opened with any program that supports plain text.

View File

@ -8,6 +8,6 @@
outsourcing the preamble be useful?}
\item \textbf{Add the command \mintinline{latex}{\includeonly{section2}} to
the
preamble. Compile the document again ,and check what has changed. What does
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? }
\end{enumerate}

View File

@ -19,7 +19,7 @@
\newpage
\input{content/first-steps-with-latex.tex}
\input{content/what-is-latex.tex}
\input{content/why-use-latex.tex}
\input{content/basic-functionality.tex}
\input{content/basic-document-structure.tex}
\exercise{basic-document-structure}