%% kfureprt.cls
%% author: christian clason (c.clason@uni-graz.at)
%
% scrartcl (KOMAscript) template for University of Graz
% implements layout according to corporate design of 2022
% and provides defaults for Institute of Mathematics and Scientific Computing

\NeedsTeXFormat{LaTeX2e}
\ProvidesClass{kfureprt}[2021/03/04 v0.4 Uni Graz CD reports]

\DeclareOption*{\PassOptionsToClass{\CurrentOption}{scrartcl}}
\ProcessOptions

\LoadClass[
11pt,
usegeometry=on,
DIV=calc,
titlepage=firstiscover,
fullsizetitle,
headings=small,
oneside,
numbers=noenddot,
parskip=half,
]{scrartcl}

\usepackage[left=20mm,right=20mm,bottom=30mm]{geometry}

%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
% language support
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
\RequirePackage{babel}
\RequirePackage[autostyle=true]{csquotes}
\RequirePackage{fontspec}
\setsansfont[Ligatures=TeX, ExternalLocation, Path=fonts/,
UprightFont=*Light,
ItalicFont=*LightItalic,
BoldFont=*ExtraBold,
BoldItalicFont=*ExtraBoldItalic]{NunitoSans-}

\usepackage{unicode-math}
\setmathfont[Scale=0.9, ExternalLocation, Path=fonts/]{FiraMath-SemiLight}
\renewcommand{\familydefault}{\sfdefault}

\frenchspacing
\RequirePackage{microtype}

%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
% define colors
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
\RequirePackage[svgnames,hyperref]{xcolor}
\definecolor{hrefcolor}{rgb}{0.0,0.4,0.7}
\definecolor{citecolor}{rgb}{0.0,0.35,0.2}
\definecolor{linkcolor}{RGB}{0,76,147}
\definecolor{kfu@gray}{RGB}{198,198,198}
\definecolor{kfu@yellow}{RGB}{255,213,0}

\RequirePackage[
colorlinks=true,
linkcolor=linkcolor,
citecolor=linkcolor,
filecolor=linkcolor,
urlcolor=linkcolor,
pdfencoding=auto,
hypertexnames=false,
linktocpage=true,%
]{hyperref}
\newcommand{\email}[1]{\href{mailto:#1}{\texttt{#1}}}

%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
% footers
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
\RequirePackage{scrlayer-scrpage}
\RequirePackage{lastpage}
\newcommand{\pageofpages}{%
    \begingroup
    \hypersetup{linkcolor=black}
    \@ifundefined{pageof@\languagename}
    {page~\thepage~of~\pageref{LastPage}}
    {\@nameuse{pageof@\languagename}}%
    \endgroup
}
\newcommand{\pageof@ngerman}{Seite~\thepage~von~\pageref{LastPage}}
\addtokomafont{pageheadfoot}{\normalfont\sffamily\footnotesize}
\cfoot{}
\ofoot{\upshape\pageofpages}
\pagestyle{scrheadings}

%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
% title page
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
\RequirePackage{graphicx}
\newcommand*\myuniversity{UNIVERSITY OF GRAZ}
\providecaptionname{ngerman}\myuniversity{UNIVERSITÄT GRAZ}
\newcommand*\myinstituteA{Institute of Mathematics and}
\providecaptionname{ngerman}\myinstituteA{Institut für Mathematik und}
\newcommand*\myinstituteB{Scientific Computing}
\providecaptionname{ngerman}\myinstituteB{Wissenschaftliches Rechnen}
\newcommand\sponsors[1]{\renewcommand\@sponsors{#1}}
\newcommand\@sponsors{}
\renewcommand\and{\\}
\renewcommand*{\maketitle}{%
    \begin{titlepage}
        \newgeometry{lmargin=2cm, rmargin=1cm, bmargin=3cm}
        \vspace*{-3cm}
        {%
            \hfill
            \parbox[c]{6cm}{\raggedleft
                \Large \myuniversity\\[1.2ex]
                \normalsize \myinstituteA\\[0.1ex] \myinstituteB
            }
            \parbox[c]{3cm}{\centering
                \includegraphics[height=3cm,keepaspectratio=true]{kfulogo}
            }
            \par
        }
        \vspace{7cm}
        {\usekomafont{title}{\Huge \@title \par}}%
        \vskip 1em
        {\ifx\@subtitle\@empty\else\usekomafont{subtitle}\@subtitle\par\fi}%
        \vskip 2em
        {\usekomafont{date}{\normalsize \@date \par}}
        \vskip 15em
        {\ifx\@subtitle\@empty\else\usekomafont{author}\@author\par\fi}%
        \vfill
        {\ifx\@sponsors\@empty\else\@sponsors\par\fi}%
    \end{titlepage}
}
