%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%              Required packages and command changes               %
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%

%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%   required base packages   %
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
% language and encoding
\RequirePackage[utf8]{inputenc}
\RequirePackage[T1]{fontenc}
\RequirePackage[ngerman]{babel}

% BibLaTeX
\RequirePackage[hyperref,style=authoryear]{biblatex}

% math packages
\RequirePackage{amsmath}   % general math
\RequirePackage{amsthm}                         % theorems
\RequirePackage{amssymb}                        % math symbols
\RequirePackage{mathtools}                      % coloneqq: nice ligatures of := and =:
\RequirePackage{stmaryrd}                       % lightning symbol

% other packages
\RequirePackage{enumerate}                      % for alphanumeric enumeration: (i), (ii), ...
\RequirePackage{csquotes}                       % language dependent correct quote signs
\RequirePackage[parfill]{parskip}

% use sans-serif font Computer Modern Bright
\RequirePackage{cmbright}                       % sans-serif fonts looking cleaner
\RequirePackage[lm]{sfmath}                     % bold math symbols in Latin Modern

\DeclareRobustCommand{\sm@ller}{%
    \dimen@\f@size\p@
    \ifdim \dimen@ > 12\p@
        4
        \dimen@=0.83333\dimen@
    \else
        \advance \dimen@ -2\p@
    \fi
    \math@fontsfalse
    \fontsize{\the\dimen@}\z@
    \selectfont
}
\newcommand{\textc}[1]{{\sm@ller\uppercase{#1}}}


% load late
\RequirePackage{hyperref}                  % hyperref package for refs
\hypersetup{
    pdftitle={
        Berechnung der Matrixexponentialfunktion und
        Anwendung auf homogene lineare Differentialgleichungssysteme mit konstanten Koeffizienten
    },
    pdfsubject={Skript zum Vortrag im Proseminar Algebra},
    pdfauthor={Niklas Birk},
    pdfkeywords={mathematics, calculus, analysis, linear algebra, ordinary differential equations, lecture notes, university}
}

\DeclareTextFontCommand{\emph}{\boldmath\bfseries}

\allowdisplaybreaks

%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%   new commands and math operatos  %
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
% common set symbols
\newcommand{\NN}{\mathbb{N}}
\newcommand{\RR}{\mathbb{R}}
\newcommand{\CC}{\mathbb{C}}

% common symbols
\renewcommand{\i}{\mathrm{i}}
\newcommand{\e}{\mathrm{e}}
\renewcommand{\d}{\mathrm{d}}

\renewcommand{\Re}{\mathrm{Re}\,}
\renewcommand{\Im}{\mathrm{Im}\,}

\DeclareMathOperator{\diag}{diag}

\renewcommand{\vec}[1]{\mathfrak{#1}}

% use the more common variants of greek letters
\renewcommand{\phi}{\varphi}
\renewcommand{\epsilon}{\varepsilon}

% symbols for differentiation and integral
\newcommand{\dx}[1][x]{\ \d #1}                        % differential
\newcommand{\dfdx}[2]{\frac{\d #1}{\d #2}}             % 1st derivative
\newcommand{\ddfdx}[3]{\frac{\d^{#3} #1}{\d #2^{#3}}}  % nth derivative

% sets of the form {...; ...}
\newcommand{\set}[2]{\left\lbrace #1\ \middle|\ #2 \right\rbrace}

%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%   theorems, definitions, etc.   %
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
% style for definitions, unnumbered theorems: "Definition ([additional name]) \newline"
\newtheoremstyle{break*}{}{}{\itshape}{}{\bfseries}{}{\newline}{\thmname{#1}~\thmnote{(#3)}}
\theoremstyle{break*}
\newtheorem*{definition}{Definition}

% style for theorems, lemmata, propositions, corollary: "<counter> Theorem ([additional name]) \newline"
\newtheoremstyle{break}{}{}{\itshape}{}{\bfseries}{}{\newline}{\thmname{#1}~\thmnumber{#2}~\thmnote{(#3)}}
\theoremstyle{break}
\newtheorem{theorem}{Satz}[section]
\newtheorem{lemma}[theorem]{Lemma}
\newtheorem{corollary}[theorem]{Folgerung}

% style for examples: "Beispiel:"
\newtheoremstyle{nobreak*}{}{}{\normalfont}{}{\bfseries}{}{ }{}
\theoremstyle{nobreak*}
\newtheorem*{remark*}{Bemerkung:}
\newtheorem*{example*}{Beispiel:}

% proofs with bold name and qed at end
\renewenvironment{proof}[1][\proofname]{\textbf{#1.} }{\nobreak\hfill\ensuremath{\blacksquare}\par}