%! Class = CLASS_NAME
%! Author = maxwe
%! Date = 06.07.22

\NeedsTeXFormat{LaTeX2e}
\ProvidesClass{esaform2023}[Class for Papers of the Esaform 2023 Conference]

\LoadClass[12pt, a4paper, usegeometry, captions=tableheading, headings=small]{scrartcl}

\RequirePackage{fontspec}
\setsansfont{arial}
\setmainfont{Times New Roman}

\RequirePackage[fleqn]{amsmath}
\RequirePackage{unicode-math}

\setkomafont{title}{\bfseries\sffamily\fontsize{16pt}{16pt}\selectfont}
\setkomafont{author}{\sffamily\fontsize{13pt}{16pt}\selectfont}

\RequirePackage[left=2.5cm, right=2.5cm, bottom=2cm, top=2.5cm]{geometry}

\pagestyle{empty}
\renewcommand*{\titlepagestyle}{empty}

\RequirePackage{xpatch}

\makeatletter
\newcommand{\affiliations}[1]{
    \newcommand{\@affiliations}{#1}
}

\newcommand{\affil}[1]{$\mathsf{{}^{#1}}$}
\renewcommand{\@maketitle}{
    \begin{center}
    {\usekomafont{title} \@title \par}
        \vskip 0.5em
            {\usekomafont{author} \@author \par}
            {\sffamily\fontsize{11pt}{18pt}\selectfont \@affiliations}
    \end{center}
}
\makeatother

\setkomafont{caption}{\footnotesize}
\setkomafont{captionlabel}{\bfseries}
\renewcommand{\figurename}{Fig.}
\renewcommand{\tablename}{Tab.}

\RequirePackage{booktabs}

\renewenvironment{abstract}{\noindent\textbf{Abstract.}}{\par}
\newenvironment{keywords}{\noindent\sffamily\textbf{Keywords:}}{\vspace{1.5em}\par }

\setcounter{secnumdepth}{-1}
\setkomafont{disposition}{\normalsize\rmfamily\bfseries}
\setkomafont{paragraph}{\rmfamily\normalfont\slshape}

\RedeclareSectionCommand[
  beforeskip=-2ex plus -1ex minus -.2ex,%
  afterskip=0.01ex,%
]{section}

\RedeclareSectionCommand[
  beforeskip=1ex,%
  afterskip=-0.5em,%
]{paragraph}