%% kfuposter.sty
%% author: christian clason (c.clason@uni-graz.at)
%
% tikzposter style for University of Graz
% implements layout according to corporate design of 2022

\NeedsTeXFormat{LaTeX2e}
\ProvidesPackage{kfuposter}[2021/03/06 v0.2 Uni Graz CD posters]

\usepackage[hypertexnames=false,plainpages=false,colorlinks=true,
linkcolor=black,urlcolor=black,citecolor=black,breaklinks=true]{hyperref}
\newcommand{\email}[1]{\href{mailto:#1}{\texttt{#1}}}

%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
% fonts and language support
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
\RequirePackage[utf8]{inputenc}
\RequirePackage[T1]{fontenc}
\RequirePackage[sfdefault,vvarbb,scaled=0.95]{notomath}
\RequirePackage[book,medium,scaled=0.85,sfdefault]{FiraSans}
\RequirePackage[scaled=0.85]{FiraMono}

\frenchspacing
\usepackage[kerning,spacing]{microtype}
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
% define colors
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
\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}
\definecolor{kfu@white}{RGB}{255,255,255}
\definecolor{kfu@black}{RGB}{0,0,0}
\definecolor{kfu@nawi}{RGB}{6,120,180}
\definecolor{kfu@math}{RGB}{144,174,181}
\definecolor{kfu@model}{RGB}{204,167,108}

%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
% references
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
\renewcommand{\cite}[1]{{\normalsize [#1]}}

\usepackage[export]{adjustbox}
\usepackage[backend=biber,%
safeinputenc,% encode unicode as latex (needs to be first)
maxcitenames=2,%
maxbibnames=99,%
citestyle=numeric,%
uniquename=false,% last names only in authoryear cite
bibstyle=numeric,%
giveninits=true,%
defernumbers=true
]{biblatex}
\ExecuteBibliographyOptions{doi=false}
\ExecuteBibliographyOptions{isbn=false}
\renewbibmacro{publisher+location+date}{%
    \printlist{publisher}%
    \setunit*{\addcomma\space}%
    \printlist{location}%
    \setunit*{\addcomma\space}%
    \usebibmacro{date}%
\newunit}
\renewbibmacro{in:}{\ifentrytype{article}{}{\printtext{\bibstring{in}\intitlepunct}}}
\DeclareFieldFormat[article,inproceedings,incollection]{title}{\mkbibemph{#1\isdot}}
\DeclareFieldFormat{journaltitle}{#1\isdot}
\DeclareFieldFormat{booktitle}{#1\isdot}
\renewcommand{\mkbibnamegiven}[1]{\ifbibliography{\textsc{#1}}{#1}}
\renewcommand{\mkbibnamefamily}[1]{\ifbibliography{\textsc{#1}}{#1}}
\DeclareFieldFormat{url}{%
    \iffieldundef{doi}{%
        \mkbibacro{URL}\addcolon\space\url{#1}%
    }{}%
}
\DeclareFieldFormat{urldate}{%
    \iffieldundef{doi}{%
        \mkbibparens{\bibstring{urlseen}\space#1}%
    }{}%
}
\newbibmacro{string+doi}[1]{%
\iffieldundef{doi}{#1}{\href{http://dx.doi.org/\thefield{doi}}{#1}}}
\DeclareFieldFormat*{title}{\usebibmacro{string+doi}{\mkbibemph{#1}}}
\DeclareNameAlias{sortname}{last-first}
\renewcommand{\bibinitdelim}{\addnbthinspace}
\AtEveryBibitem{%
    \clearfield{month}%
}
\DeclareFieldFormat{eprint:arxiv}{%
    \mkbibacro{arXiv}\addcolon\space\href{http://arxiv.org/abs/#1}{
    \nolinkurl{#1}}%
}
\AtBeginBibliography{\footnotesize}
\addbibresource{references.bib}

\usepackage[hypertexnames=false,plainpages=false,colorlinks=true,
linkcolor=black,urlcolor=black,citecolor=black,breaklinks=true]{hyperref}


%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
% title header
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
\renewcommand{\and}{\quad}
\settitle{%
    \parbox[t][7.94cm][t]{0.6\textwidth}{
        \raggedright
        \color{titlefgcolor} {\bfseries \Huge \@title \par}
        \vspace*{1em}
        {\LARGE \scshape \@author \par} \vspace*{5mm} {\Large \@institute}
}}
\titlegraphic{%
    \begin{minipage}[b]{0.175\textwidth}
        \includegraphics[width=\textwidth]{kfulogo}
    \end{minipage}
}

%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
% define styles
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
\definecolorstyle{kfu}{
}{
    % Background Colors
    \colorlet{backgroundcolor}{kfu@white}
    \colorlet{framecolor}{kfu@yellow}
    % Title Colors
    \colorlet{titlefgcolor}{kfu@black}
    \colorlet{titlebgcolor}{kfu@black}
    % Block Colors
    \colorlet{blocktitlebgcolor}{kfu@yellow}
    \colorlet{blocktitlefgcolor}{kfu@black}
    \colorlet{blockbodybgcolor}{kfu@white}
    \colorlet{blockbodyfgcolor}{kfu@black}
    % Innerblock Colors
    \colorlet{innerblocktitlebgcolor}{kfu@white}
    \colorlet{innerblocktitlefgcolor}{kfu@black}
    \colorlet{innerblockbodybgcolor}{kfu@white}
    \colorlet{innerblockbodyfgcolor}{kfu@black}
    % Note colors
    \colorlet{notefgcolor}{kfu@black}
    \colorlet{notebgcolor}{kfu@white}
    \colorlet{notefrcolor}{kfu@white}
}

\definebackgroundstyle{kfu}{
    \fill[inner sep=0pt, line width=0pt, color=backgroundcolor]%
    (bottomleft) rectangle (topright);
}

\definetitlestyle{kfu}{
    width=\paperwidth, roundedcorners=0, linewidth=7pt, innersep=1.5cm,
    titletotopverticalspace=0mm, titletoblockverticalspace=20mm
}{
    \draw[draw=kfu@yellow, line width=\titlelinewidth]%
    ($(\titleposleft,\titlepostop)+(1.5,-0.8475\titlegraphicheight)$) -- ($((0.65\titleposright,\titlepostop)+(0,-0.8475\titlegraphicheight)$);
    \node[inner sep=0pt, anchor=west, text=titlefgcolor]%
    at ($(bottomleft)+(0.5,0.66)$){\@date};
    \draw[draw=kfu@yellow, line width=\titlelinewidth]%
    ($(bottomleft)+(0,1.5)$) -- ($(bottomleft)+(\textwidth,1.5)$);
    \node[inner sep=0pt, anchor=north east]%
    at ($(\titleposright,\titlepostop)+(0,0)$){\@titlegraphic};
    \ifx\sponsorlogos\@empty\else%
        \node[anchor=south east] at ($(bottomleft)+(0.9925\textwidth,1.75)$)
        {%
            \foreach \img in \sponsorlogos {%
                \hspace{0.01\textwidth}
                \includegraphics[height=0.05\textwidth,keepaspectratio=true]{\img}%
            }%
        };%
    \fi
}

\defineblockstyle{kfu}{
    titlewidthscale=1, bodywidthscale=1, titleleft,
    titleoffsetx=0pt, titleoffsety=0pt, bodyoffsetx=0pt, bodyoffsety=0pt,
    bodyverticalshift=0pt, roundedcorners=0, titleinnersep=0.5cm,
    bodyinnersep=1cm, linewidth=10pt
}{
    \begin{scope}[line width=\blocklinewidth, rounded corners=\blockroundedcorners]
        \ifBlockHasTitle %
            \draw[draw=none]
            (blockbody.south west) rectangle (blocktitle.north east);
            \draw[color=blocktitlebgcolor]
            (blocktitle.south west) -- (blocktitle.south east);%
        \else
            \draw[draw=none]
            (blockbody.south west) rectangle (blockbody.north east);
        \fi
    \end{scope}
    % \ifBlockHasTitle%
    %     \draw[draw=none, fill=blocktitlebgcolor]%
    %     (blocktitle.south west) rectangle (blocktitle.north east);
    % \fi%
    \draw[draw=none, fill=blockbodybgcolor,rounded corners=\blockroundedcorners]%
    (blockbody.north west) [rounded corners=0] -- (blockbody.south west) --
    (blockbody.south east) [rounded corners=0]-- (blockbody.north east) -- cycle;
}

\defineinnerblockstyle{kfu}{
    titlewidthscale=1, bodywidthscale=1, titleleft,
    titleoffsetx=0pt, titleoffsety=0pt, bodyoffsetx=0pt, bodyoffsety=0pt,
    bodyverticalshift=0pt, roundedcorners=0, linewidth=1.5mm,
    titleinnersep=10pt, bodyinnersep=10pt
}{
    \begin{scope}[line width=\innerblocklinewidth, rounded corners=\innerblockroundedcorners]
        \ifInnerblockHasTitle %
            \draw[draw=none, fill=innerblockbodybgcolor]
            (innerblockbody.south west) rectangle (innerblocktitle.north east);
            \draw[color=innerblocktitlebgcolor, loosely dashed]
            (innerblocktitle.south west) -- (innerblocktitle.south east);%
        \else
            \draw[draw=none, fill=innerblockbodybgcolor]
            (innerblockbody.south west) rectangle (innerblockbody.north east);
        \fi
    \end{scope}
}

\definenotestyle{kfu}{
    targetoffsetx=0pt, targetoffsety=0pt, angle=0, radius=8cm, width=8cm,
    connection=false, rotate=0, roundedcorners=20, linewidth=0pt, innersep=1cm
}{
    \ifNoteHasConnection %% callout note
        \draw[color=notefrcolor, fill=notebgcolor]%
        (notetarget) -- ($(notetarget)!1!4:(notecenter.center)$) --
        ($(notetarget)!1!-4:(notecenter.center)$) --cycle; %
        %
    \fi
    % the body of the note
    \draw[color=notefrcolor, fill=notebgcolor, rounded
    corners=\noteroundedcorners] (notecenter.south west) -- (notecenter.north
    west) -- (notecenter.north east) -- (notecenter.south east) -- cycle;
}

\definelayouttheme{kfu}{
    \usecolorstyle{kfu}
    \usebackgroundstyle{kfu}
    \usetitlestyle{kfu}
    \useblockstyle{kfu}
    \useinnerblockstyle{kfu}
    \usenotestyle{kfu}
}
\usetheme{kfu}

\newcommand{\columnstitle}[1]{%
    \begingroup%
    \colorlet{blocktitlebgcolor}{kfu@gray}%
    \block[titlecenter]{#1}{}%
    \endgroup
}

\def\sponsorlogos{}
\newcommand{\sponsors}[1]{\def\sponsorlogos{#1}}

\tikzposterlatexaffectionproofoff % disable watermark in bottom right
