update listings command and code examples

This commit is contained in:
Fradtschuk 2022-01-08 12:32:48 +01:00
parent 70e4227534
commit eec4b468c2
7 changed files with 31 additions and 59 deletions

View File

@ -111,23 +111,25 @@
}
\newcommand\codeblock[2]{%
\ifthenelse{\equal{\listingsmode}{minted}}{%
\inputminted{#1}{#2}
\inputminted[breaklines]{#1}{#2}
}{%
\ifthenelse{\equal{#1}{latex}}{%
\lstset{language=[LaTeX]TeX,
basicstyle=\footnotesize,
breakatwhitespace=false,
% breakatwhitespace=false,
breaklines=true,
keywordstyle=\color{ForestGreen}\bfseries,
emph={%
subsection, subsubsection, url, includegraphics, toprule,
midrule, bottomrule, cref%
},
postbreak=\mbox{{$\hookrightarrow$}\space},
emphstyle={\color{ForestGreen}\bfseries},
commentstyle=\color{darkgray}
}
\lstinputlisting{#2}%
\lstinputlisting{#2}%
%
}{%
\lstset{language=#1}
\lstinputlisting{#2}
@ -136,6 +138,8 @@
}
}
% Simple code examples
% ====================
% Box for example code next to the rendered example.

View File

@ -10,38 +10,22 @@
\section{Beverages}
\subsection{Pink Lemonade}
We all know and love it in summer: a cold lemonade. The pink variant of our
favorite summer drink is traditionally achieved by adding food coloring to the
lemonade. However, we changed things up a little and decided to go for a
variant with berries instead of food coloring, which also makes the drink less
sour.
We all know and love it in summer: a cold lemonade. The pink variant of our favorite summer drink is traditionally achieved by adding food coloring to the lemonade.
However, we changed things up a little and decided to go for a variant with berries instead of food coloring, which also makes the drink less sour.
\subsubsection{Ingredients}
For making the lemonade we need 400\,g of berries. You can use either frozen or
fresh ones. You can, of course, adjust the choice of berries to your likings:
raspberries, blueberries, blackberries, or a mixture work excellently for
making the lemonade.
For making the lemonade we need 400\,g of berries. You can use either frozen or fresh ones. You can, of course, adjust the choice of berries to your likings: raspberries, blueberries, blackberries, or a mixture work excellently for making the lemonade.
To make the drink sweeter we use 50\,ml of maple syrup. Needless to say, you
can also use less, if you want your lemonade to be more sour. By the way, other
sweeteners, such as agave syrup, or coconut sugar also work fine.
To make the drink sweeter we use 50\,ml of maple syrup. Needless to say, you can also use less, if you want your lemonade to be more sour. By the way, other sweeteners, such as agave syrup, or coconut sugar also work fine.
Additionally, we need the juice of four freshly-squeezed lemons, one litre
worth of cold water and 400\,g of ice cubes to keep the drink cold.
Additionally, we need the juice of four freshly-squeezed lemons, one litre worth of cold water and 400\,g of ice cubes to keep the drink cold.
\subsubsection{Instructions}
Put the berries along with the maple syrup into a large bowl and cook them at
medium-high heat for around three to four minutes. When the berries start to
soften, reduce the heat a little. Now mash the berries with the end of a wooden
spoon until there are almost no big chunks anymore. The less chunks the better!
Put the berries along with the maple syrup into a large bowl and cook them at medium-high heat for around three to four minutes. When the berries start to soften, reduce the heat a little. Now mash the berries with the end of a wooden spoon until there are almost no big chunks anymore. The less chunks the better!
Place a sieve over the container that you want to store the lemonade in. Put
the berries into the sieve. With the end of the wooden spoon, try to press out
as much liquid of the berry mixture as possible. Let the juice sit until it is
completely cold.
Place a sieve over the container that you want to store the lemonade in. Put the berries into the sieve. With the end of the wooden spoon, try to press out as much liquid of the berry mixture as possible. Let the juice sit until it is completely cold.
When the liquid is cold, add the lemon juice, the cold water, and the ice cubes
and stir everything.
When the liquid is cold, add the lemon juice, the cold water, and the ice cubes and stir everything.
Your lemonade is now ready to enjoy!
@ -50,7 +34,8 @@ Your lemonade is now ready to enjoy!
Coming soon!
\section{Breakfast}
\subsubsection{Buckwheat Overnight Oats}
Coming soon!
% \end{document}
% \end{document}

View File

@ -1,7 +1,3 @@
Java is an object-oriented programming language, that appeared in 1995. The
most recent version of the programming language is version 16\footnote{March
2021}. In order to write Java programs, one needs to install the so-called
\emph{Java Development Kit
(JDK)}.\footnote{\url{https://www.oracle.com/java/technologies/javase-downloads.html}}
Java programs can be written independently from the operating system that one
uses.
Java is an object-oriented programming language, that appeared in 1995. The most recent version of the programming language is version 16\footnote{March
2021}. In order to write Java programs, one needs to install the so-called \emph{Java Development Kit (JDK)}.\footnote{\url{https://www.oracle.com/java/technologies/javase-downloads.html}}
Java programs can be written independently from the operating system that one uses.

View File

@ -1,9 +1,7 @@
Ingredients:
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 syrup, squeeze
the lemons and add their juice, add the remaining ingredients, scramble
thoroughly
\noindent Instructions: Boil and shred the berries, add maple syrup, squeeze the lemons and add their juice, add the remaining ingredients, scramble thoroughly
\begin{itemize}
\item Ingredients:

View File

@ -1,5 +1,4 @@
C\# is an object-oriented programming language that was developed by Microsoft
in 2011. In \cref{fig:csharp} we can see the logo of the programming language.
C\# is an object-oriented programming language that was developed by Microsoft in 2011. In \cref{fig:csharp} we can see the logo of the programming language.
\begin{figure}[H]
\caption{The logo of C\#}
@ -8,9 +7,7 @@ in 2011. In \cref{fig:csharp} we can see the logo of the programming language.
\includegraphics[width=2cm]{exercises/references/csharp.png}
\end{figure}
\cref{lst:csharphelloworld} 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.
\cref{lst:csharphelloworld} 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.
\begin{listing}[H]
\caption{A simple C\# program}

View File

@ -1,11 +1,7 @@
What is a semester ticket?
It is also known as \enquote{Studi-Ticket} or \enquote{Studi-Karte} and allows
you to use the local public transport around Bamberg for free.
In Bamberg, your student card (Studierenden\-ausweis) 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.
It is also known as \enquote{Studi-Ticket} or \enquote{Studi-Karte} and allows you to use the local public transport around Bamberg for free.
In Bamberg, your student card (Studierenden\-ausweis) 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\,\euro).
A validation printers are located in multiple university buildings, e.\,g., in
the foyer of the Erba building, in front of the library.
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

@ -1,9 +1,5 @@
``\emph{Recursion} (adjective: \emph{recursive}) occurs when a thing is defined
in terms of itself or of its type.
\emph{Recursion} is used in a variety of disciplines ranging from linguistics
to logic.
The most common application of \emph{recursion} is in mathematics and computer
science,
where a function being defined is applied within its own definition.''
``\emph{Recursion} (adjective: \emph{recursive}) occurs when a thing is defined in terms of itself or of its type.
\emph{Recursion} is used in a variety of disciplines ranging from linguistics to logic.
The most common application of \emph{recursion} is in mathematics and computer science, where a function being defined is applied within its own definition.''
Source and more information: \url{https://en.wikipedia.org/wiki/Recursion}