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

View File

@ -10,38 +10,22 @@
\section{Beverages} \section{Beverages}
\subsection{Pink Lemonade} \subsection{Pink Lemonade}
We all know and love it in summer: a cold lemonade. The pink variant of our 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.
favorite summer drink is traditionally achieved by adding food coloring to the 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.
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} \subsubsection{Ingredients}
For making the lemonade we need 400\,g of berries. You can use either frozen or 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.
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 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.
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 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.
worth of cold water and 400\,g of ice cubes to keep the drink cold.
\subsubsection{Instructions} \subsubsection{Instructions}
Put the berries along with the maple syrup into a large bowl and cook them at 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!
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 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.
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 When the liquid is cold, add the lemon juice, the cold water, and the ice cubes and stir everything.
and stir everything.
Your lemonade is now ready to enjoy! Your lemonade is now ready to enjoy!
@ -50,7 +34,8 @@ Your lemonade is now ready to enjoy!
Coming soon! Coming soon!
\section{Breakfast} \section{Breakfast}
\subsubsection{Buckwheat Overnight Oats} \subsubsection{Buckwheat Overnight Oats}
Coming soon! Coming soon!
% \end{document} % \end{document}

View File

@ -1,7 +1,3 @@
Java is an object-oriented programming language, that appeared in 1995. The Java is an object-oriented programming language, that appeared in 1995. The most recent version of the programming language is version 16\footnote{March
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}}
2021}. In order to write Java programs, one needs to install the so-called Java programs can be written independently from the operating system that one uses.
\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: Ingredients:
400 g berries, 50 ml maple syrup, 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 syrup, squeeze \noindent Instructions: Boil and shred the berries, add maple syrup, squeeze the lemons and add their juice, add the remaining ingredients, scramble thoroughly
the lemons and add their juice, add the remaining ingredients, scramble
thoroughly
\begin{itemize} \begin{itemize}
\item Ingredients: \item Ingredients:

View File

@ -1,5 +1,4 @@
C\# is an object-oriented programming language that was developed by Microsoft 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.
in 2011. In \cref{fig:csharp} we can see the logo of the programming language.
\begin{figure}[H] \begin{figure}[H]
\caption{The logo of C\#} \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} \includegraphics[width=2cm]{exercises/references/csharp.png}
\end{figure} \end{figure}
\cref{lst:csharphelloworld} shows a program that prints the text \enquote{Hello \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.
LaTeX friends!} to the console. Like Java, C\# makes use of classes and main
methods to build executable applications.
\begin{listing}[H] \begin{listing}[H]
\caption{A simple C\# program} \caption{A simple C\# program}

View File

@ -1,11 +1,7 @@
What is a semester ticket? What is a semester ticket?
It is also known as \enquote{Studi-Ticket} or \enquote{Studi-Karte} and allows 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.
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.
In Bamberg, your student card (Studierenden\-ausweis) is used, i.\,a., as a To be able to use it, you should validate the student card in one of the university buildings.
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). 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 A validation printers are located in multiple university buildings, e.\,g., in the foyer of the Erba building, in front of the library.
the foyer of the Erba building, in front of the library.
This building is opened Monday\,--\,Friday, 7am\,--\,10pm. 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 ``\emph{Recursion} (adjective: \emph{recursive}) occurs when a thing is defined in terms of itself or of its type.
in terms of itself or of its type. \emph{Recursion} is used in a variety of disciplines ranging from linguistics to logic.
\emph{Recursion} is used in a variety of disciplines ranging from linguistics The most common application of \emph{recursion} is in mathematics and computer science, where a function being defined is applied within its own definition.''
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} Source and more information: \url{https://en.wikipedia.org/wiki/Recursion}