From e378b99733f3e104837601b6a1f933c9114ae3a3 Mon Sep 17 00:00:00 2001 From: efradtschuk Date: Fri, 5 Nov 2021 16:35:29 +0100 Subject: [PATCH] add code and sh commands in exercises --- content/basic-document-structure.tex | 6 ++++- exercises/basic-document-structure/task.tex | 19 ++++++++++--- exercises/footnotes/task.tex | 5 +++- exercises/graphics/task.tex | 7 ++++- exercises/lists/lists.done.tex | 2 +- exercises/lists/task.tex | 8 ++++-- exercises/literature/task.tex | 11 +++++--- exercises/project-structure/tasks.done.tex | 30 ++++++++++++--------- exercises/references/task.tex | 8 +++++- exercises/source-code-listings/task.tex | 11 +++++--- exercises/special-characters/task.tex | 7 ++--- exercises/tables/task.tex | 2 +- exercises/text-markup/task.tex | 3 ++- 13 files changed, 84 insertions(+), 35 deletions(-) diff --git a/content/basic-document-structure.tex b/content/basic-document-structure.tex index 0c98d02..c793de7 100644 --- a/content/basic-document-structure.tex +++ b/content/basic-document-structure.tex @@ -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} diff --git a/exercises/basic-document-structure/task.tex b/exercises/basic-document-structure/task.tex index c1d73e9..7360747 100644 --- a/exercises/basic-document-structure/task.tex +++ b/exercises/basic-document-structure/task.tex @@ -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} diff --git a/exercises/footnotes/task.tex b/exercises/footnotes/task.tex index e7755d7..f43f0cf 100644 --- a/exercises/footnotes/task.tex +++ b/exercises/footnotes/task.tex @@ -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?} diff --git a/exercises/graphics/task.tex b/exercises/graphics/task.tex index 460bd8f..46f3ad8 100644 --- a/exercises/graphics/task.tex +++ b/exercises/graphics/task.tex @@ -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} diff --git a/exercises/lists/lists.done.tex b/exercises/lists/lists.done.tex index 0814edf..14eb5d5 100644 --- a/exercises/lists/lists.done.tex +++ b/exercises/lists/lists.done.tex @@ -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 diff --git a/exercises/lists/task.tex b/exercises/lists/task.tex index e5f233e..5752697 100644 --- a/exercises/lists/task.tex +++ b/exercises/lists/task.tex @@ -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} \ No newline at end of file diff --git a/exercises/literature/task.tex b/exercises/literature/task.tex index 5e76b74..8dc1c58 100644 --- a/exercises/literature/task.tex +++ b/exercises/literature/task.tex @@ -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} diff --git a/exercises/project-structure/tasks.done.tex b/exercises/project-structure/tasks.done.tex index 7529ecd..7a26d0b 100644 --- a/exercises/project-structure/tasks.done.tex +++ b/exercises/project-structure/tasks.done.tex @@ -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} \ No newline at end of file diff --git a/exercises/references/task.tex b/exercises/references/task.tex index fe92b45..376e4fd 100644 --- a/exercises/references/task.tex +++ b/exercises/references/task.tex @@ -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} diff --git a/exercises/source-code-listings/task.tex b/exercises/source-code-listings/task.tex index fa00f73..f3f3f37 100644 --- a/exercises/source-code-listings/task.tex +++ b/exercises/source-code-listings/task.tex @@ -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. diff --git a/exercises/special-characters/task.tex b/exercises/special-characters/task.tex index 517bb8a..9506e6f 100644 --- a/exercises/special-characters/task.tex +++ b/exercises/special-characters/task.tex @@ -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} diff --git a/exercises/tables/task.tex b/exercises/tables/task.tex index 65f3fb6..27e6014 100644 --- a/exercises/tables/task.tex +++ b/exercises/tables/task.tex @@ -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} diff --git a/exercises/text-markup/task.tex b/exercises/text-markup/task.tex index 0499888..0de509c 100644 --- a/exercises/text-markup/task.tex +++ b/exercises/text-markup/task.tex @@ -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}