add code and sh commands in exercises

This commit is contained in:
Fradtschuk 2021-11-05 16:35:29 +01:00
parent b67fedc413
commit e378b99733
13 changed files with 84 additions and 35 deletions

View File

@ -31,7 +31,11 @@ writing letters.
Each \code{latex}{\textbackslash documentclass} command can hold optional parameters in
square brackets.
\code{latex}{\textbackslash documentclass[10pt,a5paper,landscape]\{scrartcl\}}, for 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 A5,\footnote{The default case would be A4.} and the orientation of the page to landscape.
\code{latex}{\textbackslash documentclass[10pt,a5paper,landscape]scrartcl\}},
for 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
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. \cref{sec:language}).
\subsection{Digression: packages}

View File

@ -1,7 +1,20 @@
\begin{enumerate}
\item In the directory \mintinline{latex}{exercises/basic-document-structure}, you can find a file named \mintinline{latex}{document-structure.tex}. Open the file, copy its text and paste it into a new file. You can name the new file as you want. Wrap the text of your new file in a \mintinline{latex}{document} environment and add a preamble in order to be able to compile your first \LaTeX{} document.
\item Congratulations! You have created and compiled your first \LaTeX{} document. Maybe you have noticed that paragraphs within the text were created by using \mintinline{latex}{\\}. Replace the two backslashes by real paragraphs.
\item It is time to structure your first document. Use the \LaTeX{} commands \mintinline{latex}{\section}, \mintinline{latex}{\subsection}, etc. to structure the text. Also, include a table of contents for your document.
\item In the directory \file{exercises/basic-document-structure}, you can
find a file named \file{document-structure.tex}. Open the
file, copy its text and paste it into a new file. You can name the new file
as you want. Wrap the text of your new file in a
\code{latex}{document} environment and add a preamble in order to be
able to compile your first \LaTeX{} document.
\item Congratulations! You have created and compiled your first \LaTeX{}
document. Maybe you have noticed that paragraphs within the text were
created by using \code{latex}{\textbackslash\textbackslash}. Replace the
two backslashes by real paragraphs.
\item It is time to structure your first document. Use the \LaTeX{}
commands \code{latex}{\textbackslash section},
\code{latex}{\textbackslash subsection}, etc. to structure the text.
Also,
include
a table of contents for your document.
\item Afterwards, comment out the preamble, the document environment, and the table of contents.
\end{enumerate}

View File

@ -1,4 +1,7 @@
Make the text \enquote{March 2021} of the file \texttt{exercises/footnotes/footnotes.tex} appear as a footnote instead of in parentheses. Additionally, insert a clickable URL to the Java Development Kit as footnote.
Make the text \enquote{March 2021} of the file
\file{exercises/footnotes/footnotes.tex} appear as a footnote instead of in
parentheses. Additionally, insert a clickable URL to the Java Development Kit
as footnote.
\todo{Sollten wir dieses Beispiel aus Faulheitsgründen vielleicht ersetzen?}

View File

@ -1,4 +1,9 @@
In the \texttt{exercises/graphics} directory you can find an image file named \texttt{latex-logo.png}. Insert the image into the \texttt{exercises/graphics/graphics.tex} file. Make sure that the image is placed exactly where you have specified it. On top of that, the picture shall be centered, and a caption shall be added. Adapt the image width to the text width (\mintinline{latex}{\textwidth}).
In the \file{exercises/graphics} directory you can find an image file named
\file{latex-logo.png}. Insert the image into the
\file{exercises/graphics/graphics.tex} file. Make sure that the image is placed
exactly where you have specified it. On top of that, the picture shall be
centered, and a caption shall be added. Adapt the image width to the text width
(\code{latex}{\textbackslash textwidth}).
\exercisematerial{exercises/graphics/graphics}

View File

@ -1,5 +1,5 @@
Ingredients:
400 g berries, 50 ml maple sirup, 4 lemons, 1 l cold water, 400 g ice cubes
400 g berries, 50 ml maple syrup, 4 lemons, 1 l cold water, 400 g ice cubes
\noindent Instructions: Boil and shred the berries, add maple sirup, squeeze the lemons and add their juice, add the remaining ingredients, scramble thoroughly

View File

@ -1,5 +1,9 @@
% TODO:
Format the recipe you can find in \mintinline{bash}{exercises/lists/lists.tex} as an unordered list (\mintinline{latex}{itemize}) with sub-lists \emph{Ingredients} and \emph{Instructions}.
Within these, there shall be a compact, unordered list (\mintinline{latex}{compactitem}) of ingredients and a compact, ordered list of instructions, respectively.
Format the recipe you can find in \file{exercises/lists/lists.tex} as an
unordered list (\code{latex}{itemize}) with sub-lists \emph{Ingredients}
and \emph{Instructions}.
Within these, there shall be a compact, unordered list
(\code{latex}{compactitem}) of ingredients and a compact, ordered list of
instructions, respectively.
\exercisematerial{exercises/lists/lists}

View File

@ -7,13 +7,16 @@
\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 \mintinline{sh}{literature.bib} in the \mintinline{latex}{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 file\\\mintinline{sh}{exercises/literature/literature.tex}.
\item Make use of the \mintinline{sh}{natdin} biliography style.
\item \textbf{Note}: If compiling fails, it may help to remove all auxiliary files \\(\mintinline{sh}{main.aux/bbl/blg/loc/out/pdf/soc/toc}) before compiling again.
\item Cite the three handbooks in the
file\\\file{exercises/literature/literature.tex}.
\item Make use of the \sh{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.
\end{enumerate}
\exercisematerial{exercises/literature/literature}

View File

@ -1,9 +1,9 @@
\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.}
\file{section1.tex}, \file{section2.tex}, and
\file{section3.tex}.
Include them using the \code{latex}{\textbackslash include} command.}
\begin{figure}[H]
\inputminted[linenos=true]{latex}{exercises/project-structure/main-with-preamble.done.tex}
\caption{\mintinline{latex}{main.tex}}
@ -14,9 +14,11 @@
sections)}
\end{figure}
\item \textbf{Which command becomes superfluous when you use
\mintinline{latex}{\include}?} \\
\mintinline{latex}{\include} makes every included file appear on a new
page. Hence the command \mintinline{latex}{\newpage} becomes superfluous.
\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?} \\
@ -27,19 +29,23 @@
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 \mintinline{latex}{\includeonly{section2}} to the
\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 \mintinline{latex}{\includeonly{section2}} does exactly what
The command \code{latex}{\textbackslash includeonly\{section2\}} does
exactly what
the name already says. During compilation, only the
\mintinline{latex}{\include}
\code{latex}{\textbackslash include}
statements that contain file names that appear in
\mintinline{latex}{includeonly{file1,file2, …}} are included.
\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 \mintinline{latex}{\includeonly} only the files
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 \mintinline{latex}{\includeonly} command and
compilation we can delete the \code{latex}{\textbackslash includeonly}
command and
end up with our complete \acro{PDF}.
\end{enumerate}

View File

@ -1,4 +1,10 @@
In file \texttt{exercises/references/references.tex}, replace \enquote{in the figure} and \enquote{the following source code listing} with suited references. Use the command \mintinline{latex}{\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 \mintinline{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

@ -1,14 +1,17 @@
You will find a file called \mintinline{text}{Source.java} in the folder \mintinline{text}{exercises/source-code-listings}.
You will find a file called \file{Source.java} in the folder
\file{exercises/source-code-listings}.
We will now include it into our document and adjust its display to fit our needs.
\begin{enumerate}
\item Include the file into \mintinline{text}{exercises/source-code-listings/source-code-listings.tex}.
\item Include the file into
\file{exercises/source-code-listings/source-code-listings.tex}.
\item Activate syntax highlighting by stating the programming language Java.
\item Add line breaks and line numbers.
\item Use the theme \mintinline{latex}|native|.
\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 \mintinline{latex}|gobble|.)
\item Delete the spaces at the beginning of the lines by using a suitable
option. (Hint: The documentation speaks of \code{latex}{gobble}.)
\end{enumerate}
\noindent If you have questions, consult the minted package documentation.

View File

@ -1,14 +1,15 @@
% breakanywhere doesn't seem to work.
For this task, we are using the file \mintinline[breakanywhere]{bash}{exercises/special-characters/special-}\newline\mintinline[breakanywhere]{bash}{characters.tex}.
For this task, we are using the file \file{exercises/special-characters.tex}.
To be able to see your results here within the script,
compile the \mintinline{bash}{main.tex} file.
compile the \file{main.tex} file.
This applies for the subsequent tasks, as well.
\begin{enumerate}
\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 \emph{EUR}.
\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 \mintinline{latex}{\enquote} command.
\item Add quotation marks around the words \emph{Studi-Ticket} and
\emph{Studi-Karte} using the \code{latex}{\textbackslash enquote} command.
\item Replace the word \emph{EUR} by a Euro symbol (hence the thin space).
\end{enumerate}

View File

@ -3,7 +3,7 @@ However, the overview is not as clear as it could be.
To improve it, convert the list into a table with columns for \emph{name}, \emph{abbreviation} and \emph{term}.
Insert an additional \emph{centered column} that numbers the courses.
Add a caption to the table.
You find the table in \mintinline{bash}{exercises/tables/tables.tex}.
You find the table in \file{exercises/tables/tables.tex}.
\exercisematerial{exercises/tables/tables}

View File

@ -1,5 +1,6 @@
\begin{enumerate}
\item In \mintinline{bash}{exercies/text-markup/markup.tex}, emphasize the words ``recursion'' and ``recursive.''
\item In \file{exercies/text-markup/markup.tex}, emphasize the words
``recursion'' and ``recursive.''
\item Make the \textsc{url} clickable.
\item Of course, you can also experiment with the other commands that you learned for text markup. However, you might want to remove them afterwards to keep your document nice and tidy.
\end{enumerate}