\ProvidesClass{lecture}
\LoadClass[a4paper]{book}

\RequirePackage[utf8]{inputenc}
\RequirePackage[T1]{fontenc}
\RequirePackage{textcomp}
\RequirePackage[german]{babel}
\RequirePackage{amsmath, amssymb, amsthm}
\RequirePackage{mdframed}
\RequirePackage{geometry}
\RequirePackage{import}
\RequirePackage{pdfpages}
\RequirePackage{transparent}
\RequirePackage{xcolor}
\RequirePackage{array}
\RequirePackage[shortlabels]{enumitem}
\RequirePackage{tikz}
\RequirePackage{pgfplots}
\RequirePackage[pagestyles, nobottomtitles]{titlesec}
\RequirePackage{listings}
\RequirePackage{mathtools}
\RequirePackage{forloop}
\RequirePackage{totcount}
\RequirePackage[hidelinks]{hyperref}

\usetikzlibrary{quotes, angles}

%\DeclareOption*{\PassOptionsToClass{\CurrentOption}{article}}
\DeclareOption{uebung}{
    \makeatletter
    \lhead{\@title}
    \rhead{\@author}
    \makeatother
}
\ProcessOptions\relax

% PARAGRAPH no indent but skip
\setlength{\parskip}{3mm}
\setlength{\parindent}{0mm}

\theoremstyle{definition}
\newmdtheoremenv{satz}{Satz}[chapter]
\newmdtheoremenv{lemma}[satz]{Lemma}
\newmdtheoremenv{korrolar}[satz]{Korrolar}
\newmdtheoremenv{definition}[satz]{Definition}

\newtheorem{bsp}[satz]{Beispiel}
\newtheorem{bem}[satz]{Bemerkung}
\newtheorem{aufgabe}{Aufgabe}

% enable aufgaben counting
\regtotcounter{aufgabe}

\newcommand{\N}{\mathbb{N}}
\newcommand{\R}{\mathbb{R}}
\newcommand{\Z}{\mathbb{Z}}
\newcommand{\Q}{\mathbb{Q}}
\newcommand{\C}{\mathbb{C}}

% HEADERS

%\newpagestyle{main}[\small]{
%  \setheadrule{.55pt}%
%  \sethead[\thepage]%  even-left
%          []%                              even-center
%          [\thechapter~\chaptertitle]%     even-right
%          {\thesection~\sectiontitle}%     odd-left
%          {}%                              odd-center
%          {\thepage}%  odd-right
%}
%\pagestyle{main}

\newcommand{\incfig}[1]{%
    \def\svgwidth{\columnwidth}
    \import{./figures/}{#1.pdf_tex}
}
\pdfsuppresswarningpagegroup=1

% horizontal rule
\newcommand\hr{
    \noindent\rule[0.5ex]{\linewidth}{0.5pt}
}

% punkte tabelle
\newcommand{\punkte}{
    \@punkten{\totvalue{aufgabe}}
}

\def\@punkten#1{
    \newcounter{n}
    \begin{tabular}{|c|*{#1}{m{1cm}|}m{1cm}|@{}m{0cm}@{}}
        \hline
        Aufgabe
        \forloop{n}{1}{\not{\value{n} > #1}}{
            & \centering A\then
        }
        & \centering $\sum$ & \\[5mm] \hline
        Punkte
        \forloop{n}{1}{\not{\value{n} > #1}}{
            &
        }
        & & \\[5mm] \hline
    \end{tabular}
}

% code listings, define style
\lstdefinestyle{mystyle}{
    commentstyle=\color{gray},
    keywordstyle=\color{blue},
    numberstyle=\tiny\color{gray},
    stringstyle=\color{black},
    basicstyle=\ttfamily\footnotesize,
    breakatwhitespace=false,         
    breaklines=true,                 
    captionpos=b,                    
    keepspaces=true,                 
    numbers=left,                    
    numbersep=5pt,                  
    showspaces=false,                
    showstringspaces=false,
    showtabs=false,                  
    tabsize=2
}

% activate my colour style
\lstset{style=mystyle}

% better stackrel
\let\oldstackrel\stackrel
\renewcommand{\stackrel}[2]{%
    \oldstackrel{\mathclap{#1}}{#2}
}%

% integral d sign
\makeatletter \renewcommand\d[1]{\ensuremath{%
  \;\mathrm{d}#1\@ifnextchar\d{\!}{}}}
\makeatother

% remove page before chapters
\let\cleardoublepage=\clearpage

%josua
\newcommand{\norm}[1]{\left\Vert#1\right\Vert}
