% vim: set spelllang=de,en :

%%% Intended to be used with this documentclass:

%%% Packages

%% Styling
\usepackage{geometry}
\usepackage{fancyhdr}
\usepackage{titling}
\usepackage{titlesec}
\usepackage{enumitem}
\usepackage{parskip}

%\let\oldtitle\title
%\renewcommand{\title}[1]{\oldtitle{#1}\newcommand{\themaintitle}{#1}}

\usepackage[font=small,labelfont=bf]{caption}
\captionsetup{justification=raggedright,singlelinecheck=false,hypcap=false}

%% Font
\usepackage{times}

%% Symbols
\usepackage{pifont}

%% Chemistry/Science
\usepackage{siunitx}
\usepackage[version=3]{mhchem}
\usepackage{longtable}

\DeclareSIUnit\liter{l}

%% Graphics
\usepackage{graphicx}
\usepackage{wrapfig}
\usepackage{subfig}

%% Plots + tables
\usepackage{array}
\usepackage{pgfplots}
\usepackage{pgfplotstable}
\usepackage{booktabs}

\pgfplotsset{compat=1.16}

%% Internationalization
\usepackage[german]{babel}
\usepackage[utf8]{inputenc}

%% Misc
\usepackage{lipsum}
\usepackage{filecontents}
\usepackage[stable,bottom]{footmisc}
\usepackage{underscore}
\usepackage{cclicenses}

%%% Simple Macros
\newcommand{\xmark}{\ding{55}}%
\newcommand{\cmark}{\ding{51}}%

\newcommand{\ditto}{%
    \tikz{
        \draw [line width=0.12ex] (-0.2ex,0) -- +(0,0.8ex)
            (0.2ex,0) -- +(0,0.8ex);
        \draw [line width=0.08ex] (-0.6ex,0.4ex) -- +(-1.5em,0)
            (0.6ex,0.4ex) -- +(1.5em,0);
    }%
}

%%% Geometry
\geometry{left=2.0cm, right=2.0cm, top=2.5cm, bottom=2cm}
\setlist{topsep=2pt,itemsep=1pt,partopsep=1pt, parsep=1pt}
\setlength{\parindent}{0pt}
\setlength{\intextsep}{20pt plus 10.0pt minus 20.0pt}

%%% Sections

\newcommand{\colonafter}[1]{#1:}

\newcommand{\multisections}{
  \titleformat{\section}
  {\huge\bfseries}
  {\Alph{section}:}
  {1em}
  {}
  
  \titleformat{\subsection}
  {\LARGE\bfseries}
  {}
  {0em}
  {}
  
  \titleformat{\subsubsection}
  {\bfseries}
  {\arabic{subsubsection}.}
  {0.5em}
  {}
}

\newcommand{\singlesections}{
  \titleformat{\section}
  {\LARGE\bfseries}
  {}
  {0em}
  {\colonafter}
  
  \titleformat{\subsection}
  {\large\bfseries}
  {}
  {0em}
  {}
  
  \titleformat{\subsubsection}
  {\bfseries}
  {\arabic{subsubsection}.}
  {0.5em}
  {}
}

%%% Title
\renewcommand{\maketitle}{
  \begin{center}
    \makeatletter{}
    {\Huge\textbf\@title}
    \makeatother{}
  \end{center}
}

%%% Headers and Footers
\pagestyle{fancy}


\renewcommand{\sectionmark}[1]{\markright{#1}}
\renewcommand{\subsectionmark}[1]{}
\renewcommand{\subsubsectionmark}[1]{}

\newcommand{\multiheader}{
  \rhead{\footnotesize\nouppercase\rightmark{}, \thepage}
}

\newcommand{\singleheader}{
  \rhead{
    \makeatletter
    {\footnotesize\@title, \thepage}
    \makeatother
  }
}

% \fancyhf{}
\fancyfoot{}
\fancyfootoffset{3em}
\fancyheadoffset{3em}
\lhead{\footnotesize {\theunit}. Einheit -- {\theauthor} -- {\theclass}}
\chead{\footnotesize{\thedate}}

\renewcommand{\headrulewidth}{0.4pt}
% \renewcommand{\footrulewidth}{0.4pt}

%%% Babel
%\addto\captionsgerman{\renewcommand{\figurename}{Fig.}}


%%% Execute Options
\DeclareOption{single}{
  \singlesections{}
  \singleheader{}
}

\DeclareOption{multi}{
  \multisections{}
  \multiheader{}
}

\DeclareOption*{\PackageWarning{examplepackage}{Unknown ‘\CurrentOption’}}
\ProcessOptions\relax
