% vim: set filetype:tex

% Identification %
\NeedsTeXFormat{LaTeX2e}
\ProvidesClass{ngexrcs}[2021/12/21 ADS Exercise class]

% Handle options %
\DeclareOption*{\PassOptionsToClass{\CurrentOption}{scrartcl}}
\ProcessOptions\relax

% More declarations %
\LoadClass[sfdefaults=false, parskip=half]{scrartcl}

\KOMAoptions{mpinclude=true}
\recalctypearea

\RequirePackage{ngutils}

% define fonts
\RequirePackage{fontspec}
\RequirePackage[math-style=upright]{unicode-math}
\setmainfont{TeX Gyre Pagella}
\setsansfont{TeX Gyre Heros}
\setmonofont{TeX Gyre Cursor}
\setmathfont{Euler Math}
\mathitalicsmode=1

\setlength{\marginparwidth}{1.5\marginparwidth}
\setlength{\fboxrule}{\heavyrulewidth}

% Use sansfont for all title elements
\addtokomafont{titlehead}{\sffamily}
\addtokomafont{subject}{\sffamily}
\addtokomafont{title}{\sffamily}
\addtokomafont{subtitle}{\sffamily}
\addtokomafont{author}{\sffamily}
\addtokomafont{date}{\sffamily}
\addtokomafont{publishers}{\sffamily}

% Let sections be formated as in: Aufgabe 1 -- Section title 
\renewcommand*{\sectionformat}{Aufgabe \thesection\autodot\enskip--\enskip}

% Let points of an exercise be printed as in: [__ / 2]
\newkomafont{points}{\sffamily}
\newcommand\points[2][1em]{\marginline{\framebox{{\usekomafont{points} \hspace{#1} \textbf{/} #2}}}}

\newcounter{task}
\renewcommand{\thetask}{\@alph\c@task)}
\newenvironment{tasks}
{
	\begin{list}{\thetask}
		{
			\usecounter{task}
			\setlength{\leftmargin}{1.6em}
		}
}{%
	\end{list}
}

\DeclareNewTOC
[
	type=algorithm,
	types=algorithms,
	float,
	floattype=4,
	name=Algorithmus,
	listname={Algorithmenverzeichnis}
]
{loa}
