%\iffalse
%!TEX program  = pdfLaTeX
%<*internal>
\iffalse
%</internal>
%<*license>
MIT License

Copyright (c) 2020 Fachschaftsrat Mathematik/Informatik der Studierendenschaft der Martin-Luther-Universität Halle-Wittenberg K.d.ö.R.

Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:

The above copyright notice and this permission notice shall be included in all
copies or substantial portions of the Software.

THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
SOFTWARE.
%</license>
%<*readme>
# The `mluexercise` class

Template class for exercises/homework, maintained by the [Computer Science Student's Council](https://fachschaft.mathinf.uni-halle.de) at [Martin Luther University Halle-Wittenberg](https://uni-halle.de).

## Contact

We are happy to accept pull requests and feature requests on [GitHub](https://github.com/fsrmatheinfo/mluexercise).
Alternatively, you can contact us via email: [fachschaft@mathinf.uni-halle.de](mailto:fachschaft@mathinf.uni-halle.de)

## License

The `mluexercise` LaTeX class is distributed under the [MIT license](https://ctan.org/license/mit).
%</readme>
%<*internal>
\fi
\def\nameofplainTeX{plain}\ifx\fmtname\nameofplainTeX\else\expandafter\begingroup\fi
%</internal>
%<*install>
\input docstrip.tex
\keepsilent
\askforoverwritefalse
\usedir{tex/latex/\jobname}
\generate{
    \file{\jobname.cls}{\from{\jobname.dtx}{class}}
}
%\endbatchfile
%</install>
%<*internal>
\usedir{source/latex/\jobname}
\generate{
    \file{\jobname.ins}{\from{\jobname.dtx}{install}}
}
\nopreamble\nopostamble
\usedir{doc/latex/\jobname}
\generate{
    \file{README.md}{\from{\jobname.dtx}{readme}}
    \file{LICENSE.txt}{\from{\jobname.dtx}{license}}
}
\ifx\fmtname\nameofplainTeX\expandafter\endbatchfile\else\expandafter\endgroup\fi
%</internal>
%<*driver>
\documentclass[a4paper,english]{ltxdoc}
\usepackage[utf8]{inputenc}
\usepackage[T1]{fontenc}
\usepackage{babel}
\usepackage{libertine}
\usepackage{eulervm}
\usepackage[ttdefault]{sourcecodepro}
\usepackage[colorlinks=false]{hyperref}
\usepackage{relsize}
\newcommand{\ttsmallfont}{\ttfamily\smaller}
\renewcommand{\UrlFont}{\ttsmallfont}
\renewcommand{\texttt}[1]{{\ttsmallfont #1}}
\renewcommand{\MacroFont}{\ttfamily\footnotesize}
\usepackage{listings}
\usepackage{csquotes}
\usepackage{booktabs}
\usepackage[sf,bf]{titlesec}
\lstset{
    language=TeX,
    basicstyle=\ttfamily\footnotesize,
    breakatwhitespace=false,
    breaklines=true,
    prebreak={\mbox{\(\hookleftarrow\)}},
    numbers=left,
    numberstyle=\scriptsize,
    numbersep=1pt,
    keepspaces=true,
    tabsize=4,
    xleftmargin=1em,
}
\EnableCrossrefs
\CodelineIndex
\RecordChanges
^^A \OnlyDescription
\begin{document}
    \DocInput{\jobname.dtx}
\end{document}
%</driver>
%<*class>
%\fi
%
%\renewcommand{\filedate}{2020/11/12}
%\renewcommand{\fileversion}{v2.0}
%
%\title{\sffamily\bfseries The \texttt{\jobname} class\footnote{This document describes version \fileversion{}, last revised \filedate{}.}}
%\author{\sffamily %
%    Jan Heinrich Reimer \\
%    Fachschaftsrat Mathematik/Informatik%
%    \footnote{Fachschaftsrat Mathematik/Informatik der Studierendenschaft der Martin-Luther-Universität Halle-Wittenberg K.d.ö.R., Von-Seckendorff-Platz~1, 06120~Halle~ (Saale), Germany} \\
%    \url{https://fachschaft.mathinf.uni-halle.de} \\
%    \texttt{fachschaft@mathinf.uni-halle.de}
%}
%\date{\sffamily Released \filedate{}}
%
%\maketitle
%\tableofcontents
%
%\section{Introduction}
%
%The \texttt{mluexercise} class is a template class for solving weekly exercises at the Institute for Computer Science of Martin Luther University Halle-Wittenberg.\footnote{\url{https://uni-halle.de/}}
%The class can be used by all students---especially first semesters---to typeset their exercises with a low-effort in beautiful \LaTeX{}.
% We include a bunch of handy macros that are used throughout many lectures during the bachelor's degree program.
%
%\changes{v1.0}{2018/10/03}{Initial draft}
%\changes{v2.0}{2020/11/12}{First public release}
%
%\section{Usage}
%
%\DescribeMacro{\documentclass}
%Load the \texttt{mluexercise} class at the start of your preamble.
%
%\iffalse
%<*example>
%\fi
\begin{lstlisting}[gobble=4]
    \documentclass{mluexercise}
\end{lstlisting}
%\iffalse
%</example>
%\fi
%
%\paragraph{Languages}
%
%As in many classes, you can define your main document language.
%This will help \LaTeX{} in hyphenating words and structural texts (e.g.,~sections) are being translated automatically.
%
%\DescribeMacro{english}
%The \texttt{english} option selects English language for texts and hyphenation.
%
%\DescribeMacro{ngerman}
%The \texttt{ngerman} option selects German language (with new spelling) for texts and hyphenation.
%
%While you do not have to specify a language, it is a meaningful information for writers (including yourself) to explicitly state the desired language that should be used consistently throughout the whole document. If no language is specified, English language is used.
%
%\paragraph{Styles}
%
%\DescribeMacro{dataminingstyle}
%The \texttt{dataminingstyle} option may be used for the \textquote{Data Mining} lecture and overwrites some mathematical symbols to match the lecture's definition's.
%
%\subsection{Exercise Metadata}
%
%Define the exercise's metadata and your identity. The below macros should be used only in the preamble, that is before \lstinline|\begin{document}|.
%
%\DescribeMacro{\lecture}
%The \cs{lecture}\marg{name} macro sets the name of the lecture you are writing exercises for.
%
%\DescribeMacro{\semester}
%The semester is automatically set to the current semester. You can overwrite the default value with the \cs{semester}\marg{semester} macro if you are compiling exercises for another semester.
%
%\DescribeMacro{\exercise}
%The \cs{exercise}\marg{number} macro sets the number of the exercise you are working on.
%
%\DescribeMacro{\task}
%The \cs{task}\marg{number} macro sets the number of the first task.
%This is useful if you submit single PDF files for each task within the exercise.
%If you omit this option, numbering starts at~1.
%
%\DescribeMacro{\group}
%Sometimes tutors allow to submit exercises in groups.
%You can use the optional \cs{group}\marg{number} macro to set the group number.
%If no group number is given, the group number is not displayed.
%
%\DescribeMacro{\title}
%The \cs{title}\marg{lecture name} macro is an alias for \cs{lecture}\marg{lecture name}.
%
%\DescribeMacro{\date}
%The date is automatically set to the current date.
%You can overwrite the default value with the \cs{date}\marg{date} macro.
%
%\subsection{Student Metadata}
%
%The following commands should be used to include identification in your exercise in order to assign your work.
%
%\DescribeMacro{\studentname}
%You must define your full name with the \cs{studentname}\marg{full name} macro.
%If you are working in a group, you can enter more names separated with commas and/or line breaks.
%
%\DescribeMacro{\studentnumber}
%The \cs{studentnumber}\marg{matriculation number} macro specifies your student matriculation number (e.g.,~234\,567\,890). This is the same number as on your student ID card.
%
%\DescribeMacro{\studentsymbol}
%The \cs{studentsymbol}\marg{shorthand symbol} macro specifies your shorthand symbol used for university IT services (e.g.,~abcde). This is the same username used for Stud.IP, university mail etc.
%
%Both \cs{studentnumber} an \cs{studentsymbol} are optional.
%Though, most tutors require specifying either student number or symbol.
%
%\paragraph{Multiple Students}
%
%While you can use commas and line breaks in the above macros, we would suggest one of the following two options to submit work in groups with multiple students:
%\begin{itemize}
%    \item Either use the services offered by the university to check-in your group members online~(e.g.,~in the Institute for Computer Science's \textquote{Übungsportal}).
%        In this case you don't need to specify multiple names in the preamble, but just your own name.
%    \item Or, if you cannot specify group members elsewhere, we recommend to add a footnote on the first page. That way you can list all other students but do not waste too much paper.
%\end{itemize}
%
%\subsection{Included Packages}
%
%The \texttt{\jobname} class loads a number of useful \LaTeX{} packages listed in Table~\ref{tab:packages}.
%Those are needed to typeset exercises during the Computer Science bachelor's degree programme at Martin Luther University Halle-Wittenberg.
%We recommend reading the introductions of each package's documentation on CTAN\footnote{\url{https://ctan.org/}}.
%\begin{table}
%    \caption{Packages included in the class.}
%    \label{tab:packages}
%    \begin{tabular}{lll}
%        \toprule
%        \textbf{Package} & \textbf{Purpose} & \textbf{Link} \\
%        \midrule
%        \texttt{babel} & hyphenation, localization & {\smaller\url{https://ctan.org/pkg/babel}} \\
%        \texttt{amsmath} & mathematics & {\smaller\url{https://ctan.org/pkg/amsmath}} \\
%        \texttt{amsthm} & & {\smaller\url{https://ctan.org/pkg/amsthm}} \\
%        \texttt{amssymb} & & {\smaller\url{https://ctan.org/pkg/amssymb}} \\
%        \texttt{amstext} & & {\smaller\url{https://ctan.org/pkg/amstext}} \\
%        \texttt{array} & & {\smaller\url{https://ctan.org/pkg/array}} \\
%        \texttt{cancel} & & {\smaller\url{https://ctan.org/pkg/cancel}} \\
%        \texttt{inputenc} & UTF8 encoding & {\smaller\url{https://ctan.org/pkg/inputenc}} \\
%        \texttt{fontenc} & T1 encoding & {\smaller\url{https://ctan.org/pkg/fontenc}} \\
%        \texttt{booktabs} & tables & {\smaller\url{https://ctan.org/pkg/booktabs}} \\
%        \texttt{graphicx} & images, graphics & {\smaller\url{https://ctan.org/pkg/graphicx}} \\
%        \texttt{xcolor} & color definitions & {\smaller\url{https://ctan.org/pkg/xcolor}} \\
%        \texttt{tikz} & drawing vector graphics & {\smaller\url{https://ctan.org/pkg/tikz}} \\
%        \texttt{pgfplots} & plotting & {\smaller\url{https://ctan.org/pkg/pgfplots}} \\
%        \texttt{algorithm2e} & pseudocode, algorithms & {\smaller\url{https://ctan.org/pkg/algorithm2e}} \\
%        \texttt{listings} & code listings & {\smaller\url{https://ctan.org/pkg/listings}} \\
%        \texttt{listingsutf8} & & {\smaller\url{https://ctan.org/pkg/listingsutf8}} \\
%        \texttt{subcaption} & sub-figures & {\smaller\url{https://ctan.org/pkg/subcaption}} \\
%        \texttt{csquotes} & quotation & {\smaller\url{https://ctan.org/pkg/csquotes}} \\
%        \bottomrule
%    \end{tabular}
%\end{table}
%
%\section{Design Goals}
%
%The \texttt{\jobname} class should:
%
%\begin{itemize}
%    \item be usable for first semester students with rather little LaTeX experience,
%    \item be consistent with Martin Luther University brand guidelines\footnote{\url{https://www.pr.uni-halle.de/download/logo/}}, especially with respect to font families and colors, and
%    \item include packages frequently needed by students.
%\end{itemize}
%
%\section{Implementation}
%
%\subsection{Setup}
%
%We specify the \LaTeX{} version, define and parse options and then load the base class \texttt{scrartcl}\footnote{\url{https://ctan.org/pkg/scrartcl}} with all remaining options.
%
%    \begin{macrocode}
\NeedsTeXFormat{LaTeX2e}
\ProvidesPackage{mluexercise}[2020/11/12 v2.0]
%    \end{macrocode}
%
%\paragraph{Options}
%
%    \begin{macrocode}
\newif\ifdataminingstyle\dataminingstylefalse
\DeclareOption{dataminingstyle}{%
  \dataminingstyletrue
}
%    \end{macrocode}
%
%Process options and load base class with remaining options.
%
%    \begin{macrocode}
\DeclareOption*{\PassOptionsToClass{\CurrentOption}{scrartcl}}
\ProcessOptions*
\LoadClass{scrartcl}
%    \end{macrocode}
%
%To enable support for UTF8 and some other useful basics, we load a bunch of packages.
%
%    \begin{macrocode}
\RequirePackage[utf8]{inputenc}
\RequirePackage[T1]{fontenc}
\RequirePackage{ifthen} % Conditional branches and loops.
\RequirePackage{etoolbox} % Hooks for executing code.
\RequirePackage{hyperref} % Hyperlinks.
\RequirePackage{xcolor} % Color definitions.
%    \end{macrocode}
%
%As we'd like to be able to switch between English and German with proper hyphenation, load language support packages.%
%\footnote{If you'd like to add a language, please contact us.}
%
%    \begin{macrocode}
\RequirePackage{babel}
\RequirePackage{iflang}
\newcommand{\IfGerman}[2]{\IfLanguagePatterns{german}{#1}{%
    \IfLanguagePatterns{ngerman}{#1}{#2}}}
%    \end{macrocode}
%
%\subsection{Global Variables}
%
%The class can be configured with the lecture's and student's details. We define global variables for that and redefine some built in \LaTeX{} commands to ease the migration from standard classes.
%
%    \begin{macrocode}
\newcommand{\@checkoption}[3]{%
    \AtEndPreamble{%
        \ifthenelse{\equal{\the#1}{}}{%
            \ClassError{mluexercise}{Missing #2}{%
                Set #2 using the \protect#3 command.%
            }%
        }{}%
    }%
}
\newtoks\@lecture
\newcommand{\lecture}[1]{\global\@lecture{#1}}
\let\title\lecture % Redefine standard \title command.
\@checkoption{\@lecture}{lecture name}{\lecture}
\newtoks\@semester
\newcommand{\semester}[1]{\global\@semester{#1}}
\global\@semester{ % Automatically set semester based on current date.
    \ifnum\month<4 % Winter semester, including previous year.
    WS~{\advance\year by -1 \the\year\advance\year by 1}/\the\year%
    \else\ifnum\month<10 % Summer semester.
    SS~\the\year%
    \else % Winter semester, including next year.
    WS~\the\year/{\advance\year by 1 \the\year\advance\year by -1}%
    \fi\fi%
}
\newtoks\@exercise
\newcommand{\exercise}[1]{\global\@exercise{#1}}
\@checkoption{\@exercise}{exercise number}{\exercise}
\newtoks\@task
\newcommand{\task}[1]{\global\@task{#1}}
\global\@task{1}
\newtoks\@group
\newcommand{\group}[1]{\global\@group{#1}}
\global\@group{0}
\newtoks\@studentname
\newcommand{\studentname}[1]{\global\@studentname{#1}}
\let\author\studentname % Redefine standard \title command.
\@checkoption{\@studentname}{student name}{\studentname}
\newtoks\@studentnumber
\newcommand{\studentnumber}[1]{\global\@studentnumber{#1}}
\newtoks\@studentsymbol
\newcommand{\studentsymbol}[1]{\global\@studentsymbol{#1}}
%    \end{macrocode}
%
%\subsection{Layout, Text}
%
%Set up a reasonable page layout and define text styles that comply with Martin Luther University brand guidelines.
%
%    \begin{macrocode}
\RequirePackage{calc}
\RequirePackage[
    a4paper,
    inner=2cm,
    outer=2cm,
    top=3cm,
    bottom=3cm,
    head=0.75cm,
    headsep=0.25cm,
    foot=0.75cm,
]{geometry}
\renewcommand{\baselinestretch}{1.15}
\setlength{\parindent}{0em} % Disable paragraph indentation.
\setlength{\parskip}{1ex} % Instead enable paragraph margins.
%    \end{macrocode}
%
%\paragraph{Font Families}
%
%We use Libertine as main font as that is the closest free font to the proprietary URW~Classico font used by the university. For mathematics we use the more modern Euler~Maths font and for source code the \emph{true} monospace font Source~Code~Pro, as otherwise copying from the PDF is broken. For clarity reasons we do not want code ligatures.
%
%    \begin{macrocode}
\RequirePackage{libertine}
\RequirePackage{eulervm}
\RequirePackage[ttdefault]{sourcecodepro}
\RequirePackage{microtype}
\DisableLigatures{family=tt*}
%    \end{macrocode}
%
%\paragraph{Text Styles}
%
%    \begin{macrocode}
\newcommand{\strong}[1]{\textbf{#1}}
\newcommand{\italic}[1]{\textit{#1}}
\newcommand{\code}[1]{\texttt{#1}}
% Double underline.
\newcommand{\Underline}[1]{\underline{\underline{#1}}}
% Abbreviated plural ("Lineare Algebra" lecture).
\newcommand{\plural}[1]{\textsuperscript{\underline{#1}}}
\newcommand{\pl}[1]{\plural{#1}}
\RequirePackage[autostyle=true,german=quotes]{csquotes}
%    \end{macrocode}
%
%\paragraph{URL / Link Font}
%
%    \begin{macrocode}
\RequirePackage{relsize}
\newcommand{\ttsmallfont}{\ttfamily\smaller}
\renewcommand{\UrlFont}{\ttsmallfont}
\newcommand{\textttsmall}[1]{{\ttsmallfont #1}}
\newcommand{\query}[1]{{\ttsmallfont #1}}
\newcommand{\domain}[1]{\href{http://#1}{\mbox{\ttsmallfont #1}}}
\newcommand{\email}[1]{\href{mailto:#1}{\mbox{\ttsmallfont #1}}}
%    \end{macrocode}
%
%\paragraph{Headings}
%
%    \begin{macrocode}
\setkomafont{sectioning}{\sffamily\mdseries}
\setkomafont{section}{\LARGE}
\setkomafont{subsection}{\Large}
\setkomafont{subsubsection}{\large}
\setkomafont{paragraph}{\large}
\setkomafont{subparagraph}{\normalsize}
\renewcommand{\thesection}{%
    \bfseries\upshape \IfGerman{Aufgabe}{Task} \arabic{section}}
\renewcommand{\thesubsection}{%
    \bfseries\upshape \alph{subsection})}
\renewcommand{\thesubsubsection}{%
    \upshape (\roman{subsubsection})}
\renewcommand{\autodot}{}
%    \end{macrocode}
%
%\paragraph{Title}
%
%    \begin{macrocode}
\newcommand{\Rom}[1]{\uppercase\expandafter{\romannumeral#1\relax}}
\newcommand{\groupstring}{\ifnum\the\@group>0{, 
    \IfGerman{Gruppe}{Group} \Rom{\the\@group}}\fi}
\author{}
\setkomafont{title}{\sffamily\bfseries\huge\centering}
\setkomafont{date}{\sffamily\large\centering}
\newlength{\approxtitlewidth}
\renewcommand{\maketitle}{%
    \settowidth{\approxtitlewidth}{%
        \usefontofkomafont{title}\the\@lecture}%
    \ifthenelse{\lengthtest{\approxtitlewidth>\textwidth}}{%
        \addtokomafont{title}{\LARGE}}{}%
    \begin{center}%
        \usefontofkomafont{title}\the\@lecture \\
        \usefontofkomafont{date}\@date, \the\@semester\groupstring
    \end{center}
}
%    \end{macrocode}
%
%\paragraph{Head, Foot}
%
%    \begin{macrocode}
\RequirePackage[headsepline,footsepline]{scrlayer-scrpage}
\RequirePackage{totpages}
\pagestyle{scrheadings}
\clearscrheadfoot
\setkomafont{pageheadfoot}{\sffamily}
\setkomafont{pagenumber}{\sffamily}
\ofoot{\thepage~von~\ref{TotPages}}
%    \end{macrocode}
%
%\subsection{Mathematics}
%
%We rely on AMS packages for rendering mathematical equations, proofs, and symbols.
%Additionally we load packages for arrays in math mode and cancellations
%
%    \begin{macrocode}
\RequirePackage{amsmath}
\RequirePackage{amsthm}
\RequirePackage{amssymb}
\RequirePackage{amstext}
\RequirePackage{array}
\RequirePackage{cancel}
%    \end{macrocode}
%
%Now we define (more readable) macros for the mathematical symbols and functions most commonly used at Martin Luther University.
%
%    \begin{macrocode}
\newcommand{\union}{\cup}
\newcommand{\disjunction}{\uplus}
\newcommand{\intersection}{\cap}
\newcommand{\intersect}{\cap}
\newcommand{\infinity}{\infty}
\newcommand{\corresponds}{\triangleq}
%    \end{macrocode}
%
%    \begin{macrocode}
\newcommand{\C}{\mathbb{C}} % Complex numbers.
\newcommand{\complexnumbers}{\C}
\newcommand{\R}{\mathbb{R}} % Real numbers.
\newcommand{\realnumbers}{\R}
\newcommand{\Q}{\mathbb{Q}} % Rational numbers.
\newcommand{\rationalnumbers}{\Q}
\newcommand{\Z}{\mathbb{Z}} % Whole numbers.
\newcommand{\wholenumbers}{\Z}
\newcommand{\N}{\mathbb{N}} % Natural numbers.
\newcommand{\naturalnumbers}{\N}
\newcommand{\B}{\mathbb{B}} % Binary numbers.
\newcommand{\binarynumbers}{\B}
%    \end{macrocode}
%
%    \begin{macrocode}
% Equivalence transformation
\newcommand{\eqtransform}{\ensuremath{\qquad\big|\,\,}}
% "Ditto" sign
\newcommand{\ditto}{\textquotedbl} \newcommand{\dito}{\ditto}
% End of proof: "quod erat demonstrandum"
\renewcommand{\qed}{\nopagebreak\hfill\ensuremath{\square}}
%    \end{macrocode}
%
%    \begin{macrocode}
\newcommand{\mland}{\(\land\)} % \land in text.
\newcommand{\mlor}{\(\lor\)} % \lor in text.
%    \end{macrocode}
%
%Many maths symbols can have alternatives for stylistic choices. We enable the variants most liked by our tutors.
%
%    \begin{macrocode}
\let\tmp\mod \let\mod\bmod \let\bmod\tmp
\let\varemptyset\emptyset \let\emptyset\varnothing
\let\tmp\epsilon \let\epsilon\varepsilon \let\varepsilon\tmp
\let\tmp\phi \let\phi\varphi \let\varphi\tmp
%    \end{macrocode}
%
%For some specific lectures we provide more detailed macros for symbols and functions.
%
%\paragraph{Lecture \textquote{Lineare Algebra}}
%
%    \begin{macrocode}
\newcommand{\base}[1]{\mathcal{#1}} % Base (caligraphic)
\DeclareMathOperator{\im}{im} % Image
\DeclareMathOperator{\id}{id} % Identity
\DeclareMathOperator{\sel}{sel} % Selection
\DeclareMathOperator{\dom}{dom} % Domain
\DeclareMathOperator{\ran}{ran} % Range
\DeclareMathOperator{\Hom}{Hom} % Homomorphism
\DeclareMathOperator{\End}{End} % Endomorphism
%    \end{macrocode}
%
%\paragraph{Lecture \textquote{Datenstrukturen und effiziente Algorithmen}}
%
%    \begin{macrocode}
\renewcommand{\O}{\mathcal{O}} % asymptotic O-Notation (Landau)
\DeclareMathOperator{\indeg}{indeg} % Indegree
\DeclareMathOperator{\outdeg}{outdeg} % Outdegree
%    \end{macrocode}
%
%\paragraph{Lecture \textquote{Einführung in Data Science}}
%
%    \begin{macrocode}
\renewcommand{\P}{\ifdataminingstyle p\else\mathbf{P}\fi}
\newcommand{\E}{\ifdataminingstyle\mathbb{E}\else\mathbf{E}\fi}
\DeclareMathOperator{\var}{var}
\DeclareMathOperator{\Var}{Var}
\DeclareMathOperator{\cov}{cov}
\DeclareMathOperator{\Cov}{Cov}
\DeclareMathOperator{\Bin}{Bin}
\DeclareMathOperator{\Exp}{Exp}
\DeclareMathOperator{\Dir}{Dir}
\DeclareMathOperator{\Mult}{Mult}
\newcommand{\Normal}{\mathcal{N}}
\newcommand{\Norm}{\Normal}
%    \end{macrocode}
%
%\paragraph{Table Columns}
%
%The handy \texttt{tabular} column definitions below can be used to typeset a whole column in math mode, to avoid repetetive opening/closing brackets.
%
%    \begin{macrocode}
\newcolumntype{L}{>{\(}l<{\)}}
\newcolumntype{R}{>{\(}r<{\)}}
\newcolumntype{C}{>{\(}c<{\)}}
%    \end{macrocode}
%
%\paragraph{Calculus Environments}
%
%Calculus environments are currently work in progress, subject to change, and may not work as expected.
%However, they can simplify writing logical consequences in the \textquote{Mathematische Grundlagen der Informatik und Konzepte der Modellierung} lecture.
%
%    \begin{macrocode}
\newcounter{calculusRowCount}
\RequirePackage{pgfkeys}
\newenvironment{calculus}[1]{
\pgfkeys{/mlu/calculus/.cd,show index=false,
    context=\Gamma,context command=context,#1}
\setcounter{calculusRowCount}{0}
\newcommand{\calculusSymbol}{\text{
        \sffamily\itshape\pgfkeysvalueof{/mlu/calculus/symbol}}}
\newcommand{\calculusContext}{\ensuremath{
        \pgfkeysvalueof{/mlu/calculus/context}}}
\expandafter\let\csname \pgfkeysvalueof{/mlu/calculus/context command}%
    \endcsname\calculusContext
\par\vspace{0.5em}
\begin{minipage}{\textwidth}\begin{tabular}{
    @{\stepcounter{calculusRowCount}
    (\arabic{calculusRowCount})\hspace{1em}} R
    @{\hspace{0.4em}
    \(
        \vdash_{%
            \ifthenelse{%
                \equal{\pgfkeysvalueof{/mlu/calculus/show index}}{true}
            }{
                \ifthenelse{%
                    \equal{\pgfkeysvalueof{/mlu/calculus/symbol}}{}%
                }{}{%
                    \calculusSymbol%
                }%
            }{%
                \hspace{-0.1em}%
            }%
        }%
    \)\hspace{0.6em}}
        L l
    }
}{
\end{tabular}\end{minipage}\vspace{0.5em}
\let\calculusContext\undefined \let\calculusSymbol\undefined
\expandafter\let\csname \pgfkeysvalueof{/mlu/calculus/context command}%
    \endcsname\undefined
}
\newenvironment{eqcalc}[1][]{\begin{calculus}[
    symbol=E,show index=true,context={\calculusSymbol_{#1}},
    context command=E]}{\end{calculus}} % Equation calculus
\newenvironment{seqcalc}{\begin{calculus}[
    symbol=S,show index=true, context={\calculusSymbol},
    context command=seq]}{\end{calculus}} % Sequence calculus
%    \end{macrocode}
%
%\subsection{Algorithms, Pseudocode}
%\label{sec:implementation-pseudocode}
%
%    \begin{macrocode}
\RequirePackage[vlined,linesnumbered]{algorithm2e}
\DontPrintSemicolon % Hide semicolons.
\SetKwProg{Function}{function}{\ is}{end function}
\SetKwComment{Comment}{\quad\(\triangleright\)~}{} % Comment style.
\SetCommentSty{itshape} % Comment font.
\SetKw{Continue}{continue}
\SetKwBlock{Repeat}{repeat}{}
\SetNlSty{tiny}{}{} % Line number font.
\SetNlSkip{0.5em} % Line number skip.
\SetAlgoNlRelativeSize{0}
\SetAlFnt{\footnotesize}
%    \end{macrocode}
%
%\subsection{Code Listings}
%
%For syntax highlighting and including source code listings, we use the \texttt{listings} package.
%With \texttt{listingsutf8} we can include listings that contain Unicode characters.
%
%    \begin{macrocode}
\RequirePackage{listings}
\RequirePackage{listingsutf8} % UTF8 support in included listings.
%    \end{macrocode}
%
%Define colors for syntax highlighting.
%
%    \begin{macrocode}
\definecolor{lsnumber}{rgb}{0,0,0} % Zeilennummerfarbe
\definecolor{lscomment}{rgb}{0.25,0.5,0.35} % Kommentarfarbe
\definecolor{lskeyword}{rgb}{0.5,0,0.35} % Schlüsselwörterfarbe
\definecolor{lsstring}{rgb}{0.6,0,0} % Zeichenkettenfarbe
%    \end{macrocode}
%
%The default listing style below is enabled automatically and should guarantee consistency with the appearance of pseudocode (see Section~\ref{sec:implementation-pseudocode}).
%
%    \begin{macrocode}
\lstset{
    language=C,
    basicstyle=\ttfamily,
    breakatwhitespace=false,
    breaklines=true,
    prebreak={\mbox{\footnotesize\(\hookleftarrow\)}},
    numbers=left,
    numberstyle=\color{lsnumber}\tiny,
    numbersep=0.5em,
    stepnumber=1,
    commentstyle=\color{lscomment},
    morecomment=[s][\color{lscomment}]{/**}{*/},
    keepspaces=true,
    keywordstyle=\bfseries\color{lskeyword},
    stringstyle=\color{lsstring},
    showtabs=false, showspaces=false,
    showstringspaces=false,
    tabsize=2,
}
%    \end{macrocode}
%
%\paragraph{Haskell Language Definition}
%
%Refine the Haskell language definition and code style for use in the \textquote{Konzepte der Programmierung} lecture.
%
%    \begin{macrocode}
\lstdefinelanguage[Zimmermann]{haskell}[]{haskell}{
    escapeinside={*'}{'*},
    showstringspaces=false,
    morecomment=[l]\%,
    captionpos=b,
    emphstyle={\bfseries},
}
\lstalias[]{zhaskell}[Zimmermann]{haskell}
% Deprecated. Use `language=zhaskell` instead of `style=haskell`.
\lstdefinestyle{haskell}{language=zhaskell}
%    \end{macrocode}
%
%\paragraph{Assembler Language Definition}
%Introduce a new language definition for Prof.~Molitor's Assembler dialect used in \textquote{Einführung in Rechnerarchitektur}.
%
%    \begin{macrocode}
\lstdefinelanguage[Molitor]{Assembler}[x86masm]{Assembler}{
    morekeywords={
        ldd,sto,shl,shr,rol,ror,sub,add,shli,shri,roli,rori,
        subi,addi,or,and,xor,xnor,jmp,beq,bneq,bgt,bo,ldpc,stpc
    },
    comment=[l]{\#},
}
\lstalias[]{massembler}[Molitor]{Assembler}
% Deprecated. Use `language=massembler` instead of `style=massembler`.
\lstdefinestyle{massembler}{language=massembler}
%    \end{macrocode}
%
%\subsection{Graphics, Drawing, Plots}
%
%We add packages for including images and graphics, for drawing vector graphics, and for plotting data or functions.
%
%    \begin{macrocode}
\RequirePackage{booktabs}
\RequirePackage{graphicx}
\RequirePackage{float}
\RequirePackage{subcaption}
\RequirePackage{tikz}
\RequirePackage{pgfplots}
\RequirePackage{rotating}
\usetikzlibrary{positioning}
\usetikzlibrary{automata}
\usetikzlibrary{trees}
\tikzset{
    >=latex,
    font=\sffamily,
}
\pgfplotsset{compat=1.16}
%    \end{macrocode}
%
%\subsection{Document Hooks}
%
%The following \LaTeX{} code should be inserted just before \lstinline|\begin{document}|.
%
%    \begin{macrocode}
\AtEndPreamble{
%    \end{macrocode}
%
%Update exercise and task number as specified in the preamble. (Set first section number to task number.)
%
%    \begin{macrocode}
    \setcounter{section}{\the\@task} \addtocounter{section}{-1}
    \newcommand{\@exercisestring}{\IfGerman{%
        \the\@exercise.~Übungsserie}{Exercise~\the\@exercise}}
%    \end{macrocode}
%
%Set up page head/foot with metadata.
%
%    \begin{macrocode}
    \ihead{\the\@studentname}
    \chead{\textbf{\@exercisestring}}
    \ohead{
        \the\@studentnumber%
        \ifthenelse{\equal{\the\@studentnumber}{} \OR
            \equal{\the\@studentsymbol}{}}{}{\ /\,}%
        \the\@studentsymbol%
    }
%    \end{macrocode}
%
%Set up PDF metadata.
%
%    \begin{macrocode}
    \hypersetup{
        pdfauthor={\the\@studentname},
        pdftitle={\@exercisestring - \the\@lecture}
    }
%    \end{macrocode}
%
%
%    \begin{macrocode}
}
%    \end{macrocode}
%
%\iffalse
%</class>
%\fi
%
%\StopEventually{
%    \PrintChanges
%}
%
%\Finale
\endinput
