% arguelles v2.4.0
% author: Michele Piazzai
% contact: michele.piazzai@uc3m.es
% license: MIT

\NeedsTeXFormat{LaTeX2e}
\ProvidesPackage{beamerthemeArguelles}[2024/02/27 Argüelles]

\mode<presentation>

\newif\if@optSans
\@optSansfalse
\DeclareOption{sans}{\@optSanstrue}
\newif\if@optFrameno
\@optFramenofalse
\DeclareOption{frameno}{\@optFramenotrue}
\newif\if@optSplitnav
\@optSplitnavfalse
\DeclareOption{splitnav}{\@optSplitnavtrue}
\ProcessOptions

% split navigation
\if@optSplitnav
    \useoutertheme[subsection=false]{miniframes}
    \setbeamertemplate{mini frame in other section}{}
    \RequirePackage{etoolbox}
    \let\beamer@section@set@min@width=\relax
    \patchcmd{\insertnavigation}{\hskip-1.875ex plus-1fill}{}{}{}
    \patchcmd{\sectionentry}{\hskip1.875ex plus 1fill}{}{}{}
    \patchcmd{\sectionentry}{\hyperlink{Navigation#3}{{\usebeamertemplate{section in head/foot shaded}}}}{}{}{}
    \patchcmd{\slideentry}{\usebeamertemplate{mini frame in other subsection}}{\usebeamertemplate{mini frame in other subsection of current section}}{}{}
    \patchcmd{\slideentry}{\usebeamertemplate{mini frame in other subsection}}{\usebeamertemplate{mini frame in other section}}{}{}
    \patchcmd{\slideentry}{\usebeamertemplate{mini frame in other subsection of current section}}{\usebeamertemplate{mini frame in other subsection}}{}{}
\fi

% dependencies
\RequirePackage[utf8]{inputenc}
\RequirePackage[T1]{fontenc}
\RequirePackage[osf]{Alegreya}
\RequirePackage[osf]{AlegreyaSans}
\RequirePackage[euler-hat-accent]{eulervm}
\RequirePackage[bb=px]{mathalpha}
\RequirePackage[nopatch=footnote]{microtype}
\RequirePackage{fontawesome5}
\RequirePackage{opencolor}
\RequirePackage{enumitem}
\RequirePackage{parskip}
\RequirePackage{tikz}
\RequirePackage[skins]{tcolorbox}

% components
\useinnertheme{Arguelles}
\useoutertheme{Arguelles}
\usecolortheme{Arguelles}
\usefonttheme{Arguelles}

% sans font
\if@optSans
    \usefonttheme[onlymath]{serif}
    \newcommand\mediumfont{\AlegreyaSansMedium}
\else
    \usefonttheme{serif}
    \newcommand\mediumfont{\AlegreyaMedium}
\fi

% frame numbers
\if@optFrameno
    \defbeamertemplate*{footline}{Arguelles}{
        \usebeamerfont{footline section}\hfill\raisebox{.025\paperheight}{
            \insertframenumber\hspace{.01\paperwidth}
        }
    }
\fi

\AtBeginEnvironment{proof}{\let\@addpunct\@gobble}

\newcommand\Section[1]{\section{\texorpdfstring{\lowercase{#1}}{#1}}}
\newcommand\End{\appendix}
\renewcommand{\appendixname}{End}

\mode<all>
\endinput
