Merge branch '2022-refactor-script'

This commit is contained in:
Knoch 2022-06-18 22:01:05 +02:00
commit 3dd100ee3e
46 changed files with 91 additions and 151 deletions

View File

@ -86,12 +86,12 @@
% ===========
% Code snippets with syntax highlighting.
% TODO: Fix special character mess.
% Caution: Must not be used inside `\textbf{}'
%
% Arguments:
% 1. Language.
% 2. Source code.
\newcommand\code[2]{%
% \mintinline{#1}{#2}
\texttt{#2}%
}
@ -128,7 +128,7 @@
\ifthenelse{\equal{#1}{latex}}{%
\lstset{language=#1,
basicstyle=\footnotesize\ttfamily,
basicstyle=\small\ttfamily,
breaklines=true,
keywordstyle=\color{ForestGreen}\bfseries,
emph={%

View File

@ -1,26 +1,25 @@
\chapter{Project structure}
\label{sec:project-structure}
In the previous chapters, we have only seen very short \LaTeX{} examples. \LaTeX{} can of course also be used to create larger documents and projects, such as a thesis.
In order not to lose the overview in the source code and to avoid that source files become too long, a reasonable structuring of a larger \LaTeX{} project is advisable. For this purpose, the source code is divided into different files, which will be discussed in more detail in the following sections.
In the previous chapters, we have only seen very short \LaTeX{} examples.
\LaTeX{} can of course also be used to create larger documents and projects, such as a thesis.
In order not to lose the overview in the source code and to avoid that source files become too long, a reasonable structuring of a larger \LaTeX{} project is advisable.
For this purpose, the source code is divided into different files, which will be discussed in more detail in the following sections.
\section{Main file}
In large projects, we typically use one main file, which is often called \file{main.tex}. It is, in a sense, the structural skeleton of the project, as it contains the basic structure including the preamble. The title, table of contents, as well as the individual chapters of a work are integrated in this main file (cf.\ \cref{lst:main-file}). The inclusion of the individual sections can be done either by \code{latex}{\textbackslash input\{...\}} or \code{latex}{\textbackslash include\{\textellipsis\}}. Both require the path to the file to be included as an argument. We will discuss the differences between the two commands later (see \cref{sec:input-vs-include}).
In large projects, we typically use one main file, which is often called \file{main.tex}.
It is, in a sense, the structural skeleton of the project, as it contains the basic structure including the preamble.
The title, table of contents, as well as the individual chapters of a work are integrated in this main file (cf.\ \cref{lst:main-file}).
The inclusion of the individual sections is typically done by the \code{latex}{\textbackslash input\{...\}} command
\footnote{There exists another command called \code{latex}{\textbackslash include\{\textellipsis\}} that works slightly differently. It requires you to specify the file to be included without a file extension. Besides this, a line break is added before the content of the partial file. Lastly, you cannot nest \code{latex}{\textbackslash include\{\textellipsis\}} statements. When you try to include a file that also includes a file, a compiler error will be thrown. \code{latex}{\textbackslash input\{\textellipsis\}} on the other hand is capable of such nested imports. In this script, we will present the \code{latex}{\textbackslash input\{\textellipsis\}} command only.}
with the file to be included as an argument.
\example{lst:main-file}{project-structure/main-file}{Typical structure in a main file \LaTeX{}}
\section{Section files}
Section files are files that are included within the main file. In a thesis, for example, these can be individual chapters. You are free to decide how granular the division of the content into individual files should be.
The files that are included by the main file do not contain a preamble, since this is already present in the main file. Neither do the commands \code{latex}{\textbackslash begin\{document\}} and \code{latex}{\textbackslash end\{document\}} appear again.
\section{Input or include?}
\label{sec:input-vs-include}
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 \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 \mono{.tex} \emph{must} be omitted. Nesting of embeddings is not
possible. Also, a new page is created for each included file.
\section{Partial files}
Partial files are files that are included within another file, most often the main file.
In a thesis, for example, these can represent individual chapters.
You are free to decide how granular the division of the content into individual files should be.
The files that are included by the main file do not contain a preamble, since this is already present in the main file.
Neither do the commands \code{latex}{\textbackslash begin\{document\}} and \code{latex}{\textbackslash end\{document\}} appear again.

View File

@ -133,8 +133,8 @@ Please note that some of them only work in maths environments (c.\,f. \cref{sec:
\textless/\textgreater & \code{latex}{\textbackslash textless/\textbackslash textgreater} & \\
\textperthousand & \code{latex}{\textbackslash textperthousand} & \\
\textsection & \code{latex}{\textbackslash textsection} & \\
$\delta, \pi, \Sigma$ & \verb|\delta, \pi, \Sigma|, … & only in maths environments \\
\euro & \code{latex}{\textbackslash euro} & requires the \pkg{eurosym} package \\
$\delta, \pi, \Sigma$ & \verb|\delta, \pi, \Sigma|, … & only in maths
environments \\
\textteshlig & \code{latex}{\textbackslash textteshlig} & requires the \pkg{tipa} package \\
\textmusicalnote & \code{latex}{\textbackslash textmusicalnote} & requires the \pkg{textcomp} package \\
\bottomrule

View File

@ -1,18 +1,6 @@
\thispagestyle{empty}
\begin{center}
\fslogo \\
\vspace{3em}
\rule{\textwidth}{1pt}\par
\vspace{0.8\baselineskip}
\Huge\bfseries Script for the Fachschaft \acro{WIAI} \LaTeX{} Workshop
\rule{\textwidth}{1pt}\par
%{\large \today}
\vfill
\vfill
{\Large{ Evelyn Fradtschuk, Florian Knoch,\\
Christian Kremitzl, Bernhard Luedtke}}\\
\vfill
\end{center}
\includepdf{graphics/cover/latex-script-cover.pdf}
\newpage
\thispagestyle{empty}
@ -22,7 +10,7 @@
\begin{tabular}{@{}lp{9cm}}
& \subsubsection*{Imprint} \\
& The \LaTeX{} Script (version 1.1 from January 21st, 2022) has been assembled by the Student Council of the Information Systems and Applied Computer Sciences Faculty (Fachschaft \acro{WIAI}) at the University of Bamberg. \\
& The \LaTeX{} Script (version 1.2 from June 18th, 2022) has been assembled by the Student Council of the Information Systems and Applied Computer Sciences Faculty (Fachschaft \acro{WIAI}) at the University of Bamberg. \\
& It is licensed under Creative Commons \enquote{Attribution-ShareAlike 4.0 International} (CC BY-SA 4.0): \\
\href{http://creativecommons.org/licenses/by-sa/4.0/}{\includegraphics[height=.5cm]{graphics/cc-by-sa}} & \url{http://creativecommons.org/licenses/by-sa/4.0/} \\ \\
& Upon request, allowances exceeding the limitations of this license may be granted.

View File

@ -1 +1 @@
\codeblock{latex}{./exercises/basic-document-structure/document-structure.code.tex}
\codeblock{latex}{./exercises/basic-document-structure/document-structure.code.done.tex}

View File

@ -1 +1 @@
\codeblock{latex}{./exercises/footnotes/footnotes.code.tex}
\codeblock{latex}{./exercises/footnotes/footnotes.code.done.tex}

View File

@ -3,8 +3,6 @@ Make the text \enquote{March 2021} of the file
parentheses. Additionally, insert a clickable URL to the Java Development Kit
as footnote.
\todo{Sollten wir dieses Beispiel aus Faulheitsgründen vielleicht ersetzen?}
\texttt{https://www.oracle.com/java/technologies/javase-downloads.html}
\exercisematerial{exercises/footnotes/footnotes}

View File

@ -1 +1 @@
\codeblock{latex}{./exercises/graphics/graphics.code.tex}
\codeblock{latex}{./exercises/graphics/graphics.code.done.tex}

View File

@ -1 +1 @@
\codeblock{latex}{./exercises/lists/lists.code.tex}
\codeblock{latex}{./exercises/lists/lists.code.done.tex}

View File

@ -1,4 +0,0 @@
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}

View File

@ -0,0 +1,5 @@
An introductory \LaTeX{} course can be found in \enquote{\LaTeX{} in 24 Hours} \cite{datta2017}.
There is a plethora of further handbooks \cite*[e.\,g.,][]{goossensmittelbach2002}.
\bibliographystyle{plain}
\bibliography{exercises/literature/literature.done.bib}

View File

@ -1,15 +1,3 @@
@book{lamport1994,
author = {Leslie Lamport},
title = {LaTeX - {A} Document Preparation System: User's
Guide and Reference Manual, Second Edition},
publisher = {Pearson / Prentice Hall},
year = {1994},
isbn = {978-0-201-52983-8},
timestamp = {Fri, 08 Apr 2011 18:21:00 +0200},
biburl = {https://dblp.org/rec/books/daglib/0023602.bib},
bibsource = {dblp computer science bibliography,
https://dblp.org}
}
@book{datta2017,
author = {Dilip Datta},
title = {LaTeX in 24 Hours - {A} Practical Guide for

View File

@ -1,4 +1,3 @@
%\inputminted[breaklines]{bibtex}{exercises/literature/literature.done.bib}
\codeblock{bibtex}{./exercises/literature/literature.done.bib}
\codeblock{latex}{./exercises/literature/exercise-solution.tex}
\codeblock{latex}{./exercises/literature/literature.code.done.tex}

View File

@ -1,5 +1,4 @@
The first-mentioned book (Lamport, 1994) has been written by the creator of \LaTeX{}, Leslie Lamport himself.
A more recent publication is \enquote{\LaTeX\ in 24 Hours} (Datta, 2017).
An introductory \LaTeX{} course can be found in \enquote{\LaTeX{} in 24 Hours} (Datta, 2017).
There is a plethora of further handbooks (e.\,g., Goossens, Mittelbach and Samarin, 2002).
~\\
@ -9,5 +8,3 @@ There is a plethora of further handbooks (e.\,g., Goossens, Mittelbach and Samar
\noindent [Datta 2017] Datta, Dilip: LaTeX in 24 Hours - A Practical Guide for Scientific Writing. Springer, 2017. \url{http://dx.doi.org/10.1007/978-3-319-47831-9}. ISBN 9783319478302
\noindent [Goossens u. a. 2002] Goossens, Michel ; Mittelbach, Frank ; Samarin, Alexander: Der LaTeX Begleiter. Addison-Wesley, 2002. ISBN 9783827370440
\noindent [Lamport 1994] Lamport, Leslie: LaTeX - A Document Preparation System: Users Guide and Reference Manual, Second Edition. Pearson / Prentice Hall, 1994. ISBN 9780201529838

View File

@ -2,19 +2,17 @@
\item Use Google Scholar to retrieve Bib\TeX{} entries for the following \LaTeX{}
handbooks:
\begin{itemize}
\item Leslie Lamport (1994): \LaTeX. A Document Preparation System.
\item Dilip Datta (2017): \LaTeX\ in 24 Hours. A Practical Guide for Scientific Writing.
\item Frank Mittelbach / Michel Goossens (2002): Der \LaTeX-Begleiter.
\end{itemize}
\item Compare the entries with the results that \url{dblp.org} finds for the same titles.
\item Create a new Bib\TeX{} file called \file{literature.bib} in the
\file{exercises/literature} folder.
\item Create a new Bib\TeX{} file called \file{literature.bib} in the \file{exercises/literature} folder.
\item Add the Bib\TeX{} entries to the newly created Bib\TeX{} files. For this, select your preferred source among Google Scholar and dblp.
\item Assign unique and meaningful Bib\TeX{} keys.
\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
\item Cite the two handbooks in the
file\\\file{exercises/literature/literature.tex}.
\item Make use of the \mono{natdin} biliography style.
\item Make use of the \mono{plain} biliography style.
\item \textbf{Note}: If compiling fails, it may help to remove all auxiliary
files \\(\mono{main.aux/bbl/blg/loc/out/pdf/soc/toc}) before compiling again.
\end{enumerate}

View File

@ -1 +1 @@
\codeblock{latex}{./exercises/maths/math-formulas.code.tex}
\codeblock{latex}{./exercises/maths/math-formulas.code.done.tex}

View File

@ -9,8 +9,11 @@
\maketitle
\tableofcontents
\include{section1}
\include{section2}
\include{section3}
\newpage
\input{section1}
\newpage
\input{section2}
\newpage
\input{section3}
\end{document}

View File

@ -4,8 +4,11 @@
\maketitle
\tableofcontents
\include{section1.done}
\include{section2.done}
\include{section3.done}
\newpage
\input{section1.done}
\newpage
\input{section2.done}
\newpage
\input{section3.done}
\end{document}

View File

@ -27,7 +27,7 @@ Marzipan marzipan cupcake pastry tart sesame snaps sweet roll pie. Marshmallow p
Carrot cake cotton candy toffee jelly-o chocolate toffee cookie sweet roll. Pastry tootsie roll marzipan apple pie lollipop gingerbread sweet. Fruitcake gummies bear claw croissant. Pie cotton candy cheesecake powder bonbon candy canes lemon drops sweet.
\newpage
\section{Third ection}
\section{Third section}
Tart dragée bear claw icing fruitcake. Caramels marzipan jujubes bonbon. Fruitcake danish cookie halvah cake. Cheesecake sesame snaps jelly beans. Macaroon powder pie biscuit biscuit croissant cotton candy. Chocolate bar chupa chups tart cheesecake gingerbread tart. Ice cream muffin chupa chups sugar plum dragée topping marshmallow dragée.

View File

@ -1,49 +1,24 @@
\begin{enumerate}
\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.}
\file{section1.tex}, \file{section2.tex}, and \file{section3.tex} and insert them using the} \code{latex}{\textbackslash input} \textbf{command. (In TeXstudio, make sure that you select the main file as the file to be compiled by right-clicking on it and selecting \enquote{Select as explicit root document.})}
\begin{figure}[H]
\codeblock{latex}{exercises/project-structure/main-with-preamble.done.tex}
\caption{\file{main.tex}}
\end{figure}
\begin{figure}[H]
\codeblock{latex}{exercises/project-structure/section1.done.tex}
\caption{\file{section1.tex} (analogous for the other
sections)}
\end{figure}
\item \textbf{Which command becomes superfluous when you use
\code{latex}{\textbackslash include}?} \\
\code{latex}{\textbackslash include} makes every included file appear on a
new page. Hence the command \code{latex}{\textbackslash newpage} becomes
superfluous.
\item \textbf{Can the preamble also be excluded? If no, why? If yes, when
can outsourcing the preamble be useful?}
\item \textbf{Can the preamble also be excluded? If no, why? If yes, when can outsourcing the preamble be useful?}
The preamble can also be outsourced, like in task 1. In real-world
\LaTeX{} projects we often make use of numerous packages that need to be
The preamble can also be outsourced, like in task 1. In real-world \LaTeX{} projects, we often make use of numerous packages that need to be
configured by additional commands within the preamble. Therefore, it is
advisable to outsource the preamble. On top of that, this is useful
because the file with the most-commonly used packages can be moved from
one project to another without needing to rewrite the preamble every time.
\item
\textbf{Add the command \code{latex}{\textbackslash
includeonly\{section2\}} to the preamble. Compile the document again, and
check what has changed. What does the command do and how can it be helpful
in a larger project? }
The command \code{latex}{\textbackslash includeonly\{section2\}} does
exactly what the name already says. During compilation, only the
\code{latex}{\textbackslash include} statements that contain file names
that appear in \code{latex}{\textbackslash includeonly\{file1,file2, …\}}
are included.
This can be useful for larger projects, when the compile time becomes
longer since by using the \code{latex}{\textbackslash includeonly} only the
files can be included which we are currently working in. Before the final
compilation we can delete the \code{latex}{\textbackslash includeonly}
command and end up with our complete \acro{PDF}.
\end{enumerate}

View File

@ -1,13 +1,6 @@
\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 \code{\textbackslash include} command.}
\item \textbf{Which command becomes superfluous when you use
\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 \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? }
\item \textbf{Put the sections of the file into separate files, named}
\file{section1.tex}, \file{section2.tex}\textbf{, and} \file{section3.tex}.
\textbf{Include them using the} \code{latex}{\textbackslash input} \textbf{command. (In TeXstudio, make sure that you select the main file as the file to be compiled by right-clicking on it and selecting \enquote{Select as explicit root document.})}
\item \textbf{Can the preamble also live in its own file? If no, why? If yes, why can outsourcing the preamble be useful?}
\end{enumerate}

View File

@ -12,6 +12,6 @@ C\# is an object-oriented programming language that was developed by Microsoft i
\begin{listing}[H]
\caption{A simple C\# program}
\label{lst:csharphelloworld}
\inputminted[breaklines,
linenos=true]{csharp}{exercises/references/HelloLateXFriends.cs}
\lstset{language=csharp}
\lstinputlisting{exercises/references/HelloLateXFriends.cs}
\end{listing}

View File

@ -1 +1 @@
\codeblock{latex}{./exercises/references/references.code.tex}
\codeblock{latex}{./exercises/references/references.code.done.tex}

View File

@ -8,8 +8,5 @@ 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.
\codeblock{csharp}{exercises/references/HelloLateXFriends.cs}
\lstset{language=csharp}
\lstinputlisting{exercises/references/HelloLateXFriends.cs}

View File

@ -1,10 +1,6 @@
In file \file{exercises/references/references.tex}, replace \enquote{in the
figure} and \enquote{the following source code listing} with suited references.
Use the command \code{latex}{\textbackslash cref}. Do not forget to first
introduce
labels for the elements that you want to reference. To do so, first of all,
wrap the source code listing in a \code{latex}{listing} environment. Also
insert a caption for the source code listing.
In file \file{exercises/references/references.tex}, replace \enquote{in the figure} and \enquote{the following source code listing} with suited references.
Use the command \code{latex}{\textbackslash cref}. Do not forget to first introduce labels for the elements that you want to reference. To do so, first of all, wrap the source code listing in a \code{latex}{listing} environment.
Also, insert a caption for the source code listing.
Make sure to use suitable prefixes before the labels.
\exercisematerial{exercises/references/references}

View File

@ -7,7 +7,7 @@
bgcolor=ourBackgroundColor, % background color
firstline=5, % first line to be included
lastline=7, % last line to be included
gobble=4 % remove leading spaces
autogobble=true % remove leading spaces
]{java}{exercises/source-code-listings/Source.java}
\usemintedstyle{default}

View File

@ -12,8 +12,7 @@ If you have questions, consult the \pkg{minted} or \pkg{listings} package docume
\item Use the theme \code{latex}{native}.
\item This theme is optimized for a dark background. Change the background color to dark blue.
\item Include only lines 5 to 7.
\item Delete the spaces at the beginning of the lines by using a suitable
option. (Hint: The documentation speaks of \code{latex}{gobble}.)
\item Delete the spaces at the beginning of the lines. (Hint: The documentation speaks of \code{latex}{autogobble}.)
\end{enumerate}
\section*{Listings tasks}

View File

@ -1 +1 @@
\codeblock{latex}{./exercises/special-characters/special-characters.code.tex}
\codeblock{latex}{./exercises/special-characters/special-characters.code.done.tex}

View File

@ -1,8 +1,7 @@
What is a semester ticket?
It is also known as Studi-Ticket or Studi-Karte in German and allows you to use the local public transport around Bamberg for free.
In Bamberg, the semester ticked is embodied in your student card (Studierendenausweis).
To be able to use it, you have to validate the student card in one of the university buildings.
This is possible after you have paid the semester fees.
Validation printers are located in multiple university buildings, e. g., in the foyer of the Erba building, in front of the library.
This building is opened Monday-Friday, 7am-10pm.
It is also known as Studi-Ticket or Studi-Karte and allows you to use the local public transport around Bamberg for free.
In Bamberg, your student card (Studierendenausweis) is used, i. a., as a semester ticket.
To be able to use it, you should validate the student card in one of the university buildings.
This is possible after you have paid the semester fees (101,50 €).
A validation printers are located in multiple university buildings, e. g., in the foyer of the Erba building, in front of the library.
This building is opened Monday - Friday, 7am - 10pm.

View File

@ -5,9 +5,13 @@ compile the \file{main.tex} file.
This applies for the subsequent tasks, as well.
\begin{enumerate}
\item Replace the spaces in exercises/special-characters.tex within the abbreviations (\enquote{e. g.}) by thin spaces.
\item Replace the hyphens separating the opening hours by en dashes (--), optionally surrounded by thin spaces.
\item In the text, you find a bunch of abbreviations. Replace the spaces
within the abbreviations by thin spaces. Put a thin space in front of the
word Euro sign (€).
\item Replace the hyphens within the Erba opening hours by en dashes.
\item Restrict the hyphenation of word \emph{Studierendenausweis} to one position: \\\emph{Studierenden-ausweis}.
\item Add quotation marks around the words \emph{Studi-Ticket} and
\emph{Studi-Karte} using the \code{latex}{\textbackslash enquote} command.
\end{enumerate}
\exercisematerial[.63]{exercises/special-characters/special-characters}

View File

@ -1,4 +1,4 @@
\codeblock{latex}{./exercises/tables/tables.code.tex}
\codeblock{latex}{./exercises/tables/tables.code.done.tex}
\begin{table}[h]
\centering

View File

@ -1 +1 @@
\codeblock{latex}{./exercises/text-markup/markup.code.tex}
\codeblock{latex}{./exercises/text-markup/markup.code.done.tex}

Binary file not shown.

Binary file not shown.

View File

@ -1,5 +1,5 @@
\begin{itemize}
\item lasagne noodles
\item lasagna noodles
\item crushed tomatoes
\item herbs \begin{enumerate}
\item oregano

View File

@ -11,7 +11,7 @@
keywordstyle=\color{codeblue},
identifierstyle=\color{codegreen},
stringstyle=\color{codeyellow},
basicstyle=\footnotesize
basicstyle=\small
\ttfamily\color{white},
commentstyle=\color{codegray},
numberstyle=\tiny\color{codegray},

View File

@ -36,12 +36,12 @@
\exercise{lists}
\input{content/maths.tex}
\exercise{maths}
\input{content/source-code-listings.tex}
\exercise{source-code-listings}
\input{content/graphics.tex}
\exercise{graphics}
\input{content/tables.tex}
\exercise{tables}
\input{content/source-code-listings.tex}
\exercise{source-code-listings}
\input{content/footnotes.tex}
\exercise{footnotes}
\input{content/references.tex}

View File

@ -32,6 +32,9 @@
% Tables
\usepackage{longtable, array, tabularx, booktabs, colortbl}
% PDF imports
\usepackage{pdfpages}
% ToDos
\usepackage{todonotes}
\usepackage{changes}