% \iffalse meta-comment
%
% Copyright (C) 2023-20** by Romain NOEL <romainoel@free.fr>
% -----------------------------------------------------------
%
% This file may be distributed and/or modified under the conditions of
% the LaTeX Project Public License, either version 1.3c of this license
% or (at your option) any later version. The latest version of this
% license is in:
%
% http://www.latex-project.org/lppl.txt
%
% and version 1.3c or later is part of all distributions of LaTeX
% version 2006/05/20 or later.
%
% \fi
%
% \iffalse
%<*driver>
\ProvidesFile{gotham.dtx}
%</driver>
%<*internal>
\input expl3-generic \relax
%</internal>
%<class>\NeedsTeXFormat{LaTeX3e}
%<package>\ProvidesExplPackage{beamerthemegotham}{2026-04-02}{1.2.5.a}{A modern, minimal-ish, versatile and extendable yet robust theme for Beamer}
%<author>Romain NOEL</author>
%<maintainer>Romain NOEL</maintainer>
%<url>https://gitlab.com/RomainNOEL/beamertheme-gotham</url>
%<desc>
% A modern, minimal-ish, versatile and extendable yet robust theme for Beamer. It uses l3build system to both build and verify (Test-Driven Development) the delivered code.
% </desc>
%
%<*driver>
\documentclass{l3doc}
	\usepackage[T1]{fontenc}
	\usepackage{pdfpages}
	\usepackage{standalone}
	% \usepackage{gotham}
	% \usepackage{readprov}
	% 	\ReadPackageInfos{beamerthemegotham}
	\edef\GothamVersion{v1.2.5.a} %{\fileversion}
	\edef\GothamDate{2026-04-02} %{\filedate}

	\usepackage{parskip}
	\usepackage{setspace}
	\usepackage{xspace}
		\onehalfspacing

	\usepackage{xcolor}
		\definecolor{tPrim}{HTML}{00707F}   % Green-Blue
		\definecolor{tSec}{HTML}{5FA4B0}    % Green-Blue light
		\definecolor{tAccent}{HTML}{F07F3C} % Orange
		\definecolor{tGrey}{HTML}{E6E6E1}   % Grey-Beige

	% \usepackage{fancyvrb}
	\usepackage{listings}
		\lstset{%
			language=[LaTeX]{TeX},
			basicstyle=\ttfamily,
			keywordstyle=\color{tPrim}\bfseries,
			commentstyle=\color{tSec},
			stringstyle=\color{tSec},
			backgroundcolor=\color{white},
			numbers=none,
			numberstyle=\tiny\ttfamily,
			stepnumber=2,
			showspaces=false,
			showstringspaces=false,
			showtabs=false,
			frame=none,
			framerule=1pt,
			tabsize=2,
			rulesep=5em,
			captionpos=b,
			breaklines=true,
			breakatwhitespace=false,
			framexleftmargin=0em,
			framexrightmargin=0em,
			xleftmargin=0em,
			xrightmargin=0em,
			aboveskip=1em,
			belowskip=1em,
			morekeywords={usetheme,institute,maketitle,@gotham@titleformat,%
			plain,gothamset,setbeamercolor,defbeamertemplate},
		}
		\lstMakeShortInline|

	\usepackage{hyperref}

		\setlength{\fboxsep}{0pt}%
	\usepackage{subcaption} % For subfigures
	\usepackage{cleveref} % for references

		\providecommand{\defopt}[1]{\underline{#1}}%{default: #1}%{\underline{#1}}
		\NewDocumentEnvironment{DescribeGothamOption}{ o m m m }{
			\DescribeOption{#2} % from l3doc
			\IfNoValueTF{#1}{
				% true => left empty intentionally
			}{
				\DescribeOption{% add extra info like added or updated dates to mimic 'function' env.
					\rule[2.5ex]{\linewidth}{0.3pt}
					\\[-3.5ex]
					{\scriptsize #1 \hfill\ }
				}
			}
			\begin{minipage}[t]{\textwidth}
				\textit{\textbf{\textcolor{tSec}{#3}}}\dotfill\,\defopt{#4}\par
				\begingroup
					\vspace{0.5em}
		}{
					\par
				\endgroup
			\end{minipage}
		}


	%% =====================================================================
	\title{\textsc{Gotham}\\ A modern, minimal-ish, versatile and extendable theme for Beamer}
	\author{Romain NOEL \\ \url{romainoel@free.fr}}
	\date{\GothamVersion~---~\GothamDate}

	\providecommand{\themename}{\textbf{\textsc{Gotham}}\xspace}

	%% =====================================================================


	%% l3doc commands
	\EnableCrossrefs
	\CodelineIndex
	\RecordChanges
\begin{document}
\input{gotham-doc.tex}
	\clearpage
%\section{A simple example}
% \includepdf[pages=-,
% 	pagecommand=\section{A simple example},
% 	width=0.7\textwidth]
% 	{gotham-exampleSimple.pdf}
\section{Commands description for users}
	\EnableDocumentation
	\DisableImplementation
	\DocInput{\jobname.dtx}
	\newpage
\section{Package implementation for developers}
	\EnableImplementation
	\DisableDocumentation
	\GetFileInfo{\jobname.sty}
	\DocInput{\jobname.dtx}
	\PrintChanges
\end{document}
%</driver>
%
%<*devImpl>
\documentclass{l3doc}
	\usepackage[T1]{fontenc}
	\usepackage{pdfpages}
	\usepackage{standalone}
	%\usepackage{gotham}
	\providecommand{\defopt}[1]{\underline{#1}}
	% l3doc commands
	\EnableCrossrefs
	\CodelineIndex
	\RecordChanges
\begin{document}
\section{Commands description for users}
	\EnableImplementation
	\DisableDocumentation
	\DocInput{gotham.dtx}
\end{document}
%</devImpl>
%
%
%<*userCmd>
\documentclass{l3doc}
	\usepackage[T1]{fontenc}
	\usepackage{pdfpages}
	\usepackage{standalone}
	%\usepackage{gotham}
	\providecommand{\defopt}[1]{\underline{#1}}
	% l3doc commands
	\EnableCrossrefs
	\CodelineIndex
	\RecordChanges
\begin{document}
\section{Package implementation for developers}
	\EnableDocumentation
	\DisableImplementation
	\DocInput{gotham.dtx}
\end{document}
%</userCmd>
%
% \fi
%
%
%\begin{implementation}
%    \begin{macrocode}
%<*font>
\ProvidesExplPackage{beamerfontthemegotham}{2026-04-02}{1.2.5.a}{gotham font theme}
\RequirePackage{expl3}
% \RequirePackage{xparse}
% \RequirePackage{etoolbox}
\RequirePackage{ifxetex}
\RequirePackage{ifluatex}
%    \end{macrocode}
% \end{implementation}


%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%%%%%%%%%%%%   FONT      %%%%%%%%%%%%%
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%

% \begin{implementation}
% 	\begin{variable}{font messages}
% 		Definition of the messages that are used and reused by font theme.
% 		\changes{v0.2.0}{2024-01-25}{New}
%   \begin{macrocode}
\msg_new:nnn { gotham } { font-not-found }
{
   Could~not~find~font~'#1'.\c_space_tl
}

\msg_new:nnn { gotham } { fonts-not-available }
{
   No~suitable~fonts~found.~Using~fallback~fonts.
}

\msg_new:nnn { gotham } { compiler-xe-or-lua }
{
   You~need~to~compile~with~XeLaTeX~or~LuaLaTeX~to~use~the~Fira~fonts.
}
%    \end{macrocode}
% \end{variable}
% \end{implementation}

% \begin{implementation}
% 	\begin{variable}{\g_gotham_fontsnotfound_int:n}
% 		Counter for the number of font not found.
%    \begin{macrocode}
\int_new:N \g_gotham_fontsnotfound_int
%    \end{macrocode}
% \end{variable}
% \end{implementation}

% \begin{implementation}
% 	\begin{function}{\checkfont:n}
% 		\begin{arguments}
% 			\item Name of the font.
% 		\end{arguments}
% 		Command to check if one font exist.
% 		\TestFiles{gotham-test-035}
% 		\TestMissing{a isolated unit test would be nice.}
%    \begin{macrocode}
\cs_new_protected:Nn \checkfont:n
{
	\fontspec_font_if_exist:nF { #1 }
	{
		% false: check with regular postfix.
		\fontspec_font_if_exist:nF { #1~Regular }
		{
			% false: raise a warning and increment the number of font not found.
			\int_incr:N \g_gotham_fontsnotfound_int
			\msg_warning:nnn { gotham } { font-not-found } { #1 }
		}
	}
}
%    \end{macrocode}
% \end{function}
% \end{implementation}

% \begin{documentation}
% \begin{function}{\iffontsavailable}
%	\begin{syntax}
%		 \cs{iffontsavailable} \marg{list of fonts' names} \marg{True code} \marg{False code}
%	\end{syntax}
%	If all fonts in \marg{list of fonts' names} are font then \marg{True code} is executed else \marg{False code}.
% \end{function}
% \end{documentation}
% \begin{implementation}
% 	\begin{function}{\iffontsavailable}
% 		Command to check if a list of font is available.
% 		\TestFiles{gotham-test-035}
% 		\TestMissing{a isolated unit test would be nice.}
%    \begin{macrocode}
\providecommand{\iffontsavailable}[3]
{
	\int_zero:N \g_gotham_fontsnotfound_int
	\clist_map_function:nN { #1 } \checkfont:n
	\int_compare:nTF { \g_gotham_fontsnotfound_int = 0 }
	{
		% True
		#2
	}{
		% False
		#3
	}
}
%    \end{macrocode}
% \end{function}
% \end{implementation}

% \begin{implementation}
% 	\begin{macro}{Load fonts if available}
% 		If fontspec is loadable (ie. if xelatex or lualatex), then load available fonts, otherwise raise a warning and go on.
% 		\UnitTested
% 		\TestFiles{gotham-test-035}
%    \begin{macrocode}
\ifboolexpr{bool~{xetex}~or~bool~{luatex}}{
	% if fontspec loaded pass option otherwise load fontspec.
	\@ifpackageloaded{fontspec}{
		\PassOptionsToPackage{no-math}{fontspec}
	}{
		\RequirePackage[no-math]{fontspec}
	}
	%
	% We search for regular, italic, light, light italic, fonts under the default |Fira Sans| names.
	\iffontsavailable{FiraSans-Light.otf,
			FiraSans-LightItalic.otf,
			FiraSans-Regular.otf,
			FiraSans-Italic.otf}
	{
		\setsansfont[ItalicFont={FiraSans-LightItalic.otf},
			BoldFont={FiraSans-Regular.otf},
			BoldItalicFont={FiraSans-Italic.otf}]
		{FiraSans-Light.otf}
		% Latin Modern Typewriter
		\renewcommand{\ttdefault}{lmtt}
	}{
		% If this fails, the suffix OT --- used by some Linux distributions --- will be tried.
		\iffontsavailable{FiraSans~Light~OT,
			FiraSans~LightItalic~OT,
			FiraSans~Regular~OT,
			FiraSans~Italic~OT}
		{
			\setsansfont[ItalicFont={Fira~Sans~LightItalic~OT},
				BoldFont={Fira~Sans~Regular~OT},
				BoldItalicFont={Fira~Sans~Italic~OT}]
			{Fira~Sans~Light~OT}
			% Latin Modern Typewriter
			\renewcommand{\ttdefault}{lmtt}
		}{
			% If this also fails, a warning will be displayed and the standard fonts will be used.
			\msg_warning:nn { gotham } { fonts-not-available }
		}
	}
	%
	% We search for regular, mono, and mono bold fonts under the default |Fira Mono| names.
	\iffontsavailable{FiraMono-Medium.otf, FiraMono-Bold.otf}{
		\setmonofont[BoldFont={FiraMono-Medium.otf}]{FiraMono-Bold.otf}
	}{
		% If this fails, the suffix OT --- used by some Linux distributions --- will be tried.
		\iffontsavailable{Fira~Mono~Medium~OT, Fira~Mono~Bold~OT}{
			\setmonofont[BoldFont={Fira~Mono~Medium~OT}]{Fira~Mono~Bold~OT}
			\renewcommand{\ttdefault}{lmtt} % Latin Modern Typewriter
		}{
			% If this also fails, a warning will be displayed and the standard fonts will be used.
			\msg_warning:nn { gotham } { fonts-not-available }
		}
	}
	%
	% Add a feature for numbers in tables.
	\AtBeginEnvironment{tabular}{
		\addfontfeature{Numbers={Monospaced}}
	}
}{
	% If compiled with pdf\LaTeX{}, then apply a dirty patch (that will not do the job but suppress warnings) and raise a warning.
	\msg_warning:nn { gotham } { compiler-xe-or-lua }
	\DeclareFontShape{OT1}{cmss}{bx}{sc}{<-> cmbcsc10}{}
	\DeclareFontShape{OT1}{cmss}{bx}{it}{<->sub*cmss/m/sl}{}
}
%    \end{macrocode}
% \end{macro}
% \end{implementation}

% \begin{implementation}
% 	\begin{macro}{\setbeamerfont{title}, general font definitions}
%		Set all needed font environment variables:shape, size, series.
%		Remark: Case is missing.
% 		\UnitTested
% 		\TestFiles{gotham-test-035, gotham-test-036}
% 		\TestMissing{block, caption, description, bibio}
%    \begin{macrocode}
\setbeamerfont{title}{size=\Large, series=\bfseries}
\setbeamerfont*{subtitle}{size=\large}
\setbeamerfont{author}{size=\small}
\setbeamerfont{date}{size=\small}

\setbeamerfont{section~title}{size=\Large, series=\bfseries}
\setbeamerfont{subsection~title}{size=\large, series=\bfseries}
\setbeamerfont{subsubsection~title}{size=\normalsize, series=\bfseries}

\setbeamerfont{frametitle}{size=\large, series=\bfseries}
\setbeamerfont{frametitleToc}{size=\LARGE, series=\bfseries}
\setbeamerfont{frametitleSection}{size*={60}{1}, series=\bfseries}

\setbeamerfont{page~number~in~head/foot}{size=\footnotesize}
\setbeamerfont{footline}{size=\scriptsize}

\setbeamerfont{block~title}{size=\normalsize, series=\bfseries}
\setbeamerfont{block~title~alerted}{size=\normalsize, series=\bfseries}
\setbeamerfont{caption}{size=\small}
\setbeamerfont{caption~name}{series=\bfseries}
\setbeamerfont{description~item}{series=\bfseries}

\setbeamerfont{bibliography~entry~author}{size=\normalsize, series=\normalfont}
\setbeamerfont{bibliography~entry~title}{size=\normalsize, series=\bfseries}
\setbeamerfont{bibliography~entry~location}{size=\normalsize, series=\normalfont}
\setbeamerfont{bibliography~entry~note}{size=\small, series=\normalfont}
\setbeamerfont{standout}{size=\Large, series=\bfseries}
%    \end{macrocode}
% \end{macro}
% \end{implementation}

% \begin{implementation}
% 	\begin{function}{\__gotham_title_format:n, titles formats}
%		Pre-hooks that will be inserted to control case format of titles in addition with the fonts set.
% 		\TestFiles{gotham-test-035, gotham-test-036, gotham-test-036b, gotham-test-1045}
% 		\TestMissing{format of framesubtitle, part and subsection are not tested (and not working) yet.}
%    \begin{macrocode}
\def\gotham@titleformat#1{#1}
\def\gotham@subtitleformat#1{#1}
\def\gotham@parttitleformat#1{#1}
\def\gotham@sectiontitleformat#1{#1}
\def\gotham@subsectiontitleformat#1{#1}
\def\gotham@subsubsectiontitleformat#1{#1}
\def\gotham@frametitleformat#1{#1}
\def\gotham@framesubtitleformat#1{#1}
% IF ONE DAY: I can patch beamer with expl3, I will use the following commands instead.
% %% \cs_new:Npn \__gotham_unchanged:n #1 {#1}
% %% \cs_new:Npn \__gotham_title_format:n #1 {#1}
% %% \cs_new:Npn \__gotham_subtitle_format:n #1 {#1}
% %% \cs_new:Npn \__gotham_part_title_format:n #1 {#1}
% %% \cs_new:Npn \__gotham_section_title_format:n #1 {#1}
% %% \cs_new:Npn \__gotham_subsection_title_format:n #1 {#1}
% %% \cs_new:Npn \__gotham_frametitle_format:n #1 {#1}
% %% \cs_new:Npn \__gotham_framesubtitle_format:n #1 {#1}
%    \end{macrocode}
% \end{function}
% \end{implementation}

% \begin{implementation}
% 	\begin{macro}{\beamer@title,\beamer@subtitle,\sectionentry}
% 		Since, case feature is not available in |setbeamerfont|; to make the uppercase, lowercase and title-case macros work in the title, subtitle, etc., we have to patch the appropriate |beamer| commands that set their values.
% 		This solution was suggested by Enrico Gregorio in an answer to \href{http://tex.stackexchange.com/questions/112526/}{this StackExchange question}.
% 		Remark: patchcmd from etoolbox (or other), is not compatible with expl3.
% 		\UnitTested
% 		\TestFiles{gotham-test-035, gotham-test-036, gotham-test-036b, gotham-test-1042}
% 		\TestMissing{format of framesubtitle, part and subsection are not tested (and not working) yet.}
% 		\changes{v1.2.4}{2025-12-04}{change or add patches for parts,section, sub, subsubsec and all their 'section*'intoc}
%    \begin{macrocode}
\ExplSyntaxOff
\patchcmd{\beamer@title}
	{\def\inserttitle{#2}}
	{\def\inserttitle{\gotham@titleformat{#2}}}
	% {\def\inserttitle{ \__gotham_title_format:n{#2} }}
	{}
	{\PackageError{beamerfontthemegotham}{Patching~title~failed}\@ehc}
\patchcmd{\beamer@subtitle}
	{\def\insertsubtitle{#2}}
	{\def\insertsubtitle{{\gotham@subtitleformat{#2}}}}
	% {\def\insertsubtitle{ \__gotham_subtitle_format:n{#2} }}
	{}
	{\PackageError{beamerfontthemegotham}{Patching~subtitle~failed}\@ehc}


% %%%% PART  %%%%%

% Missing command for part in toc from https://tex.stackexchange.com/questions/5285/tableofcontents-from-part-commands-in-beamer
%% number, partname, page.
\providecommand\beamer@partintoc[3]{%
	\ifnum\c@tocdepth=-1\relax
		% requesting onlyparts.
		\makebox[6em]{PART #1:} #2
		\par
	\fi
}
\define@key{beamertoc}{onlyparts}[]{%
	\c@tocdepth=-1\relax
}
\patchcmd{\beamer@part} % beamerbasenavigation.sty l.195
	{\def\beamer@partname{#2}}
	{\def\beamer@partname{\gotham@parttitleformat{#2}}}
	{}
	{\PackageError{beamerfontthemegotham}{Patching~part~title~failed}\@ehc}%
\patchcmd{\beamer@part} % beamerbasenavigation.sty l.195
	{\def\beamer@partnameshort{#1}}
	{\def\beamer@partnameshort{\gotham@parttitleformat{#1}}}
	{}
	{\PackageError{beamerfontthemegotham}{Patching~part~title~failed}\@ehc}%
\patchcmd{\beamer@part} % beamerbasenavigation.sty l.195
	{\protect\partentry{#2}{\the\c@part}}
	{\protect\partentry{\gotham@parttitleformat{#2}}{\the\c@part}}
	{}
	{\PackageError{beamerfontthemegotham}{Patching~part~title~failed}\@ehc}%
\patchcmd{\beamer@part} % beamerbasenavigation.sty l.195
	{\Hy@writebookmark{\the\c@part}{#1}{Outline\the\c@part}{1}{toc}}
	{\Hy@writebookmark{\the\c@part}{\gotham@parttitleformat{#1}}{Outline\the\c@part}{1}{toc}}
	{}
	{\PackageError{beamerfontthemegotham}{Patching~part~title~failed}\@ehc}%


%%%%% SECTION  %%%%%
%
% \patchcmd{\sectionentry} % beamerbasenavigation.sty l.335
% 	{\def\insertsectionhead{#2}}
% 	{\def\insertsectionhead{\gotham@sectiontitleformat{#2}}}
% 	{}
% 	{\PackageError{beamerfontthemegotham}{Patching~section~title~failed}\@ehc}%
\patchcmd{\beamer@section} % beamerbasenavigation.sty l.195
	{\protect\beamer@sectionintoc{\the\c@section}{#2}}
	{\protect\beamer@sectionintoc{\the\c@section}{\gotham@sectiontitleformat{#2}}}
	{}
	{\PackageError{beamerfontthemegotham}{Patching~section~title~failed}\@ehc}%
\patchcmd{\beamer@section} % beamerbasenavigation.sty l.195
	{\long\def\secname{#2}}
	{\long\def\secname{\gotham@sectiontitleformat{#2}}}
	{}
	{\PackageError{beamerfontthemegotham}{Patching~section~title~failed}\@ehc}%

\@tempswafalse
\patchcmd{\beamer@section} % beamerbasesection.sty l. 209
	{\def\insertsectionhead{\hyperlink{Navigation\the\c@page}{#1}}}
	{\def\insertsectionhead{\hyperlink{Navigation\the\c@page}{\gotham@sectiontitleformat{#1}}}}
		% \__gotham_section_title_format:n{#2}
	{\@tempswatrue}
	{}
\patchcmd{\beamer@section} % beamerbasesection.sty l. 209
	{\edef\insertsectionhead{\noexpand\hyperlink{Navigation\the\c@page}{\unexpanded{#1}}}}
	{\edef\insertsectionhead{\noexpand\hyperlink{Navigation\the\c@page}{\noexpand\gotham@sectiontitleformat{\unexpanded{#1}}}}}
		% \exp_not:N \__gotham_section_title_format:n {#1}
	{\@tempswatrue}
	{}
\if@tempswa\else
	{\PackageError{beamerfontthemegotham}{Patching~section~title~failed}\@ehc}
\fi
\@tempswafalse


% %%%% SUBSECTION %%%%%

\patchcmd{\beamer@subsection} % beamerbasenavigation.sty l.195
	{\protect\beamer@subsectionintoc{\the\c@section}{\the\c@subsection}{#2}}
	{\protect\beamer@subsectionintoc{\the\c@section}{\the\c@subsection}{\gotham@subsectiontitleformat{#2}}}
	{}
	{\PackageError{beamerfontthemegotham}{Patching~subsection~title~failed}\@ehc}%
\patchcmd{\beamer@subsection} % beamerbasenavigation.sty l.195
	{\long\def\subsecname{#2}}
	{\long\def\subsecname{\gotham@subsectiontitleformat{#2}}}
	{}
	{\PackageError{beamerfontthemegotham}{Patching~subsection~title~failed}\@ehc}%

\@tempswafalse
\patchcmd{\beamer@subsection} % beamerbasesubsection.sty l. 209
	{\def\insertsubsectionhead{\hyperlink{Navigation\the\c@page}{#1}}}
	{\def\insertsubsectionhead{\hyperlink{Navigation\the\c@page}{\gotham@subsectiontitleformat{#1}}}}
		% \__gotham_subsection_title_format:n{#2}
	{\@tempswatrue}
	{}
\patchcmd{\beamer@subsection} % beamerbasesubsection.sty l. 209
	{\edef\insertsubsectionhead{\noexpand\hyperlink{Navigation\the\c@page}{\unexpanded{#1}}}}
	{\edef\insertsubsectionhead{\noexpand\hyperlink{Navigation\the\c@page}{\noexpand\gotham@subsectiontitleformat{\unexpanded{#1}}}}}
		% \exp_not:N \__gotham_subsection_title_format:n {#1}
	{\@tempswatrue}
	{}
\if@tempswa\else
	{\PackageError{beamerfontthemegotham}{Patching~subsection~title~failed}\@ehc}
\fi
\@tempswafalse


% %%% SUBSUBSECTION  %%%%%

\patchcmd{\beamer@subsubsection} % beamerbasenavigation.sty l.195
	{\long\def\subsubsecname{#2}}
	{\long\def\subsubsecname{\gotham@subsubsectiontitleformat{#2}}}
	{}
	{\PackageError{beamerfontthemegotham}{Patching~subsubsection~title~failed}\@ehc}%
\patchcmd{\beamer@subsubsection} %\protect\beamer@subsubsectionintoc
	{{\the\c@section}{\the\c@subsection}{\the\c@subsubsection}{#2}}
	{{\the\c@section}{\the\c@subsection}{\the\c@subsubsection}{\gotham@subsubsectiontitleformat{#2}}}
	{}
	{\PackageError{beamerfontthemegotham}{Patching~subsubsection~title~failed}\@ehc}%

\@tempswafalse

\patchcmd{\beamer@subsubsection} % beamerbasesubsubsection.sty l. 209
	{\edef\insertsubsubsectionhead{\noexpand\hyperlink{Navigation\the\c@page}{\unexpanded{#1}}}}
	{\edef\insertsubsubsectionhead{\noexpand\hyperlink{Navigation\the\c@page}{\noexpand\gotham@subsubsectiontitleformat{\unexpanded{#1}}}}}
		% \exp_not:N \__gotham_subsubsection_title_format:n {#1}
	{\@tempswatrue}
	{}
\if@tempswa\else
	{\PackageError{beamerfontthemegotham}{Patching~subsubsection~title~failed}\@ehc}
\fi
\@tempswafalse

%
% Similarly, to make the |\MakeLowercase| and |\MakeUppercase| macros work in the frame title we have to patch |\beamer@@frametitle|.
\providecommand{\beamer@insertframetitlecontinuation}{
	\usebeamertemplate*{frametitle~continuation}
}
\patchcmd{\beamer@@frametitle} % beamerbaselocalstructure.sty l. 32
	{\gdef\insertframetitle{{%
		#2%
		\ifnum\beamer@autobreakcount>0
			\relax{}\space%
			\beamer@insertframetitlecontinuation%
		\fi%
		}}%
	}
	{\gdef\insertframetitle{{%
		\gotham@frametitleformat{#2}%
		% \__gotham_frametitle_format:n {#2}
		\ifnum\beamer@autobreakcount>0
			\relax{}\space%
			\beamer@insertframetitlecontinuation%
		\fi%
		}}%
	}
	{}
	{\PackageWarning{beamerfontthemegotham}{Patching~frametitle~failed}\@ehc}
%
%% NOT WORKING YET !
%% \patchcmd{\framesubtitle} % beamerbaselocalstructure.sty l.55
%% 	{\only#2{\ifblank{#1}{}{\gdef\insertframesubtitle{{#1}}\beamer@aftersubtitle}}}
%% 	{\only{#2}{\ifblank{#1}{}{\gdef\insertframesubtitle{{#1}}\beamer@aftersubtitle}}}
%% 	{}
%% 	{\PackageWarning{beamerfontthemegotham}{Patching~framesubtitle~failed}\@ehc}
%
\ExplSyntaxOn
%    \end{macrocode}
% \end{macro}
% \end{implementation}

% \begin{documentation}
% \begin{function}{\usefonttheme}
%	\begin{syntax}
%		\cs{usefonttheme}\oarg{option1=value1, ...}\marg{gotham}
%		\textrm{where the options are (default marked as} \defopt{default}\textrm{):}
% 		\meta{title format} = \oarg{\defopt{textregular} \textbar lower \textbar upper \textbar titlecase}
%		\meta{title shape} = \oarg{\defopt{textregular} \textbar smallcaps \textbar italic}
% 		\meta{subtitle format} = \oarg{\defopt{textregular} \textbar lower \textbar upper \textbar titlecase}
%		\meta{subtitle shape} = \oarg{\defopt{textregular} \textbar smallcaps \textbar italic}
% 		\meta{frametitle format} = \oarg{\defopt{textregular} \textbar lower \textbar upper \textbar titlecase}
%		\meta{frametitle shape} = \oarg{\defopt{textregular} \textbar smallcaps \textbar italic}
% 		\meta{framesubtitle format} = \oarg{\defopt{textregular} \textbar lower \textbar upper \textbar titlecase}
%		\meta{framesubtitle shape} = \oarg{\defopt{textregular} \textbar smallcaps \textbar italic}
% 		\meta{part format} = \oarg{\defopt{textregular} \textbar lower \textbar upper \textbar titlecase}
%		\meta{part shape} = \oarg{\defopt{textregular} \textbar smallcaps \textbar italic}
% 		\meta{section format} = \oarg{\defopt{textregular} \textbar lower \textbar upper \textbar titlecase}
%		\meta{section shape} = \oarg{\defopt{textregular} \textbar smallcaps \textbar italic}
% 		\meta{subsection format} = \oarg{\defopt{textregular} \textbar lower \textbar upper \textbar titlecase}
%		\meta{subsection shape} = \oarg{\defopt{textregular} \textbar smallcaps \textbar italic}
% 		\meta{subsubsection format} = \oarg{\defopt{textregular} \textbar lower \textbar upper \textbar titlecase}
%		\meta{subsubsection shape} = \oarg{\defopt{textregular} \textbar smallcaps \textbar italic}
%	\end{syntax}
%	The 'package' (usefonttheme) options can control both shape and format of title (of the presentation), subtitle, part title, section title, subsection title, subsubsection title, frametitle and framesubtitle.
% \end{function}
% \end{documentation}
%%%%
% \begin{implementation}
% 	\begin{macro}{font key -- interface}
% 		Controls the format and shape of the title (of the presentation), subtitle, part title, section title, subsection title, frametitle and framesubtitle.
% 		\UnitTested
% 		\TestFiles{gotham-test-035, gotham-test-036, gotham-test-036b}
% 		\TestMissing{format of framesubtitle are not tested (and not working) yet.}
% 		\changes{v1.2.4}{2025-12-04}{add subsubsection format and shape options}
%    \begin{macrocode}
\keys_define:nn { gotham / font }
{
	% format title
	format~title .choice:,
	format~title .usage:n = { general },
	format~title .default:n = { regular },
	format~title / regular .code:n =
	{
		\let\gotham@titleformat\@empty
		% \cs_set_eq:NN \__gotham_title_format:n \__gotham_unchanged:n
	},
	format~title / lower .code:n =
	{
		\let\gotham@titleformat \text_lowercase:n %\lowercase
		% \cs_set_eq:NN \__gotham_title_format:n \text_lowercase:n
		\PackageWarning{ gotham } { Be~aware~that~format~title=lower~can~lead~to~problems. }
	},
	format~title / upper .code:n =
	{
		\let\gotham@titleformat \text_uppercase:n %\uppercase
		% \cs_set_eq:NN \__gotham_title_format:n \text_uppercase:n
		\PackageWarning{ gotham } { Be~aware~that~format~title=upper~can~lead~to~problems. }
	},
	format~title / titlecase .code:n =
	{
		\let\gotham@titleformat \text_titlecase_all:n %\MakeTitlecase
		% \cs_set_eq:NN \__gotham_title_format:n \text_titlecase_all:n
		\PackageWarning{ gotham } { Be~aware~that~format~title=titlecase~can~lead~to~problems. }
	},
	format~title / unknown .code:n = { \PackageWarning{ gotham } { The~choice~'\l_keys_value_tl'~is~unknown~for~the~(known)~option~'\l_keys_key_tl',~so~being~ignored. }{helping~message: format~title / unknown } },
}
\keys_define:nn { gotham / font }
{
	% shape title
	shape~title .choice:,
	shape~title .usage:n = { general },
	shape~title .default:n = { regular },
	shape~title / regular .code:n =
	{
		\setbeamerfont{title}{shape=\normalfont}
	},
	shape~title / smallcaps .code:n =
	{
		\setbeamerfont{title}{shape=\scshape}
	},
	shape~title / italic .code:n =
	{
		\setbeamerfont{title}{shape=\itshape}
	},
	shape~title / unknown .code:n = { \PackageWarning{ gotham } { The~choice~'\l_keys_value_tl'~is~unknown~for~the~(known)~option~'\l_keys_key_tl',~so~being~ignored. }{helping~message: shape~title / unknown} },
}

\keys_define:nn { gotham / font }
{
	% format subtitle
	format~subtitle .choice:,
	format~subtitle .usage:n = { general },
	format~subtitle .default:n = { regular },
	format~subtitle / regular .code:n =
	{
		\let\gotham@subtitleformat\@empty
		% \cs_set_eq:NN \__gotham_subtitle_format:n \__gotham_unchanged:n
	},
	format~subtitle / lower .code:n =
	{
		\let\gotham@subtitleformat \text_lowercase:n	%\lowercase
		% \cs_set_eq:NN \__gotham_subtitle_format:n \text_lowercase:n
		\PackageWarning{ gotham } { Be~aware~that~format~subtitle=lower~can~lead~to~problems. }
	},
	format~subtitle / upper .code:n =
	{
		\let\gotham@subtitleformat \text_uppercase:n	%\uppercase
		\cs_set_eq:NN \__gotham_subtitle_format:n \text_uppercase:n
		\PackageWarning{ gotham } { Be~aware~that~format~subtitle=upper~can~lead~to~problems. }
	},
	format~subtitle / titlecase .code:n =
	{
		\let\gotham@subtitleformat \text_titlecase_all:n %\MakeTitlecase
		% \cs_set_eq:NN \__gotham_subtitle_format:n \text_titlecase_all:n %\MakeTitlecase
		\PackageWarning{ gotham } { Be~aware~that~format~subtitle=titlecase~can~lead~to~problems. }
	},
	format~subtitle / unknown .code:n = { \PackageWarning{ gotham } { The~choice~'\l_keys_value_tl'~is~unknown~for~the~(known)~option~'\l_keys_key_tl',~so~being~ignored. }{helping~message: format~subtitle / unknown} },
}
\keys_define:nn { gotham / font }
{
	% shape subtitle
	shape~subtitle .choice:,
	shape~subtitle .usage:n = { general },
	shape~subtitle .default:n = { regular },
	shape~subtitle / regular .code:n =
	{
		\setbeamerfont{subtitle}{shape=\normalfont}
	},
	shape~subtitle / smallcaps .code:n =
	{
		\setbeamerfont{subtitle}{shape=\scshape}
	},
	shape~subtitle / italic .code:n =
	{
		\setbeamerfont{subtitle}{shape=\itshape}
	},
	shape~subtitle / unknown .code:n = { \PackageWarning{ gotham } { The~choice~'\l_keys_value_tl'~is~unknown~for~the~(known)~option~'\l_keys_key_tl',~so~being~ignored. }{helping~message: shape~subtitle / unknown} },
}

\keys_define:nn { gotham / font }
{
	% format frametitle
	format~frametitle .choice:,
	format~frametitle .usage:n = { general },
	format~frametitle .default:n = { regular },
	format~frametitle / regular .code:n =
	{
		\let\gotham@frametitleformat\@empty
		% \cs_set_eq:NN \__gotham_frametitle_format:n \__gotham_unchanged:n
	},
	format~frametitle / lower .code:n =
	{
		\let\gotham@frametitleformat \text_lowercase:n %\lowercase
		% \cs_set_eq:NN \__gotham_frametitle_format:n \text_lowercase:n
		\PackageWarning{ gotham } { Be~aware~that~format~frametitle=lower~can~lead~to~problems. }
	},
	format~frametitle / upper .code:n =
	{
		\let\gotham@frametitleformat \text_uppercase:n %\uppercase
		% \cs_set_eq:NN \__gotham_frametitle_format:n \text_uppercase:n
		\PackageWarning{ gotham } { Be~aware~that~format~frametitle=upper~can~lead~to~problems. }
	},
	format~frametitle / titlecase .code:n =
	{
		\let\gotham@frametitleformat \text_titlecase_all:n %\Maketitlecase
		% \cs_set_eq:NN \__gotham_frametitle_format:n \text_titlecase_all:n %\MakeTitlecase
		\PackageWarning{ gotham } { Be~aware~that~format~frametitle=titlecase~can~lead~to~problems. }
	},
	format~frametitle / unknown .code:n = { \PackageWarning{ gotham } { The~choice~'\l_keys_value_tl'~is~unknown~for~the~(known)~option~'\l_keys_key_tl',~so~being~ignored. }{helping~message: format~frametitle / unknown} },
}
\keys_define:nn { gotham / font }
{
	% shape frametitle
	shape~frametitle .choice:,
	shape~frametitle .usage:n = { general },
	shape~frametitle .default:n = { regular },
	shape~frametitle / regular .code:n =
	{
		\setbeamerfont{frametitle}{shape=\normalfont}
	},
	shape~frametitle / smallcaps .code:n =
	{
		\setbeamerfont{frametitle}{shape=\scshape}
	},
	shape~frametitle / italic .code:n =
	{
		\setbeamerfont{frametitle}{shape=\itshape}
	},
	shape~frametitle / unknown .code:n = { \PackageWarning{ gotham } { The~choice~'\l_keys_value_tl'~is~unknown~for~the~(known)~option~'\l_keys_key_tl',~so~being~ignored. }{helping~message: shape~frametitle / unknown} },
}

\keys_define:nn { gotham / font }
{
	% format framesubtitle
	format~framesubtitle .choice:,
	format~framesubtitle .usage:n = { general },
	format~framesubtitle .default:n = { regular },
	format~framesubtitle / regular .code:n =
	{
		\let\gotham@framesubtitleformat\@empty
		% \cs_set_eq:NN \__gotham_framesubtitle_format:n \__gotham_unchanged:n
	},
	format~framesubtitle / lower .code:n =
	{
		\let\gotham@framesubtitleformat \text_lowercase:n %\lowercase
		% \cs_set_eq:NN \__gotham_framesubtitle_format:n \text_lowercase:n
		\PackageWarning{ gotham } { Be~aware~that~format~framesubtitle=lower~can~lead~to~problems. }
	},
	format~framesubtitle / upper .code:n =
	{
		\let\gotham@framesubtitleformat \text_uppercase:n %\uppercase
		% \cs_set_eq:NN \__gotham_framesubtitle_format:n \text_uppercase:n
		\PackageWarning{ gotham } { Be~aware~that~format~framesubtitle=upper~can~lead~to~problems. }
	},
	format~framesubtitle / titlecase .code:n =
	{
		\let\gotham@framesubtitleformat \text_titlecase_all:n %\Maketitlecase
		% \cs_set_eq:NN \__gotham_framesubtitle_format:n \text_titlecase_all:n %\Maketitlecase
		\PackageWarning{ gotham } { Be~aware~that~format~framesubtitle=titlecase~can~lead~to~problems. }
	},
	format~framesubtitle / unknown .code:n = { \PackageWarning{ gotham } { The~choice~'\l_keys_value_tl'~is~unknown~for~the~(known)~option~'\l_keys_key_tl',~so~being~ignored. }{helping~message: format~framesubtitle / unknown} },
}
\keys_define:nn { gotham / font }
{
	% shape framesubtitle
	shape~framesubtitle .choice:,
	shape~framesubtitle .usage:n = { general },
	shape~framesubtitle .default:n = { regular },
	shape~framesubtitle / regular .code:n =
	{
		\setbeamerfont{framesubtitle}{shape=\normalfont}
	},
	shape~framesubtitle / smallcaps .code:n =
	{
		\setbeamerfont{framesubtitle}{shape=\scshape}
	},
	shape~framesubtitle / italic .code:n =
	{
		\setbeamerfont{framesubtitle}{shape=\itshape}
	},
	shape~framesubtitle / unknown .code:n = { \PackageWarning{ gotham } { The~choice~'\l_keys_value_tl'~is~unknown~for~the~(known)~option~'\l_keys_key_tl',~so~being~ignored. }{helping~message: shape~framesubtitle / unknown} },
}

\keys_define:nn { gotham / font }
{
	% format part
	format~part .choice:,
	format~part .usage:n = { general },
	format~part .default:n = { regular },
	format~part / regular .code:n =
	{
		\let\gotham@parttitleformat\@empty
		% \cs_set_eq:NN \__gotham_part_title_format:n \text_titlecase:n
	},
	format~part / lower .code:n =
	{
		\let\gotham@parttitleformat \text_lowercase:n %\lowercase
		% \cs_set_eq:NN \__gotham_part_title_format:n \text_lowercase:n
		\PackageWarning{ gotham } { Be~aware~that~format~part=lower~can~lead~to~problems. }
	},
	format~part / upper .code:n =
	{
		\let\gotham@parttitleformat \text_uppercase:n %\uppercase
		% \cs_set_eq:NN \__gotham_part_title_format:n \text_uppercase:n
		\PackageWarning{ gotham } { Be~aware~that~format~part=upper~can~lead~to~problems. }
	},
	format~part / titlecase .code:n =
	{
		\let\gotham@parttitleformat\text_titlecase_all:n %\Maketitlecase
		% \cs_set_eq:NN \__gotham_part_title_format:n \text_titlecase:n
		\PackageWarning{ gotham } { Be~aware~that~format~part=titlecase~can~lead~to~problems. }
	},
	format~part / unknown .code:n = { \PackageWarning{ gotham } { The~choice~'\l_keys_value_tl'~is~unknown~for~the~(known)~option~'\l_keys_key_tl',~so~being~ignored. }{helping~message: format~part / unknown} },
}
\keys_define:nn { gotham / font }
{
	% shape part
	shape~part .choice:,
	shape~part .usage:n = { general },
	shape~part .default:n = { regular },
	shape~part / regular .code:n =
	{
		\setbeamerfont{part~title}{shape=\normalfont}
	},
	shape~part / smallcaps .code:n =
	{
		\setbeamerfont{part~title}{shape=\scshape}
	},
	shape~part / italic .code:n =
	{
		\setbeamerfont{part~title}{shape=\itshape}
	},
	shape~part / unknown .code:n = { \PackageWarning{ gotham } { The~choice~'\l_keys_value_tl'~is~unknown~for~the~(known)~option~'\l_keys_key_tl',~so~being~ignored. }{helping~message: shape~part / unknown} },
}

\keys_define:nn { gotham / font }
{
	% format section
	format~section .choice:,
	format~section .usage:n = { general },
	format~section .default:n = { regular },
	format~section / regular .code:n =
	{
		\let\gotham@sectiontitleformat\@empty
		% \cs_set_eq:NN \__gotham_section_title_format:n \__gotham_unchanged:n
	},
	format~section / lower .code:n =
	{
		\let\gotham@sectiontitleformat \text_lowercase:n %\lowercase
		% \cs_set_eq:NN \__gotham_section_title_format:n \text_lowercase:n
		\PackageWarning{ gotham } { Be~aware~that~format~section=lower~can~lead~to~problems. }
	},
	format~section / upper .code:n =
	{
		\let\gotham@sectiontitleformat \text_uppercase:n %\uppercase
		% \cs_set_eq:NN \__gotham_section_title_format:n \text_uppercase:n
		\PackageWarning{ gotham } { Be~aware~that~format~section=upper~can~lead~to~problems. }
	},
	format~section / titlecase .code:n =
	{
		\let\gotham@sectiontitleformat \text_titlecase_all:n %\Maketitlecase
		% \cs_set_eq:NN \__gotham_section_title_format:n \text_titlecase_all:n
		\PackageWarning{ gotham } { Be~aware~that~format~section=titlecase~can~lead~to~problems. }
	},
	format~section / unknown .code:n = { \PackageWarning{ gotham } { The~choice~'\l_keys_value_tl'~is~unknown~for~the~(known)~option~'\l_keys_key_tl',~so~being~ignored. }{helping~message: format~section / unknown} },
}
\keys_define:nn { gotham / font }
{
	% shape section
	shape~section .choice:,
	shape~section .usage:n = { general },
	shape~section .default:n = { regular },
	shape~section / regular .code:n =
	{
		\setbeamerfont{section~title}{shape=\normalfont}
	},
	shape~section / smallcaps .code:n =
	{
		\setbeamerfont{section~title}{shape=\scshape}
	},
	shape~section / italic .code:n =
	{
		\setbeamerfont{section~title}{shape=\itshape}
	},
	shape~section / unknown .code:n = { \PackageWarning{ gotham } { The~choice~'\l_keys_value_tl'~is~unknown~for~the~(known)~option~'\l_keys_key_tl',~so~being~ignored. }{helping~message: shape~section / unknown} },
}

\keys_define:nn { gotham / font }
{
	% format subsection
	format~subsection .choice:,
	format~subsection .usage:n = { general },
	format~subsection .default:n = { regular },
	format~subsection / regular .code:n =
	{
		\let\gotham@subsectiontitleformat\@empty
		% \cs_set_eq:NN \__gotham_subsection_title_format:n \__gotham_unchanged:n
	},
	format~subsection / lower .code:n =
	{
		\let\gotham@subsectiontitleformat \text_lowercase:n %\lowercase
		% \cs_set_eq:NN \__gotham_subsection_title_format:n \text_lowercase:n
		\PackageWarning{ gotham } { Be~aware~that~format~subsection=lower~can~lead~to~problems. }
	},
	format~subsection / upper .code:n =
	{
		\let\gotham@subsectiontitleformat \text_uppercase:n %\uppercase
		% \cs_set_eq:NN \__gotham_subsection_title_format:n \text_uppercase:n
		\PackageWarning{ gotham } { Be~aware~that~format~subsection=upper~can~lead~to~problems. }
	},
	format~subsection / titlecase .code:n =
	{
		\let\gotham@subsectiontitleformat\text_titlecase_all:n %\Maketitlecase
		% \cs_set_eq:NN \__gotham_subsection_title_format:n \text_titlecase_all:n
		\PackageWarning{ gotham } { Be~aware~that~format~subsection=titlecase~can~lead~to~problems. }
	},
	format~subsection / unknown .code:n = { \PackageWarning{ gotham } { The~choice~'\l_keys_value_tl'~is~unknown~for~the~(known)~option~'\l_keys_key_tl',~so~being~ignored. }{helping~message: format~subsection / unknown} },
}
\keys_define:nn { gotham / font }
{
	% shape subsection
	shape~subsection .choice:,
	shape~subsection .usage:n = { general },
	shape~subsection .default:n = { regular },
	shape~subsection / regular .code:n =
	{
		\setbeamerfont{subsection~title}{shape=\normalfont}
	},
	shape~subsection / smallcaps .code:n =
	{
		\setbeamerfont{subsection~title}{shape=\scshape}
	},
	shape~subsection / italic .code:n =
	{
		\setbeamerfont{subsection~title}{shape=\itshape}
	},
	shape~subsection / unknown .code:n = { \PackageWarning{ gotham } { The~choice~'\l_keys_value_tl'~is~unknown~for~the~(known)~option~'\l_keys_key_tl',~so~being~ignored. }{helping~message: shape~subsection / unknown} },
}

\keys_define:nn { gotham / font }
{
	% format subsubsection
	format~subsubsection .choice:,
	format~subsubsection .usage:n = { general },
	format~subsubsection .default:n = { regular },
	format~subsubsection / regular .code:n =
	{
		\let\gotham@subsubsectiontitleformat\@empty
		% \cs_set_eq:NN \__gotham_subsubsection_title_format:n \__gotham_unchanged:n
	},
	format~subsubsection / lower .code:n =
	{
		\let\gotham@subsubsectiontitleformat \text_lowercase:n %\lowercase
		% \cs_set_eq:NN \__gotham_subsubsection_title_format:n \text_lowercase:n
		\PackageWarning{ gotham } { Be~aware~that~format~subsubsection=lower~can~lead~to~problems. }
	},
	format~subsubsection / upper .code:n =
	{
		\let\gotham@subsubsectiontitleformat \text_uppercase:n %\uppercase
		% \cs_set_eq:NN \__gotham_subsubsection_title_format:n \text_uppercase:n
		\PackageWarning{ gotham } { Be~aware~that~format~subsubsection=upper~can~lead~to~problems. }
	},
	format~subsubsection / titlecase .code:n =
	{
		\let\gotham@subsubsectiontitleformat\text_titlecase_all:n %\Maketitlecase
		% \cs_set_eq:NN \__gotham_subsubsection_title_format:n \text_titlecase_all:n
		\PackageWarning{ gotham } { Be~aware~that~format~subsubsection=titlecase~can~lead~to~problems. }
	},
	format~subsubsection / unknown .code:n = { \PackageWarning{ gotham } { The~choice~'\l_keys_value_tl'~is~unknown~for~the~(known)~option~'\l_keys_key_tl',~so~being~ignored. }{helping~message: format~subsubsection / unknown} },
}
\keys_define:nn { gotham / font }
{
	% shape subsubsection
	shape~subsubsection .choice:,
	shape~subsubsection .usage:n = { general },
	shape~subsubsection .default:n = { regular },
	shape~subsubsection / regular .code:n =
	{
		\setbeamerfont{subsubsection~title}{shape=\normalfont}
	},
	shape~subsubsection / smallcaps .code:n =
	{
		\setbeamerfont{subsubsection~title}{shape=\scshape}
	},
	shape~subsubsection / italic .code:n =
	{
		\setbeamerfont{subsubsection~title}{shape=\itshape}
	},
	shape~subsubsection / unknown .code:n = { \PackageWarning{ gotham } { The~choice~'\l_keys_value_tl'~is~unknown~for~the~(known)~option~'\l_keys_key_tl',~so~being~ignored. }{helping~message: shape~subsubsection / unknown} },
}
%    \end{macrocode}
% \end{macro}
% \end{implementation}

% \begin{implementation}
% 	\begin{macro}{Default font keys}
%		Apply default key options.
% 		\UnitTested
% 		\TestFiles{gotham-test-035}
%    \begin{macrocode}
% when no value is given, default is called.
\keys_set:nn { gotham / font } {
	format~title, shape~title,
	format~subtitle, shape~subtitle,
	format~frametitle, shape~frametitle,
	format~framesubtitle, shape~framesubtitle,
	format~part, shape~part,
	format~section, shape~section,
	format~subsection, shape~subsection,
	format~subsubsection, shape~subsubsection,
}
%    \end{macrocode}
% \end{macro}
% \end{implementation}

% \begin{implementation}
% 	\begin{macro}{Process font keys}
%		Process package options.
% 		\UnitTested
% 		\TestFiles{gotham-test-035}
%    \begin{macrocode}
\ProcessKeyOptions[ gotham / font ]
%    \end{macrocode}
% \end{macro}
% \end{implementation}
%
% \begin{implementation}
%    \begin{macrocode}
%\endinput
%</font>
%    \end{macrocode}
% \end{implementation}
%
%
% ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
%
%\begin{implementation}
%    \begin{macrocode}
%<*color>
\ProvidesExplPackage{beamercolorthemegotham}{2026-04-02}{1.2.5.a}{Gotham color theme}
\RequirePackage{expl3}
% \RequirePackage{xparse}
\RequirePackage{xcolor}
%    \end{macrocode}
% \end{implementation}
%
%
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%%%%%%%%%%%%   COLOR     %%%%%%%%%%%%%
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%
% \begin{implementation}
% 	\begin{variable}{\definecolor[named]{gAnthracite}, colors definition}
%		Definition of the Gotham colors.
%    \begin{macrocode}
\definecolor[named]{gLightOrange}{HTML}{EB811B}
\definecolor[named]{gLightGreen}{HTML}{14B03D}
\definecolor[named]{gDeepBlue}{RGB}{42, 42, 255}
\definecolor[named]{gDeepYellOr}{RGB}{255, 204, 0}
\definecolor[named]{gAnthracite}{HTML}{2d3e50}
\definecolor[named]{gLightTeal}{RGB}{172, 195, 210}
\definecolor[named]{gPaleYell}{RGB}{255, 255, 240}
\definecolor[named]{gDarkBlack}{gray}{0.1}
\definecolor[named]{gDarkGrey}{gray}{0.25}
\definecolor[named]{gMidGrey}{gray}{0.5}
\definecolor[named]{gLightGrey}{gray}{0.9}
%    \end{macrocode}
% \end{variable}
% \end{implementation}

% \begin{documentation}
% \begin{variable}{\colorlet{colorPale}, set gotham palette colors}
%	\begin{syntax}
% 		\cs{colorlet} \marg{colorPale} \marg{gPaleYell}
% 		\cs{colorlet} \marg{colorDark} \marg{gDarkBlack}
% 		\cs{colorlet} \marg{colorA} \marg{gAnthracite}
% 		\cs{colorlet} \marg{colorAreversed} \marg{gLightTeal}
% 		\cs{colorlet} \marg{colorB} \marg{gMidGrey}
% 		\cs{colorlet} \marg{colorC} \marg{gDeepYellOr}
% 		\cs{colorlet} \marg{colorD} \marg{gLightOrange}
% 		\cs{colorlet} \marg{colorE} \marg{gLightGreen}
%	\end{syntax}
%	Setup the colors use for presentations:
% 	\begin{itemize}
% 		\item	|colorPale| is used for BG in light mode
% 		\item	|colorDark| is used for FG in light mode
% 		\item	|colorA| is used for frametitle and standout BG in light mode
% 		\item	|colorAreversed| is used for frametitle and standout BG in dark mode
% 		\item	|colorB| is used for progress bar and blocks BG
% 		\item	|colorC| is used for progress bar FG
% 		\item	|colorD| is used for alert FG/BG depending on the block mode
% 		\item	|colorE| is used for example FG/BG depending on the block mode
%	\end{itemize}
% \end{variable}
% \end{documentation}
%%%%%%
% \begin{implementation}
% 	\begin{variable}{\colorlet{colorPale}, set gotham palette colors}
%		A set Gotham palette: a list of color variables easily adapted.
%    \begin{macrocode}
% Define the color palette
\@ifundefined{\string\color@colorAreversed}{
	% default colorset.
	\colorlet{colorPale}{gPaleYell} % BG in light/normal mode
	\colorlet{colorDark}{gDarkBlack} % FG in light/normal mode
	\colorlet{colorA}{gAnthracite} % frametitle, standin.out,
	\colorlet{colorAreversed}{gLightTeal} % frametitle, standin.in,
	\colorlet{colorB}{gMidGrey} % gray BG : progress bar, blocks
	\colorlet{colorC}{gDeepYellOr} % progress bar
	\colorlet{colorD}{gLightOrange} % alert
	\colorlet{colorE}{gLightGreen} % example
}{
	% else nothing to do, colors are already defined.
}
\providecommand{\gothamHookPostColorBGSet}{}
%    \end{macrocode}
% \end{variable}
% \end{implementation}

% \begin{documentation}
% \begin{variable}{\colorlet{colorBG}{colorPale}, set functional colors}
%	\begin{syntax}
% 		\cs{colorlet} \marg{colorBG} \marg{colorPale}
% 		\cs{colorlet} \marg{colorFG} \marg{colorDark}
% 		\cs{colorlet} \marg{colorFrametitle} \marg{colorA}
% 		\cs{colorlet} \marg{colorStandout} \marg{colorA}
% 		\cs{colorlet} \marg{colorStandin} \marg{colorA}
% 		\cs{colorlet} \marg{colorTitlepage} \marg{colorA}
% 		\cs{colorlet} \marg{colorFiligrane} \marg{colorB}
% 		\cs{colorlet} \marg{colorBackElement} \marg{colorB}
% 		\cs{colorlet} \marg{colorProgBar} \marg{colorC}
% 		\cs{colorlet} \marg{colorAlert} \marg{colorD}
% 		\cs{colorlet} \marg{colorExample} \marg{colorE}
%	\end{syntax}
%	Setup the default color aliases used in the presentation theme definitions.
%	These aliases are partly redefined by dark/light/transparent modes.
% \end{variable}
% \end{documentation}
%%%%%%
% \begin{implementation}
% 	\begin{variable}{\colorlet{colorBG}{colorPale}, set functional colors}
%		A set of variable easily adapted.
%    \begin{macrocode}
% Define the color palette
\colorlet{colorFG}{colorDark}
\colorlet{colorBG}{colorPale}
\colorlet{colorStandin}{colorPale}
\colorlet{colorStandout}{colorA}
\colorlet{colorFrametitle}{colorA}
\colorlet{colorTitlepage}{colorA}
\colorlet{colorFiligrane}{colorB}
\colorlet{colorBackElement}{colorB}
\colorlet{colorProgBar}{colorC}
\colorlet{colorAlert}{colorD}
\colorlet{colorExample}{colorE}
%    \end{macrocode}
% \end{variable}
% \end{implementation}

% \begin{implementation}
% 	\begin{variable}{\l__gotham_color_assignation_prop:}
%		Define a map of color names used internally to the color set elements.
% 		\changes{v1.2.3}{2025-11-04}{New}
%    \begin{macrocode}
\prop_if_exist:NTF \l__gotham_color_assignation_prop
{}{
	% if not defined than define it.
	\prop_new:N \l__gotham_color_assignation_prop

	% Key value (by default)
	\prop_put:Nnn \l__gotham_color_assignation_prop {colorFG} {colorDark}
	\prop_put:Nnn \l__gotham_color_assignation_prop {colorBG} {colorPale}
	\prop_put:Nnn \l__gotham_color_assignation_prop {colorStandin} {colorPale}
	\prop_put:Nnn \l__gotham_color_assignation_prop {colorStandout} {colorA}
	\prop_put:Nnn \l__gotham_color_assignation_prop {colorFrametitle} {colorA}
	\prop_put:Nnn \l__gotham_color_assignation_prop {colorTitlepage} {colorA}
	\prop_put:Nnn \l__gotham_color_assignation_prop {colorFiligrane} {colorB}
	\prop_put:Nnn \l__gotham_color_assignation_prop {colorBackElement} {colorB}
	\prop_put:Nnn \l__gotham_color_assignation_prop {colorProgBar} {colorC}
	\prop_put:Nnn \l__gotham_color_assignation_prop {colorAlert} {colorD}
	\prop_put:Nnn \l__gotham_color_assignation_prop {colorExample} {colorE}
}
%    \end{macrocode}
% \end{variable}
% \end{implementation}


% \begin{implementation}
% 	\begin{function}{\__gotham_reload_color:}
%		Command to reassign a color names used internally to its corresponding color element of the set.
%		This reassignation is done through the dedicated map.
% 		\changes{v1.2.3}{2025-11-04}{New}
% 		\TestFiles{gotham-test-1040}
%    \begin{macrocode}
\cs_new_protected:Nn \__gotham_reload_color:{
	\colorlet{colorFG}{\prop_item:Nn \l__gotham_color_assignation_prop {colorFG}}
	\colorlet{colorBG}{\prop_item:Nn \l__gotham_color_assignation_prop {colorBG}}
	\colorlet{colorStandin}{\prop_item:Nn \l__gotham_color_assignation_prop {colorStandin}}
	\colorlet{colorStandout}{\prop_item:Nn \l__gotham_color_assignation_prop {colorStandout}}
	\colorlet{colorFrametitle}{\prop_item:Nn \l__gotham_color_assignation_prop {colorFrametitle}}
	\colorlet{colorTitlepage}{\prop_item:Nn \l__gotham_color_assignation_prop {colorTitlepage}}
	\colorlet{colorFiligrane}{\prop_item:Nn \l__gotham_color_assignation_prop {colorFiligrane}}
	\colorlet{colorBackElement}{\prop_item:Nn \l__gotham_color_assignation_prop {colorBackElement}}
	\colorlet{colorProgBar}{\prop_item:Nn \l__gotham_color_assignation_prop {colorProgBar}}
	\colorlet{colorAlert}{\prop_item:Nn \l__gotham_color_assignation_prop {colorAlert}}
	\colorlet{colorExample}{\prop_item:Nn \l__gotham_color_assignation_prop {colorExample}}
}
%    \end{macrocode}
% \end{function}
% \end{implementation}

% \begin{documentation}
% \begin{function}{\gothamReloadColors}
%	\begin{syntax}
%		 \cs{gothamReloadColors}
%	\end{syntax}
%	Command to reassign a color names used internally to its corresponding color element of the set.
% \end{function}
% \end{documentation}
%%%%%%
% \begin{implementation}
% 	\begin{function}{\gothamReloadColors}
%		Command accessible to users to call the reassignation of color names used internally.
% 		\changes{v1.2.3}{2025-11-04}{New}
% 		\TestFiles{gotham-test-1040}
%    \begin{macrocode}
\providecommand{\gothamReloadColors}{
	\__gotham_reload_color:
}
%    \end{macrocode}
% \end{function}
% \end{implementation}

% \begin{implementation}
% 	\begin{function}{\__gotham_color_set_style_anthracite:}
%		Command to activate anthracite colorset.
% 		\changes{v1.2.3}{2025-11-04}{reload all colors from function}
% 		\TestFiles{gotham-test-1037}
%    \begin{macrocode}
\cs_new_protected:Nn \__gotham_color_set_style_anthracite:{
	\colorlet{colorPale}{gPaleYell} % BG in light/normal mode
	\colorlet{colorDark}{gDarkBlack} % FG in light/normal mode
	\colorlet{colorA}{gAnthracite} % frametitle, standin.out,
	\colorlet{colorAreversed}{gLightTeal} % frametitle, standin.in,
	\colorlet{colorB}{gMidGrey} % gray BG : progress bar, blocks
	\colorlet{colorC}{gDeepYellOr} % progress bar
	\colorlet{colorD}{gLightOrange} % alert
	\colorlet{colorE}{gLightGreen} % example
	\__gotham_reload_color:
}
%    \end{macrocode}
% \end{function}
% \end{implementation}

% \begin{implementation}
% 	\begin{function}{\__gotham_color_set_style_red:}
%		Command to activate red colorset.
% 		\changes{v1.2.3}{2025-11-04}{reload all colors from function}
% 		\TestFiles{gotham-test-1037, gotham-test-1040}
%    \begin{macrocode}
\cs_new_protected:Nn \__gotham_color_set_style_red:{
	\colorlet{colorPale}{gPaleYell} % BG in light/normal mode
	\colorlet{colorDark}{gDarkBlack} % FG in light/normal mode
	\colorlet{colorA}{red} % frametitle, standin.out,
	\colorlet{colorAreversed}{gLightTeal} % frametitle, standin.in,
	\colorlet{colorB}{gMidGrey} % gray BG : progress bar, blocks
	\colorlet{colorC}{gDeepYellOr} % progress bar
	\colorlet{colorD}{gLightOrange} % alert
	\colorlet{colorE}{gLightGreen} % example
	\__gotham_reload_color:
}
%    \end{macrocode}
% \end{function}
% \end{implementation}


% \begin{implementation}
% 	\begin{variable}{\providebool{darkBG}, \providebool{transparentBG}}
%		Variable to track color setup.
%    \begin{macrocode}
% \providebool{reversedColor}
% \boolfalse{reversedColor}
\providebool{darkBG}
\boolfalse{darkBG}
\providebool{transparentBG}
\booltrue{transparentBG}
%    \end{macrocode}
% \end{variable}
% \end{implementation}

% \begin{implementation}
% 	\begin{function}{\__gotham_color_set_darkBG:}
%		Command to activate dark mode
% 		\changes{v1.2.0}{2024-11-11}{add hook after colorset}
% 		\changes{v1.2.2}{2025-07-02}{reload all colors to apply changes from users}
% 		\changes{v1.2.3}{2025-11-04}{change map and reload all colors from function}
% 		\TestFiles{gotham-test-037, gotham-test-1037, gotham-test-055}
%    \begin{macrocode}
\cs_new_protected:Nn \__gotham_color_set_darkBG:{
	\booltrue{darkBG}
	\boolfalse{transparentBG}
	\prop_put:Nnn \l__gotham_color_assignation_prop {colorStandin} {colorFG}
	\prop_put:Nnn \l__gotham_color_assignation_prop {colorStandout} {colorAreversed}
	\prop_put:Nnn \l__gotham_color_assignation_prop {colorFrametitle} {colorAreversed}
	\prop_put:Nnn \l__gotham_color_assignation_prop {colorTitlepage} {colorAreversed}

	%%% adapt and reload
	\__gotham_reload_color:

	%%% dark
	\setbeamercolor{normal~text}{
		fg=colorBG,
		bg=colorFG,
	}
	\usebeamercolor[fg]{normal~text}
	\setbeamercolor{primary~palette}{
		% reversed color compared to normal text
		use=normal~text,
		fg=normal~text.bg,
		bg=normal~text.fg
	}
	\gothamHookPostColorBGSet{}
}
%    \end{macrocode}
% \end{function}
% \end{implementation}

% \begin{implementation}
% 	\begin{function}{\__gotham_color_set_lightBG:}
%		Command to activate light background.
% 		\changes{v1.2.0}{2024-11-11}{add hook after colorset}
% 		\changes{v1.2.2}{2025-07-02}{reload all colors to apply changes from users}
% 		\changes{v1.2.3}{2025-11-04}{change map and reload all colors from function}
% 		\TestFiles{gotham-test-037, gotham-test-1037, gotham-test-055}%    \begin{macrocode}
\cs_new_protected:Nn \__gotham_color_set_lightBG:{
	\boolfalse{darkBG}
	\boolfalse{transparentBG}
	\prop_put:Nnn \l__gotham_color_assignation_prop {colorStandin} {colorBG}
	\prop_put:Nnn \l__gotham_color_assignation_prop {colorStandout} {colorA}
	\prop_put:Nnn \l__gotham_color_assignation_prop {colorFrametitle} {colorA}
	\prop_put:Nnn \l__gotham_color_assignation_prop {colorTitlepage} {colorA}

	%%% adapt and reload
	\__gotham_reload_color:

	%%% light
	\setbeamercolor{normal~text}{
		fg=colorFG,
		bg=colorBG
	}
	\usebeamercolor[fg]{normal~text}
	\setbeamercolor{primary~palette}{
		% reversed color compared to normal text
		use=normal~text,
		fg=normal~text.bg,
		bg=normal~text.fg
	}
	\gothamHookPostColorBGSet{}
}
%    \end{macrocode}
% \end{function}
% \end{implementation}

% \begin{implementation}
% 	\begin{function}{\__gotham_color_set_transparentBG:}
%		Command to activate transparent background.
% 		\changes{v1.2.0}{2024-11-11}{add hook after colorset}
% 		\changes{v1.2.2}{2025-07-02}{reload all colors to apply changes from users}
% 		\changes{v1.2.3}{2025-11-04}{change map and reload all colors from function}
% 		\TestFiles{gotham-test-037, gotham-test-1037, gotham-test-055}%    \begin{macrocode}
% \providecommand{\gotham@colors@transparent}{
\cs_new_protected:Nn \__gotham_color_set_transparentBG:{
	\boolfalse{darkBG}
	\booltrue{transparentBG}
	{\usebeamercolor[bg]{normal~text}\colorlet{colorStandin}{bg}}% this is not working because the colorlet is not kept outside of the {} environment...
	% \usebeamercolor{normal~text} % reset % NOT working neither
	\prop_put:Nnn \l__gotham_color_assignation_prop {colorStandin} {colorBG} % since the two previous lines are not working, let define it like light-bg
	\prop_put:Nnn \l__gotham_color_assignation_prop {colorStandout} {colorA}
	\prop_put:Nnn \l__gotham_color_assignation_prop {colorFrametitle} {colorA}
	\prop_put:Nnn \l__gotham_color_assignation_prop {colorTitlepage} {colorA}

	%%% adapt and reload
	\__gotham_reload_color:

	%%% transparent like light background.
	\setbeamercolor{normal~text}{
		fg=colorFG,
		bg=,
	}
	\usebeamercolor[fg]{normal~text}
	\setbeamercolor{primary~palette}{
		% reversed color compared to normal text
		use=normal~text,
		fg=colorBG,
		bg=normal~text.fg
	}
	\gothamHookPostColorBGSet{}
}
%    \end{macrocode}
% \end{function}
% \end{implementation}

% \begin{implementation}
% 	\begin{function}{\__gotham_color_set_transparent_block:}
%		Command to activate transparent block.
% 		\TestFiles{gotham-test-037}
%    \begin{macrocode}
\cs_new_protected:Nn \__gotham_color_set_transparent_block:{
	\setbeamercolor{block~title}{
		use=normal~text,
		fg=normal~text.fg,
		bg=
	}
	\setbeamercolor{block~body}{
		bg=
	}
	\setbeamercolor{alerted~text}{
		fg=colorAlert
	}
	\setbeamercolor{example~text}{
		fg=colorExample
	}
	\setbeamercolor{block~title~example}{
		use={block~title, example~text},
		bg=block~title.bg,
		fg=example~text.fg
	}
	\setbeamercolor{block~title~alerted}{
		use={block~title, alerted~text},
		bg=block~title.bg,
		fg=alerted~text.fg
	}
}
%    \end{macrocode}
% \end{function}
% \end{implementation}

% \begin{implementation}
% 	\begin{function}{\__gotham_color_set_fill_block:}
%		Command to activate fill block.
% 		\TestFiles{gotham-test-037}
%    \begin{macrocode}
\cs_new_protected:Nn \__gotham_color_set_fill_block:{
	\setbeamercolor{block~title}{
		fg=colorBackElement!10!normal~text.fg,
		bg=colorBackElement!135!fg
	}
	\setbeamercolor{block~body}{
		use={block~title, normal~text},
		bg=block~title.bg!50!normal~text.bg
	}
	\setbeamercolor{alerted~text}{
		fg=colorAlert
	}
	\setbeamercolor{example~text}{
		fg=colorExample
	}
	\setbeamercolor{block~title~example}{
		use={block~title, example~text},
		bg=block~title.bg,
		fg=example~text.fg
	}
	\setbeamercolor{block~title~alerted}{
		use={block~title, alerted~text},
		bg=block~title.bg,
		fg=alerted~text.fg
	}
}%    \end{macrocode}
% \end{function}
% \end{implementation}

% \begin{implementation}
% 	\begin{function}{\__gotham_color_set_native_block:}
%		Command to activate native block.
% 		\TestFiles{gotham-test-037}
%    \begin{macrocode}
\cs_new_protected:Nn \__gotham_color_set_native_block:{
	\setbeamercolor{block~title}{
		fg=colorPale,
		bg=colorBackElement!90!fg
	}
	\setbeamercolor{block~body}{
		use={block~title, normal~text},
		bg=block~title.bg!50!normal~text.bg
	}
	\setbeamercolor{alerted~text}{
		fg=colorAlert
	}
	% With native block, we have to let alerted text with a visible color (not pale) to keep alert visible (cf test-1005).
	% So, we have to create an extra color: alertedBlock~text.
	\setbeamercolor{alertedBlock~text}{
		fg=colorPale
	}
	\setbeamercolor{example~text}{
		fg=colorPale
	}
	\setbeamercolor{block~title~alerted}{
		use={block~title, alertedBlock~text},
		bg=colorAlert,
		fg=alertedBlock~text.fg
	}
	\setbeamercolor{block~title~example}{
		use={block~title, example~text},
		bg=colorExample,
		fg=example~text.fg
	}
}
%    \end{macrocode}
% \end{function}
% \end{implementation}

% \begin{implementation}
% 	\begin{macro}{Gotham color adaptation}
%		Set colors variable from Gotham color setup that needs specific adaptation, i.e. |structure| as mentioned in Beamer documentation and |progress bar| since it is a new feature.
% 		\UnitTested
% 		\TestFiles{gotham-test-037}
%    \begin{macrocode}
\setbeamercolor{structure}{use=normal~text, fg=normal~text.fg}
\setbeamercolor{progress~bar}{
	use=alerted~text,
	fg=colorProgBar,
	bg=alerted~text.fg!50!black!30
}
%    \end{macrocode}
% \end{macro}
% \end{implementation}

% \begin{implementation}
% 	\begin{macro}{Usual color env}
%		Set colors variable from Gotham color setup.
% 		The titles and structural elements (e.g. |itemize| bullets) are set in the same color as |normal text|.
%		This would ideally done by setting |normal text| as a parent style, which we do to set |titlelike|, but this doesn't work for |structure| as its foreground is set explicitly in |beamercolorthemedefault.sty|.
% 		\UnitTested
% 		\TestFiles{gotham-test-037}
%    \begin{macrocode}
\setbeamercolor{titlelike}{use=normal~text, parent=normal~text}
\setbeamercolor{author}{use=normal~text, parent=normal~text}
\setbeamercolor{date}{use=normal~text, parent=normal~text}
\setbeamercolor{institute}{use=normal~text, parent=normal~text}
\setbeamercolor{frametitle}{
	use=primary~palette,
	parent=primary~palette,
	bg=colorFrametitle
}
% The Gotham inner or outer themes optionally display progress bars in various locations.
% Their color is set by |progress bar| but the two different kinds can be customized separately.
% The horizontal rule on the title page is also set based on the progress bar color and can be customized with |title separator|.
\setbeamercolor{title~separator}{
	use=progress~bar,
	parent=progress~bar
}
\setbeamercolor{progress~bar~in~head/foot}{%
	use=progress~bar,
	parent=progress~bar
}
\setbeamercolor{progress~bar~in~part~page}{
	use=progress~bar,
	parent=progress~bar
}
\setbeamercolor{progress~bar~in~section~page}{
	use=progress~bar,
	parent=progress~bar
}
\setbeamercolor{progress~bar~in~splitvert}{
	use=progress~bar,
	parent=progress~bar
}
% \setbeamercolor{progress~bar~in~subsection~page}{
% 	use=progress~bar,
% 	parent=progress~bar
% }
% \setbeamercolor{progress~bar~in~subsubsection~page}{
% 	use=progress~bar,
% 	parent=progress~bar
% }
%
% Blocks
\setbeamercolor{block~body~alerted}{use=block~body, parent=block~body}
\setbeamercolor{block~body~example}{use=block~body, parent=block~body}
%
% Footnote
\setbeamercolor{footnote}{fg=normal~text.fg!90}
\setbeamercolor{footnote~mark}{fg=.}
%
% Bibliography
%
% We also reset the bibliography colors in order to pick up the surrounding colors at the time of use.
% This prevents us having to set the correct color in normal and standout mode.
% \setbeamercolor{bibliography entry author}{fg=, bg=}
% \setbeamercolor{bibliography entry title}{fg=, bg=}
% \setbeamercolor{bibliography entry location}{fg=, bg=}
% \setbeamercolor{bibliography entry note}{fg=, bg=}
%    \end{macrocode}
% \end{macro}
% \end{implementation}

% \begin{implementation}
% 	\begin{macro}{new color environments}
%		Set up colors for the the new beamer environment used by the theme.
% 		\UnitTested
% 		\TestFiles{gotham-test-037}
%    \begin{macrocode}
% \setbeamercolor{frametitleSection}{use=primary~palette, bg=, fg=primary~palette.bg}
\setbeamercolor{frametitleSection}{use=structure,fg=structure.bg}

\setbeamercolor{standout}{use=primary~palette, bg=colorStandout, fg=primary~palette.bg}
\setbeamercolor{standin}{use=normal~text, bg=colorStandin, fg=normal~text.fg}

\setbeamercolor{section~in~toc}{use=normal~text, parent=normal~text,}
\setbeamercolor{subsection~in~toc}{use=normal~text, parent=normal~text,}
\setbeamercolor{subsubsection~in~toc}{use=normal~text, parent=normal~text,}
\setbeamercolor{footlineRule}{use=normal~text, parent=normal~text,}
%    \end{macrocode}
% \end{macro}
% \end{implementation}

% \begin{documentation}
% \begin{function}{\usecolortheme}
%	\begin{syntax}
%		\cs{usecolortheme}\oarg{option1=value1, ...}\marg{gotham}
%		\textrm{where the options are (default marked as} \defopt{default}\textrm{):}
% 		\meta{background} = \oarg{\defopt{transparent} \textbar light \textbar dark}
%		\meta{block} = \oarg{\defopt{native} \textbar fill \textbar transparent}
%     \meta{colorset} = \oarg{\defopt{anthracite} \textbar red }
%	\end{syntax}
%	The 'package' (usecolortheme) options can control color mode (dark, ligh or transparent background) and the block (native or fill or transparent).
% 	Block environments such as |theorem| and |example| have no background color by default.
% 	The option |block=fill| sets a background color based on the background and foreground of |normal text|.
% 	The option |block=transparent| reverts the block environments to an empty background, which can be useful if changing colors mid-presentation.
% 	The option |colorset=red| changes the colorset used to define a color theme.
% \end{function}
% \end{documentation}
%%%%
% \begin{implementation}
% 	\begin{macro}{color key -- interface}
% 		Controls the background mode (dark, ligh or transparent background) and the block (fill or transparent) and colorset (anthracite, red, blue, green, etc).
% 		\UnitTested
% 		\TestFiles{gotham-test-037}
%    \begin{macrocode}
\keys_define:nn { gotham / color }
{
	% block
	block .choice:,
	block .usage:n = { general },
	block .default:n = { native },
	block / native .code:n = { \__gotham_color_set_native_block: },
	block / transparent .code:n = { \__gotham_color_set_transparent_block: },
	block / fill .code:n = { \__gotham_color_set_fill_block: },
	block / unknown .code:n = { \PackageWarning{ gotham } { The~choice~'\l_keys_value_tl'~is~unknown~for~the~(known)~option~'\l_keys_key_tl',~so~being~ignored. }{helping~message: block / unknown} },
}

\keys_define:nn { gotham / color }
{
	% background
	background .choice:,
	background .usage:n = { general },
	background .default:n = { transparent },
	background / transparent .code:n = { \__gotham_color_set_transparentBG: },
	background / light .code:n = { \__gotham_color_set_lightBG: },
	background / dark .code:n = { \__gotham_color_set_darkBG: },
	background / unknown .code:n = { \PackageWarning{ gotham } { The~choice~'\l_keys_value_tl'~is~unknown~for~the~(known)~option~'\l_keys_key_tl',~so~being~ignored. }{helping~message: background / unknown} },
}

\keys_define:nn { gotham / color }
{
	% colorset
	colorset .choice:,
	colorset .usage:n = { general },
	colorset .default:n = { anthracite },
	colorset / anthracite .code:n = { \__gotham_color_set_style_anthracite: },
	colorset / red .code:n = { \__gotham_color_set_style_red: },
	% colorset / blue .code:n = {  },
	% colorset / green .code:n = {  },
	% colorset / orange .code:n = {  },
	% colorset / teal .code:n = {  },
	colorset / unknown .code:n = { \PackageWarning{ gotham } { The~choice~'\l_keys_value_tl'~is~unknown~for~the~(known)~option~'\l_keys_key_tl',~so~being~ignored. }{helping~message: colorset / unknown} },
}
%    \end{macrocode}
% \end{macro}
% \end{implementation}

% \begin{implementation}
% 	\begin{macro}{Default color keys}
%		Apply default key options.
% 		\UnitTested
% 		\TestFiles{gotham-test-037}
%    \begin{macrocode}
% when no value is given, default is called.
\keys_set:nn { gotham / color } { background, block, colorset }
%    \end{macrocode}
% \end{macro}
% \end{implementation}

% \begin{implementation}
% 	\begin{macro}{Process color keys}
%		Process package options.
% 		\UnitTested
% 		\TestFiles{gotham-test-037}
%    \begin{macrocode}
\ProcessKeyOptions[ gotham / color ]
\mode<all>
%    \end{macrocode}
% \end{macro}
% \end{implementation}
%
%
% \begin{implementation}
%    \begin{macrocode}
%\endinput
%</color>
%    \end{macrocode}
% \end{implementation}
%
% ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
%
%
%\begin{implementation}
%    \begin{macrocode}
%<*inner>
\ProvidesExplPackage{beamerinnerthemegotham}{2026-04-02}{1.2.5.a}{gotham inner theme}
\RequirePackage{expl3}
% \RequirePackage{xparse}
\RequirePackage{calc}
% \RequirePackage{xfp}
\RequirePackage{tikz}
%    \end{macrocode}
% \end{implementation}
%
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%%%%%%%%%%%%   INNER     %%%%%%%%%%%%%
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%
% \begin{implementation}
% A |beamer| inner theme dictates the style of the frame elements traditionally set in the ``body'' of each slide. These include:
% \begin{itemize}
%   \item title page;
% 	 \item backgrounds;
% 	 \item standin/out;
% 	 \item part, section etc, pages;
% 	 \item table of content pages (including for sections...);
%   \item environement elements: \begin{itemize}
% 		\item itemize, enumerate, and description environments;
% 		\item block environments including theorems and proofs;
%		\item figures and tables; and
%		\item footnotes and plain text.
% 	 \end{itemize}
% \end{itemize}
% \end{implementation}
%
%

%%%  Titlepage  %%%
%%%%%%%%%%%%%%%%%%%
%
% \begin{implementation}
%  \begin{macro}{Compitibility mode for colors}
% 	 FROM COLOR THEME: useful to provide this recall when the inner theme is loaded without the color theme.
%    \begin{macrocode}
\@ifundefined{\string\color@colorProgBar}{
	\providebool{darkBG} \boolfalse{darkBG}
	\providebool{transparentBG} \booltrue{transparentBG}
	\colorlet{colorBG}{white}
	\colorlet{colorFG}{black}
	\colorlet{colorFrametitle}{purple}
	\colorlet{colorStandout}{purple}
	\colorlet{colorStandin}{purple}
	\colorlet{colorTitlepage}{purple}
	\colorlet{colorFiligrane}{gray}
	\colorlet{colorBackElement}{gray}
	\colorlet{colorProgBar}{orange}
	\colorlet{colorAlert}{red}
	\colorlet{colorExample}{green}
	\setbeamercolor{progress~bar}{
		use=alerted~text,
		fg=colorProgBar,
		bg=alerted~text.fg!50!black!30
	}
	\setbeamercolor{progress~bar~in~head/foot}{%
		use=progress~bar,
		parent=progress~bar
	}
	\setbeamercolor{progress~bar~in~part~page}{
		use=progress~bar,
		parent=progress~bar
	}
	\setbeamercolor{progress~bar~in~section~page}{
		use=progress~bar,
		parent=progress~bar
	}
	\setbeamercolor{progress~bar~in~splitvert}{
		use=progress~bar,
		parent=progress~bar
	}
	\setbeamercolor{frametitleSection}{use=primary~palette, bg=, fg=primary~palette.bg}
	\setbeamercolor{standout}{use=primary~palette, bg=colorStandout, fg=primary~palette.bg}
	\setbeamercolor{standin}{use=normal~text, bg=colorStandin, fg=normal~text.fg}
	\setbeamercolor{section~in~toc}{use=normal~text, parent=normal~text,}
	\setbeamercolor{subsection~in~toc}{use=normal~text, parent=normal~text,}
	\setbeamercolor{subsubsection~in~toc}{use=normal~text, parent=normal~text,}
}{
	% else the colors are defined: this is fine.
}
%    \end{macrocode}
%  \end{macro}
% \end{implementation}

% \begin{implementation}
%  \begin{macro}{\maketitle,\titlepage}
% 		Normal people should use |\maketitle| or |\titlepage| instead of using the |title page| beamer template directly.
% 		Beamer already defines these macros, but we patch them here to make the title page |[plain]| by default, remove |\@thanks|, and ensure the title frame number doesn't count.
%   	Inserts the title frame, or causes the current frame to use the |title page| template.
% 		\changes{v1.2.0}{2024-11-11}{add vertically centered}
% 		\UnitTested
% 		\TestFiles{gotham-test-038}
%    \begin{macrocode}
\def\maketitle{
	\ifbeamer@inframe
		\titlepage
	\else
		\frame[plain, c, noframenumbering]{\titlepage}
	\fi
}
\def\titlepage{
	% \setkeys{beamerframe}{c} % no effect
	% \setkeys{beamerframe}{plain} % no effect
	% \setbeamertemplate{footline}[empty] % no effect
	% \setkeys{beamerframe}{nofootline} % create error of unclosed env
	\usebeamertemplate{title~page}
}
%    \end{macrocode}
%  \end{macro}
% \end{implementation}

% \begin{implementation}
%  \begin{macro}{\defbeamertemplate{title~graphic}{gotham}}
%		Definition of elements templates that will be used in titlepage.
% 		\UnitTested
% 		\TestFiles{gotham-test-038}
%    \begin{macrocode}
\defbeamertemplate*{title~graphic}{gotham}{
	% \vbox to 0pt {% %%%%% MODIFIED !
	\vbox{
		% \vspace*{2em} %%%%% COMMENT ADDED !
		\inserttitlegraphic
	}
	\nointerlineskip
}
\defbeamertemplate*{title}{gotham}{
	%\raggedright% %%%%% COMMENT ADDED !
	\linespread{1.0}
	\inserttitle
	\par
	\vspace*{0.5em}
}
\defbeamertemplate*{subtitle}{gotham}{
	%\raggedright% %%%%% COMMENT ADDED !
	\insertsubtitle
	\par
	\vspace*{0.5em}
}
\defbeamertemplate*{author}{gotham}{
	\vspace*{1.em}
	\insertauthor
	\par
	\vspace*{0.25em}
}
\defbeamertemplate*{date}{gotham}{
	\insertdate
	\par
}
\defbeamertemplate*{institute}{gotham}{
	\vspace*{3mm}
	\insertinstitute
	\par
}
%    \end{macrocode}
%  \end{macro}
% \end{implementation}

% \begin{implementation}
%  \begin{variable}{\l__gotham_titleseparator_width_dim, \l__gotham_titleseparator_height_dim, \l__gotham_title_width_dim, \l__gotham_subtitle_width_dim, \l__gotham_title_max_width_dim}
%		Define the new lengths that will be used for titlepage templates.
%		\begin{macrocode}
\dim_new:N \l__gotham_titleseparator_width_dim
\dim_set:Nn \l__gotham_titleseparator_width_dim {\textwidth}
\dim_new:N \l__gotham_titleseparator_height_dim
\dim_set:Nn \l__gotham_titleseparator_height_dim {2pt}
% \newlength{\titlewidth}
% \newlength{\subtitlewidth}
% \newlength{\maxwidth}
\dim_new:N \l__gotham_title_width_dim
\dim_new:N \l__gotham_subtitle_width_dim
\dim_new:N \l__gotham_title_max_width_dim
%    \end{macrocode}
%  \end{variable}
% \end{implementation}

% \begin{implementation}
% 	\begin{variable}{\defbeamertemplate*{title~separator}{gotham}}
%		Define a new template for ``line'' displayed on some titlepage templates.
%		\begin{macrocode}
\defbeamertemplate*{title~separator}{gotham}{
	\begin{tikzpicture}
		% \fill[fg] (0,0) rectangle (\gotham@titleseparator@linewidth, \gotham@titleseparator@lineheight);
		\fill[fg] (0,0) rectangle
		(\dim_use:N \l__gotham_titleseparator_width_dim,
		\dim_use:N \l__gotham_titleseparator_height_dim);
	\end{tikzpicture}
	\par
}
%    \end{macrocode}
%  \end{variable}
% \end{implementation}

% \begin{documentation}
%	\begin{variable}{\gothamtitlepagelogo}
%		The command to insert the institute logo on title page.
%		This command is left empty by default, to be redefined by users
%	\end{variable}
% \end{documentation}
%%%%
% \begin{implementation}
% 	\begin{variable}{\gothamtitlepagelogo}
% 		\UnitTested
% 		\TestFiles{gotham-test-038}
%    \begin{macrocode}
\providecommand{\gothamtitlepagelogo}{}
%    \end{macrocode}
%  \end{variable}
% \end{implementation}

% \begin{documentation}
% 	\begin{variable}{\gothamtitlepagebg}
% 		The command to insert the background title page
%		This command is left empty by default, to be redefined by users
% 	\end{variable}
% \end{documentation}
%%%%%
% \begin{implementation}
% 	\begin{variable}{\gothamtitlepagebg}
% 		\UnitTested
% 		\TestFiles{gotham-test-038}
%    \begin{macrocode}
\providecommand{\gothamtitlepagebg}{}
%    \end{macrocode}
%  \end{variable}
% \end{implementation}

% \begin{implementation}
% 	\begin{macro}{\defbeamertemplate{title~page}{gotham~normal}}
% 		Template for the normal gotham title page.
% 		Each element is only typeset if it is defined by the user.
% 		If |\subtitle| is empty, for example, it won't leave a blank space on the title slide.
% 		\changes{v1.2.0}{2024-11-11}{length of subtitle}
% 		\changes{v1.2.3}{2025-07-27}{adapt margins}
% 		\UnitTested
% 		\TestFiles{gotham-test-038, gotham-test-056, gotham-test-1027}
%	 \begin{macrocode}

% Beamer's definition of |\insertauthor| is always nonempty, so we have to test another macro initialized by |\author{...}| to see if the user has defined an author.
% This solution was suggested by Sam Carter in an answer to \href{https://tex.stackexchange.com/questions/241306/}{this Stack Exchange question}.

\defbeamertemplate{title~page}{gotham~normal}{
	\ifx\insertframetitle\@empty\else\vspace*{-3em}\fi
	\begin{picture}(0,0)
		% the background covering the whole page
		\put(-30,-125){\noindent
			\fcolorbox{normal~text.bg}{normal~text.bg}{
				\begin{minipage}[b][\paperheight]{\paperwidth}
					\hfil
				\end{minipage}
			}
		}

		% The text: title, author, institute, etc.
		\put(-3.4,-125){\noindent
			\fcolorbox{normal~text.bg}{normal~text.bg}{
			\begin{minipage}[b][\paperheight]{\textwidth}
				\parbox[c][0pt][c]{0pt}{\gothamtitlepagebg}
				\centering
				\vfill
				\ifx\inserttitle\@empty\else
					\parbox{0.99\textwidth}{\centering
						\usebeamertemplate*{title}
					}\\[1.ex]
				\fi
				\ifx\insertsubtitle\@empty\else
					\parbox{0.99\textwidth}{\centering
						\usebeamertemplate*{subtitle}
					}\\[2.ex]
				\fi
				% \hspace*{-0pt}
				\usebeamertemplate*{title~separator}
				% from above patch
				\expandafter\ifblank\expandafter{\beamer@andstripped}{
					% empty author
					\vspace*{1.em}
				}{
					\usebeamertemplate*{author}
				}
				\ifx\insertdate\@empty\else\usebeamertemplate*{date}\fi
				\ifx\insertinstitute\@empty\else{\parbox{0.95\textwidth}{\raggedright\usebeamertemplate*{institute}} }\fi
				\vfill
				\vbox{}
			\end{minipage}
			}
			% end third argument of fcolorobx
		}

		% the institute logo on title page
		\put(234,-120){
			\gothamtitlepagelogo
		}

		% the extra logos on title page (\inserttitlegraphic)
		\put(0,-123){
			\noindent\vbox{
				\begin{minipage}[b][0.96\paperheight]{\paperwidth}
					\ifx\inserttitlegraphic\@empty\else\usebeamertemplate*{title~graphic}\fi
				\end{minipage}
			}
		}
	\end{picture}
}
%    \end{macrocode}
%  \end{macro}
% \end{implementation}

% \begin{implementation}
% 	\begin{macro}{\defbeamertemplate{title~page}{gotham~reversed}}
% 		With a similarly layout to gotham normal, but this template inverses the background and foreground colors compared to the color mode chose (dark, light or transparent).
% 		\UnitTested
% 		\TestFiles{gotham-test-038}
%	 \begin{macrocode}
\defbeamertemplate{title~page}{gotham~reversed}{
	\begin{picture}(0,0)
		% The background picture
		\put(-28,-128){\gothamtitlepagebg}

		% The text: title, author, institute, etc.
		\put(-3.4,-125){\noindent
			% \fcolorbox{declared-color-frame}{declared-color-background}{text}
			\ifbool{darkBG}{
				% Dark true
				\setbeamercolor{normal~text}{fg=colorFG, }
				\fcolorbox{colorPale}{colorPale}% reversed
			}{
				% Light
				\setbeamercolor{normal~text}{fg=colorBG, }
				\fcolorbox{colorTitlepage}{colorTitlepage}% reversed
			}% end if
			{
				% begin third argument of fcolorobx
				%\fcolorbox{normal~text.fg}{normal~text.fg}{
				\begin{minipage}[b][\paperheight]{\textwidth}
					\centering
					\vfill
					\ifx\inserttitle\@empty\else\usebeamertemplate*{title}\fi
					\ifx\insertsubtitle\@empty\else\usebeamertemplate*{subtitle}\fi
					\usebeamertemplate*{title~separator}
					\expandafter\ifblank\expandafter{\beamer@andstripped}{
						% empty author
						\vspace*{1.em}
					}{
						\usebeamertemplate*{author}
					}
					\ifx\insertdate\@empty\else\usebeamertemplate*{date}\fi
					\ifx\insertinstitute\@empty\else{\parbox{0.9\textwidth}{\raggedright\usebeamertemplate*{institute}} }\fi
					\vfill
					\vbox{}
				\end{minipage}
			}
			% end third argument of fcolorobx
		}

		% the institute logo on title page
		\put(234,-120){
			\gothamtitlepagelogo
		}

		% the extra logos on title page (\inserttitlegraphic)
		\put(-27,-123){
			\noindent\vbox{
				\begin{minipage}[b][0.96\paperheight]{0.899\textwidth}
				\ifx\inserttitlegraphic\@empty\else\usebeamertemplate*{title~graphic}\fi
				\end{minipage}
			}
		}
	\end{picture}
}
%    \end{macrocode}
%  \end{macro}
% \end{implementation}

% \begin{documentation}
%   \begin{variable}{\gothamDividedPicTop, \gothamDividedPicBottomIncr, \gothamDividedPicTextWidth}
%     variables controlling the dimensions of the splitting trapezoid on the title page for the gotham divided style.
%     |\gothamDividedPicTop| controls the distance between the top right corner and the top splitting point.
%     |\gothamDividedPicBottomIncr| controls the increment toward the left direction for the bottom splitting point.
%     |\gothamDividedPicTextWidth| controls the width of the text on the titlepage (for the divided style).
%   \end{variable}
% \end{documentation}
%%%%%%
% \begin{implementation}
%   \begin{variable}{\gothamDividedPicTop, \gothamDividedPicBottomIncr, \gothamDividedPicTextWidth}
%     variables controlling the dimensions of the trapezoid splitting the title page for the gotham divided style.
%    \begin{macrocode}
\newlength{\gothamDividedPicTop}
\newlength{\gothamDividedPicBottomIncr}
\setlength{\gothamDividedPicTop}{0.275\paperwidth}
\setlength{\gothamDividedPicBottomIncr}{0.275\paperwidth}
\newlength{\gothamDividedPicTextWidth}
\setlength{\gothamDividedPicTextWidth}{.55\textwidth}
%    \end{macrocode}
%   \end{variable}
% \end{implementation}

% \begin{implementation}
% 	\begin{macro}{defbeamertemplate{title~page}{gotham~dividedpic}}
% 		This title page template is inspired from \url{https://github.com/LukasPietzschmann/awesome-beamer}
% 		\changes{v1.2.4}{2025-12-25}{adapt the background image evaluation (|ifx gothamtitlepagebg empty|) and duplicated authors/shortauthor from issue n13.}
% 		\UnitTested
% 		\TestFiles{gotham-test-038, gotham-test-1044}
%	 \begin{macrocode}
\defbeamertemplate{title~page}{gotham~dividedpic}{
	\def\titlecontent{\usebeamerfont{title}\usebeamercolor[fg]{title}\inserttitle}
	\def\subtitlecontent{\usebeamerfont{subtitle}\usebeamercolor[fg]{subtitle}\insertsubtitle}
	\settowidth\l__gotham_title_width_dim\titlecontent
	\settowidth\l__gotham_subtitle_width_dim\subtitlecontent
	\setlength\l__gotham_title_max_width_dim{\ifdim\l__gotham_title_width_dim>\l__gotham_subtitle_width_dim\l__gotham_title_width_dim\else\l__gotham_subtitle_width_dim\fi}
	% \thispagestyle{navigation@titlepage}
	\begin{minipage}{\gothamDividedPicTextWidth}
		\raggedright
		\titlecontent\\
		\subtitlecontent\\

		\textcolor{colorProgBar}{\rule{\ifdim\l__gotham_title_max_width_dim<\gothamDividedPicTextWidth\l__gotham_title_max_width_dim\else\gothamDividedPicTextWidth\fi}{\dim_use:N \l__gotham_titleseparator_height_dim}}\\[0.75em]

		\expandafter\ifblank\expandafter{\beamer@andstripped}{
			% empty author
			\vspace*{2.em}
		}{%
			\usebeamerfont{author}\usebeamercolor[fg]{author}
			\insertauthor\\
		}
		\ifx\beamer@shortauthor\@empty{
			% empty short author
		}\else{
			\ifx\beamer@shortauthor\beamer@andstripped{
				% if the short author is equal to the author skip it.
			}\else{
				\usebeamerfont{author}\usebeamercolor[fg]{author}
				{\insertshortauthor} \par
				\vspace{0.5em}
			}\fi
		}
		\fi
		\ifx\insertinstitute\@empty\else{
			\usebeamertemplate*{institute}\vspace{1.5em}
		}\fi
		\insertdate
	\end{minipage}

	% \ifdefined\@background
	\begin{tikzpicture}[remember~picture, overlay]
		\clip (current~page.south~east)
			-- (current~page.north~east)
			-- ++(-\gothamDividedPicTop, 0)
			-- ++(-\gothamDividedPicBottomIncr, -\paperheight)
			-- cycle;

		\ifx\gothamtitlepagebg\@empty
			\fill[
				right~color=colorTitlepage!100,
			]
			(current~page.south~east)
			rectangle
			++(\dimexpr-\gothamDividedPicTop-\gothamDividedPicBottomIncr, \dimexpr\paperheight);
		\else
			\node[
				anchor=south~east,
				inner~sep=0,
				outer~sep=0
			] at (current~page.south~east) {
				% \includegraphics[height=\paperheight]{\@background}
				\gothamtitlepagebg
			};
		\fi
	\end{tikzpicture}
}
%    \end{macrocode}
%  \end{macro}
% \end{implementation}


% \begin{implementation}
% 	\begin{macro}{defbeamertemplate{title~page}{gotham~splitvert}}
% 		This title page template is inspired from \url{https://github.com/pcafrica/focus-beamertheme}
% 		\UnitTested
% 		\changes{v1.2.0}{2024-11-11}{length of subtitle}
% 		\TestFiles{gotham-test-038}
%	 \begin{macrocode}
\defbeamertemplate{title~page}{gotham~splitvert}{
	% \IfEmpty{\insertframetitle}{
	\ifx\beamer@frametitle\@empty
		\vspace*{-0.5\paperheight}
	\else %}{
		\vspace*{-0.63\paperheight}
	\fi %}
	{
		\usebeamercolor{frametitle}\colorlet{gotham@@tempColor}{bg}%
		\begin{tikzpicture}[overlay, remember~picture]
			\fill[color=gotham@@tempColor] (current~page.north~west) rectangle ([shift = {(0, -0.45\paperheight)}] current~page.north~east);
		\end{tikzpicture}
	}

	% \vspace{1.65\baselineskip}
	\begin{minipage}[b][0.5\paperheight]{\textwidth}
		% \vspace{\baselineskip}
		\vbox{}
		\vfill
		{
			\usebeamerfont{title}
			\usebeamercolor[fg]{frametitle}
			\inserttitle
		}
		\ifx\insertsubtitle\@empty\else
			\\[1ex]
			{
				\usebeamerfont{subtitle}
				\usebeamercolor[fg]{frametitle}
				\insertsubtitle
			}
		\fi
		\vspace{1.\baselineskip}
	\end{minipage}


	% Set the title graphic in a zero-height box, so that
	% the position of other elements is not affected.
	\ifx\inserttitlegraphic\@empty\else
		\newline
		\vspace*{-1.65\baselineskip}
		% {\vfuzz=9999pt\vbox~to~0pt {
		{\parbox[c][0pt][c]{\textwidth}{
			\raggedleft
			\inserttitlegraphic
			% \usebeamertemplate*{title~graphic}
		}}
	\fi

	% \ifx\insertauthor\empty\else
	\expandafter\ifblank\expandafter{\beamer@andstripped}{
		% empty author
		\vspace*{1.em}
	}{
		\newline
		\begin{minipage}[t]{\textwidth}
			% \usebeamercolor{normal~text}
			% \usebeamerfont{author}
			% \insertauthor
			\vspace*{-0.65\baselineskip}
			\usebeamertemplate*{author}
		\end{minipage}
	}
	% \fi

	\ifx\insertinstitute\@empty\else
		\newline
		\vspace*{-1.65\baselineskip}
		\begin{minipage}[t]{\textwidth}
			% \usebeamerfont{institute}
			% \insertinstitute
			\usebeamertemplate*{institute}
		\end{minipage}
	\fi

	\ifx\insertdate\@empty\else
		\newline
		\begin{minipage}[t]{\textwidth}
			\vspace*{2.65\baselineskip}
			% \usebeamerfont{date}
			% \insertdate
			\usebeamertemplate*{date}
		\end{minipage}
		\vspace*{-3.15\baselineskip}
	\fi
}
%    \end{macrocode}
%  \end{macro}
% \end{implementation}


% \begin{documentation}
% \begin{function}{\__gotham_set_template:nn}
%	\begin{syntax}
%		 \cs{__gotham_set_template:nn} \marg{element} \marg{option}
%	\end{syntax}
%	Function that test if a beamertemplate with the given element and option name exists. If it exists then it is set (applied), otherwise an error is raised.
% \end{function}
% \end{documentation}
%%%%%%
% \begin{implementation}
% 	\begin{function}{\__gotham_set_template:nn}
% 		\begin{arguments}
% 			\item element name (from beamer doc) in other word, the name the template category
% 			\item prefined option (from beamer doc)
% 		\end{arguments}
% 		Function to set a beamertemplate with an option if it exists, otherwise an error is raised.
% 		Unfortunatly, (as far as I know) it not possible to test if the element name exists independtly from the prefined option.
% 		\TestFiles{gotham-test-038}
%    \begin{macrocode}
\cs_if_exist:NTF \__gotham_set_template:nn {}{
	% If it doesn't exist, then create it.

	% Define the command to set template if it exists.
	\cs_new_protected:Nn \__gotham_set_template:nn
	{
		\cs_if_exist:cTF {beamer@@tmpop@#1@#2} {
			\setbeamertemplate{#1}[#2]
		}{
			\PackageError{beamerinnerthemegotham}
			{The~beamer~template~named~'#1'~with~the~option~'#2'~does~not~exist}
			{helping~message unknown setbeamertemplate option}
		}
	}
}
%    \end{macrocode}
%  \end{function}
% \end{implementation}

% \begin{documentation}
% \begin{function}{\useinnertheme}
%	\begin{syntax}
%		\cs{useinnertheme}\oarg{option1=value1, ...}\marg{gotham}
%		\textrm{where the options are (default marked as} \defopt{default}\textrm{):}
% 		\meta{title page} = \oarg{\defopt{gotham normal} \textbar gotham splitvert \textbar gotham dividedpic \textbar gotham reversed}
%	\end{syntax}
%	The 'package' (useinnertheme) options can set different title page templates.
% \end{function}
% \end{documentation}
%%%%
% \begin{implementation}
% 	\begin{macro}{inner key -- interface}
% 		Controls for the title page templates.
% 		\UnitTested
% 		\TestFiles{gotham-test-038}
%    \begin{macrocode}
\keys_define:nn { gotham / inner }
{
	% title~page
	title~page .usage:n = { general },
	title~page .default:n = { gotham~normal },
	title~page .code:n = { \__gotham_set_template:nn{title~page}{#1} },
}
%    \end{macrocode}
%  \end{macro}
% \end{implementation}



%% Backgrounds %%%
%%%%%%%%%%%%%%%%%%

% \begin{implementation}
%    \begin{macrocode}
% Background lengths
% \newlength{\imageBGoffset}
% \setlength{\imageBGoffset}{\paperwidth}
% \addtolength{\imageBGoffset}{-8.5mm}
%    \end{macrocode}
% \end{implementation}

% \begin{documentation}
%   \begin{variable}{\l__gotham_template_name_prop}
%     Dictionary/map of template elements and predefined option according to the context.
%     Naming convention: template/What/Who, i.e. Name: key=background~canvas/watermark, value = gotham~draft
%   \end{variable}
% \end{documentation}
%%%%%%
% \begin{implementation}
%   \begin{variable}{\l__gotham_template_name_prop}
%     Dictionary/map of template elements and predefined option according to the context.
%     Naming convention: template/What/Who, i.e. Name: key=background~canvas/watermark, value = gotham~draft
%    \begin{macrocode}
\prop_if_exist:NTF \l__gotham_template_name_prop
{}{
	% if not defined than define it.
	\prop_new:N \l__gotham_template_name_prop
}
%    \end{macrocode}
%   \end{variable}
% \end{implementation}


% \begin{documentation}
%   \begin{function}{\defbeamertemplate{background}{name}{def}}
%     \begin{syntax}
%       \cs{defbeamertemplate} \marg{background canvas} \marg{chosen name} \marg{definition}
%     \end{syntax}
%     The |background canvas| and the |background| beamer templates can be redifined by users if wanted/needed.
%     By default these templates are empty (except the color in background canvas when it not transparent).
%   \end{function}
% \end{documentation}
%%%%%%
% \begin{implementation}
%   \begin{macro}{\defbeamertemplate{background~canvas}{empty}{def}}
%     empty background canvas that contains color, that can be used to reset background.
%     \UnitTested
%     \TestFiles{gotham-test-038}
%    \begin{macrocode}
\defbeamertemplate{background~canvas}{empty}{% empty background style has a color.
	% \ifbeamercolorempty[bg]{background}{}{\color{bg}\vrule width\paperwidth height\paperheight}% copied beamer default here
	\hspace*{28pt}
	\begin{beamercolorbox}[wd=\paperwidth,
      ht=\paperheight,
   ]{background}
      % nothing to write, only a background color
   \end{beamercolorbox}
}%
\defbeamertemplate{background}{empty}{}%
%    \end{macrocode}
%   \end{macro}
% \end{implementation}


% \begin{implementation}
%   \begin{macro}{\defbeamertemplate{background}{watermark/gotham~draft}{def}}
%     Background that contains a watermakr stamp with the word: DRAFT.
%     \UnitTested
%     \TestFiles{gotham-test-038}
%    \begin{macrocode}
\defbeamertemplate{background}{watermark/gotham~draft}{
	\begin{tikzpicture}[overlay,remember~picture]
		\node[color=red, opacity=0.3, scale=5, rotate=45] at ([shift={(0,0)}]current~page.center) {DRAFT};
	\end{tikzpicture}
}
% Add the template to the prop (dictionary)
\prop_put:Nnn \l__gotham_template_name_prop {background/watermark} {gotham~draft}
%    \end{macrocode}
%   \end{macro}
% \end{implementation}

% \begin{implementation}
%   \begin{function}{\__gotham_add_beamerframe_key:n}
%     \begin{arguments}
%       \item Name of the option to add, this name should also correspond to the name of the environment followed by the suffix 'env'.
%     \end{arguments}
%     Function to add an option of a frame using an environment.
%     For example, if the name 'optionA' is the argument given to the function, an frame option named 'optionA' will be added, and this option will surround the frame with the environment named 'optionAenv'.
%     So, the environment 'optionA' must have been declared before.
%     \TestFiles{gotham-test-038}
%    \begin{macrocode}
\seq_if_exist:NTF \l__gotham_frameoption_tmp_seq {}{
	% Define the sequence of frameoptions environments to close
	\seq_new:N \l__gotham_frameoption_tmp_seq
}

\cs_if_exist:NTF \__gotham_add_beamerframe_key:n {}{
	% if it doesn't exist, then create it.

	% Define the command to add frameoptions
	\cs_new_protected:Nn \__gotham_add_beamerframe_key:n {
		\define@key{beamerframe}{ #1 }[true]{
			\begin{#1env}
			\seq_put_left:Nn \l__gotham_frameoption_tmp_seq { \end{#1env} }
		}
	}

	% At the end of frames close the opened environments.
	\apptocmd{\beamer@reseteecodes}{
		% Join elements in the queue without separator then output the result
		\seq_use:Nn \l__gotham_frameoption_tmp_seq {}
		% clear working queue
		\seq_clear:N \l__gotham_frameoption_tmp_seq
	}{}{}
}
%    \end{macrocode}
%   \end{function}
% \end{implementation}

% \begin{documentation}
%   \begin{function}{\begin{frame}[noBGC]}
%     Add a frame option |noBGC| to display an empty background canvas.
%   \end{function}
% \end{documentation}
%%%%%%
% \begin{implementation}
%   \begin{macro}{\begin{frame}[noBCG]}
%     Add a frame option |noBGC| to display an empty background canvas.
%		To do it, we must add a global boolean variable, capture the option at the begin of the frame and patch the end of the frame.
%     \UnitTested
%     \TestFiles{gotham-test-038}
%    \begin{macrocode}

\newenvironment{noBGCenv}{
	\setbeamertemplate{background~canvas}[empty]
}{}
\__gotham_add_beamerframe_key:n {noBGC}
%    \end{macrocode}
%   \end{macro}
% \end{implementation}

% \begin{documentation}
%   \begin{variable}{\l_gotham_defaultWatermark}
%     Boolean to triggering if watermark should be displayed by default (without giving the frame option).
%		The variable is |false| by default.
%   \end{variable}
% \end{documentation}
%%%%%%
% \begin{implementation}
%   \begin{macro}{\l_gotham_defaultWatermark}
%     Boolean variable to display the watermark by default (or not).
%     \UnitTested
%     \TestFiles{gotham-test-038}
%    \begin{macrocode}
\bool_new:N \l_gotham_defaultWatermark
\bool_set_false:N \l_gotham_defaultWatermark
% At every new frame, reset the options to default (unless some options/keys are given)
\BeforeBeginEnvironment{frame}{
	\bool_if:NTF \l_gotham_defaultWatermark {
		\setbeamertemplate{background}[watermark/\prop_item:Nn \l__gotham_template_name_prop {background/watermark}]
	}{% false
		\setbeamertemplate{background}[empty]
	}
}
%    \end{macrocode}
%   \end{macro}
% \end{implementation}

% \begin{documentation}
%   \begin{function}{\begin{frame}[watermark]}
%      Add a frame option |watermark| to display watermark in background.
%   \end{function}
% \end{documentation}
%%%%%%
% \begin{implementation}
%   \begin{macro}{\begin{frame}[watermark]}
%     Add a frame option |watermark| to display an empty background canvas.
%		To do it, we must add a global boolean variable, capture the option at the begin of the frame and patch the end of the frame.
%     \UnitTested
%     \TestFiles{gotham-test-038}
%    \begin{macrocode}
% bool to trigger the add of watermark in background
\newenvironment{watermarkenv}{
	\setbeamertemplate{background}[
		watermark/\prop_item:Nn \l__gotham_template_name_prop {background/watermark}
	]
}{}
\__gotham_add_beamerframe_key:n {watermark}
%    \end{macrocode}
%   \end{macro}
% \end{implementation}

% \begin{documentation}
%   \begin{function}{\begin{frame}[nowatermark]}
%      Add a frame option |nowatermark| to do not display nowatermark in background.
%   \end{function}
% \end{documentation}
%%%%%%
% \begin{implementation}
%   \begin{macro}{\begin{frame}[nowatermark]}
%     Add a frame option |nowatermark| to do not display an empty background canvas.
%		To do it, we must add a global boolean variable, capture the option at the begin of the frame and patch the end of the frame.
%     \UnitTested
%     \TestFiles{gotham-test-038}
%    \begin{macrocode}
% bool to trigger the add of nowatermark in background
\newenvironment{nowatermarkenv}{
	\setbeamertemplate{background}[empty]
}{}
\__gotham_add_beamerframe_key:n {nowatermark}
%    \end{macrocode}
%   \end{macro}
% \end{implementation}

% \begin{implementation}
%   \begin{variable}{\l__gotham_tmpa_seq, \l__gotham_tmpa_tl, \l__gotham_tmpb_tl}
%     tmp variables
%    \begin{macrocode}
\seq_if_exist:NTF \l__gotham_tmpa_seq
{}{
	% sequence
	\seq_new:N \l__gotham_tmpa_seq
}
\tl_if_exist:NTF \l__gotham_tmpa_tl
{}{
	% token list A
	\tl_new:N \l__gotham_tmpa_tl
}
\tl_if_exist:NTF \l__gotham_tmpb_tl
{}{
	% token list B
	\tl_new:N \l__gotham_tmpb_tl
}
%    \end{macrocode}
%   \end{variable}
% \end{implementation}

% \begin{implementation}
%   \begin{function}{\__gotham_set_prop_template:nn}
%     \begin{arguments}
%       \item element name (from beamer doc) in other word, the name the template category
%       \item prefined option (from beamer doc)
%     \end{arguments}
%     Function that store in a map the name a template use later.
%     The following naming convention is used: Template/What/Who~Name: watermark/gotham~draft.
% 	   The means for example that if a beamer template is defined using
%     |\defbeamertemplate{background}{watermark/gotham~draft}{...}|,
%     then the function has to be call using
% 		|\__gotham_set_prop_template{background/watermark}{gotham~draft}|,
%     that will filled internally the map using the l3 command
%     |\prop_put:Nnn \l__gotham_template_name_prop {background/watermark}{gotham~draft}|.
%     If the template name given as input does not exist, an error is raised.
%     \TestFiles{gotham-test-039}
%    \begin{macrocode}
\cs_if_exist:NTF \__gotham_set_prop_template:nn {}{
	% if it doesn't exist, then create it.
	\cs_new_protected:Nn \__gotham_set_prop_template:nn
	{
		% Check if the first argument contains a /
		\tl_if_in:nnTF { #1 } { / }
		{
			% Split the first around the /
			\seq_set_split:Nnn \l__gotham_tmpa_seq { / } { #1 }
			\tl_set:Nn \l__gotham_tmpa_tl { \seq_item:Nn \l__gotham_tmpa_seq { 1 } }
			\tl_set:Nn \l__gotham_tmpb_tl { \seq_item:Nn \l__gotham_tmpa_seq { 2 } }
			% Check if template exist
			\cs_if_exist:cTF {beamer@@tmpop@\exp_not:V \l__gotham_tmpa_tl @\exp_not:V \l__gotham_tmpb_tl /#2} {
				% set the value in the map, so it can be called later.
				\prop_put:Nnn \l__gotham_template_name_prop {#1} {#2}
				% \setbeamertemplate{#1}[#2]
			}{
				\PackageError{beamerthemegotham}
				{The~beamer~template~named~'\l__gotham_tmpa_tl'~with~the~option~'\l__gotham_tmpb_tl/#2'~does~not~exist}
				{helping~message}
			}
		}{% false -> error
			\PackageError{beamerthemegotham}
			{%
				When~using~'\c_backslash_str\cs_to_str:N \__gotham_set_prop_template'~the~first~argument~should~contain~a~'/'~to~respect~the~naming~convention~used~(Template/what/Who~name),~but~you~gave~'#1'.~
				As~example:~if~'\c_backslash_str defbeamertemplate{background}{watermark/gotham~draft}'...,~then~use~'\c_backslash_str\cs_to_str:N \__gotham_set_prop_template{background/watermark}{gotham~draft}'
			}{helping~message}
		}
	}
}
%    \end{macrocode}
%   \end{function}
% \end{implementation}

% \begin{documentation}
% \begin{function}{\useinnertheme}
%	\begin{syntax}
%		\cs{useinnertheme}\oarg{option1=value1, ...}\marg{gotham}
%		\textrm{where the options are (default marked as} \defopt{default}\textrm{):}
%		\meta{watermark default} = \oarg{\defopt{off} \textbar on }
% 		\meta{watermark template} = \oarg{\defopt{gotham draft} \textbar ...}
%	\end{syntax}
%	The 'package' (useinnertheme) options can control |background| (and |background canvas|) templates according to situations.
% 	Block environments such as |theorem| and |example| have no background color by default.
% 	The option |watermark default=on| can enable the |watermark template| on every frame; but it can still be turned off for specific frames when using the frame option |nowatermark|.
% \end{function}
% \end{documentation}
%%%%
% \begin{implementation}
% 	\begin{macro}{inner key -- interface}
% 		Controls the inner settings for background and watermark).
% 		\UnitTested
% 		\TestFiles{gotham-test-037}
%    \begin{macrocode}
\keys_define:nn { gotham / inner }{
	% watermark template
	watermark~template .usage:n = { general },
	watermark~template .default:n = { gotham~draft },
	watermark~template .code:n = { \__gotham_set_prop_template:nn{background/watermark}{#1} },
}
\keys_define:nn { gotham / inner }{
	% watermark default
	watermark~default .choice:,
	watermark~default .usage:n = { general },
	watermark~default .default:n = { false },

	watermark~default / true .code:n = { \bool_set_true:N \l_gotham_defaultWatermark },
	watermark~default / on .code:n = { \bool_set_true:N \l_gotham_defaultWatermark },
	watermark~default / enable .code:n = { \bool_set_true:N \l_gotham_defaultWatermark },

	watermark~default / false .code:n = { \bool_set_false:N \l_gotham_defaultWatermark },
	watermark~default / off .code:n = { \bool_set_false:N \l_gotham_defaultWatermark },
	watermark~default / disable .code:n = { \bool_set_false:N \l_gotham_defaultWatermark },

	watermark~default / unknown .code:n = { \PackageWarning{ gotham } { The~choice~'#1'~is~unknown~for~the~(known)~option~'watermark~default',~so~being~ignored. }{helping~message: watermark~default / unknown} },
}
%    \end{macrocode}
%   \end{macro}
% \end{implementation}


%%%%  Stand IN/OUT  %%%%
%%%%%%%%%%%%%%%%%%%%%%%%

% \begin{documentation}
%   \begin{function}{\begin{frame}[c]}
%      Add a frame option |c| for enhanced vertically centered text in the frame.
%   \end{function}
% \end{documentation}
%%%%%%
% \begin{implementation}
%   \begin{macro}{\begin{frame}[c]}
%     Add a frame option |c| for improved vertically centered text in the frame.
%     By default, Beamer frames offer the |c| option to \textit{almost} vertically center the text, but the placement is a little too high.
%     To fix this, we redefine the |c| option to equalize |\beamer@frametopskip| and |\beamer@framebottomskip|.
%     This solution was suggested by Enrico Gregorio in an answer to \href{http://tex.stackexchange.com/questions/247826/}{this Stack Exchange question}.
%     \UnitTested
%     \TestFiles{gotham-test-039}
%    \begin{macrocode}
\define@key{beamerframe}{c}[true]{
	\beamer@frametopskip=0pt~plus~1fill\relax
	\beamer@framebottomskip=0pt~plus~1fill\relax
	\beamer@frametopskipautobreak=0pt~plus~.4\paperheight\relax
	\beamer@framebottomskipautobreak=0pt~plus~.6\paperheight\relax
	\def\beamer@initfirstlineunskip{}
}
%    \end{macrocode}
%   \end{macro}
% \end{implementation}

% \begin{implementation}
%   \begin{macro}{\defbeamertemplate{background~canvas}{standout/gotham}}
%     Definition of the background canvas template used by the standout frame of gotham theme.
%     \UnitTested
%     \TestFiles{gotham-test-040}
%    \begin{macrocode}
\defbeamertemplate{background~canvas}{standout/gotham}{
	% copied from beamer default
	\ifbeamercolorempty[bg]{standout}{
		% if the background standout color is transparent, do nothing.
	}{
		\usebeamercolor[bg]{standout}\color{bg}
		\vrule~width\paperwidth~height\paperheight
	}
}
% Add the template to the prop (dictionary) of background template to use according to the situation
\prop_put:Nnn \l__gotham_template_name_prop {background~canvas/standout} {gotham}
%    \end{macrocode}
%   \end{macro}
% \end{implementation}

% \begin{implementation}
%   \begin{macro}{\defbeamertemplate{standout}{gotham}}
%     Definition of the standout template used by the standout frame of gotham theme.
%     This includes background canvas template, fonts and colors.
%     \UnitTested
%     \TestFiles{gotham-test-040}
%    \begin{macrocode}
\defbeamertemplate*{standout}{gotham}{
	% \setkeys{beamerframe}{c}
	% \setkeys{beamerframe}{noframenumbering}
	% \centering

	\setbeamertemplate{background~canvas}[standout/\prop_item:Nn \l__gotham_template_name_prop {background~canvas/standout}]
	% \usebeamertemplate{background~canvas}%[standout/gotham]
	\usebeamerfont{standout}
	% if the background color is switched, then change foreground (font) color.
	\ifbeamercolorempty[bg]{primary~palette}{
		%true : empty background (transparent)
		\setbeamercolor{background~canvas}{
			use=primary~palette,
			bg=primary~palette.fg
		}
	}{
		%false : background not empty (dark or light)
		\setbeamercolor{background~canvas}{
			use=primary~palette,
			bg=primary~palette.bg
		}
	}
	\setbeamercolor{local~structure}{fg=primary~palette.bg}
	\usebeamercolor[fg]{primary~palette}
}
%    \end{macrocode}
%   \end{macro}
% \end{implementation}

% \begin{documentation}
%   \begin{function}{\begin{frame}[standout]}
%      Add a frame option |standout| to display the standout frame template.
%   \end{function}
% \end{documentation}
%%%%%%
% \begin{implementation}
%   \begin{macro}{\begin{frame}[standout]}
%     Add a frame option |standout| to display the standout frame template.
%		To do it, we must add a global boolean variable, capture the option at the begin of the frame and patch the end of the frame.
%     \UnitTested
%     \TestFiles{gotham-test-040}
%    \begin{macrocode}
\newenvironment{standoutenv}{
	\usebeamertemplate{standout}
}{}
\__gotham_add_beamerframe_key:n {standout}
%    \end{macrocode}
%   \end{macro}
% \end{implementation}

% \begin{implementation}
%   \begin{macro}{\defbeamertemplate{background~canvas}{standin/gotham}}
%     Definition of the background canvas template used by the standin frame of gotham theme.
%     \UnitTested
%     \TestFiles{gotham-test-040}
%    \begin{macrocode}
\defbeamertemplate{background~canvas}{standin/gotham}{
	\ifbeamercolorempty[bg]{standin}{
		% if the background standin color is transparent, do nothing.
	}{
		% Uncomment this if-condition to have a 'light' background in 'transparent' color-mode.
		\ifbool{transparentBG}{
			% \color{} is not possible so, it is better to do nothing for transparent bg than creating a transparent vrule.
		}{
			\usebeamercolor[bg]{standin}\color{bg}
			\vrule~width\paperwidth~height\paperheight
		}
	}
}
% Add the template to the prop (dictionary) of background template to use according to the situation
\prop_put:Nnn \l__gotham_template_name_prop {background~canvas/standin} {gotham}
%    \end{macrocode}
%   \end{macro}
% \end{implementation}

% \begin{implementation}
%   \begin{macro}{\defbeamertemplate{standout}{gotham}}
%     Definition of the standout template used by the standout frame of gotham theme.
%     This includes background canvas template, fonts and colors.
%     \UnitTested
%     \TestFiles{gotham-test-040}
%    \begin{macrocode}
\defbeamertemplate*{standin}{gotham}{
	%
	% \setkeys{beamerframe}{c}
	% \setkeys{beamerframe}{noframenumbering}
	% \centering
	\setbeamertemplate{background~canvas}[standin/\prop_item:Nn \l__gotham_template_name_prop {background~canvas/standin}]
	% \usebeamertemplate{background~canvas}%[standin/gotham]
	\usebeamerfont{standin}
	%
	% Uncomment this if-condition to have a 'light' frametitle in 'transparent' color-mode.
	% \ifbeamercolorempty[bg]{normal~text}{
	% 	%true : empty background (transparent)
	% 	\setbeamercolor{frametitle}{
	% 		use=normal~text,
	% 		bg=colorBG,
	% 		fg=normal~text.fg
	% 	}
	% }{
		% false
		\setbeamercolor{frametitle}{
			use=normal~text,
			bg=normal~text.bg,
			fg=normal~text.fg
		}
	% }
	% \setbeamercolor{frametitle}{
	% 	use=normal~text,
	% 	bg=normal~text.bg,
	% 	fg=normal~text.fg
	% }
}
%    \end{macrocode}
%   \end{macro}
% \end{implementation}

% \begin{documentation}
%   \begin{function}{\begin{frame}[standin]}
%      Add a frame option |standin| to display the standin frame template.
%   \end{function}
% \end{documentation}
%%%%%%
% \begin{implementation}
%   \begin{macro}{\begin{frame}[standin]}
%     Add a frame option |standin| to display the standin frame template.
%		To do it, we must add a global boolean variable, capture the option at the begin of the frame and patch the end of the frame.
%     \UnitTested
%     \TestFiles{gotham-test-040}
%    \begin{macrocode}
\newenvironment{standinenv}{
	\usebeamertemplate{standin}
}{}
\__gotham_add_beamerframe_key:n {standin}
%    \end{macrocode}
%   \end{macro}
% \end{implementation}

% \begin{documentation}
% \begin{function}{\useinnertheme}
%	\begin{syntax}
%		\cs{useinnertheme}\oarg{option1=value1, ...}\marg{gotham}
%		\textrm{where the options are (default marked as} \defopt{default}\textrm{):}
%		\meta{standin template} = \oarg{\defopt{gotham} \textbar ...}
% 		\meta{standout template} = \oarg{\defopt{gotham} \textbar ...}
%		\meta{standin BG template} = \oarg{\defopt{gotham} \textbar ...}
% 		\meta{standout BG template} = \oarg{\defopt{gotham} \textbar ...}
%	\end{syntax}
%	The 'package' (useinnertheme) options can control |standout| (and |standin|) templates.
%  These templates are activated when giving the frame option |\begin{frame}[standin]| and |standout|.
% \end{function}
% \end{documentation}
%%%%
% \begin{implementation}
% 	\begin{macro}{inner key -- interface}
% 		Controls the inner settings for standout and standin.
% 		\UnitTested
% 		\TestFiles{gotham-test-037}
%    \begin{macrocode}
\keys_define:nn { gotham / inner }
{
	% standout BG template
	standout~BG~template .usage:n = { general },
	standout~BG~template .default:n = { gotham },
	standout~BG~template .code:n = {
		\__gotham_set_prop_template:nn{background~canvas/standout}{#1}
	},
}
\keys_define:nn { gotham / inner }
{
	% standin BG template
	standin~BG~template .usage:n = { general },
	standin~BG~template .default:n = { gotham },
	standin~BG~template .code:n = {
		\__gotham_set_prop_template:nn{background~canvas/standin}{#1}
	},
}
\keys_define:nn { gotham / inner }
{
	% standout template
	standout~template .usage:n = { general },
	standout~template .default:n = { gotham },
	standout~template .code:n = {
		\__gotham_set_template:nn{standout}{#1}
	},
}
\keys_define:nn { gotham / inner }
{
	% standin template
	standin~template .usage:n = { general },
	standin~template .default:n = { gotham },
	standin~template .code:n = {
		\__gotham_set_template:nn{standin}{#1}
	},
}
%    \end{macrocode}
%   \end{macro}
% \end{implementation}


%%%%  Sections  %%%%
%%%%%%%%%%%%%%%%%%%%%%%

% \begin{documentation}
%   \begin{function}{\begin{frame}[part]}
%      Add a frame option |part| to display the part frame template.
%   \end{function}
% \end{documentation}
%%%%%%
% \begin{implementation}
%   \begin{macro}{\begin{frame}[part]}
%     Add a frame option |part| to display the part frame template.
%		To do it, we must add a global boolean variable, capture the option at the begin of the frame and patch the end of the frame.
%     \UnitTested
%     \TestFiles{gotham-test-041}
%    \begin{macrocode}
\bool_new:N \l_gotham_partframe
\bool_set_false:N \l_gotham_partframe
\define@key{beamerframe}{part}[true]{
	\bool_set_true:N \l_gotham_partframe
	\begingroup
		\usebeamertemplate{part~frame}
}
\apptocmd{\beamer@reseteecodes}{
	\bool_if:NTF \l_gotham_partframe {
		\endgroup
		\bool_set_false:N \l_gotham_partframe
	}{}
}{}{}
% \define@key{beamerframe}{part}[true]{
%   \thispagestyle{navigation@part}
% }
% \def\ps@navigation@part{
% 	\usebeamertemplate{part~frame}
% 	\@nameuse{ps@navigation}
% }
%    \end{macrocode}
%   \end{macro}
% \end{implementation}

% \begin{documentation}
%   \begin{function}{\begin{frame}[section]}
%      Add a frame option |section| to display the section frame template.
%   \end{function}
% \end{documentation}
%%%%%%
% \begin{implementation}
%   \begin{macro}{\begin{frame}[section]}
%     Add a frame option |section| to display the section frame template.
%		To do it, we must add a global boolean variable, capture the option at the begin of the frame and patch the end of the frame.
%     \UnitTested
%     \TestFiles{gotham-test-041}
%    \begin{macrocode}
\bool_new:N \l_gotham_sectionframe
\bool_set_false:N \l_gotham_sectionframe
\define@key{beamerframe}{section}[true]{
	\bool_set_true:N \l_gotham_sectionframe
	\begingroup
		\usebeamertemplate{section~frame}
}
\apptocmd{\beamer@reseteecodes}{
	\bool_if:NTF \l_gotham_sectionframe {
		\endgroup
		\bool_set_false:N \l_gotham_sectionframe
	}{}
}{}{}
% \define@key{beamerframe}{section}[true]{
%   \thispagestyle{navigation@section}
% }
% \def\ps@navigation@section{
% 	\usebeamertemplate{section~frame}
% 	\@nameuse{ps@navigation}
% }
%    \end{macrocode}
%   \end{macro}
% \end{implementation}

% \begin{documentation}
%   \begin{function}{\begin{frame}[subsection]}
%      Add a frame option |subsection| to display the subsection frame template.
%   \end{function}
% \end{documentation}
%%%%%%
% \begin{implementation}
%   \begin{macro}{\begin{frame}[subsection]}
%     Add a frame option |subsection| to display the subsection frame template.
%		To do it, we must add a global boolean variable, capture the option at the begin of the frame and patch the end of the frame.
%     \UnitTested
%     \TestFiles{gotham-test-041}
%    \begin{macrocode}
\bool_new:N \l_gotham_subsectionframe
\bool_set_false:N \l_gotham_subsectionframe
\define@key{beamerframe}{subsec}[true]{
	\bool_set_true:N \l_gotham_subsectionframe
	\begingroup
		\usebeamertemplate{subsection~frame}
}
\apptocmd{\beamer@reseteecodes}{
	\bool_if:NTF \l_gotham_subsectionframe {
		\endgroup
		\bool_set_false:N \l_gotham_subsectionframe
	}{}
}{}{}
% \define@key{beamerframe}{subsec}[true]{
%   \thispagestyle{navigation@subsec}
% }
% \def\ps@navigation@subsec{
% 	\usebeamertemplate{subsection~frame}
% 	\@nameuse{ps@navigation}
% }
%    \end{macrocode}
%   \end{macro}
% \end{implementation}

% \begin{documentation}
%   \begin{function}{\begin{frame}[subsubsection]}
%      Add a frame option |subsubsection| to display the subsubsection frame template.
%   \end{function}
% \end{documentation}
%%%%%%
% \begin{implementation}
%   \begin{macro}{\begin{frame}[subsubsection]}
%     Add a frame option |subsubsection| to display the subsubsection frame template.
%		To do it, we must add a global boolean variable, capture the option at the begin of the frame and patch the end of the frame.
%     \UnitTested
%     \TestFiles{gotham-test-041}
%    \begin{macrocode}
\bool_new:N \l_gotham_subsubsectionframe
\bool_set_false:N \l_gotham_subsubsectionframe
\define@key{beamerframe}{subsubsec}[true]{
	\bool_set_true:N \l_gotham_subsubsectionframe
	\begingroup
		\usebeamertemplate{subsubsection~frame}
}
\apptocmd{\beamer@reseteecodes}{
	\bool_if:NTF \l_gotham_subsubsectionframe {
		\endgroup
		\bool_set_false:N \l_gotham_subsubsectionframe
	}{}
}{}{}
% \define@key{beamerframe}{subsubsec}[true]{
%   \thispagestyle{navigation@subsubsec}
% }
% \def\ps@navigation@subsubsec{
% 	\usebeamertemplate{subsubsection~frame}
% 	\@nameuse{ps@navigation}
% }
%    \end{macrocode}
%   \end{macro}
% \end{implementation}

% \begin{documentation}
%   \begin{variable}{\partContentName, \secContentName, \subsecContentName}
%     Commands containing the 'part content' title for part, section and subection (if theses ToC frames are enabled).
%     An option for subsubsection is not useful (at least up to understanding of the moment) because we do not display frame with the content of a subsubsection since it is the small unity we are working with.
%   \end{variable}
% \end{documentation}
%%%%%%
% \begin{implementation}
%   \begin{variable}{\providebool{partContent}, \partContentName}
%    Boolean variable to enable the table of contents of the part, and the command containing the 'Part contents' title.
%    \begin{macrocode}
% repeated from BeamerExtra
\providebool{partContent}
\booltrue{partContent}
\providecommand{\partContentName}{Part~content}
%    \end{macrocode}
%   \end{variable}
% \end{implementation}
% \begin{implementation}
%   \begin{variable}{\providebool{secContent}, \secContentName}
%    Boolean variable to enable the table of contents of the section, and the command containing the 'Section contents' title.
%    \begin{macrocode}
\providebool{sectionContent}
\booltrue{sectionContent}
\providecommand{\secContentName}{Section~content}
%    \end{macrocode}
%   \end{variable}
% \end{implementation}
% \begin{implementation}
%   \begin{variable}{\providebool{subsectionContent}, \subsecContentName}
%    Boolean variable to enable the table of contents of the subsection, and the command containing the 'Subsection contents' title.
%    \begin{macrocode}
\providebool{subsectionContent}
\booltrue{subsectionContent}
\providecommand{\subsecContentName}{Subsection~content}
%    \end{macrocode}
%   \end{variable}
% \end{implementation}
% \begin{implementation}
%   \begin{variable}{\providebool{subsubsectionContent}, \subsubsecContentName}
%    Boolean variable to enable the table of contents of the subsubsection, and the command containing the 'Subsubsection contents' title.
%    \begin{macrocode}
% Subsubsection is not useful (at least up to understanding of the moment) because we do not display frame with the content of a subsubsection since it is the small unity we are working with.
\providebool{subsubsectionContent}
\booltrue{subsubsectionContent}
\providecommand{\subsubsecContentName}{Subsubsection~content}
%    \end{macrocode}
%   \end{variable}
% \end{implementation}

% \begin{implementation}
%   \begin{macro}{\defbeamertemplate{part~title}{gotham}, \defbeamertemplate{section~title}{gotham}, \defbeamertemplate{subsection~title}{gotham}, \defbeamertemplate{subsection~title}{gotham}}
%     Definitions of templates controling how will appear the name/title of the parts, sections, subsections and subsubsections.
%     \UnitTested
%     \TestFiles{gotham-test-041}
%    \begin{macrocode}
\def\partname{\translate{Part}}
\defbeamertemplate*{part~title}{gotham}{
	\usebeamercolor[fg]{part~title}
	\usebeamerfont{part~title}
	\partname \ \insertromanpartnumber
	\\[1.75ex]
	\insertpart
}
\defbeamertemplate*{section~title}{gotham}{
	\usebeamercolor[fg]{section~title}
	\usebeamerfont{section~title}
	\insertsectionnumber.~
	\insertsectionhead
}
\defbeamertemplate*{subsection~title}{gotham}{
	\usebeamercolor[fg]{subsection~title}
	\usebeamerfont{subsection~title}
	\insertsectionnumber.\insertsubsectionnumber.~
	\insertsubsectionhead
}
\def\subsubsectionname{\translate{Subsubsection}}
\def\insertsubsubsectionnumber{\arabic{subsubsection}}
\def\subsubsectionpage{\usebeamertemplate*{subsubsection~page}}
\defbeamertemplate*{subsubsection~title}{gotham}{
	\usebeamercolor[fg]{subsubsection~title}
	\usebeamerfont{subsubsection~title}
	\insertsectionnumber.\insertsubsectionnumber.\insertsubsubsectionnumber.~
	\insertsubsubsectionhead
}
%    \end{macrocode}
%   \end{macro}
% \end{implementation}

% \begin{documentation}
% 	\begin{variable}[added=2025-01-06]{\partpageOptions, \sectionpageOptions, \subsectionpageOptions, \subsubsectionpageOptions}
% 		Variable commands that contain the coma-separated list of options which are given to the partpage (respectively to the section, subsection and subsubsection).
% 	\end{variable}
% \end{documentation}
%%%%
% \begin{implementation}
% 	\begin{variable}[added=2025-01-06]{\partpageOptions, \sectionpageOptions, \subsectionpageOptions, \subsubsectionpageOptions}
% 		Options used in |\begin{frame}[\partpageOptions,part]{\partpage}...| .
% 		TESTED in gotham-test-1039
% 		\changes{v1.2.1}{2025-01-06}{newly introduced}
%    \begin{macrocode}
\providecommand{\partpageOptions}{noframenumbering}
\providecommand{\sectionpageOptions}{noframenumbering}
\providecommand{\subsectionpageOptions}{noframenumbering}
\providecommand{\subsubsectionpageOptions}{noframenumbering}
%    \end{macrocode}
% 	\end{variable}
% \end{implementation}

% \begin{documentation}
% 	\begin{variable}[added=2025-01-06]{\partpageTocOptions, \sectionpageTocOptions, \subsectionpageTocOptions, \subsubsectionpageTocOptions}
% 		Variable commands that contain the coma-separated list of options which are given to the toc page's frame at the begin of a part (respectively to the section, subsection and subsubsection).
% 	\end{variable}
% \end{documentation}
%%%%
% \begin{implementation}
% 	\begin{variable}[added=2025-01-06]{\partpageTocOptions, \sectionpageTocOptions, \subsectionpageTocOptions, \subsubsectionpageTocOptions}
% 		Options used in |\begin{frame}[\partpageTocOptions,tocpart]{toc part page...}| .
% 		TESTED in gotham-test-1039
% 		\changes{v1.2.1}{2025-01-06}{newly introduced}
%    \begin{macrocode}
\providecommand{\partpageTocOptions}{noframenumbering}
\providecommand{\sectionpageTocOptions}{noframenumbering}
\providecommand{\subsectionpageTocOptions}{noframenumbering}
% \providecommand{\subsubsectionpageTocOptions}{noframenumbering}
%    \end{macrocode}
% 	\end{variable}
% \end{implementation}

% \begin{documentation}
% 	\begin{variable}[added=2025-01-06]{\partTocOptions, \sectionTocOptions, \subsectionTocOptions, \subsubsectionTocOptions}
% 		Variable commands that contain the coma-separated list of options which are given to the |\tableofcontents| at the beginning of a part (respectively to the section, subsection and subsubsection).
% 	\end{variable}
% \end{documentation}
%%%%
% \begin{implementation}
% 	\begin{variable}[added=2025-01-06]{\partTocOptions, \sectionTocOptions, \subsectionTocOptions, \subsubsectionTocOptions}
% 		Options used in |\tableofcontents[\partTocOptions]| .
% 		TESTED in gotham-test-1039
% 		\changes{v1.2.1}{2025-01-06}{newly introduced}
%    \begin{macrocode}
\providecommand{\partTocOptions}{}
\providecommand{\sectionTocOptions}{
	currentsection, currentsubsection,
	hideothersubsections,
	sectionstyle=show/shaded,
}
\providecommand{\subsectionTocOptions}{
	currentsection, currentsubsection,
	% currentsubsubsection,
	hideothersubsections,
	sectionstyle=show/shaded,
	subsectionstyle=show/shaded/hide,
	subsubsectionstyle=show/show/hide,
}
% \providecommand{\subsubsectionTocOptions}{}
%    \end{macrocode}
% 	\end{variable}
% \end{implementation}

% \begin{implementation}
%   \begin{function}[updated=2025-07-02]{\__gotham_inner_disable_partpage:, \__gotham_inner_enable_partpage:}
%     Commands to disable or enable the display of a 'part page' frame at the beginning of every new part.
%     \changes{v1.2.1}{2025-01-06}{includes new variables}
% 		\changes{v1.2.2}{2025-07-02}{fix when multiple options given}
% 		\changes{v1.2.4}{2025-12-25}{add partintoc}
%     \TestFiles{gotham-test-041}
%    \begin{macrocode}

% Missing command for part in toc from https://tex.stackexchange.com/questions/5285/tableofcontents-from-part-commands-in-beamer
%% number, partname, page.
\@ifundefined{beamer@partintoc}{
   \providecommand\beamer@partintoc[3]{
		\ifnum\c@tocdepth=-1\relax
			% requesting onlyparts.
			\makebox[6em]{PART #1:} #2
			\par
		\fi
	}
	\define@key{beamertoc}{onlyparts}[]{
		\c@tocdepth=-1\relax
	}
}{
   %\providecommand\beamer@partintoc is defined, so I guess that \define@key{beamertoc}{onlyparts} also.
	% they are probably both coming from gotham fonts.
}

\cs_new_protected:Nn \__gotham_inner_disable_partpage:
{
	\AtBeginPart{
		% intentionally empty except adding part name in toc.
		\addtocontents{toc}{\protect\beamer@partintoc{\the\c@part}{\beamer@partname}{\the\c@page}}%
	}
}

\cs_new_protected:Nn \__gotham_inner_enable_partpage:
{
	\AtBeginPart{
		% add part name in toc
		\addtocontents{toc}{\protect\beamer@partintoc{\the\c@part}{\beamer@partname}{\the\c@page}}%

		\ifbeamer@inframe
			\partpage
		\else
			\ifdefempty{\partpageOptions}{
				% empty partpageOptions command
				\frame[c, part]{\partpage}
			}{
				% non-empty partpageOptions command
				% so store the options in an intermediate variable to expand
				\edef\l__gotham_partpageOptions_tmp{c, \partpageOptions, part}
				% Give these options expanded to the frame command
				\expandafter\frame\expandafter[\l__gotham_partpageOptions_tmp]{\partpage}
			}
		\fi

		\ifbool{partContent}{
			% true
			\ifdefempty{\partpageTocOptions}{
				% empty partpageTocOptions command so let's create a frame with simply tocpart option
				\frame[tocpart]{
					\ifdefempty{\partContentName}{}{\frametitle{\partContentName}}
					{
						\expandafter\tableofcontents\expandafter[\partTocOptions]
					}
				}
			}{
				% non-empty partpageTocOptions command so store the options in an intermediate variable to expand
				\edef\l__gotham_partpageTocOptions_tmp{\partpageTocOptions , tocpart}
				% Give these options expanded to the frame command
  				\expandafter\frame\expandafter[\l__gotham_partpageTocOptions_tmp]{
					\ifdefempty{\partContentName}{}{\frametitle{\partContentName}}
					{
						\expandafter\tableofcontents\expandafter[\partTocOptions]
					}
				}
			}
		}{
			% else empty
		}
	}
}
%    \end{macrocode}
%   \end{function}
% \end{implementation}

% \begin{implementation}
%   \begin{function}[updated=2025-07-02]{\__gotham_inner_disable_sectionpage:, \__gotham_inner_enable_sectionpage:}
%     Commands to disable or enable the display of a 'section page' frame at the beginning of every new section.
% 		\changes{v1.2.2}{2025-07-02}{fix when multiple options given}
%     \changes{v1.2.1}{2025-01-06}{includes new variables}
%     \TestFiles{gotham-test-041}
%    \begin{macrocode}
\cs_new_protected:Nn \__gotham_inner_disable_sectionpage:
{
	\AtBeginSection{
		% intentionally empty
	}
}

\cs_new_protected:Nn \__gotham_inner_enable_sectionpage:
{
	\AtBeginSection{
		\ifbeamer@inframe
			\sectionpage
		\else
			\ifdefempty{\sectionpageOptions}{
				% empty sectionpageOptions command
				\frame[c, section]{\sectionpage}
			}{
				% non-empty sectionpageOptions command
				% so store the options in an intermediate variable to expand
				\edef\l__gotham_sectionpageOptions_tmp{c, \sectionpageOptions, section}
				% Give these options expanded to the frame command
				\expandafter\frame\expandafter[\l__gotham_sectionpageOptions_tmp]{\sectionpage}
			}
		\fi

		\ifbool{sectionContent}{
			% true
			\ifdefempty{\sectionpageTocOptions}{
				% empty sectionpageTocOptions command so let's create a frame with simply tocsec option
				\frame[tocsec]{
					\ifdefempty{\secContentName}{}{\frametitle{\secContentName}}
					{
						\expandafter\tableofcontents\expandafter[\sectionTocOptions]
					}
				}
			}{
				% non-empty sectionpageTocOptions command so store the options in an intermediate variable to expand
				\edef\l__gotham_sectionpageTocOptions_tmp{\sectionpageTocOptions , tocsec}
				% Give these options expanded to the frame command
  				\expandafter\frame\expandafter[\l__gotham_sectionpageTocOptions_tmp]{
					\ifdefempty{\secContentName}{}{\frametitle{\secContentName}}
					{
						\expandafter\tableofcontents\expandafter[\sectionTocOptions]
					}
				}
			}
		}{
			% else empty
		}
	}
}
%    \end{macrocode}
%   \end{function}
% \end{implementation}

% \begin{implementation}
%   \begin{function}[updated=2025-07-02]{\__gotham_inner_disable_subsectionpage:, \__gotham_inner_enable_subsectionpage:}
%     Commands to disable or enable the display of a 'subsection page' frame at the beginning of every new subsection.
%     \changes{v1.2.1}{2025-01-06}{includes new variables}
% 		\changes{v1.2.2}{2025-07-02}{fix when multiple options given}
%     \TestFiles{gotham-test-041}
%    \begin{macrocode}
\cs_new_protected:Nn \__gotham_inner_disable_subsectionpage:
{
  \AtBeginSubsection{
	 % intentionally empty
  }
}

\cs_new_protected:Nn \__gotham_inner_enable_subsectionpage:
{
	\AtBeginSubsection{
		\ifbeamer@inframe
			\subsectionpage
		\else
			\ifdefempty{\subsectionpageOptions}{
				% empty subsectionpageOptions command
				\frame[c, subsec]{\subsectionpage}
			}{
				% non-empty subsectionpageOptions command
				% so store the options in an intermediate variable to expand
				\edef\l__gotham_subsectionpageOptions_tmp{c, \subsectionpageOptions, subsec}
				% Give these options expanded to the frame command
				\expandafter\frame\expandafter[\l__gotham_subsectionpageOptions_tmp]{\subsectionpage}
			}
		\fi

		\ifbool{subsectionContent}{
			% true
			\ifdefempty{\subsectionpageTocOptions}{
				% empty subsectionpageTocOptions command so let's create a frame with simply tocsubsec option
				\frame[tocsubsec]{
					\ifdefempty{\subsecContentName}{}{\frametitle{\subsecContentName}}
					{
						\expandafter\tableofcontents\expandafter[\subsectionTocOptions]
					}
				}
			}{
				% non-empty subsectionpageTocOptions command so store the options in an intermediate variable to expand
				\edef\l__gotham_subsectionpageTocOptions_tmp{\subsectionpageTocOptions , tocsubsec}
				% Give these options expanded to the frame command
  				\expandafter\frame\expandafter[\l__gotham_subsectionpageTocOptions_tmp]{
					\ifdefempty{\subsecContentName}{}{\frametitle{\subsecContentName}}
					{
						\expandafter\tableofcontents\expandafter[\subsectionTocOptions]
					}
				}
			}
		}{
			% else empty
		}
	}
}
%    \end{macrocode}
%   \end{function}
% \end{implementation}

% \begin{implementation}
%   \begin{function}[updated=2025-07-02]{\__gotham_inner_disable_subsubsectionpage:, \__gotham_inner_enable_subsubsectionpage:}
%     Commands to disable or enable the display of a 'subsubsection page' frame at the beginning of every new subsubsection.
%     \changes{v1.2.1}{2025-01-06}{includes new variables}
% 		\changes{v1.2.2}{2025-07-02}{fix when multiple options given}
%     \TestFiles{gotham-test-041}
%    \begin{macrocode}
\cs_new_protected:Nn \__gotham_inner_disable_subsubsectionpage:
{
  \AtBeginSubsubsection{
	 % intentionally empty
  }
}

\cs_new_protected:Nn \__gotham_inner_enable_subsubsectionpage:
{
	\AtBeginSubsubsection{
		\ifbeamer@inframe
			\subsubsectionpage
		\else
			\ifdefempty{\subsubsectionpageOptions}{
				%% empty command
				\frame[c, subsubsec]{\subsubsectionpage}
			}{
				%% non-empty command :
				% store temporary the options
				\edef\l__gotham_subsubsectionpageOptions_tmp{c,\subsubsectionpageOptions,subsubsec}%{c,subsubsec,\subsubsectionpageOptions}%
				% Give these options expanded to the frame command
  				\expandafter\frame\expandafter[\l__gotham_subsubsectionpageOptions_tmp]{\subsubsectionpage}
			}
		\fi

		% I don't think anyone will use this for now. But, just in case I keep it commented.
		% \ifbool{subsubsectionContent}{
		% 	% true
		% 	\ifdefempty{\subsubsectionpageTocOptions}{
		% 		% empty command
		% 		\begin{frame}[tocsubsubsec]
		% 	}{
		% 		% non-empty command
		% 		\begin{frame}[\expandafter\subsubsectionpageTocOptions, tocsubsubsec]
		% 	}
		% 		\ifdefempty{\subsubsecContentName}{}{\frametitle{\subsubsecContentName}}
		% 		{
		% 			\expandafter\tableofcontents\expandafter[\subsubsectionTocOptions]
		% 		}
		% 	\end{frame}
		% }{
		% 	% else empty
		% }
	}
}
%    \end{macrocode}
%   \end{function}
% \end{implementation}

% \begin{documentation}
%   \begin{variable}{\gothamProgressSectionHeight}
%     Variables used to defined the progress bar in section pages.
%     If the vertical size of the bar want to be changed, the command |\setlength{\gothamProgressSectionHeight}{<0.4pt>}| can be used.
%   \end{variable}
% \end{documentation}
%%%%%%
% \begin{implementation}
%   \begin{variable}{\gothamProgressSectionHeight}
%     Variables used to defined the progress bar in section pages.
%    \begin{macrocode}
% horizontal size of the bar (used internally and set to |\textwidth|.
\newlength{\gotham@progressonsectionpage}
% vertical size of the bar
\newlength{\gothamProgressSectionHeight}
\setlength{\gothamProgressSectionHeight}{3pt}
%    \end{macrocode}
%   \end{variable}
% \end{implementation}

% \begin{implementation}
%   \begin{macro}{\defbeamertemplate{progress~bar~in~section~page}{empty}, \defbeamertemplate{progress~bar~in~section~page}{display}}
%     Templates to disable or enable the display of the progress bar in section pages.
%     \UnitTested
%     \TestFiles{gotham-test-041}
%    \begin{macrocode}
\defbeamertemplate{progress~bar~in~section~page}{empty}{
	\vspace{\gothamProgressSectionHeight+1ex}
}

\def\inserttotalframenumber{100}
\defbeamertemplate{progress~bar~in~section~page}{display}{
	\setlength{\gotham@progressonsectionpage}{
		\textwidth * \ratio{\insertframenumber~pt}{\inserttotalframenumber~pt}
	}
	\begin{tikzpicture}
		\fill[bg] (0,0) rectangle (\textwidth, \gothamProgressSectionHeight);
		\fill[fg] (0,0) rectangle (\gotham@progressonsectionpage, \gothamProgressSectionHeight);
	\end{tikzpicture}
}
%    \end{macrocode}
%   \end{macro}
% \end{implementation}

% \begin{documentation}
%   \begin{variable}{\sectionhoffset}
%     length controlling the horizontal offset of the (section title + progress bar) block.
%     Can be useful when extra stuff want to be display on sides of the block.
%     The default value is 0.
%   \end{variable}
% \end{documentation}
%%%%%%
% \begin{implementation}
%   \begin{variable}{\sectionhoffset}
%     length controlling the horizontal offset of the (section title + progress bar) block.
%    \begin{macrocode}
\newlength{\sectionhoffset}
\setlength{\sectionhoffset}{0pt}
%    \end{macrocode}
%   \end{variable}
% \end{implementation}

% \begin{implementation}
%   \begin{macro}{\defbeamertemplate*{part|section|subsection|subsubsection~page}{progressbar/simple}}
%     Template of part \textbar section \textbar subsection \textbar subsubsection pages shared by 'progressbar' and 'simple' style.
%     These pages contain what is inside the part \textbar section \textbar subsection \textbar subsubsection frame (without background and frametitle).
%     \UnitTested
%     \TestFiles{gotham-test-041}
%    \begin{macrocode}
\defbeamertemplate{part~page}{progressbar/simple}{
	%\frametitle{toto section}
	\centering
	\hspace*{\sectionhoffset}
	\begin{minipage}{22em}
		% \raggedright
		\centering
		\usebeamertemplate*{part~title}\\[-1ex]
		\usebeamertemplate*{progress~bar~in~section~page}
		\par
	\end{minipage}
	\par
	\vspace{\baselineskip}
}
\defbeamertemplate{section~page}{progressbar/simple}{
	%\frametitle{toto section}
	\centering
	\hspace*{\sectionhoffset}
	\begin{minipage}{22em}
		\raggedright
		\usebeamertemplate*{section~title}\\[-1ex]
		\usebeamertemplate*{progress~bar~in~section~page}
		\par
	\end{minipage}
	\par
	\vspace{\baselineskip}
}
\defbeamertemplate{subsection~page}{progressbar/simple}{
	%\frametitle{toto section}
	\centering
	\hspace*{\sectionhoffset}
	\begin{minipage}{22em}
		\raggedright
		\usebeamertemplate*{section~title}\\[-1ex]
		\usebeamertemplate*{progress~bar~in~section~page}
		\par
		\usebeamertemplate*{subsection~title}
	\end{minipage}
	\par
	\vspace{\baselineskip}
}
\defbeamertemplate{subsubsection~page}{progressbar/simple}{
	% \frametitle{toto section}
	\centering
	\hspace*{\sectionhoffset}
	\begin{minipage}{22em}
		\raggedright
		\usebeamertemplate*{section~title}\\[-1ex]
		\usebeamertemplate*{progress~bar~in~section~page}
		\par
		\usebeamertemplate*{subsection~title}
		\par
		\usebeamertemplate*{subsubsection~title}
	\end{minipage}
	\par
	\vspace{\baselineskip}
}
%    \end{macrocode}
%   \end{macro}
% \end{implementation}

% \begin{implementation}
%   \begin{macro}{\defbeamertemplate{background~canvas}{part|section|subsection|subsubsection/gotham}}
%     Background canvas template of part \textbar section \textbar subsection \textbar subsubsection pages.
%     \UnitTested
%     \TestFiles{gotham-test-041}
%    \begin{macrocode}
\defbeamertemplate{background~canvas}{part/gotham}{
	\ifbeamercolorempty[bg]{normal~text}{}{\color{bg}\vrule width\paperwidth height\paperheight}
}
\defbeamertemplate{background~canvas}{section/gotham}{
	\setbeamertemplate{background~canvas}[part/gotham]
	\usebeamertemplate{background~canvas}
}
\defbeamertemplate{background~canvas}{subsection/gotham}{
	\setbeamertemplate{background~canvas}[part/gotham]
	\usebeamertemplate{background~canvas}
}
\defbeamertemplate{background~canvas}{subsubsection/gotham}{
	\setbeamertemplate{background~canvas}[part/gotham]
	\usebeamertemplate{background~canvas}
}
%    \end{macrocode}
%   \end{macro}
% \end{implementation}

% \begin{implementation}
%   \begin{macro}{\defbeamertemplate{part|section|subsection|subsubsection~frame}{gotham~simple}}
%     Template for part \textbar section \textbar subsection \textbar subsubsection frames with 'gotham simple' style.
%     \UnitTested
%     \TestFiles{gotham-test-041}
%    \begin{macrocode}
\defbeamertemplate{part~frame}{gotham~simple}{
	\setbeamertemplate{background~canvas}[part/gotham]
	\setbeamercolor{frametitle}{
		use={frametitleSection, normal~text},
		bg=frametitleSection.fg,
		fg=normal~text.fg
	}
	\setbeamertemplate{progress~bar~in~section~page}[empty]
	\setbeamertemplate{part~page}[progressbar/simple]
   % \usebeamertemplate*{part~page}% activated automatically
}

\defbeamertemplate{section~frame}{gotham~simple}{
	\setbeamertemplate{background~canvas}[section/gotham]
	\setbeamercolor{frametitle}{
		use={frametitleSection, normal~text},
		bg=frametitleSection.fg,
		fg=normal~text.fg
	}
	\setbeamertemplate{progress~bar~in~section~page}[empty]
	\setbeamertemplate{section~page}[progressbar/simple]
   % \usebeamertemplate*{section~page}% activated automatically
}

\defbeamertemplate{subsection~frame}{gotham~simple}{
	\setbeamertemplate{background~canvas}[subsection/gotham]
	\setbeamercolor{frametitle}{
		use={frametitleSection, normal~text},
		bg=frametitleSection.fg,
		fg=normal~text.fg
	}
	\setbeamertemplate{progress~bar~in~section~page}[empty]
	\setbeamertemplate{subsection~page}[progressbar/simple]
   % \usebeamertemplate*{subsection~page}% activated automatically
}

\defbeamertemplate{subsubsection~frame}{gotham~simple}{
	\setbeamertemplate{background~canvas}[subsubsection/gotham]
	\setbeamercolor{frametitle}{
		use={frametitleSection, normal~text},
		bg=frametitleSection.fg,
		fg=normal~text.fg
	}
	\setbeamertemplate{progress~bar~in~section~page}[empty]
	\setbeamertemplate{subsubsection~page}[progressbar/simple]
   % \usebeamertemplate*{subsubsection~page}% activated automatically
}
%    \end{macrocode}
%   \end{macro}
% \end{implementation}

% \begin{implementation}
%   \begin{macro}{\defbeamertemplate{part|section|subsection|subsubsection~frame}{gotham~progressbar}}
%     Template for part \textbar section \textbar subsection \textbar subsubsection frames with 'gotham progressbar' style.
%     \UnitTested
%     \TestFiles{gotham-test-041}
%    \begin{macrocode}
\defbeamertemplate{part~frame}{gotham~progressbar}{
	\setbeamertemplate{background~canvas}[part/gotham]
	\setbeamercolor{frametitle}{
		use={frametitleSection, normal~text},
		bg=frametitleSection.fg,
		fg=normal~text.fg
	}
	\setbeamertemplate{progress~bar~in~section~page}[display]
	\setbeamertemplate{part~page}[progressbar/simple]
   % \usebeamertemplate*{part~page}% activated automatically
}

\defbeamertemplate{section~frame}{gotham~progressbar}{
	\setbeamertemplate{background~canvas}[section/gotham]
	\setbeamercolor{frametitle}{
		use={frametitleSection, normal~text},
		bg=frametitleSection.fg,
		fg=normal~text.fg
	}
	\setbeamertemplate{progress~bar~in~section~page}[display]
	\setbeamertemplate{section~page}[progressbar/simple]
   % \usebeamertemplate*{section~page}% activated automatically
}

\defbeamertemplate{subsection~frame}{gotham~progressbar}{
	\setbeamertemplate{background~canvas}[subsection/gotham]
	\setbeamercolor{frametitle}{
		use={frametitleSection, normal~text},
		bg=frametitleSection.fg,
		fg=normal~text.fg
	}
	\setbeamertemplate{progress~bar~in~section~page}[display]
	\setbeamertemplate{subsection~page}[progressbar/simple]
   % \usebeamertemplate*{subsection~page}% activated automatically
}

\defbeamertemplate{subsubsection~frame}{gotham~progressbar}{
	\setbeamertemplate{background~canvas}[subsubsection/gotham]
	\setbeamercolor{frametitle}{
		use={frametitleSection, normal~text},
		bg=frametitleSection.fg,
		fg=normal~text.fg
	}
	\setbeamertemplate{progress~bar~in~section~page}[display]
	\setbeamertemplate{subsubsection~page}[progressbar/simple]
   % \usebeamertemplate*{subsubsection~page}% activated automatically
}
%    \end{macrocode}
%   \end{macro}
% \end{implementation}

% \begin{implementation}
%   \begin{macro}{\defbeamertemplate*{progress~bar~in~splitvert}{empty|dispay}}
%     Internal template to display or disable (empty) the progressbar used in 'splitvert' (split vertically) style.
%     \UnitTested
%     \TestFiles{gotham-test-041}
%    \begin{macrocode}
\defbeamertemplate{progress~bar~in~splitvert}{empty}{
	\vspace{-0.5ex}
}

\defbeamertemplate*{progress~bar~in~splitvert}{display}{
	% \nointerlineskip
	\setlength{\gotham@progressonsectionpage}{
		\paperwidth * \ratio{\insertframenumber pt}{\inserttotalframenumber pt}
	}
	\begin{tikzpicture}
		\fill[bg] (0,0) rectangle (\paperwidth, \gothamProgressSectionHeight);
		\fill[fg] (0,0) rectangle (\gotham@progressonsectionpage, \gothamProgressSectionHeight);
	\end{tikzpicture}
}
%    \end{macrocode}
%   \end{macro}
% \end{implementation}

% \begin{implementation}
%   \begin{macro}{\defbeamertemplate{part|section|subsection|subsubsection page}{gotham splitvert progressbar/simple}, \defbeamertemplate{part|section|subsection|subsubsection frame}{gotham splitvert progressbar}, \defbeamertemplate{part|section|subsection|subsubsection frame}{gotham splitvert simple}}
%     Templates for part \textbar section \textbar subsection \textbar subsubsection pages that are common for 'gotham splitvert progressbar' and 'gotham splitvert simple' styles (which implies part \textbar section \textbar subsection \textbar subsubsection frames).
%     \UnitTested
%     \TestFiles{gotham-test-041}
%    \begin{macrocode}
% Part page splitvert.
\defbeamertemplate{part~page}{gotham~splitvert~progressbar/simple}{
	% \frametitle{part!}
	% \IfEmpty{\insertframetitle}{
	\ifx\beamer@frametitle\@empty
		\vspace*{-0.05\paperheight}
	\else %}{
		\vspace*{-0.165\paperheight}
	\fi %}
	{
		\usebeamercolor{frametitle}\colorlet{gotham@@tempColor}{bg}
		\begin{tikzpicture}[overlay, remember~picture]
			\fill[color=gotham@@tempColor] (current~page.north~west) rectangle ([shift = {(0, -0.45\paperheight)}] current~page.north~east);
		\end{tikzpicture}
	}

	% \hspace*{\sectionhoffset}
	\begin{minipage}[b][0.45\paperheight]{\textwidth}
		\centering
		\usebeamertemplate*{part~title}
	\end{minipage}
	\\[-0.1\baselineskip]
	\hspace*{-1.0cm}\noindent
	\usebeamertemplate*{progress~bar~in~splitvert}

	\newline
	\begin{minipage}[t][0.5\paperheight]{\textwidth}
		% \vspace{0.5\baselineskip}
		% \usebeamerfont{subsection~ttitle}
		% \usebeamercolor[bg]{frametitle}
		% empty
	\end{minipage}
}
\defbeamertemplate{part~frame}{gotham~splitvert~progressbar}{
	\setbeamertemplate{background~canvas}[part/gotham]
	% \setbeamercolor{frametitle}{}
	% \setlength{\sectionhoffset}{1cm}
	\setbeamercolor{part~title}{use=frametitle, fg=frametitle.fg}
	\setbeamertemplate{progress~bar~in~splitvert}[display]
	\setbeamertemplate{part~page}[gotham~splitvert~progressbar/simple]
   % \usebeamertemplate*{part~page}% activated automatically
}
\defbeamertemplate{part~frame}{gotham~splitvert~simple}{
	\setbeamertemplate{background~canvas}[part/gotham]
	% \setbeamercolor{frametitle}{}
	% \setlength{\sectionhoffset}{1cm}
	\setbeamercolor{part~title}{use=frametitle, fg=frametitle.fg}
	\setbeamertemplate{progress~bar~in~splitvert}[empty]
	\setbeamertemplate{part~page}[gotham~splitvert~progressbar/simple]
   % \usebeamertemplate*{part~page}% activated automatically
}

% Section page splitvert.
\defbeamertemplate{section~page}{gotham~splitvert~progressbar/simple}{
	% \frametitle{section!}
	% \IfEmpty{\insertframetitle}{
	\ifx\beamer@frametitle\@empty
		\vspace*{-0.05\paperheight}
	\else %}{
		\vspace*{-0.165\paperheight}
	\fi %}
	{
		\usebeamercolor{frametitle}\colorlet{gotham@@tempColor}{bg}
		\begin{tikzpicture}[overlay, remember~picture]
			\fill[color=gotham@@tempColor] (current~page.north~west) rectangle ([shift = {(0, -0.45\paperheight)}] current~page.north~east);
		\end{tikzpicture}
	}

	\hspace*{\sectionhoffset}
	\begin{minipage}[b][0.45\paperheight]{\textwidth}
		\usebeamertemplate*{section~title}
	\end{minipage}
	\\[-0.1\baselineskip]
	\hspace*{-1.0cm}\noindent
	\usebeamertemplate*{progress~bar~in~splitvert}

	\newline
	\hspace*{\sectionhoffset}
	\begin{minipage}[t][0.5\paperheight]{\textwidth}
		% \vspace{0.5\baselineskip}
		\usebeamerfont{subsection~title}
		\usebeamercolor[bg]{frametitle}
		% empty
	\end{minipage}
}
\defbeamertemplate{section~frame}{gotham~splitvert~progressbar}{
	\setbeamertemplate{background~canvas}[section/gotham]
	% \setbeamercolor{frametitle}{}
	\setlength{\sectionhoffset}{1cm}
	\setbeamercolor{section~title}{use=frametitle, fg=frametitle.fg}
	\setbeamertemplate{progress~bar~in~splitvert}[display]
	\setbeamertemplate{section~page}[gotham~splitvert~progressbar/simple]
   % \usebeamertemplate*{section~page}% activated automatically
}
\defbeamertemplate{section~frame}{gotham~splitvert~simple}{
	\setbeamertemplate{background~canvas}[section/gotham]
	% \setbeamercolor{frametitle}{}
	\setlength{\sectionhoffset}{1cm}
	\setbeamercolor{section~title}{use=frametitle, fg=frametitle.fg}
	\setbeamertemplate{progress~bar~in~splitvert}[empty]
	\setbeamertemplate{section~page}[gotham~splitvert~progressbar/simple]
   % \usebeamertemplate*{section~page}% activated automatically
}

% Subsection page splitvert.
\defbeamertemplate{subsection~page}{gotham~splitvert~progressbar/simple}{
	% \frametitle{subsection!}
	% \IfEmpty{\insertframetitle}{
	\ifx\beamer@frametitle\@empty
		\vspace*{-0.05\paperheight}
	\else %}{
		\vspace*{-0.165\paperheight}
	\fi %}
	{
		\usebeamercolor{frametitle}\colorlet{gotham@@tempColor}{bg}
		\begin{tikzpicture}[overlay, remember~picture]
			\fill[color=gotham@@tempColor] (current~page.north~west) rectangle ([shift = {(0, -0.45\paperheight)}] current~page.north~east);
		\end{tikzpicture}
	}

	\hspace*{\sectionhoffset}
	\begin{minipage}[b][0.45\paperheight]{\textwidth}
		\usebeamertemplate*{section~title}
	\end{minipage}
	\\[-0.1\baselineskip]
	\hspace*{-1.0cm}\noindent
	\usebeamertemplate*{progress~bar~in~splitvert}

	\newline
	\hspace*{\sectionhoffset}
	\begin{minipage}[t][0.5\paperheight]{\textwidth}
		% \vspace{0.5\baselineskip}
		\usebeamerfont{subsection~title}
		\usebeamercolor[bg]{frametitle}
		\usebeamertemplate*{subsection~title}
		% \par
		% \vspace{1em}%phantom subsection
	\end{minipage}
}
\defbeamertemplate{subsection~frame}{gotham~splitvert~progressbar}{
	\setbeamertemplate{background~canvas}[subsection/gotham]
	% \setbeamercolor{frametitle}{}
	\setlength{\sectionhoffset}{1cm}
	\setbeamercolor{section~title}{use=frametitle, fg=frametitle.fg}
	\setbeamercolor{subsection~title}{use=frametitle, fg=frametitle.bg}
	\setbeamertemplate{progress~bar~in~splitvert}[display]
	\setbeamertemplate{subsection~page}[gotham~splitvert~progressbar/simple]
   % \usebeamertemplate*{subsection~page}% activated automatically
}
\defbeamertemplate{subsection~frame}{gotham~splitvert~simple}{
	\setbeamertemplate{background~canvas}[subsection/gotham]
	% \setbeamercolor{frametitle}{}
	\setlength{\sectionhoffset}{1cm}
	\setbeamercolor{section~title}{use=frametitle, fg=frametitle.fg}
	\setbeamercolor{subsection~title}{use=frametitle, fg=frametitle.bg}
	\setbeamertemplate{progress~bar~in~splitvert}[empty]
	\setbeamertemplate{subsection~page}[gotham~splitvert~progressbar/simple]
   % \usebeamertemplate*{subsection~page}% activated automatically
}

% Subsubection page splitvert.
\defbeamertemplate{subsubsection~page}{gotham~splitvert~progressbar/simple}{
	% \frametitle{subsubsection!}
	% \IfEmpty{\insertframetitle}{
	\ifx\beamer@frametitle\@empty
		\vspace*{-0.05\paperheight}
	\else %}{
		\vspace*{-0.165\paperheight}
	\fi %}
	{
		\usebeamercolor{frametitle}\colorlet{gotham@@tempColor}{bg}
		\begin{tikzpicture}[overlay, remember~picture]
			\fill[color=gotham@@tempColor] (current~page.north~west) rectangle ([shift = {(0, -0.45\paperheight)}] current~page.north~east);
		\end{tikzpicture}
	}

	\hspace*{\sectionhoffset}
	\begin{minipage}[b][0.45\paperheight]{\textwidth}
		\usebeamertemplate*{section~title}
	\end{minipage}
	\\[-0.1\baselineskip]
	\hspace*{-1.0cm}\noindent
	\usebeamertemplate*{progress~bar~in~splitvert}

	\newline
	\hspace*{\sectionhoffset}
	\begin{minipage}[t][0.5\paperheight]{\textwidth}
		% \vspace{0.5\baselineskip}
		\usebeamerfont{subsubsection~title}
		\usebeamercolor[bg]{frametitle}
		\usebeamertemplate*{subsection~title}
		\par
		\usebeamertemplate*{subsubsection~title}
	\end{minipage}
}
\defbeamertemplate{subsubsection~frame}{gotham~splitvert~progressbar}{
	\setbeamertemplate{background~canvas}[subsubsection/gotham]
	% \setbeamercolor{frametitle}{}
	\setlength{\sectionhoffset}{1cm}
	\setbeamercolor{section~title}{use=frametitle, fg=frametitle.fg}
	\setbeamercolor{subsection~title}{use=frametitle, fg=frametitle.bg}
	\setbeamercolor{subsubsection~title}{use=frametitle, fg=frametitle.bg}
	\setbeamertemplate{progress~bar~in~splitvert}[display]
	\setbeamertemplate{subsubsection~page}[gotham~splitvert~progressbar/simple]
   % \usebeamertemplate*{subsubsection~page}% activated automatically
}
\defbeamertemplate{subsubsection~frame}{gotham~splitvert~simple}{
	\setbeamertemplate{background~canvas}[subsubsection/gotham]
	% \setbeamercolor{frametitle}{}
	\setlength{\sectionhoffset}{1cm}
	\setbeamercolor{section~title}{use=frametitle, fg=frametitle.fg}
	\setbeamercolor{subsection~title}{use=frametitle, fg=frametitle.bg}
	\setbeamercolor{subsubsection~title}{use=frametitle, fg=frametitle.bg}
	\setbeamertemplate{progress~bar~in~splitvert}[empty]
	\setbeamertemplate{subsubsection~page}[gotham~splitvert~progressbar/simple]
   % \usebeamertemplate*{subsubsection~page}% activated automatically
}
%    \end{macrocode}
%   \end{macro}
% \end{implementation}


% \begin{implementation}
%   \begin{macro}{\defbeamertemplate{part|section|subsection|subsubsection page}{gotham progressvert}, \defbeamertemplate{part|section|subsection|subsubsection frame}{gotham progressvert}}
%     Templates for part \textbar section \textbar subsection \textbar subsubsection pages for 'gotham progressvert'.
%     \UnitTested
%     \TestFiles{gotham-test-041}
%    \begin{macrocode}

% Part page progressvert.
\defbeamertemplate{part~page}{gotham~progressvert}{
	% \frametitle{part!}
	% \IfEmpty{\insertframetitle}{
	\ifx\beamer@frametitle\@empty
		\vspace*{-0.05\paperheight}
	\else %}{
		\vspace*{-0.165\paperheight}
	\fi %}
	\setlength{\gotham@progressonsectionpage}{
		\paperheight * \ratio{\insertframenumber pt}{\inserttotalframenumber pt}
	}
	{
		\usebeamercolor{frametitle}\colorlet{gotham@@tempColor}{bg}
		\colorlet{gotham@@tempColorB}{fg}
		\begin{tikzpicture}[overlay, remember~picture]
			\fill[color=gotham@@tempColor]
				([shift={(0,0)}] current~page.north~west) --
				([shift={(0,-\gotham@progressonsectionpage)}] current~page.north~west) --
				([shift={(0,-\gotham@progressonsectionpage)}] current~page.north~east) --
				([shift={(0,0)}] current~page.north~east)
				--cycle;
			\node[color=gotham@@tempColorB, align=left, text~width=0.8\textwidth] at ([shift={(\sectionhoffset,0)}] current~page.center) {
				{\usebeamerfont{part~title}
				\partname \ \insertromanpartnumber
				\\[1.75ex]
				\insertpart
				}
			};

			\clip
				([shift={(0,0)}] current~page.south~west) --
				([shift={(0,\paperheight-\gotham@progressonsectionpage)}] current~page.south~west) --
				([shift={(0,\paperheight-\gotham@progressonsectionpage)}] current~page.south~east) --
				([shift={(0,0)}] current~page.south~east)
				--cycle;

			\fill[color=gotham@@tempColorB]
				([shift={(0,0)}]current~page.south~west) --
				([shift={(0,\paperheight-\gotham@progressonsectionpage)}] current~page.south~west) --
				([shift={(0,\paperheight-\gotham@progressonsectionpage)}] current~page.south~east) --
				([shift={(0,0)}] current~page.south~east)
				--cycle;
			\node[color=gotham@@tempColor, align=left, text~width=0.8\textwidth] at ([shift={(\sectionhoffset,0)}] current~page.center) {
				{\usebeamerfont{part~title}
				\partname \ \insertromanpartnumber
				\\
				\insertpart
				}
			};
		\end{tikzpicture}
	}
}
\defbeamertemplate{part~frame}{gotham~progressvert}{
	\setbeamertemplate{background~canvas}[part/gotham]
	% \setbeamercolor{frametitle}{}
	\setlength{\sectionhoffset}{1cm}
	% \setbeamercolor{section~title}{use=frametitle, fg=frametitle.bg}
	% \setbeamercolor{subsection~title}{use=frametitle, fg=frametitle.bg}
	% \setbeamercolor{part~title}{use=frametitle, fg=frametitle.bg}
	% \setbeamertemplate{progress~bar~in~splitvert}[display]
	\setbeamertemplate{part~page}[gotham~progressvert]
   % \usebeamertemplate*{section~page}% activated automatically
}

% Section page progressvert.
\defbeamertemplate{section~page}{gotham~progressvert}{
	% \frametitle{section!}
	% \IfEmpty{\insertframetitle}{
	\ifx\beamer@frametitle\@empty
		\vspace*{-0.05\paperheight}
	\else %}{
		\vspace*{-0.165\paperheight}
	\fi %}
	\setlength{\gotham@progressonsectionpage}{
		\paperheight * \ratio{\insertframenumber pt}{\inserttotalframenumber pt}
	}
	{
		\usebeamercolor{frametitle}\colorlet{gotham@@tempColor}{bg}
		\colorlet{gotham@@tempColorB}{fg}
		\begin{tikzpicture}[overlay, remember~picture]
			\fill[color=gotham@@tempColor]
				([shift={(0,0)}] current~page.north~west) --
				([shift={(0,-\gotham@progressonsectionpage)}] current~page.north~west) --
				([shift={(0,-\gotham@progressonsectionpage)}] current~page.north~east) --
				([shift={(0,0)}] current~page.north~east)
				--cycle;
			\node[color=gotham@@tempColorB, align=left, text~width=0.8\textwidth] at ([shift={(\sectionhoffset,0)}] current~page.center) {
				{\usebeamerfont{section~title}
				\insertsectionnumber.~
				\insertsectionhead}
			};

			\clip
				([shift={(0,0)}] current~page.south~west) --
				([shift={(0,\paperheight-\gotham@progressonsectionpage)}] current~page.south~west) --
				([shift={(0,\paperheight-\gotham@progressonsectionpage)}] current~page.south~east) --
				([shift={(0,0)}] current~page.south~east)
				--cycle;

			\fill[color=gotham@@tempColorB]
				([shift={(0,0)}]current~page.south~west) --
				([shift={(0,\paperheight-\gotham@progressonsectionpage)}] current~page.south~west) --
				([shift={(0,\paperheight-\gotham@progressonsectionpage)}] current~page.south~east) --
				([shift={(0,0)}] current~page.south~east)
				--cycle;
			\node[color=gotham@@tempColor, align=left, text~width=0.8\textwidth] at ([shift={(\sectionhoffset,0)}] current~page.center) {
				{\usebeamerfont{section~title}
				\insertsectionnumber.~
				\insertsectionhead}
			};
		\end{tikzpicture}
	}
}
\defbeamertemplate{section~frame}{gotham~progressvert}{
	\setbeamertemplate{background~canvas}[section/gotham]
	% \setbeamercolor{frametitle}{}
	\setlength{\sectionhoffset}{1cm}
	% \setbeamercolor{section~title}{use=frametitle, fg=frametitle.bg}
	% \setbeamercolor{subsection~title}{use=frametitle, fg=frametitle.bg}
	% \setbeamercolor{section~title}{use=frametitle, fg=frametitle.bg}
	% \setbeamertemplate{progress~bar~in~splitvert}[display]
	\setbeamertemplate{section~page}[gotham~progressvert]
   % \usebeamertemplate*{section~page}% activated automatically
}

% Subection page progressvert.
\defbeamertemplate{subsection~page}{gotham~progressvert}{
	% \frametitle{subsection!}
	% \IfEmpty{\insertframetitle}{
	\ifx\beamer@frametitle\@empty
		\vspace*{-0.05\paperheight}
	\else %}{
		\vspace*{-0.165\paperheight}
	\fi %}
	\setlength{\gotham@progressonsectionpage}{
		\paperheight * \ratio{\insertframenumber pt}{\inserttotalframenumber pt}
	}
	{
		\usebeamercolor{frametitle}\colorlet{gotham@@tempColor}{bg}
		\colorlet{gotham@@tempColorB}{fg}
		\begin{tikzpicture}[overlay, remember~picture]
			\fill[color=gotham@@tempColor]
				([shift={(0,0)}] current~page.north~west) --
				([shift={(0,-\gotham@progressonsectionpage)}] current~page.north~west) --
				([shift={(0,-\gotham@progressonsectionpage)}] current~page.north~east) --
				([shift={(0,0)}] current~page.north~east)
				--cycle;
			\node[color=gotham@@tempColorB, align=left, text~width=0.8\textwidth] at ([shift={(\sectionhoffset,0)}] current~page.center) {
				{\usebeamerfont{section~title}
				\insertsectionnumber.~
				\insertsectionhead}
				\\
				{\usebeamerfont{subsection~title}
				\insertsectionnumber.\insertsubsectionnumber.~
				\insertsubsectionhead}
			};

			\clip
				([shift={(0,0)}] current~page.south~west) --
				([shift={(0,\paperheight-\gotham@progressonsectionpage)}] current~page.south~west) --
				([shift={(0,\paperheight-\gotham@progressonsectionpage)}] current~page.south~east) --
				([shift={(0,0)}] current~page.south~east)
				--cycle;

			\fill[color=gotham@@tempColorB]
				([shift={(0,0)}]current~page.south~west) --
				([shift={(0,\paperheight-\gotham@progressonsectionpage)}] current~page.south~west) --
				([shift={(0,\paperheight-\gotham@progressonsectionpage)}] current~page.south~east) --
				([shift={(0,0)}] current~page.south~east)
				--cycle;
			\node[color=gotham@@tempColor, align=left, text~width=0.8\textwidth] at ([shift={(\sectionhoffset,0)}] current~page.center) {
				{\usebeamerfont{section~title}
				\insertsectionnumber.~
				\insertsectionhead}
				\\
				{\usebeamerfont{subsection~title}
				\insertsectionnumber.\insertsubsectionnumber.~
				\insertsubsectionhead}
			};
		\end{tikzpicture}
	}
}
\defbeamertemplate{subsection~frame}{gotham~progressvert}{
	\setbeamertemplate{background~canvas}[subsection/gotham]
	% \setbeamercolor{frametitle}{}
	\setlength{\sectionhoffset}{1cm}
	% \setbeamercolor{section~title}{use=frametitle, fg=frametitle.bg}
	% \setbeamercolor{subsection~title}{use=frametitle, fg=frametitle.bg}
	% \setbeamercolor{subsection~title}{use=frametitle, fg=frametitle.bg}
	% \setbeamertemplate{progress~bar~in~splitvert}[display]
	\setbeamertemplate{subsection~page}[gotham~progressvert]
   % \usebeamertemplate*{subsection~page}% activated automatically
}

% Subsubection page progressvert.
\defbeamertemplate{subsubsection~page}{gotham~progressvert}{
	% \frametitle{subsubsection!}
	% \IfEmpty{\insertframetitle}{
	\ifx\beamer@frametitle\@empty
		\vspace*{-0.05\paperheight}
	\else %}{
		\vspace*{-0.165\paperheight}
	\fi %}
	\setlength{\gotham@progressonsectionpage}{
		\paperheight * \ratio{\insertframenumber pt}{\inserttotalframenumber pt}
	}
	{
		\usebeamercolor{frametitle}\colorlet{gotham@@tempColor}{bg}
		\colorlet{gotham@@tempColorB}{fg}
		\begin{tikzpicture}[overlay, remember~picture]
			\fill[color=gotham@@tempColor]
				([shift={(0,0)}] current~page.north~west) --
				([shift={(0,-\gotham@progressonsectionpage)}] current~page.north~west) --
				([shift={(0,-\gotham@progressonsectionpage)}] current~page.north~east) --
				([shift={(0,0)}] current~page.north~east)
				--cycle;
			\node[color=gotham@@tempColorB, align=left, text~width=0.8\textwidth] at ([shift={(\sectionhoffset,0)}] current~page.center) {
				{\usebeamerfont{section~title}
				\insertsectionnumber.~
				\insertsectionhead}
				\\
				{\usebeamerfont{subsection~title}
				\insertsectionnumber.\insertsubsectionnumber.~
				\insertsubsectionhead}
				\\
				{\usebeamerfont{subsubsection~title}
				\insertsectionnumber.\insertsubsectionnumber.\insertsubsubsectionnumber.~
				\insertsubsubsectionhead}
			};

			\clip
				([shift={(0,0)}] current~page.south~west) --
				([shift={(0,\paperheight-\gotham@progressonsectionpage)}] current~page.south~west) --
				([shift={(0,\paperheight-\gotham@progressonsectionpage)}] current~page.south~east) --
				([shift={(0,0)}] current~page.south~east)
				--cycle;

			\fill[color=gotham@@tempColorB]
				([shift={(0,0)}]current~page.south~west) --
				([shift={(0,\paperheight-\gotham@progressonsectionpage)}] current~page.south~west) --
				([shift={(0,\paperheight-\gotham@progressonsectionpage)}] current~page.south~east) --
				([shift={(0,0)}] current~page.south~east)
				--cycle;
			\node[color=gotham@@tempColor, align=left, text~width=0.8\textwidth] at ([shift={(\sectionhoffset,0)}] current~page.center) {
				{\usebeamerfont{section~title}
				\insertsectionnumber.~
				\insertsectionhead}
				\\
				{\usebeamerfont{subsection~title}
				\insertsectionnumber.\insertsubsectionnumber.~
				\insertsubsectionhead}
				\\
				{\usebeamerfont{subsubsection~title}
				\insertsectionnumber.\insertsubsectionnumber.\insertsubsubsectionnumber.~
				\insertsubsubsectionhead}
			};
		\end{tikzpicture}
	}
}
\defbeamertemplate{subsubsection~frame}{gotham~progressvert}{
	\setbeamertemplate{background~canvas}[subsubsection/gotham]
	% \setbeamercolor{frametitle}{}
	\setlength{\sectionhoffset}{1cm}
	% \setbeamercolor{section~title}{use=frametitle, fg=frametitle.bg}
	% \setbeamercolor{subsection~title}{use=frametitle, fg=frametitle.bg}
	% \setbeamercolor{subsubsection~title}{use=frametitle, fg=frametitle.bg}
	% \setbeamertemplate{progress~bar~in~splitvert}[display]
	\setbeamertemplate{subsubsection~page}[gotham~progressvert]
   % \usebeamertemplate*{subsubsection~page}% activated automatically
}
%    \end{macrocode}
%   \end{macro}
% \end{implementation}


% \begin{documentation}
% \begin{function}{\useinnertheme}
%	\begin{syntax}
%		\cs{useinnertheme}\oarg{option1=value1, ...}\marg{gotham}
%		\textrm{where the options are (default marked as} \defopt{default}\textrm{):}
%		\meta{partframe template} = \oarg{\defopt{gotham progressbar} \textbar gotham simple \textbar gotham splitvert progressbar \textbar gotham splitvert simple \textbar gotham progressvert \textbar ...}
% 		\meta{partframe default} = \oarg{\defopt{on} \textbar off}
%		\meta{sectionframe template} = \oarg{\defopt{gotham progressbar} \textbar gotham simple \textbar gotham splitvert progressbar \textbar gotham splitvert simple \textbar gotham progressvert \textbar ...}
% 		\meta{sectionframe default} = \oarg{\defopt{on} \textbar off}
%		\meta{subsectionframe template} = \oarg{\defopt{gotham progressbar} \textbar gotham simple \textbar gotham splitvert progressbar \textbar gotham splitvert simple \textbar gotham progressvert \textbar ...}
% 		\meta{subsectionframe default} = \oarg{\defopt{on} \textbar off}
%		\meta{subsubframe template} = \oarg{\defopt{gotham progressbar} \textbar gotham simple \textbar gotham splitvert progressbar \textbar gotham splitvert simple \textbar gotham progressvert \textbar ...}
% 		\meta{subsubframe default} = \oarg{\defopt{on} \textbar off}
%	\end{syntax}
%	The 'package' (useinnertheme) options can control |partframe templates| (or |sectionframe|, |subsectionframe| and |subsubsectionframe| respectively), which define the style of the partframe (or |sectionframe|, |subsectionframe| and |subsubsectionframe| respectively) displayed at every new beginning of sectioning.
%  These templates can be disabled (or re-enabled) by default using the option |partframe default| (or |sectionframe|, |subsectionframe| and |subsubsectionframe| respectively).
% \end{function}
% \end{documentation}
%%%%
% \begin{implementation}
% 	\begin{macro}{inner key -- interface}
% 		Controls the inner settings for partframe (or |sectionframe|, |subsectionframe| and |subsubsectionframe| respectively) and standin.
% 		\UnitTested
% 		\TestFiles{gotham-test-041}
%    \begin{macrocode}
\keys_define:nn { gotham / inner }{
	% partframe template
	partframe~template .usage:n = { general },
	partframe~template .default:n = { gotham~progressbar },
	partframe~template .code:n = { \__gotham_set_template:nn{part~frame}{#1} }
}
\keys_define:nn { gotham / inner }
{
	% partframe default
	partframe~default .choice:,
	partframe~default .usage:n = { general },
	partframe~default .default:n = { true },

	partframe~default / true .code:n = { \__gotham_inner_enable_partpage: },
	partframe~default / on .code:n = { \__gotham_inner_enable_partpage: },
	partframe~default / enable .code:n = { \__gotham_inner_enable_partpage: },

	partframe~default / false .code:n = { \__gotham_inner_disable_partpage: },
	partframe~default / off .code:n = { \__gotham_inner_disable_partpage: },
	partframe~default / disable .code:n = { \__gotham_inner_disable_partpage: },

	partframe~default / unknown .code:n = { \PackageWarning{ gotham } { The~choice~'#1'~is~unknown~for~the~(known)~option~'partframe~default',~so~being~ignored. }{helping~message: partframe~default / unknown} },
}

\keys_define:nn { gotham / inner }{
	% sectionframe template
	sectionframe~template .usage:n = { general },
	sectionframe~template .default:n = { gotham~progressbar },
	sectionframe~template .code:n = { \__gotham_set_template:nn{section~frame}{#1} }
}
\keys_define:nn { gotham / inner }
{
	% sectionframe default
	sectionframe~default .choice:,
	sectionframe~default .usage:n = { general },
	sectionframe~default .default:n = { true },

	sectionframe~default / true .code:n = { \__gotham_inner_enable_sectionpage: },
	sectionframe~default / on .code:n = { \__gotham_inner_enable_sectionpage: },
	sectionframe~default / enable .code:n = { \__gotham_inner_enable_sectionpage: },

	sectionframe~default / false .code:n = { \__gotham_inner_disable_sectionpage: },
	sectionframe~default / off .code:n = { \__gotham_inner_disable_sectionpage: },
	sectionframe~default / disable .code:n = { \__gotham_inner_disable_sectionpage: },

	sectionframe~default / unknown .code:n = { \PackageWarning{ gotham } { The~choice~'#1'~is~unknown~for~the~(known)~option~'sectionframe~default',~so~being~ignored. }{helping~message: sectionframe~default / unknown} },
}

\keys_define:nn { gotham / inner }{
	% subsectionframe template
	subsectionframe~template .usage:n = { general },
	subsectionframe~template .default:n = { gotham~progressbar },
	subsectionframe~template .code:n = { \__gotham_set_template:nn{subsection~frame}{#1} }
}
\keys_define:nn { gotham / inner }
{
	% subsectionframe default
	subsectionframe~default .choice:,
	subsectionframe~default .usage:n = { general },
	subsectionframe~default .default:n = { true },

	subsectionframe~default / true .code:n = { \__gotham_inner_enable_subsectionpage: },
	subsectionframe~default / on .code:n = { \__gotham_inner_enable_subsectionpage: },
	subsectionframe~default / enable .code:n = { \__gotham_inner_enable_subsectionpage: },

	subsectionframe~default / false .code:n = { \__gotham_inner_disable_subsectionpage: },
	subsectionframe~default / off .code:n = { \__gotham_inner_disable_subsectionpage: },
	subsectionframe~default / disable .code:n = { \__gotham_inner_disable_subsectionpage: },

	subsectionframe~default / unknown .code:n = { \PackageWarning{ gotham } { The~choice~'#1'~is~unknown~for~the~(known)~option~'subsectionframe~default',~so~being~ignored. }{helping~message: subsectionframe~default / unknown} },
}

\keys_define:nn { gotham / inner }{
	% subsubsectionframe template
	subsubsectionframe~template .usage:n = { general },
	subsubsectionframe~template .default:n = { gotham~progressbar },
	subsubsectionframe~template .code:n = { \__gotham_set_template:nn{subsubsection~frame}{#1} }
}
\keys_define:nn { gotham / inner }
{
	% subsubsectionframe default
	subsubsectionframe~default .choice:,
	subsubsectionframe~default .usage:n = { general },
	subsubsectionframe~default .default:n = { true },

	subsubsectionframe~default / true .code:n = { \__gotham_inner_enable_subsubsectionpage: },
	subsubsectionframe~default / on .code:n = { \__gotham_inner_enable_subsubsectionpage: },
	subsubsectionframe~default / enable .code:n = { \__gotham_inner_enable_subsubsectionpage: },

	subsubsectionframe~default / false .code:n = { \__gotham_inner_disable_subsubsectionpage: },
	subsubsectionframe~default / off .code:n = { \__gotham_inner_disable_subsubsectionpage: },
	subsubsectionframe~default / disable .code:n = { \__gotham_inner_disable_subsubsectionpage: },

	subsubsectionframe~default / unknown .code:n = { \PackageWarning{ gotham } { The~choice~'#1'~is~unknown~for~the~(known)~option~'subsubsectionframe~default',~so~being~ignored. }{helping~message: subsubsectionframe~default / unknown} },
}
%    \end{macrocode}
%   \end{macro}
% \end{implementation}


%%%% Table of Content %%%%
%%%%%%%%%%%%%%%%%%%%%%%%%%

% \begin{implementation}
%   \begin{macro}{\tikzset{section~number/.style={}} }
%     Definition of how sections, subsections and subsubsections' numbers will appear in 'gotham bullet' style for tables of contents.
%     \UnitTested
%     \TestFiles{gotham-test-042}
%    \begin{macrocode}
\tikzset{section~number/.style={
		circle,
		fill=colorAlert,
		minimum~size=0.4em,
		text=colorAlert!10,
		inner~sep=1.5pt,
	},
	section/.style={
		draw=none,
		rectangle,
		minimum~height=1em,
		minimum~width=0.8\textwidth,
		text~width=0.8\textwidth,
		text=fg,
		align=left
	},
	subsection~number/.style={
		circle,
		fill=colorBackElement!50,
		inner~sep=0pt,
		minimum~size=0.15cm,
	},
	subsection/.style={
		draw=none,
		rectangle,
		minimum~height=1em,
		minimum~width=0.8\textwidth,
		text~width=0.8\textwidth,
		text=fg!80,
		align=left
	},
	subsubsection~number/.style={
		circle,
		fill=colorBackElement!50,
		inner~sep=0pt,
		minimum~size=0.06cm,
	},
	subsubsection/.style={
		draw=none,
		rectangle,
		minimum~height=1em,
		minimum~width=0.8\textwidth,
		text~width=0.8\textwidth,
		text=fg!80,
		align=left
	},
}
%    \end{macrocode}
%   \end{macro}
% \end{implementation}

% \begin{implementation}
%   \begin{macro}{\defbeamertemplate{section~in~toc}{gotham~bullet}}
%     Template definitions for |gotham bullet| style of ToC that appear in section \textbar subsection \textbar subsubsection frame.
% 		\changes{v1.2.1}{2025-02-10}{adapt shaded subsection in toc}
% 		\changes{v1.2.3}{2025-07-27}{protect from interaction with minted}
% 		\changes{v1.2.5}{2026-03-25}{improve section bullet hline to linewidth}
%     \UnitTested
%     \TestFiles{gotham-test-042, gotham-test-057, gotham-test-1046}
%    \begin{macrocode}
\defbeamertemplate{part~in~toc}{gotham~bullet}{
	\leavevmode
	{{\inserttocpartnumber}.}~\inserttocpart
	% \\
	\par \vspace{-0.2cm}
}
\defbeamertemplate{section~in~toc}{gotham~bullet}{
	\hspace*{0.4cm}\tikz[baseline=-0.5ex]\node[section~number]{\textbf{\inserttocsectionnumber}};
	\ \tikz[baseline=-0.5ex]\node[section]{\usebeamerfont*{toc~title}\inserttocsection};\\[-0.35cm]
	\hspace*{1.13cm}{\usebeamercolor*[fg]{footer} \rule{0.69\linewidth}{0.2pt}{\par\vskip-0.35\baselineskip}\nointerlineskip}
}
\defbeamertemplate{subsection~in~toc}{gotham~bullet}{
	\leavevmode
	\hspace*{0.53cm}\tikz[baseline=-0.5ex]\node[subsection~number]{};
	\hspace*{0.5cm}\tikz[baseline=-0.5ex]\node[subsection]{\usebeamerfont*{toc~subtitle}\inserttocsubsection \gotham@strut};
	% \\[-0.2cm]
	\par \vspace{-0.38cm}
}
\defbeamertemplate{subsubsection~in~toc}{gotham~bullet}{
	\leavevmode
	\hspace*{0.58cm}\tikz[baseline=-0.5ex]\node[subsubsection~number]{};
	\hspace*{0.69cm}\tikz[baseline=-0.5ex]\node[subsubsection]{\usebeamerfont*{toc~subtitle}\inserttocsubsubsection \gotham@strut};
	% \\[-0.2cm]
	\par \vspace{-0.38cm}
}
% Shaded for sections already done in the presentation.
\defbeamertemplate{section~in~toc~shaded}{gotham~bullet}{
	\hspace*{0.4cm}\tikz[baseline=-0.5ex]\node[section~number, fill=colorBackElement!40]{\usebeamerfont*{toc~subtitle}\textbf{\inserttocsectionnumber}};
	\ \tikz[baseline=-0.5ex]\node[section, text=colorBackElement!20]{\usebeamerfont*{toc~title}\inserttocsection};\\[-0.35cm]
	\hspace*{1.13cm}{\usebeamercolor*[fg]{footer} \rule{0.69\linewidth}{0.2pt}{\par\vskip-0.35\baselineskip}\nointerlineskip}
}
\defbeamertemplate{subsection~in~toc~shaded}{gotham~bullet}{
	\leavevmode
	\hspace*{0.53cm}\tikz[baseline=-0.5ex]\node[subsection~number,fill=colorBackElement!20]{};
	\hspace*{0.5cm}\tikz[baseline=-0.5ex]\node[subsection, text=colorBackElement!20]{\usebeamerfont*{toc~subtitle}\inserttocsubsection \gotham@strut};
	% \\[-0.2cm]
	\par \vspace{-0.38cm}
}
\defbeamertemplate{subsubsection~in~toc~shaded}{gotham~bullet}{
	\leavevmode
	\hspace*{0.58cm}\tikz[baseline=-0.5ex]\node[subsubsection~number,fill=colorBackElement!20]{};
	\hspace*{0.69cm}\tikz[baseline=-0.5ex]\node[subsubsection,text=colorBackElement!20]{\usebeamerfont*{toc~subtitle}\inserttocsubsubsection \gotham@strut};
	% \\[-0.2cm]
	\par \vspace{-0.38cm}
}
%    \end{macrocode}
%   \end{macro}
% \end{implementation}

% \begin{implementation}
%   \begin{macro}{\defbeamertemplate{section~in~toc}{gotham~bullet}}
%     Template definitions for |gotham simple| style of ToC that appear in section \textbar subsection \textbar subsubsection frame.
%     \changes{v1.2.1}{2025-01-06}{adapt shaded subsection in toc}
%     \UnitTested
%     \TestFiles{gotham-test-042}
%    \begin{macrocode}
\defbeamertemplate{part~in~toc}{gotham~simple}{
	\leavevmode
	{{\inserttocpartnumber}.}~\inserttocpart
	% \\
	\par \vspace{-0.2cm}
}
\defbeamertemplate{section~in~toc}{gotham~simple}{
	{{\inserttocsectionnumber}.}~\inserttocsection
	% \\
	\par \vspace{-0.2cm}
}
\defbeamertemplate{subsection~in~toc}{gotham~simple}{
	\leavevmode
	\quad{{\inserttocsectionnumber}.\inserttocsubsectionnumber.}~\inserttocsubsection
	% \\
	\par \vspace{-0.2cm}
}
\defbeamertemplate{subsubsection~in~toc}{gotham~simple}{
	\leavevmode
	\qquad{{\inserttocsectionnumber}.\inserttocsubsectionnumber.\inserttocsubsubsectionnumber.}~\inserttocsubsubsection
	% \\
	\par \vspace{-0.2cm}
}
\defbeamertemplate{section~in~toc~shaded}{gotham~simple}{
	\leavevmode
	\begin{colormixin}{20!parent.bg}
		{{\inserttocsectionnumber}.}~\inserttocsection
	\end{colormixin}
	% \\
	\par \vspace{-0.2cm}
}
\defbeamertemplate{subsection~in~toc~shaded}{gotham~simple}{
	\leavevmode
	\begin{colormixin}{20!parent.bg}
		\quad{{\inserttocsectionnumber}.\inserttocsubsectionnumber.}~\inserttocsubsection
	\end{colormixin}
	% \\
	\par \vspace{-0.2cm}
}
\defbeamertemplate{subsubsection~in~toc~shaded}{gotham~simple}{
	\leavevmode
	\begin{colormixin}{20!parent.bg}
		\qquad{{\inserttocsectionnumber}.\inserttocsubsectionnumber.\inserttocsubsubsectionnumber.}~\inserttocsubsubsection
	\end{colormixin}
	% \\
	\par \vspace{-0.2cm}
}
%    \end{macrocode}
%   \end{macro}
% \end{implementation}

% \begin{implementation}
%   \begin{macro}{\defbeamertemplate{background~canvas}{toc/gotham~simple}, \defbeamertemplate{toc~page}{gotham~simple|bullet}}
%     Definition of toc page style named gotham simple and gotham bullet, used for table of content pages.
%     Both are using a dedicated background canvas.
%     \changes{v1.2.1}{2025-01-05}{add shaded subsection in toc setup}
%     \UnitTested
%     \TestFiles{gotham-test-042}
%    \begin{macrocode}
\defbeamertemplate{background~canvas}{toc/gotham~simple}{
	\ifbeamercolorempty[bg]{standin}{}{
		\color{bg}\vrule width\paperwidth height\paperheight
	}
}
\defbeamertemplate{toc~page}{gotham~simple}{
	\setbeamertemplate{part~in~toc}[gotham~simple]
	\setbeamertemplate{section~in~toc}[gotham~simple]
	\setbeamertemplate{section~in~toc~shaded}[gotham~simple]
	\setbeamertemplate{subsection~in~toc}[gotham~simple]
	\setbeamertemplate{subsection~in~toc~shaded}[gotham~simple]
	\setbeamertemplate{subsubsection~in~toc}[gotham~simple]
	\setbeamertemplate{subsubsection~in~toc~shaded}[gotham~simple]
	\setbeamertemplate{background~canvas}[toc/gotham~simple]
}
\defbeamertemplate{toc~page}{gotham~bullet}{
	\setbeamertemplate{part~in~toc}[gotham~bullet]
	\setbeamertemplate{section~in~toc}[gotham~bullet]
	\setbeamertemplate{section~in~toc~shaded}[gotham~bullet]
	\setbeamertemplate{subsection~in~toc}[gotham~bullet]
	\setbeamertemplate{subsection~in~toc~shaded}[gotham~bullet]
	\setbeamertemplate{subsubsection~in~toc}[gotham~bullet]
	\setbeamertemplate{subsubsection~in~toc~shaded}[gotham~bullet]
	\setbeamertemplate{background~canvas}[toc/gotham~simple]
}
%    \end{macrocode}
%   \end{macro}
% \end{implementation}

% \begin{documentation}
%   \begin{function}{\begin{frame}[toc]}
%      Add a frame option |toc| to display the toc frame template.
%   \end{function}
% \end{documentation}
%%%%%%
% \begin{implementation}
%   \begin{macro}{\begin{frame}[toc]}
%     Add a frame option |toc| to display the toc frame template.
%		To do it, we must add a global boolean variable, capture the option at the begin of the frame and patch the end of the frame.
%     \UnitTested
%     \TestFiles{gotham-test-042}
%    \begin{macrocode}
\newenvironment{tocenv}{
	\usebeamertemplate{toc~page}
}{}
\__gotham_add_beamerframe_key:n {toc}
%    \end{macrocode}
%   \end{macro}
% \end{implementation}

% \begin{implementation}
%   \begin{macro}{\defbeamertemplate{background~canvas}{toc~part|section|subsection~gotham}}
%     Defintion of the background canvas used by the toc in part\,\textbar\,section\,\textbar\,subsection.
%     \UnitTested
%     \TestFiles{gotham-test-042}
%    \begin{macrocode}
\defbeamertemplate{background~canvas}{toc~part~gotham}{
	\ifbeamercolorempty[bg]{normal~text}{}{\color{bg}\vrule width\paperwidth height\paperheight}
}
\defbeamertemplate{background~canvas}{toc~section~gotham}{
	\ifbeamercolorempty[bg]{normal~text}{}{\color{bg}\vrule width\paperwidth height\paperheight}
}
\defbeamertemplate{background~canvas}{toc~subsection~gotham}{
	\ifbeamercolorempty[bg]{normal~text}{}{\color{bg}\vrule width\paperwidth height\paperheight}
}
%    \end{macrocode}
%   \end{macro}
% \end{implementation}

% \begin{implementation}
%   \begin{macro}{\defbeamertemplate{toc~part~frame}{gotham~simple}}
%     Definition of the toc in part\,\textbar\,section\,\textbar\,subsection templates for gotham simple style.
%     \UnitTested
%     \TestFiles{gotham-test-042}
%    \begin{macrocode}
\defbeamertemplate{toc~part~frame}{gotham~simple}{
	\setbeamertemplate{part~in~toc}[gotham~simple]
	\setbeamertemplate{section~in~toc}[gotham~simple]
	\setbeamertemplate{section~in~toc~shaded}[gotham~simple]
	\setbeamertemplate{subsection~in~toc}[gotham~simple]
	\setbeamertemplate{subsection~in~toc~shaded}[gotham~simple]
	\setbeamertemplate{subsubsection~in~toc}[gotham~simple]
	\setbeamertemplate{subsubsection~in~toc~shaded}[gotham~simple]
	\setbeamertemplate{background~canvas}[toc~part~gotham]
	\setbeamertemplate{frametitle}[toc~gotham]
	% \usebeamertemplate*{part~page}% already included
}
\defbeamertemplate{toc~section~frame}{gotham~simple}{
	\setbeamertemplate{part~in~toc}[gotham~simple]
	\setbeamertemplate{section~in~toc}[gotham~simple]
	\setbeamertemplate{section~in~toc~shaded}[gotham~simple]
	\setbeamertemplate{subsection~in~toc}[gotham~simple]
	\setbeamertemplate{subsection~in~toc~shaded}[gotham~simple]
	\setbeamertemplate{subsubsection~in~toc}[gotham~simple]
	\setbeamertemplate{subsubsection~in~toc~shaded}[gotham~simple]
	\setbeamertemplate{background~canvas}[toc~section~gotham]
	\setbeamertemplate{frametitle}[toc~gotham]%
	% \usebeamertemplate*{section~page}% already included
}
\defbeamertemplate{toc~subsection~frame}{gotham~simple}{
	\setbeamertemplate{part~in~toc}[gotham~simple]
	\setbeamertemplate{section~in~toc}[gotham~simple]
	\setbeamertemplate{section~in~toc~shaded}[gotham~simple]
	\setbeamertemplate{subsection~in~toc}[gotham~simple]
	\setbeamertemplate{subsection~in~toc~shaded}[gotham~simple]
	\setbeamertemplate{subsubsection~in~toc}[gotham~simple]
	\setbeamertemplate{subsubsection~in~toc~shaded}[gotham~simple]
	\setbeamertemplate{background~canvas}[toc~subsection~gotham]
	\setbeamertemplate{frametitle}[toc~gotham]
	% \usebeamertemplate*{subsection~page}% already included
}
%    \end{macrocode}
%   \end{macro}
% \end{implementation}

% \begin{implementation}
%   \begin{macro}{\defbeamertemplate{toc~part~frame}{gotham~bullet}}
%     Definition of the toc in part\,\textbar\,section\,\textbar\,subsection templates for gotham bullet style.
%     \UnitTested
%     \TestFiles{gotham-test-042}
%    \begin{macrocode}
\defbeamertemplate{toc~part~frame}{gotham~bullet}{
	\setbeamertemplate{part~in~toc}[gotham~bullet]
	\setbeamertemplate{section~in~toc}[gotham~bullet]
	\setbeamertemplate{section~in~toc~shaded}[gotham~bullet]
	\setbeamertemplate{subsection~in~toc}[gotham~bullet]
	\setbeamertemplate{subsection~in~toc~shaded}[gotham~bullet]
	\setbeamertemplate{subsubsection~in~toc}[gotham~bullet]
	\setbeamertemplate{subsubsection~in~toc~shaded}[gotham~bullet]
	\setbeamertemplate{background~canvas}[toc~part~gotham]
	\setbeamertemplate{frametitle}[toc~gotham]
	% \usebeamertemplate*{part~page}% already included
}
\defbeamertemplate{toc~section~frame}{gotham~bullet}{
	\setbeamertemplate{part~in~toc}[gotham~bullet]
	\setbeamertemplate{section~in~toc}[gotham~bullet]
	\setbeamertemplate{section~in~toc~shaded}[gotham~bullet]
	\setbeamertemplate{subsection~in~toc}[gotham~bullet]
	\setbeamertemplate{subsection~in~toc~shaded}[gotham~bullet]
	\setbeamertemplate{subsubsection~in~toc}[gotham~bullet]
	\setbeamertemplate{subsubsection~in~toc~shaded}[gotham~bullet]
	\setbeamertemplate{background~canvas}[toc~section~gotham]
	\setbeamertemplate{frametitle}[toc~gotham]%
	% \usebeamertemplate*{section~page}% already included
}
\defbeamertemplate{toc~subsection~frame}{gotham~bullet}{
	\setbeamertemplate{part~in~toc}[gotham~bullet]
	\setbeamertemplate{section~in~toc}[gotham~bullet]
	\setbeamertemplate{section~in~toc~shaded}[gotham~bullet]
	\setbeamertemplate{subsection~in~toc}[gotham~bullet]
	\setbeamertemplate{subsection~in~toc~shaded}[gotham~bullet]
	\setbeamertemplate{subsubsection~in~toc}[gotham~bullet]
	\setbeamertemplate{subsubsection~in~toc~shaded}[gotham~bullet]
	\setbeamertemplate{background~canvas}[toc~subsection~gotham]
	\setbeamertemplate{frametitle}[toc~gotham]
	% \usebeamertemplate*{subsection~page}% already included
}
%    \end{macrocode}
%   \end{macro}
% \end{implementation}

% \begin{documentation}
%   \begin{function}{\begin{frame}[tocpart]}
%      Add a frame option |tocpart| to display the tocpart frame template.
%   \end{function}
% \end{documentation}
%%%%%%
% \begin{implementation}
%   \begin{macro}{\begin{frame}[tocpart]}
%     Add a frame option |tocpart| to display the tocpart frame template.
%		To do it, we must add a global boolean variable, capture the option at the begin of the frame and patch the end of the frame.
%     \UnitTested
%     \TestFiles{gotham-test-042}
%    \begin{macrocode}
\bool_new:N \l_gotham_tocpartframe
\bool_set_false:N \l_gotham_tocpartframe
\define@key{beamerframe}{tocpart}[true]{
	\bool_set_true:N \l_gotham_tocpartframe
	\begingroup
		\usebeamertemplate{toc~part~frame}
}
\apptocmd{\beamer@reseteecodes}{
	\bool_if:NTF \l_gotham_tocpartframe {
		\endgroup
		\bool_set_false:N \l_gotham_tocpartframe
	}{}
}{}{}
% \define@key{beamerframe}{tocpart}[true]{
%   \thispagestyle{navigation@tocpart}
% }
% \def\ps@navigation@tocpart{
% 	\usebeamertemplate{toc~part~frame}
% 	\@nameuse{ps@navigation}
% }
%    \end{macrocode}
%   \end{macro}
% \end{implementation}

% \begin{documentation}
%   \begin{function}{\begin{frame}[tocsec]}
%      Add a frame option |tocsec| to display the tocsec frame template.
%   \end{function}
% \end{documentation}
%%%%%%
% \begin{implementation}
%   \begin{macro}{\begin{frame}[tocsec]}
%     Add a frame option |tocsec| to display the tocsec frame template.
%		To do it, we must add a global boolean variable, capture the option at the begin of the frame and patch the end of the frame.
%     \UnitTested
%     \TestFiles{gotham-test-042}
%    \begin{macrocode}
\bool_new:N \l_gotham_tocsectionframe
\bool_set_false:N \l_gotham_tocsectionframe
\define@key{beamerframe}{tocsec}[true]{
	\bool_set_true:N \l_gotham_tocsectionframe
	\begingroup
		\usebeamertemplate{toc~section~frame}
}
\apptocmd{\beamer@reseteecodes}{
	\bool_if:NTF \l_gotham_tocsectionframe {
		\endgroup
		\bool_set_false:N \l_gotham_tocsectionframe
	}{}
}{}{}
% \define@key{beamerframe}{tocsec}[true]{
%   \thispagestyle{navigation@tocsec}
% }
% \def\ps@navigation@tocsec{
% 	\usebeamertemplate{toc~section~frame}
% 	\@nameuse{ps@navigation}
% }
%    \end{macrocode}
%   \end{macro}
% \end{implementation}

% \begin{documentation}
%   \begin{function}{\begin{frame}[tocsubsec]}
%      Add a frame option |tocsubsec| to display the tocsubsec frame template.
%   \end{function}
% \end{documentation}
%%%%%%
% \begin{implementation}
%   \begin{macro}{\begin{frame}[tocsubsec]}
%     Add a frame option |tocsubsec| to display the tocsubsec frame template.
%		To do it, we must add a global boolean variable, capture the option at the begin of the frame and patch the end of the frame.
%     \UnitTested
%     \TestFiles{gotham-test-042}
%    \begin{macrocode}
\bool_new:N \l_gotham_tocsubsectionframe
\bool_set_false:N \l_gotham_tocsubsectionframe
\define@key{beamerframe}{tocsubsec}[true]{
	\bool_set_true:N \l_gotham_tocsubsectionframe
	\begingroup
		\usebeamertemplate{toc~subsection~frame}
}
\apptocmd{\beamer@reseteecodes}{
	\bool_if:NTF \l_gotham_tocsubsectionframe {
		\endgroup
		\bool_set_false:N \l_gotham_tocsubsectionframe
	}{}
}{}{}
% \define@key{beamerframe}{tocsubsec}[true]{
%   \thispagestyle{navigation@tocsubsec}
% }
% \def\ps@navigation@tocsubsec{
% 	\usebeamertemplate{toc~subsection~frame}
% 	\@nameuse{ps@navigation}
% }
%    \end{macrocode}
%   \end{macro}
% \end{implementation}

% \begin{documentation}
%   \begin{function}{\begin{frame}[tocsubsubsec]}
%      Add a frame option |tocsubsubsec| to display the tocsubsubsec frame template.
%   \end{function}
% \end{documentation}
%%%%%%
% \begin{implementation}
%   \begin{macro}{\begin{frame}[tocsubsubsec]}
%     Add a frame option |tocsubsubsec| to display the tocsubsubsec frame template.
%		To do it, we must add a global boolean variable, capture the option at the begin of the frame and patch the end of the frame.
%     \UnitTested
%     \TestFiles{gotham-test-042}
%    \begin{macrocode}
\bool_new:N \l_gotham_tocsubsubsectionframe
\bool_set_false:N \l_gotham_tocsubsubsectionframe
\define@key{beamerframe}{tocsubsubsec}[true]{
	\bool_set_true:N \l_gotham_tocsubsubsectionframe
	\begingroup
		\usebeamertemplate{toc~subsubsection~frame}
}
\apptocmd{\beamer@reseteecodes}{
	\bool_if:NTF \l_gotham_tocsubsubsectionframe {
		\endgroup
		\bool_set_false:N \l_gotham_tocsubsubsectionframe
	}{}
}{}{}
% \define@key{beamerframe}{tocsubsubsec}[true]{
%   \thispagestyle{navigation@tocsubsubsec}
% }
% \def\ps@navigation@tocsubsubsec{
% 	\usebeamertemplate{toc~subsubsection~frame}
% 	\@nameuse{ps@navigation}
% }
%    \end{macrocode}
%   \end{macro}
% \end{implementation}

% \begin{documentation}
% \begin{function}{\useinnertheme}
%	\begin{syntax}
%		\cs{useinnertheme}\oarg{option1=value1, ...}\marg{gotham}
%		\textrm{where the options are (default marked as} \defopt{default}\textrm{):}
%		\meta{tocframe template} = \oarg{\defopt{gotham bullet} \textbar gotham simple \textbar ...}
% 		\meta{parttocframe template default} = \oarg{\defopt{gotham simple} \textbar gotham bullet}
% 		\meta{parttocframe default} = \oarg{\defopt{on} \textbar off}
% 		\meta{sectocframe template default} = \oarg{\defopt{gotham simple} \textbar gotham bullet}
% 		\meta{sectocframe default} = \oarg{\defopt{on} \textbar off}
% 		\meta{subsectocframe template default} = \oarg{\defopt{gotham simple} \textbar gotham bullet}
% 		\meta{subsectocframe default} = \oarg{\defopt{on} \textbar off}
%	\end{syntax}
%	The 'package' (useinnertheme) options can control |parttocframe templates| (or |sectocframe| and |subsectocframe| respectively), which define the style of the table of content for partframe (or |sectionframe|, and |subsectionframe|  respectively) displayed at every new beginning of sectioning.
%  These templates can be disabled (or re-enabled) by default using the option |parttocframe default| (or |sectocframe| and |subssectocframe| respectively).
% \end{function}
% \end{documentation}
%%%%
% \begin{implementation}
% 	\begin{macro}{inner key -- interface}
% 		Controls the inner settings for |parttocframe| (or |sectocframe|, |subsectocframe| respectively).
% 		\UnitTested
% 		\TestFiles{gotham-test-041}
%    \begin{macrocode}
\keys_define:nn { gotham / inner }
{
	% TOC style
	tocframe~template .usage:n = { general },
	tocframe~template .default:n = { gotham~bullet },
	tocframe~template .code:n = { \__gotham_set_template:nn{toc~page}{#1} }
}

\keys_define:nn { gotham / inner }{
	% parttocframe template
	parttocframe~template .usage:n = { general },
	parttocframe~template .default:n = { gotham~simple },
	parttocframe~template .code:n = { \__gotham_set_template:nn{toc~part~frame}{#1} }
}
\keys_define:nn { gotham / inner }
{
	% parttocframe default
	parttocframe~default .choice:,
	parttocframe~default .usage:n = { general },
	parttocframe~default .default:n = { true },

	parttocframe~default / true .code:n = { \booltrue{partContent} },
	parttocframe~default / on .code:n = { \booltrue{partContent} },
	parttocframe~default / enable .code:n = { \booltrue{partContent} },

	parttocframe~default / false .code:n = { \boolfalse{partContent} },
	parttocframe~default / off .code:n = { \boolfalse{partContent} },
	parttocframe~default / disable .code:n = { \boolfalse{partContent} },

	parttocframe~default / unknown .code:n = { \PackageWarning{ gotham } { The~choice~'#1'~is~unknown~for~the~(known)~option~'parttocframe~default',~so~being~ignored. }{helping~message: parttocframe~default / unknown} },
}

\keys_define:nn { gotham / inner }{
	% sectiontocframe template
	sectiontocframe~template .usage:n = { general },
	sectiontocframe~template .default:n = { gotham~simple },
	sectiontocframe~template .code:n = { \__gotham_set_template:nn{toc~section~frame}{#1} }
}
\keys_define:nn { gotham / inner }
{
	% sectiontocframe default
	sectiontocframe~default .choice:,
	sectiontocframe~default .usage:n = { general },
	sectiontocframe~default .default:n = { true },

	sectiontocframe~default / true .code:n = { \booltrue{sectionContent} },
	sectiontocframe~default / on .code:n = { \booltrue{sectionContent} },
	sectiontocframe~default / enable .code:n = { \booltrue{sectionContent} },

	sectiontocframe~default / false .code:n = { \boolfalse{sectionContent} },
	sectiontocframe~default / off .code:n = { \boolfalse{sectionContent} },
	sectiontocframe~default / disable .code:n = { \boolfalse{sectionContent} },

	sectiontocframe~default / unknown .code:n = { \PackageWarning{ gotham } { The~choice~'#1'~is~unknown~for~the~(known)~option~'sectiontocframe~default',~so~being~ignored. }{helping~message: sectiontocframe~default / unknown} },
}

\keys_define:nn { gotham / inner }{
	% subsectiontocframe template
	subsectiontocframe~template .usage:n = { general },
	subsectiontocframe~template .default:n = { gotham~simple },
	subsectiontocframe~template .code:n = { \__gotham_set_template:nn{toc~subsection~frame}{#1} }
}
\keys_define:nn { gotham / inner }
{
	% subsectiontocframe default
	subsectiontocframe~default .choice:,
	subsectiontocframe~default .usage:n = { general },
	subsectiontocframe~default .default:n = { true },

	subsectiontocframe~default / true .code:n = { \booltrue{subsectionContent} },
	subsectiontocframe~default / on .code:n = { \booltrue{subsectionContent} },
	subsectiontocframe~default / enable .code:n = { \booltrue{subsectionContent} },

	subsectiontocframe~default / false .code:n = { \boolfalse{subsectionContent} },
	subsectiontocframe~default / off .code:n = { \boolfalse{subsectionContent} },
	subsectiontocframe~default / disable .code:n = { \boolfalse{subsectionContent} },

	subsectiontocframe~default / unknown .code:n = { \PackageWarning{ gotham } { The~choice~'#1'~is~unknown~for~the~(known)~option~'subsectiontocframe~default',~so~being~ignored. }{helping~message: subsectiontocframe~default / unknown} },
}
%    \end{macrocode}
%   \end{macro}
% \end{implementation}


%% Environments styles %%%
%%%%%%%%%%%%%%%%%%%%%%%%%%

% \begin{implementation}
%   \begin{variable}{\gotham@blocksep, \gotham@blockadjust}
%     |blocksep| and |blockadjust| lengths used in |\gotham@block| definition.
%     While |gotham@strut| is a command to ensure verticale spacing equivalent to a line.
%    \begin{macrocode}
\newlength{\gotham@blocksep}
\newlength{\gotham@blockadjust}
\setlength{\gotham@blocksep}{0.75ex}
\setlength{\gotham@blockadjust}{0.25ex}
\providecommand{\gotham@strut}{
	\vphantom{ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz (/)}
}
%    \end{macrocode}
%   \end{variable}
% \end{implementation}

% \begin{implementation}
%   \begin{variable}{\gotham@parskip, \linespread}
%     length parskip defined by gotham and the linespread are adjusted.
%    \begin{macrocode}
	\newlength{\gotham@parskip}
	\setlength{\gotham@parskip}{0.5em}
	\setlength{\parskip}{\gotham@parskip}
	\linespread{1.15}
%    \end{macrocode}
%   \end{variable}
% \end{implementation}

% \begin{implementation}
%   \begin{macro}{\newcommand{\gotham@block}[1]}
%     The three different block environments differ only in their colours.
%     Rather than repeat the essentially the same template three times, we use the auxiliary macro |\gotham@block| to define all three templates.
%     \UnitTested
%     \TestFiles{gotham-test-043}
%    \begin{macrocode}
\providecommand{\gotham@block}[1]{
	\par\vskip\medskipamount
	\setlength{\parskip}{0pt}

	% If a background color is defined for the block title or body, we need to add a little bit of padding to the corresponding box.
	% Ideally, this would be accomplished by setting |colsep=0.75ex|, which is intended to add ``color separation space'' only when the box has a colored background.
	% Unfortunately, |colsep| also adds this separation if the background color is inherited, even if the inherited color is actually empty.
	% (The technical reason for this boils down to the fact that the |\ifx| directive does not expand macros.)
	%
	% To achieve the correct spacing for |alertblock|s and |exampleblock|s as well as for normal blocks, we have to begin the |beamercolorbox| differently based on whether |block title| has an empty background.
	%
	% If the |block title| background is empty, or the user has explicitly removed the background from (e.g.) |block title alerted|, we just need to set a rightskip for a nice ragged-right block title.
	\ifbeamercolorempty[bg]{block~title#1}{%
		\begin{beamercolorbox}[rightskip=0pt~plus~4em]{block~title#1}
	}{
		\ifbeamercolorempty[bg]{block~title}{
			\begin{beamercolorbox}[rightskip=0pt~plus~4em]{block~title#1}
		}
	%   Otherwise, if the |block title| has a background, we set the padding based on |\gotham@blockskip|.
	% However, we have to visually compensate for the |\gotham@strut| added to the block title (see below) by subtracting |\gotham@blockadjust| from the top and bottom padding.
	%
		{
			\begin{beamercolorbox}[
				sep=\dimexpr\gotham@blocksep-\gotham@blockadjust\relax,
				leftskip=\gotham@blockadjust,
				rightskip=\dimexpr\gotham@blockadjust~plus~4em\relax,
			]{block~title#1}
		}
	}
	% We can now set the contents of the |block title|.
	% The zero-width but positive-height box |\gotham@strut| ensures that the block title box has a consistent height, even if it lacks punctuation, ascenders, or descenders.
	%
		\usebeamerfont*{block~title#1}
		\gotham@strut
		\insertblocktitle
		\gotham@strut
	\end{beamercolorbox}
	% Next, we typeset the |block body|.
	% This the code is similar to, but simpler than, the |block title| code since we don't need to adjust for any struts.
	\nointerlineskip
	\ifbeamercolorempty[bg]{block~body#1}{
		\begin{beamercolorbox}[vmode]{block~body#1}
	}{
		\ifbeamercolorempty[bg]{block~body}{
			\begin{beamercolorbox}[vmode]{block~body#1}
		}{
			\begin{beamercolorbox}[sep=\gotham@blocksep, vmode]{block~body#1}
			\vspace{-\gotham@parskip}
		}
	}
	\usebeamerfont{block~body#1}
	\setlength{\parskip}{\gotham@parskip}
}
% This concludes the auxiliary macro |\gotham@block|.
%    \end{macrocode}
%   \end{macro}
% \end{implementation}

% \begin{documentation}
% \begin{function}{\begin{block}, \begin{alertblock}, \begin{exampleblock}}
%	Three boxed environment are defined by default: |block|, |alertblock| and |exampleblock|.
%	The style of blocks can be changed using |\setbeamertemplate{blocks}[rounded][shadow=true]|.
% \end{function}
% \end{documentation}
%%%%
% \begin{implementation}
% 	\begin{macro}{\defbeamertemplate{block~begin}{gotham}}
% 		We could define the block beamer templates using the auxiliary macro |\gotham@block|....
%     Yet, following the precious advice from Sam Carter \url{https://github.com/jolars/moloch/issues/6}, we should keep beamer blocks.
%     But of course, one can go back to metropolis style using the commented lines here.
% 		\UnitTested
% 		\TestFiles{gotham-test-043}
%    \begin{macrocode}
% \defbeamertemplate*{block~begin}{gotham}{\gotham@block{}}
% \defbeamertemplate*{block~alerted~begin}{gotham}{\gotham@block{~alerted}}
% \defbeamertemplate*{block~example~begin}{gotham}{\gotham@block{~example}}
% \defbeamertemplate*{block~end}{gotham}{\end{beamercolorbox}\vspace*{0.2ex}}
% \defbeamertemplate*{block~alerted~end}{gotham}{\end{beamercolorbox}\vspace*{0.2ex}}
% \defbeamertemplate*{block~example~end}{gotham}{\end{beamercolorbox}\vspace*{0.2ex}}
%    \end{macrocode}
%   \end{macro}
% \end{implementation}

% \begin{documentation}
% \begin{function}{\begin{itemize}}
%	Three level of itemize environment are defined by default with decreasing size:  |circle|, |triangle| and |square|.
% \end{function}
% \end{documentation}
%%%%
% \begin{implementation}
% 	\begin{macro}{\defbeamertemplate{block~begin}{gotham}}
% 		We define the block beamer templates using the auxiliary macro |\gotham@block|.
% 		\UnitTested
% 		\TestFiles{gotham-test-043}
%    \begin{macrocode}
\defbeamertemplate*{itemize~item}{gotham}{%\textbullet}
	\large
	\setbeamertemplate{itemize~item}[circle]
	\usebeamertemplate{itemize~item}
}
\defbeamertemplate*{itemize~subitem}{gotham}{%$\blacktriangleright$
	\scriptsize
	\setbeamertemplate{itemize~subitem}[triangle]
	\usebeamertemplate{itemize~subitem}
}
\defbeamertemplate*{itemize~subsubitem}{gotham}{%square or -
	\Tiny
	$\blacksquare$ % \textbf{-}
	% \setbeamertemplate{itemize~subsubitem}[square]
	% \usebeamertemplate{itemize~subsubitem} % not working because the size of the square is hardcoded.
}

%% TRY: enumitem package, enumitem and beamer are incompatible.
% \setitemize{label=\usebeamerfont*{itemize~item}
%   \usebeamercolor[fg]{itemize~item}
%   \usebeamertemplate{itemize~item}}
%% I tried to redefine everything to make them compatible, but it breaks the [alert] environment... So, I gave up.

%    \end{macrocode}
%   \end{macro}
% \end{implementation}

% \begin{documentation}
%   \begin{function}{\defbeamertemplate{caption}, \defbeamertemplate{footnote}}
%     Gotham defines float captions with a numbered style and footnotes with traditional style (color can be tuned with |\setbeamercolor{footnote}|).
%   \end{function}
% \end{documentation}
%%%%%%
% \begin{implementation}
%   \begin{macro}{\defbeamertemplate{caption}, \defbeamertemplate{footnote}}
%     Templates definitions for caption and footnote.
%     \TestMissing{explanation}
%     \UnitTested
%     \TestFiles{gotham-test-043}
%    \begin{macrocode}
\defbeamertemplate*{caption~label~separator}{gotham}{:~}
\setbeamertemplate{caption}[numbered]
\defbeamertemplate*{footnote}{gotham}{
	\parindent~0em\noindent
	\raggedright
	\usebeamercolor{footnote}\hbox~to~0.8em{\hfil\insertfootnotemark}\insertfootnotetext\par
}
%    \end{macrocode}
%   \end{macro}
% \end{implementation}

% \begin{implementation}
% 	\begin{macro}{Default inner keys}
%		Apply default key options.
% 		\UnitTested
% 		\TestFiles{gotham-test-043}
%    \begin{macrocode}
% when no value is given, default is called.
\keys_set:nn { gotham / inner } {
	title~page,
	watermark~template, watermark~default,
	standout~template, standin~template,
	partframe~template, partframe~default,
	sectionframe~template, sectionframe~default,
	subsectionframe~template, subsectionframe~default,
	subsubsectionframe~template, subsubsectionframe~default,
	tocframe~template,
	parttocframe~template, parttocframe~default,
	sectiontocframe~template, sectiontocframe~default,
	subsectiontocframe~template, subsectiontocframe~default,
	% subsubsectiontocframe~template, subsubsectiontocframe~default,
}
%    \end{macrocode}
% \end{macro}
% \end{implementation}

% \begin{implementation}
% 	\begin{macro}{Process inner keys}
%		Process package options.
% 		\UnitTested
% 		\TestFiles{gotham-test-043}
%    \begin{macrocode}
\ProcessKeyOptions[ gotham / inner ]
% \mode<all>
%    \end{macrocode}
% \end{macro}
% \end{implementation}


% \begin{implementation}
%    \begin{macrocode}
%\endinput
%</inner>
%    \end{macrocode}
% \end{implementation}
%
%
% ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
%
%
%\begin{implementation}
%    \begin{macrocode}
%<*outer>
\ProvidesExplPackage{beamerouterthemegotham}{2026-04-02}{1.2.5.a}{gotham outer theme}
\RequirePackage{expl3}
\RequirePackage{xfp}
\RequirePackage{calc}
\RequirePackage{tikz}
%    \end{macrocode}
% \end{implementation}
%
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%%%%%%%%%%%%   OUTER     %%%%%%%%%%%%%
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%
%
% \begin{implementation}
%  \begin{macro}{Compitibility mode for colors}
% 	 FROM COLOR THEME: useful to provide this recall when the inner theme is loaded without the color theme.
%    \begin{macrocode}
\@ifundefined{\string\color@colorProgBar}{
	\providebool{darkBG} \boolfalse{darkBG}
	\providebool{transparentBG} \booltrue{transparentBG}
	\colorlet{colorBG}{white}
	\colorlet{colorFG}{black}
	\colorlet{colorFrametitle}{purple}
	\colorlet{colorStandout}{purple}
	\colorlet{colorStandin}{purple}
	\colorlet{colorTitlepage}{purple}
	\colorlet{colorFiligrane}{gray}
	\colorlet{colorBackElement}{gray}
	\colorlet{colorProgBar}{orange}
	\colorlet{colorAlert}{red}
	\colorlet{colorExample}{green}
	\setbeamercolor{progress~bar}{
		use=alerted~text,
		fg=colorProgBar,
		bg=alerted~text.fg!50!black!30
	}
	\setbeamercolor{progress~bar~in~head/foot}{%
		use=progress~bar,
		parent=progress~bar
	}
	\setbeamercolor{progress~bar~in~part~page}{
		use=progress~bar,
		parent=progress~bar
	}
	\setbeamercolor{progress~bar~in~section~page}{
		use=progress~bar,
		parent=progress~bar
	}
	\setbeamercolor{progress~bar~in~splitvert}{
		use=progress~bar,
		parent=progress~bar
	}
	\setbeamercolor{frametitleSection}{use=primary~palette, bg=, fg=primary~palette.bg}
	\setbeamercolor{standout}{use=primary~palette, bg=colorStandout, fg=primary~palette.bg}
	\setbeamercolor{standin}{use=normal~text, bg=colorStandin, fg=normal~text.fg}
	\setbeamercolor{section~in~toc}{use=normal~text, parent=normal~text,}
	\setbeamercolor{subsection~in~toc}{use=normal~text, parent=normal~text,}
	\setbeamercolor{subsubsection~in~toc}{use=normal~text, parent=normal~text,}
}{
	% else the colors are defined: this is fine.
}
%    \end{macrocode}
%  \end{macro}
% \end{implementation}

% \begin{documentation}
%   \begin{variable}{\l__gotham_template_name_prop}
%     Dictionary/map of template elements and predefined option according to the context.
%     Naming convention: template/What/Who, i.e. Name: key=background~canvas/watermark, value = gotham~draft
%   \end{variable}
% \end{documentation}
%%%%%%
% \begin{implementation}
%   \begin{variable}{\l__gotham_template_name_prop}
%     Dictionary/map of template elements and predefined option according to the context.
%     Naming convention: template/What/Who, i.e. Name: key=background~canvas/watermark, value = gotham~draft
%    \begin{macrocode}
\prop_if_exist:NTF \l__gotham_template_name_prop
{}{
	% if not defined than define it.
	\prop_new:N \l__gotham_template_name_prop
}
%    \end{macrocode}
%   \end{variable}
% \end{implementation}

% \begin{implementation}
%   \begin{variable}{\l__gotham_tmpa_seq, \l__gotham_tmpa_tl, \l__gotham_tmpb_tl}
%     tmp variables
%    \begin{macrocode}
\seq_if_exist:NTF \l__gotham_tmpa_seq
{}{
	% sequence
	\seq_new:N \l__gotham_tmpa_seq
}
\tl_if_exist:NTF \l__gotham_tmpa_tl
{}{
	% token list A
	\tl_new:N \l__gotham_tmpa_tl
}
\tl_if_exist:NTF \l__gotham_tmpb_tl
{}{
	% token list B
	\tl_new:N \l__gotham_tmpb_tl
}
%    \end{macrocode}
%   \end{variable}
% \end{implementation}

% \begin{implementation}
%   \begin{function}{\__gotham_set_prop_template:nn}
%     \begin{arguments}
%       \item element name (from beamer doc) in other word, the name the template category
%       \item prefined option (from beamer doc)
%     \end{arguments}
%     Function that store in a map the name a template use later.
%     The following naming convention is used: Template/What/Who~Name: watermark/gotham~draft.
% 	   The means for example that if a beamer template is defined using
%     |\defbeamertemplate{background}{watermark/gotham~draft}{...}|,
%     then the function has to be call using
% 		|\__gotham_set_prop_template{background/watermark}{gotham~draft}|,
%     that will filled internally the map using the l3 command
%     |\prop_put:Nnn \l__gotham_template_name_prop {background/watermark}{gotham~draft}|.
%     If the template name given as input does not exist, an error is raised.
%     \TestFiles{gotham-test-044}
%    \begin{macrocode}
\cs_if_exist:NTF \__gotham_set_prop_template:nn {}{
	% if it doesn't exist, then create it.
	\cs_new_protected:Nn \__gotham_set_prop_template:nn
	{
		% Check if the first argument contains a /
		\tl_if_in:nnTF { #1 } { / }
		{
			% Split the first around the /
			\seq_set_split:Nnn \l__gotham_tmpa_seq { / } { #1 }
			\tl_set:Nn \l__gotham_tmpa_tl { \seq_item:Nn \l__gotham_tmpa_seq { 1 } }
			\tl_set:Nn \l__gotham_tmpb_tl { \seq_item:Nn \l__gotham_tmpa_seq { 2 } }
			% Check if template exist
			\cs_if_exist:cTF {beamer@@tmpop@\exp_not:V \l__gotham_tmpa_tl @\exp_not:V \l__gotham_tmpb_tl /#2} {
				% set the value in the map, so it can be called later.
				\prop_put:Nnn \l__gotham_template_name_prop {#1} {#2}
				% \setbeamertemplate{#1}[#2]
			}{
				\PackageError{beamerthemegotham}
				{The~beamer~template~named~'\l__gotham_tmpa_tl'~with~the~option~'\l__gotham_tmpb_tl/#2'~does~not~exist}
				{helping~message}
			}
		}{% false -> error
			\PackageError{beamerthemegotham}
			{
				When~using~'\c_backslash_str\cs_to_str:N \__gotham_set_prop_template'~the~first~argument~should~contain~a~'/'~to~respect~the~naming~convention~used~(Template/what/Who~name),~but~you~gave~'#1'.~
				As~example:~if~'\c_backslash_str defbeamertemplate{background}{watermark/gotham~draft}'...,~then~use~'\c_backslash_str\cs_to_str:N \__gotham_set_prop_template{background/watermark}{gotham~draft}'
			}{helping~message}
		}
	}
}
%    \end{macrocode}
%   \end{function}
% \end{implementation}

% \begin{implementation}
%   \begin{function}{\__gotham_add_beamerframe_key:n}
%     \begin{arguments}
%       \item Name of the option to add, this name should also correspond to the name of the environment followed by the suffix 'env'.
%     \end{arguments}
%     Function to add an option of a frame using an environment.
%     For example, if the name 'optionA' is the argument given to the function, an frame option named 'optionA' will be added, and this option will surround the frame with the environment named 'optionAenv'.
%     So, the environment 'optionA' must have been declared before.
%     \TestFiles{gotham-test-038}
%    \begin{macrocode}
\seq_if_exist:NTF \l__gotham_frameoption_tmp_seq {}{
	% Define the sequence of frameoptions environments to close
	\seq_new:N \l__gotham_frameoption_tmp_seq
}

\cs_if_exist:NTF \__gotham_add_beamerframe_key:n {}{
	% if it doesn't exist, then create it.

	% Define the command to add frameoptions
	\cs_new_protected:Nn \__gotham_add_beamerframe_key:n {
		\define@key{beamerframe}{ #1 }[true]{
			\begin{#1env}
			\seq_put_left:Nn \l__gotham_frameoption_tmp_seq { \end{#1env} }
		}
	}

	% At the end of frames close the opened environments.
	\apptocmd{\beamer@reseteecodes}{
		% Join elements in the queue without separator then output the result
		\seq_use:Nn \l__gotham_frameoption_tmp_seq {}
		% clear working queue
		\seq_clear:N \l__gotham_frameoption_tmp_seq
	}{}{}
}
%    \end{macrocode}
%   \end{function}
% \end{implementation}

% \begin{documentation}
% \begin{function}{\__gotham_set_template:nn}
%	\begin{syntax}
%		 \cs{__gotham_set_template:nn} \marg{element} \marg{option}
%	\end{syntax}
%	Function that test if a beamertemplate with the given element and option name exists. If it exists then it is set (applied), otherwise an error is raised.
% \end{function}
% \end{documentation}
%%%%%%
% \begin{implementation}
% 	\begin{function}{\__gotham_set_template:nn}
% 		\begin{arguments}
% 			\item element name (from beamer doc) in other word, the name the template category
% 			\item prefined option (from beamer doc)
% 		\end{arguments}
% 		Function to set a beamertemplate with an option if it exists, otherwise an error is raised.
% 		Unfortunatly, (as far as I know) it not possible to test if the element name exists independtly from the prefined option.
% 		\TestFiles{gotham-test-038}
%    \begin{macrocode}
\cs_if_exist:NTF \__gotham_set_template:nn {}{
	% If it doesn't exist, then create it.

	% Define the command to set template if it exists.
	\cs_new_protected:Nn \__gotham_set_template:nn
	{
		\cs_if_exist:cTF {beamer@@tmpop@#1@#2} {
			\setbeamertemplate{#1}[#2]
		}{
			\PackageError{beamerinnerthemegotham}
			{The~beamer~template~named~'#1'~with~the~option~'#2'~does~not~exist}
			{helping~message unknown setbeamertemplate option}
		}
	}
}
%    \end{macrocode}
%  \end{function}
% \end{implementation}


%%% Sidebars %%%
%%%%%%%%%%%%%%%%

% \begin{documentation}
%   \begin{variable}{\sidebarRightHOffset, \sidebarLeftHOffset}
%     Length controling the horizontal offset in order to position |\gothamRightFiligrane| (respectively |\gothamLeftFiligrane|) when using the default sidebar canvas (right and left) from gotham.
%   \end{variable}
% \end{documentation}
%%%%%%
% \begin{implementation}
%   \begin{variable}{\sidebarRightHOffset, \sidebarLeftHOffset}
%     lengths between borders (right and left) and the commands (|\gothamRightFiligrane| and |\gothamleftFiligrane|) used inside |\setbeamertemplate{sidebar~canvas~right}[default/gotham~filigrane]| (left respectively).
%     \UnitTested
%     \TestFiles{gotham-test-044}
%    \begin{macrocode}
% sidebar lengths
\newlength{\sidebarRightHOffset}
\newlength{\sidebarLeftHOffset}
\setlength{\sidebarRightHOffset}{-2.5ex}
\setlength{\sidebarLeftHOffset}{+0.5ex}
%    \end{macrocode}
%   \end{variable}
% \end{implementation}

% \begin{documentation}
%   \begin{function}{\gothamRightFiligrane, \gothamLeftFiligrane}
%     Commands used internally by |\setbeamertemplate{sidebar~canvas~right}[default/gotham~filigrane]| (left respectively), that are empty by default.
%     But these commands can be simply redefined to custom watermarks (filigrane) in sidebars.
%   \end{function}
% \end{documentation}
%%%%%%
% \begin{implementation}
%   \begin{macro}{\gothamRightFiligrane, \gothamLeftFiligrane}
%     Commands used internally by |\setbeamertemplate{sidebar~canvas~right}[default/gotham~filigrane]| (left respectively), that are empty by default.
%     But these commands can be simply redefined to custom watermarks (filigrane) in sidebars.
%     \UnitTested
%     \TestFiles{gotham-test-044}
%    \begin{macrocode}
% Command to add filigrane/edging in sidebar
\providecommand{\gothamRightFiligrane}{
	% left empty intentionally
	% \rotatebox{90}{gotham right filigrane pattern}
}
\providecommand{\gothamLeftFiligrane}{
	% left empty intentionally
	% \rotatebox{-90}{\hspace*{5em} gotham left filigrane pattern}
}
%    \end{macrocode}
%   \end{macro}
% \end{implementation}

% \begin{implementation}
%   \begin{macro}{\defbeamertemplate{sidebar~canvas~right}{}, \defbeamertemplate{sidebar~canvas~left}{}}
%     Definitions of |\defbeamertemplate{sidebar~canvas~right}| (respectively |\defbeamertemplate{sidebar~canvas~left}|) that are used by gotham by default.
%     \UnitTested
%     \TestFiles{gotham-test-044}
%    \begin{macrocode}
\defbeamertemplate{sidebar~right}{default/beamer}{
	\vfill
	\llap{\insertlogo\hskip0.1cm}
	\vskip2pt
	\llap{\usebeamertemplate***{navigation~symbols}\hskip0.1cm}
	\vskip2pt
}
\defbeamertemplate{sidebar~right}{default/empty}{}
\defbeamertemplate{sidebar~canvas~right}{default/empty}{}
\defbeamertemplate{sidebar~canvas~right}{default/gotham~filigrane}{
	% pull to the left otherwise, the filigrane is outside of the frame.
	\hspace*{\sidebarRightHOffset}
	\gothamRightFiligrane
}
\defbeamertemplate{sidebar~left}{default/empty}{}
\defbeamertemplate{sidebar~canvas~left}{default/empty}{}
\defbeamertemplate{sidebar~canvas~left}{default/gotham~filigrane}{
	\hspace*{\sidebarLeftHOffset}
	\gothamLeftFiligrane
}
% Add the template to the prop (dictionary) of background template to use according to the situation
\prop_put:Nnn \l__gotham_template_name_prop {sidebar~canvas~left/default} {gotham~filigrane}
\prop_put:Nnn \l__gotham_template_name_prop {sidebar~canvas~right/default} {gotham~filigrane}
\prop_put:Nnn \l__gotham_template_name_prop {sidebar~left/default} {empty}
\prop_put:Nnn \l__gotham_template_name_prop {sidebar~right/default} {beamer}
%    \end{macrocode}
%   \end{macro}
% \end{implementation}

% \begin{documentation}
%   \begin{variable}{\l_gotham_defaultEdging}
%     Boolean to triggering if edging should be displayed by default (without giving the frame option).
%		The variable is |false| by default.
%   \end{variable}
% \end{documentation}
%%%%%%
% \begin{implementation}
%   \begin{macro}{\l_gotham_defaultEdging}
%     Boolean variable to display the edging by default (or not).
%     \UnitTested
%     \TestFiles{gotham-test-044}
%    \begin{macrocode}
\bool_new:N \l_gotham_defaultEdging
\bool_set_false:N \l_gotham_defaultEdging
% At every new frame, reset the options to default (unless some options/keys are given)
\BeforeBeginEnvironment{frame}{
	\bool_if:NTF \l_gotham_defaultEdging {
		\setbeamertemplate{sidebar~canvas~left}[default/\prop_item:Nn \l__gotham_template_name_prop {sidebar~canvas~left/default}]
		\setbeamertemplate{sidebar~canvas~right}[default/\prop_item:Nn \l__gotham_template_name_prop {sidebar~canvas~right/default}]
	}{
		% false
		\setbeamertemplate{sidebar~canvas~left}[default/empty]
		\setbeamertemplate{sidebar~canvas~right}[default/empty]
	}
}
%    \end{macrocode}
%   \end{macro}
% \end{implementation}

% \begin{documentation}
%   \begin{function}{\begin{frame}[edging]}
%      Add a frame option |edging| to display edging in sidebar canvas.
%   \end{function}
% \end{documentation}
%%%%%%
% \begin{implementation}
%   \begin{macro}{\begin{frame}[edging]}
%     Add a frame option |edging| to display an empty sidebar canvas canvas.
%		To do it, we must add a global boolean variable, capture the option at the begin of the frame and patch the end of the frame.
%     \UnitTested
%     \TestFiles{gotham-test-044}
%    \begin{macrocode}
% bool to trigger the add of edging in sidebar canvas
\newenvironment{edgingenv}{
	\setbeamertemplate{sidebar~canvas~left}[
		default/\prop_item:Nn \l__gotham_template_name_prop {sidebar~canvas~left/default}
	]
	\setbeamertemplate{sidebar~canvas~right}[
		default/\prop_item:Nn \l__gotham_template_name_prop {sidebar~canvas~right/default}
	]
}{}
\__gotham_add_beamerframe_key:n {edging}
%    \end{macrocode}
%   \end{macro}
% \end{implementation}

% \begin{documentation}
%   \begin{function}{\begin{frame}[noedging]}
%      Add a frame option |noedging| to do not display noedging in sidebar canvas.
%   \end{function}
% \end{documentation}
%%%%%%
% \begin{implementation}
%   \begin{macro}{\begin{frame}[noedging]}
%     Add a frame option |noedging| to do not display an empty sidebar canvas canvas.
%		To do it, we must add a global boolean variable, capture the option at the begin of the frame and patch the end of the frame.
%     \UnitTested
%     \TestFiles{gotham-test-044}
%    \begin{macrocode}
% bool to trigger the add of noedging in sidebar canvas
\newenvironment{noedgingenv}{
	\setbeamertemplate{sidebar~canvas~left}[default/empty]
	\setbeamertemplate{sidebar~canvas~right}[default/empty]
}{}
\__gotham_add_beamerframe_key:n {noedging}
%    \end{macrocode}
%   \end{macro}
% \end{implementation}

% \begin{documentation}
% \begin{function}{\useoutertheme}
%	\begin{syntax}
%		\cs{useoutertheme}\oarg{option1=value1, ...}\marg{gotham}
%		\textrm{where the options are (default marked as} \defopt{default}\textrm{):}
%     \meta{edging default} = \oarg{\defopt{off} \textbar on }
%		\meta{sidebar canvas left template} = \oarg{\defopt{gotham} \textbar ...}
% 		\meta{sidebar canvas right template} = \oarg{\defopt{gotham filigrane} \textbar empty \textbar ...}
%	\end{syntax}
%	The 'package' (useoutertheme) options can control |sidebar canvas right| (and |sidebar canvas left|) templates.
%  These templates are activated when giving the frame option |\begin{frame}[edging]|.
% 	The option |edging default=on| can enable the |sidebar canvas right| (and |sidebar canvas left|) templates on every frame; but it can still be turned off for specific frames when using the frame option |noedging|.
% \end{function}
% \end{documentation}
%%%%
% \begin{implementation}
% 	\begin{macro}{outer key -- interface}
% 		Controls the outer settings for sidebar canvas right and sidebar canvas left.
% 		\UnitTested
% 		\TestFiles{gotham-test-044}
%    \begin{macrocode}
\keys_define:nn { gotham / outer }
{
	% sidebar~canvas~right template
	sidebar~canvas~right~template .usage:n = { general },
	sidebar~canvas~right~template .default:n = { gotham~filigrane },
	sidebar~canvas~right~template .code:n = { \__gotham_set_prop_template:nn{sidebar~canvas~right/default}{#1} },
}
\keys_define:nn { gotham / outer }
{
	% sidebar~canvas~left template
	sidebar~canvas~left~template .usage:n = { general },
	sidebar~canvas~left~template .default:n = { gotham~filigrane },
	sidebar~canvas~left~template .code:n = { \__gotham_set_prop_template:nn{sidebar~canvas~left/default}{#1} },
}
\keys_define:nn { gotham / outer }{
	% edging default
	edging~default .choice:,
	edging~default .usage:n = { general },
	edging~default .default:n = { false },

	edging~default / true .code:n = { \bool_set_true:N \l_gotham_defaultEdging },
	edging~default / on .code:n = { \bool_set_true:N \l_gotham_defaultEdging },
	edging~default / enable .code:n = { \bool_set_true:N \l_gotham_defaultEdging },

	edging~default / false .code:n = { \bool_set_false:N \l_gotham_defaultEdging },
	edging~default / off .code:n = { \bool_set_false:N \l_gotham_defaultEdging },
	edging~default / disable .code:n = { \bool_set_false:N \l_gotham_defaultEdging },

	edging~default / unknown .code:n = { \PackageWarning{ gotham } { The~choice~'#1'~is~unknown~for~the~(known)~option~'edging~default',~so~being~ignored. }{helping~message: edging~default / unknown} },
}
%    \end{macrocode}
%   \end{macro}
% \end{implementation}


%%% Navigation \& Logo %%%
%%%%%%%%%%%%%%%%%%%%%%%%%%

% \begin{documentation}
%   \begin{function}{\defbeamertemplate{navigation~symbols}{empty} }
%     By default the navigation symbols are disable.
%   \end{function}
% \end{documentation}
%%%%%%
% \begin{implementation}
%   \begin{macro}{\defbeamertemplate*{navigation~symbols}{empty} }
%     Apply the empty navigation symbol template by default.
%     \UnitTested
%     \TestFiles{gotham-test-045}
%    \begin{macrocode}
\defbeamertemplate*{navigation~symbols}{empty}{}
%    \end{macrocode}
%   \end{macro}
% \end{implementation}

% \begin{documentation}
%   \begin{function}{\defbeamertemplate{navigation~symbols}{default} }
%     Navigation symbols can be turned on using |\setbeamertemplate{navigation symbols}[default]|.
%   \end{function}
% \end{documentation}
%%%%%%
% \begin{implementation}
%   \begin{macro}{\defbeamertemplate{navigation~symbols}{horizontal} }
%     From Beamer default theme.
%     \UnitTested
%     \TestFiles{gotham-test-045}
%    \begin{macrocode}
% \setbeamertemplate{navigation~symbols}[vertical]
% \setbeamertemplate{navigation~symbols}[only~frame~symbol]
% \setbeamertemplate{navigation~symbols}[default]% = horizontal
% \defbeamertemplate{navigation~symbols}{horizontal}{
% 	\usebeamercolor[fg]{navigation~symbols}
% 	\insertslidenavigationsymbol
% 	\insertframenavigationsymbol
% 	\insertsubsectionnavigationsymbol
% 	\insertsectionnavigationsymbol
% 	\insertdocnavigationsymbol
% 	\insertbackfindforwardnavigationsymbol
% }
%    \end{macrocode}
%   \end{macro}
% \end{implementation}

% \begin{implementation}
%   \begin{macro}{\defbeamertemplate{logo}{empty}}
%     Template used sometimes to have no logo on specific frames.
%     \UnitTested
%     \TestFiles{gotham-test-045}
%    \begin{macrocode}
\defbeamertemplate{logo}{empty}{}
%    \end{macrocode}
%   \end{macro}
% \end{implementation}

% \begin{documentation}
%   \begin{function}{\begin{frame}[nologo]}
%      Add a frame option |nologo|, if you do not want your logo to be displayed.
%   \end{function}
% \end{documentation}
%%%%%%
% \begin{implementation}
%   \begin{macro}{\begin{frame}[nologo]}
%     Add a frame option |nologo|, if you do not want your logo to be displayed.
%		To do it, we must add a global boolean variable, capture the option at the begin of the frame and patch the end of the frame.
%     \UnitTested
%     \TestFiles{gotham-test-045}
%    \begin{macrocode}
% bool to trigger the add of nologo action on frame.
\newenvironment{nologoenv}{
	\setbeamertemplate{logo}[empty]
}{}
\__gotham_add_beamerframe_key:n {nologo}
%    \end{macrocode}
%   \end{macro}
% \end{implementation}


%%% Headline \& Frametitle  %%%
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%

%%% Headline %%%

% \begin{implementation}
%   \begin{macro}{\defbeamertemplate{headline}{default/gotham}}
%     The headline template is empty by default by can be changed when using progress bar or the current section.
%     \UnitTested
%     \TestFiles{gotham-test-046, gotham-test-046b, gotham-test-047}
%    \begin{macrocode}
\defbeamertemplate{headline}{default/gotham}{}
\prop_put:Nnn \l__gotham_template_name_prop {headline/default} {gotham}
%    \end{macrocode}
%   \end{macro}
% \end{implementation}

% \begin{implementation}
%   \begin{macro}{\defbeamertemplate{headline}{default/gotham~section}}
%     The headline template used to print the current section name and subection.
%     This template is used with |circlehead| progress bar
%     \UnitTested
%     \TestFiles{gotham-test-046, gotham-test-046b, gotham-test-047}
%    \begin{macrocode}
\defbeamertemplate{headline}{default/gotham~section}{
	\begin{beamercolorbox}[wd=1.0\paperwidth, ht=2.5ex, dp=1.4ex, left]{headfoot}
		\usebeamerfont{section~in~head/foot}\hspace*{3.5ex}
		\usebeamertemplate{section~in~head/foot}
	\end{beamercolorbox}
}
%    \end{macrocode}
%   \end{macro}
% \end{implementation}


%%% Frametitle %%%

% \begin{documentation}
%   \begin{variable}{\gothamFrametitleToppading, \gothamFrametitleBottompading, \gothamFrametitleLeftpading, \gothamFrametitleRightpading}
%     Dimensions controlling the top, bottom, left and right padding in the frametitle.
%   \end{variable}
% \end{documentation}
%%%%%%
% \begin{implementation}
%   \begin{variable}{\gothamFrametitleToppading, \gothamFrametitleBottompading, \gothamFrametitleLeftpading, \gothamFrametitleRightpading}
%     Dimensions of lengths used in the frametitle: top, bottom, left and right padding.
%     All of them are equal to 2.2ex by default.
%    \begin{macrocode}
\newlength{\gothamFrametitleToppading}
\newlength{\gothamFrametitleBottompading}
\newlength{\gothamFrametitleLeftpading}
\newlength{\gothamFrametitleRightpading}
\setlength{\gothamFrametitleToppading}{2.2ex}
\setlength{\gothamFrametitleBottompading}{2.2ex}
\setlength{\gothamFrametitleLeftpading}{2.2ex}
\setlength{\gothamFrametitleRightpading}{2.2ex}
% \gotham@strut from inner
\providecommand{\gotham@strut}{
	\vphantom{ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz (/)}
}
%    \end{macrocode}
%   \end{variable}
% \end{implementation}

% \begin{implementation}
%   \begin{macro}{\gotham@frametitlestrut@start, \gotham@frametitlestrut@end}
%     Commands used to control the space over and under the title in frametitle.
%     \UnitTested
%     \TestFiles{gotham-test-046, gotham-test-046b, gotham-test-047}
%    \begin{macrocode}
\providecommand{\gotham@frametitlestrut@start}{
	\rule{0pt}{\gothamFrametitleToppading +
		\totalheightof{
			\ifcsdef{gotham@frametitleformat}{\gotham@frametitleformat{X}}{X}
		}
	}
}
\providecommand{\gotham@frametitlestrut@end}{
	\rule[-\gothamFrametitleBottompading]{0pt}{\gothamFrametitleBottompading}
}
%    \end{macrocode}
%   \end{macro}
% \end{implementation}

% \begin{documentation}
%   \begin{function}{\gothamInstituteLogoSquare[height]}
%     \begin{syntax}
%       \cs{height} \oarg{height of the logo use in inclugraphics (4ex by default)}
%     \end{syntax}
%     Command to set the image logo to include.
%   \end{function}
% \end{documentation}
%%%%%%
% \begin{implementation}
%   \begin{function}{\gothamInstituteLogoSquare[height] \defbeamertemplate{includeLogo}{default/gotham~square}}
%     \begin{syntax}
%       \cs{gothamInstituteLogoSquare} \oarg{height}
%     \end{syntax}
%     Command to include the desired logo and a template used to add it to the frametitle.
%     For example your can do |\renewcommand{\gothamInstituteLogoSquare}[1][4ex]{\includegraphics[height=#1]{gotham-logo.pdf}}|.
%     \TestFiles{gotham-test-046, gotham-test-047}
%    \begin{macrocode}
\providecommand{\gothamInstituteLogoSquare}[1][4ex]{
	%\includegraphics[height=#1]{gotham-logo.pdf}
}
\defbeamertemplate{includeLogo}{default/gotham~square}{
	\gothamInstituteLogoSquare
}
\prop_put:Nnn \l__gotham_template_name_prop {includeLogo/default} {gotham~square}
%    \end{macrocode}
%   \end{function}
% \end{implementation}

% \begin{implementation}
%   \begin{macro}{\defbeamertemplate{includeLogo}{default/gotham~circle}}
%     Template used in frametitle when the option |progress bar= circlehead| is activated.
%     \UnitTested
%     \TestFiles{gotham-test-046b}
%    \begin{macrocode}
\defbeamertemplate{includeLogo}{default/gotham~circle}{
	\gothamProgressCircle
}
%    \end{macrocode}
%   \end{macro}
% \end{implementation}

% \begin{implementation}
%   \begin{macro}{\defbeamertemplate{includeLogo}{default/gotham~circle}}
%     Template to make sure the logo will remain centered and to do not change the height of the line when included.
%     This template is used to include logo in frametitle.
%     \UnitTested
%     \TestFiles{gotham-test-046b}
%    \begin{macrocode}
\defbeamertemplate{instituteLogo}{default/gotham}{
	% \raisebox{lift}[height][depth]{text}
	\raisebox{0pt}[0pt][0pt]{
		\raisebox{.5\fontcharht\font`E-0.5\height}{
			% \setbeamertemplate{}[]
			\setbeamertemplate{includeLogo}[default/\prop_item:Nn \l__gotham_template_name_prop {includeLogo/default}]
			\usebeamertemplate{includeLogo}
		}
	}
}
\prop_put:Nnn \l__gotham_template_name_prop {instituteLogo/default} {gotham}
%    \end{macrocode}
%   \end{macro}
% \end{implementation}

% \begin{documentation}
%   \begin{function}{\gothamFrameSubtitleSep}
%     Command that can be redefined to control the separator between the title of the frame and its subtitle.
%     For example if a default Beamer style is desired, one can use |\renewcommand{\gothamFrameSubtitleSep}{\\[-.42em]}|.
%     By default it is a hyphen.
%   \end{function}
% \end{documentation}
%%%%%%
% \begin{implementation}
%   \begin{function}{\gothamFrameSubtitleSep}
%     Hyphen used as separator between title of the frame and its subtitle (within frametitle template).
%     \TestFiles{ gotham-test-047}
%    \begin{macrocode}
\providecommand{\gothamFrameSubtitleSep}{
	% \\[-.42em] % if newline (as default Beamer)
	% or if same line with a -- separator.
	\ ---~
}
%    \end{macrocode}
%   \end{function}
% \end{implementation}

% \begin{documentation}
%   \begin{variable}{\gothamFramesubtitleStrutend}
%     Variable vertical length used to adapte the bottom padding when a subtitle is given.
%   \end{variable}
% \end{documentation}
%%%%%%
% \begin{implementation}
%   \begin{variable}{\gothamFramesubtitleStrutend}
%     Length used in |vspace| at the end of framesubtitle.
%    \begin{macrocode}
\newlength{\gothamFramesubtitleStrutend}
\setlength{\gothamFramesubtitleStrutend}{0pt}
% \setlength{\gothamFramesubtitleStrutend}{-1.25ex} %% When \newcommand{\gothamFrameSubtitleSep}{\\[-.42em]}
%    \end{macrocode}
%   \end{variable}
% \end{implementation}

% \begin{implementation}
%   \begin{macro}{\defbeamertemplate{frametitle}{default/gotham~subsameline}}
%     Template for frametitle include subtitle on the same line and a logo a flushed left.
%     \UnitTested
%     \TestFiles{gotham-test-047}
%    \begin{macrocode}
\defbeamertemplate{frametitle}{default/gotham~subsameline}{
	\nointerlineskip
	\begin{beamercolorbox}[
			wd=\paperwidth,
			sep=0pt,
			leftskip=\gothamFrametitleLeftpading,
			rightskip=\gothamFrametitleRightpading,
		]{frametitle}
		\gotham@frametitlestrut@start
		\insertframetitle
		\ifx\insertframesubtitle\@empty
			%% if subtitle to the frame is empty
		\else
			%% if not empty: add subtitle
			{\usebeamerfont{framesubtitle}\usebeamercolor[fg]{framesubtitle}\gothamFrameSubtitleSep \insertframesubtitle}
			\vspace*{\gothamFramesubtitleStrutend}
		\fi
		\nolinebreak
		%% Add logo
		\hfill{
			\setbeamertemplate{instituteLogo}[default/\prop_item:Nn \l__gotham_template_name_prop {instituteLogo/default}]
			\usebeamertemplate{instituteLogo}
		}
		\gotham@frametitlestrut@end
	\end{beamercolorbox}
}
\prop_put:Nnn \l__gotham_template_name_prop {frametitle/default} {gotham~subsameline}
%    \end{macrocode}
%   \end{macro}
% \end{implementation}

% \begin{implementation}
%   \begin{macro}{\defbeamertemplate{framesubtitle}{default/gotham~subnewline}}
%     Template for framesubtitle include subtitle on the same line and a logo a flushed left.
%     \UnitTested
%     \TestFiles{gotham-test-047}
%    \begin{macrocode}
\dim_new:N \l__gotham_framesubtitle_subnewline_strutend_dim
\defbeamertemplate{framesubtitle}{default/gotham~subnewline}{
	\nointerlineskip
	\begin{beamercolorbox}[
		wd=\paperwidth,
		sep=0pt,
		leftskip=\gothamFrametitleLeftpading,
		rightskip=\gothamFrametitleRightpading,
	]{frametitle}
		% put the subtitle in a raisebox to have no influence on the result.
		\raisebox{0pt}[0pt][0pt]{
			\raisebox{-0.3ex}{
				{ \usebeamerfont{framesubtitle}\usebeamercolor[fg]{framesubtitle}\insertframesubtitle}
			}
		}
		% add 1ex to take into account the subtitle height.
		\dim_set:Nn \l__gotham_framesubtitle_subnewline_strutend_dim {1.ex+\gothamFramesubtitleStrutend}
		\vspace{\l__gotham_framesubtitle_subnewline_strutend_dim}
	\end{beamercolorbox}
}
\prop_put:Nnn \l__gotham_template_name_prop {framesubtitle/default} {gotham~subnewline}
%    \end{macrocode}
%   \end{macro}
% \end{implementation}

% \begin{implementation}
%   \begin{macro}{\defbeamertemplate{framesubtitle}{default/gotham~subnewline}}
%     Template for frametitle and a logo a flushed left then the subtitle on a new line.
%     \UnitTested
%     \TestFiles{gotham-test-047}
%    \begin{macrocode}
\defbeamertemplate{frametitle}{default/gotham~subnewline}{
	\nointerlineskip
	\begin{beamercolorbox}[
		wd=\paperwidth,
		sep=0pt,
		leftskip=\gothamFrametitleLeftpading,
		rightskip=\gothamFrametitleRightpading,
	]{frametitle}
		\gotham@frametitlestrut@start
		\insertframetitle
		\nolinebreak
		\hfill{
			\setbeamertemplate{instituteLogo}[default/\prop_item:Nn \l__gotham_template_name_prop {instituteLogo/default}]
			\usebeamertemplate{instituteLogo}
		}
		\gotham@frametitlestrut@end
	\end{beamercolorbox}
	%% End of the frametitle box, start then use the subtitle template if needed.
	\ifx\insertframesubtitle\@empty
		%% if subtitle to the frame is not empty
	\else
		% reduce vertical space to have a 1pt overlap, so no white line appears with vectorial viewers.
		\vspace*{-1pt}
		% add the subtitle
		\setbeamertemplate{framesubtitle}[default/\prop_item:Nn \l__gotham_template_name_prop {framesubtitle/default}]
		% \setbeamertemplate{framesubtitle}%[framesubtitle/default]
		\usebeamertemplate{framesubtitle}
	\fi
}
%    \end{macrocode}
%   \end{macro}
% \end{implementation}

% \begin{documentation}
% \begin{function}{\useoutertheme}
%	\begin{syntax}
%		\cs{useoutertheme}\oarg{option1=value1, ...}\marg{gotham}
%		\textrm{where the options are (default marked as} \defopt{default}\textrm{):}
%     \meta{frametitle template} = \oarg{\defopt{gotham subsameline} \textbar gotham subnewline \textbar ... }
%		\meta{framesubtitle template} = \oarg{\defopt{gotham subnewline} \textbar ...}
%	\end{syntax}
%	The 'package' (useoutertheme) options can control |frametitle| (and |framesubtitle|) templates.
% \end{function}
% \end{documentation}
%%%%
% \begin{implementation}
% 	\begin{macro}{outer key -- interface}
% 		Controls the outer settings for frametitle and framesubtitle.
% 		\UnitTested
% 		\TestFiles{gotham-test-047}
%    \begin{macrocode}
\keys_define:nn { gotham / outer }{
	% frametitle template
	frametitle~template .usage:n = { general },
	frametitle~template .default:n = { gotham~subsameline },
	frametitle~template .code:n = {
		\__gotham_set_prop_template:nn{frametitle/default}{#1}
		\setbeamertemplate{frametitle}[default/\prop_item:Nn \l__gotham_template_name_prop {frametitle/default}]
	}
}
\keys_define:nn { gotham / outer }{
	% frametitle template
	framesubtitle~template .usage:n = { general },
	framesubtitle~template .default:n = { gotham~subnewline },
	framesubtitle~template .code:n = {
		\__gotham_set_prop_template:nn{framesubtitle/default}{#1}
		\setbeamertemplate{framesubtitle}[default/\prop_item:Nn \l__gotham_template_name_prop {framesubtitle/default}]
	}
}
%    \end{macrocode}
%   \end{macro}
% \end{implementation}


%%% Continuation %%%

% \begin{implementation}
%   \begin{macro}{\defbeamertemplate{frametitle~continuation}{default/beamer}}
%     Template for numerotation of frametitle when a frame are continuing on sevral pages (allowed with the beamer option |allowframebreaks|).
%     Beamer theme (by default) is using roman number with uppercase.
%     \UnitTested
%     \TestFiles{gotham-test-047}
%    \begin{macrocode}
\defbeamertemplate{frametitle~continuation}{default/beamer}{
	\usebeamerfont{frametitle}
	{
		\MakeUppercase{\romannumeral \insertcontinuationcount}
	}
}
%    \end{macrocode}
%   \end{macro}
% \end{implementation}

% \begin{implementation}
%   \begin{macro}{\defbeamertemplate{frametitle~continuation}{default/tot}}
%     Template for numerotation of frametitle when a frame are continuing on sevral pages (allowed with the beamer option |allowframebreaks|).
%     This template is using arabic number slash over the total number of page for this frame.
%     \UnitTested
%     \TestFiles{gotham-test-047}
%    \begin{macrocode}
\defbeamertemplate{frametitle~continuation}{default/tot}{
	\usebeamerfont{frametitle}
	{
		\textmd{%
			[\insertcontinuationcount
			\,/\,%
			\the\numexpr\beamer@endpageofframe+1-\beamer@startpageofframe
			]%
		}%
	}
}
%    \end{macrocode}
%   \end{macro}
% \end{implementation}

% \begin{implementation}
%   \begin{macro}{\defbeamertemplate{frametitle~continuation}{default/gotham}}
%     Template for numerotation of frametitle when a frame are continuing on sevral pages (allowed with the beamer option |allowframebreaks|).
%     Gotham theme (by default) is using roman number with lowercase.
%     \UnitTested
%     \TestFiles{gotham-test-047}
%    \begin{macrocode}
\defbeamertemplate{frametitle~continuation}{default/gotham}{
	\usebeamerfont{frametitle}
	{
		%\small
		(\romannumeral \insertcontinuationcount)
	}
}
\prop_put:Nnn \l__gotham_template_name_prop {frametitle~continuation/default} {gotham}
%    \end{macrocode}
%   \end{macro}
% \end{implementation}

% \begin{documentation}
% \begin{function}{\useoutertheme}
%	\begin{syntax}
%		\cs{useoutertheme}\oarg{option1=value1, ...}\marg{gotham}
%		\textrm{where the options are (default marked as} \defopt{default}\textrm{):}
%     \meta{frametitle continuation template} = \oarg{\defopt{gotham} \textbar tot \textbar beamer \textbar ... }
%	\end{syntax}
%	The 'package' (useoutertheme) options can control |frametitle continuation| templates.
% \end{function}
% \end{documentation}
%%%%
% \begin{implementation}
% 	\begin{macro}{outer key -- interface}
% 		Controls the outer settings for frametitle continuation.
% 		\UnitTested
% 		\TestFiles{gotham-test-047}
%    \begin{macrocode}
\keys_define:nn { gotham / outer }{
	% frametitle template
	frametitle~continuation~template .usage:n = { general },
	frametitle~continuation~template .default:n = { gotham },
	frametitle~continuation~template .code:n = {
		\__gotham_set_prop_template:nn{frametitle~continuation/default}{#1}
		\setbeamertemplate{frametitle~continuation}[default/\prop_item:Nn \l__gotham_template_name_prop {frametitle~continuation/default}]
	}
}
%    \end{macrocode}
%   \end{macro}
% \end{implementation}


%%% Footer \& Footline  %%%
%%%%%%%%%%%%%%%%%%%%%%%%%%

%%% Footline  %%%

% \begin{implementation}
%   \begin{macro}{\defbeamertemplate{footline}{empty}}
%     Empty footline template used when the option nofootline is given.
%     \UnitTested
%     \TestFiles{gotham-test-048}
%    \begin{macrocode}
\defbeamertemplate{footline}{empty}{}
%    \end{macrocode}
%   \end{macro}
% \end{implementation}

% \begin{documentation}
%   \begin{function}{\begin{frame}[nofootline]}
%      Add a frame option |nofootline| to do not display nofootline.
%   \end{function}
% \end{documentation}
%%%%%%
% \begin{implementation}
%   \begin{macro}{\begin{frame}[nofootline]}
%     Add a frame option |nofootline| to do not display an empty footline.
%		To do it, we must add a global boolean variable, capture the option at the begin of the frame and patch the end of the frame.
%     \UnitTested
%     \TestFiles{gotham-test-048}
%    \begin{macrocode}
% bool to trigger the add of nofootline in frame.
\newenvironment{nofootlineenv}{
	\setbeamertemplate{footline}[empty]
}{}
\__gotham_add_beamerframe_key:n {nofootline}
%    \end{macrocode}
%   \end{macro}
% \end{implementation}

% \begin{documentation}
%   \begin{variable}[updated=2024-11-11]{\gothamFootlineVOffset, \gothamFootlineHRightOffset,\gothamFootlineHeight, \gothamFootlineDepth}
%     Lengths controlling the position of |footline|.
%     |\gothamFootlineVOffset| is controlling vertical space between to bottom of the text (or the footnote) and the footline.
%     |\gothamFootlineVOffset| is by default -0.5ex, to have more space in the frame but if the footer is not really used, the space can be even more optimized using |\setlength{\gothamFootlineVOffset}{-2.0ex}|.
%     |\gothamFootlineHRightOffset| is horizontal space between the right corner and the footline.
%     Obviously, it can be back to "normal" setting it to 0pt.
%     |\gothamFootlineHeight| and |\gothamFootlineDepth|  are controlling the heigth of the footline and the position of the text within.
%   \end{variable}
% \end{documentation}
%%%%%%
% \begin{implementation}
%   \begin{variable}[updated=2024-11-11]{\gothamFootlineVOffset, \gothamFootlineHeight, \gothamFootlineDepth}
%     Lengths used in |footline| template.
%    \begin{macrocode}
% Footline lengths
% space between to bottom of the text (or the footnote) and the footline
\newlength{\gothamFootlineVOffset}
\newlength{\gothamFootlineHeight}
\newlength{\gothamFootlineDepth}
\newlength{\gothamFootlineHRightOffset}

\setlength{\gothamFootlineVOffset}{-0.5ex}
\setlength{\gothamFootlineDepth}{0.1ex}
\setlength{\gothamFootlineHeight}{1.5ex}
\setlength{\gothamFootlineHRightOffset}{\spaceskip}
%    \end{macrocode}
%   \end{variable}
% \end{implementation}

% \begin{implementation}
%   \begin{macro}{\defbeamertemplate*{footline}{default/gotham}}
%     Template that is activate by default since this footline is relatively generic.
% 		\changes{v1.2.0}{2024-11-11}{add gothamFootlineHRightOffset}
%     \UnitTested
%     \TestFiles{gotham-test-048}
%    \begin{macrocode}
\defbeamertemplate*{footline}{default/gotham}{
	% new line to adjust the footline position.
	\vspace*{\gothamFootlineVOffset}
	\begin{beamercolorbox}[
		wd=\textwidth,
		sep=0pt,
		leftskip=3ex,
		rightskip=3ex,
		ht={\gothamFootlineHeight},
		dp={\gothamFootlineDepth},
	]{footline}
		\usebeamerfont{page number in head/foot}
		\ifbeamertemplateempty{frame~footer}{
			%executed if empty
			\hfill \ \gotham@strut
		}{
			%⟨executed otherwise⟩
			\usebeamertemplate*{frame~footer}
		}
		\hspace{\gothamRightFooterPadding}
		{\usebeamertemplate{page~number~in~head/foot}}
		\hspace*{\gothamFootlineHRightOffset}
	\end{beamercolorbox}
}
\prop_put:Nnn \l__gotham_template_name_prop {footline/default} {gotham}
%    \end{macrocode}
%   \end{macro}
% \end{implementation}

% \begin{documentation}
%   \begin{function}{\begin{frame}[nopagenumber]}
%      Add a frame option |nopagenumber| to do not display the page number in the footline.
%   \end{function}
% \end{documentation}
%%%%%%
% \begin{implementation}
%   \begin{macro}{\begin{frame}[nopagenumber]}
%     Add a frame option |nopagenumber| to do not display an page number locally.
%		To do it, we must add a global boolean variable, capture the option at the begin of the frame and patch the end of the frame.
%     \UnitTested
%     \TestFiles{gotham-test-048}
%    \begin{macrocode}
% bool to trigger the add of nopagenumber in frame.
\newenvironment{nopagenumberenv}{
	\setbeamertemplate{page~number~in~head/foot}[none]
}{}
\__gotham_add_beamerframe_key:n {nopagenumber}
%    \end{macrocode}
%   \end{macro}
% \end{implementation}


%%% Footer  %%%

% \begin{documentation}
%   \begin{variable}{\gothamLeftFooterPadding, \gothamRightFooterPadding, \gothamFooterHOffset}
%     Lengths controlling the position of |footer|.
%     |\gothamFooterHOffset| is controlling the horizontal space between the footer and the bottom of the page (or the progressbar).
%     |\gothamLeftFooterPadding| and |\gothamLeftFooterPadding| are controlling the space between the left and right side of the footer and the border of the page.
%   \end{variable}
% \end{documentation}
%%%%%%
% \begin{implementation}
%   \begin{variable}{\gothamLeftFooterPadding, \gothamRightFooterPadding, \gothamFooterHOffset}
%     Lengths used in |footer| template for positioning left right and bottom.
%    \begin{macrocode}
\newlength{\gothamLeftFooterPadding}
\newlength{\gothamRightFooterPadding}
\newlength{\gothamFooterHOffset}
\setlength{\gothamLeftFooterPadding}{2.0ex}
\setlength{\gothamRightFooterPadding}{3.5ex}
\setlength{\gothamFooterHOffset}{0pt}
%    \end{macrocode}
%   \end{variable}
% \end{implementation}

% \begin{implementation}
%   \begin{macro}{\defbeamertemplate{frame~footer}{none}}
%     Footer template used when nothing is put as footer but it will create undesired results.
%     \UnitTested
%     \TestFiles{gotham-test-048}
%    \begin{macrocode}
\defbeamertemplate{frame~footer}{none}{}
%    \end{macrocode}
%   \end{macro}
% \end{implementation}

% \begin{implementation}
%   \begin{macro}{\defbeamertemplate{frame~footer}{empty}}
%     Footer template used when |nofooter| option is given and it presevers spacing to have nice results.
%     \UnitTested
%     \TestFiles{gotham-test-048}
%    \begin{macrocode}
\defbeamertemplate{frame~footer}{empty}{
	\hspace{\gothamLeftFooterPadding}
	\hfill \
	\gotham@strut
	% decrease space between progress bar and footer
	\vspace*{\gothamFooterHOffset}
}
%    \end{macrocode}
%   \end{macro}
% \end{implementation}

% \begin{documentation}
%   \begin{function}{\begin{frame}[nofooter]}
%      Add a frame option |nofooter| to do not display nofooter.
%   \end{function}
% \end{documentation}
%%%%%%
% \begin{implementation}
%   \begin{macro}{\begin{frame}[nofooter]}
%     Add a frame option |nofooter| to do not display an empty footer.
%		To do it, we must add a global boolean variable, capture the option at the begin of the frame and patch the end of the frame.
%     \UnitTested
%     \TestFiles{gotham-test-048}
%    \begin{macrocode}
% bool to trigger the add of nofooter in frame.
\newenvironment{nofooterenv}{
	\setbeamertemplate{frame~footer}[empty]
}{}
\__gotham_add_beamerframe_key:n {nofooter}
%    \end{macrocode}
%   \end{macro}
% \end{implementation}

% \begin{documentation}
%   \begin{variable}{\l_gotham_defaultRotateFooter}
%     Boolean to triggering if rotated footer should be displayed by default (without giving the frame option).
%		The variable is |false| by default.
%   \end{variable}
% \end{documentation}
%%%%%%
% \begin{implementation}
%   \begin{macro}{\l_gotham_defaultRotateFooter}
%     Boolean variable to display the rotated footer by default (or not).
%     \UnitTested
%     \TestFiles{gotham-test-048}
%    \begin{macrocode}
\bool_new:N \l_gotham_defaultRotateFooter
\bool_set_false:N \l_gotham_defaultRotateFooter
\bool_new:N \l_gotham_RotateFooter
\bool_set_false:N \l_gotham_RotateFooter
% At every new frame, reset the options to default (unless some options/keys are given)
\BeforeBeginEnvironment{frame}{
	\bool_if:NTF \l_gotham_defaultRotateFooter {
		\bool_set_true:N \l_gotham_RotateFooter
	}{% false
		\bool_set_false:N \l_gotham_RotateFooter
	}
}
%    \end{macrocode}
%   \end{macro}
% \end{implementation}

% \begin{documentation}
%   \begin{function}{\begin{frame}[rotateFooter]}
%      Add a frame option |rotateFooter| to display rotated footer.
%   \end{function}
% \end{documentation}
%%%%%%
% \begin{implementation}
%   \begin{macro}{\begin{frame}[rotateFooter]}
%     Add a frame option |rotateFooter| to display a rotated footer.
%		To do it, we must add a global boolean variable, capture the option at the begin of the frame and patch the end of the frame.
%     \UnitTested
%     \TestFiles{gotham-test-048}
%    \begin{macrocode}
% bool to trigger
% Capture new options/keys for frames
\define@key{beamerframe}{rotateFooter}[true]{
	\bool_set_true:N \l_gotham_RotateFooter
}
%    \end{macrocode}
%   \end{macro}
% \end{implementation}

% \begin{documentation}
%   \begin{function}{\begin{frame}[noRotateFooter]}
%      Add a frame option |noRotateFooter| to display a none-RotateFooter.
%   \end{function}
% \end{documentation}
%%%%%%
% \begin{implementation}
%   \begin{macro}{\begin{frame}[noRotateFooter]}
%     Add a frame option |noRotateFooter| to display a none-rotated footer.
%		To do it, we must add a global boolean variable, capture the option at the begin of the frame and patch the end of the frame.
%     \UnitTested
%     \TestFiles{gotham-test-048}
%    \begin{macrocode}
% Capture new options/keys for frames
\define@key{beamerframe}{noRotateFooter}[true]{
	\bool_set_false:N \l_gotham_RotateFooter
}
%    \end{macrocode}
%   \end{macro}
% \end{implementation}

% \begin{documentation}
% \begin{function}{\useoutertheme}
%	\begin{syntax}
%		\cs{useoutertheme}\oarg{option1=value1, ...}\marg{gotham}
%		\textrm{where the options are (default marked as} \defopt{default}\textrm{):}
%     \meta{rotateFooter default} = \oarg{\defopt{off} \textbar on }
%	\end{syntax}
% 	The option |rotateFooter default=on| can enable the rotation of the footer on every frame; but it can all be turned on for specific frames when using the frame option |\begin{frame}[rotateFooter]|.
% \end{function}
% \end{documentation}
%%%%
% \begin{implementation}
% 	\begin{macro}{outer key -- interface}
% 		Controls the outer settings for sidebar canvas right and sidebar canvas left.
% 		\UnitTested
% 		\TestFiles{gotham-test-048}
%    \begin{macrocode}
\keys_define:nn { gotham / outer }{
	% rotateFooter default
	rotateFooter~default .choice:,
	rotateFooter~default .usage:n = { general },
	rotateFooter~default .default:n = { false },

	rotateFooter~default / true .code:n = { \bool_set_true:N \l_gotham_defaultRotateFooter },
	rotateFooter~default / on .code:n = { \bool_set_true:N \l_gotham_defaultRotateFooter },
	rotateFooter~default / enable .code:n = { \bool_set_true:N \l_gotham_defaultRotateFooter },

	rotateFooter~default / false .code:n = { \bool_set_false:N \l_gotham_defaultRotateFooter },
	rotateFooter~default / off .code:n = { \bool_set_false:N \l_gotham_defaultRotateFooter },
	rotateFooter~default / disable .code:n = { \bool_set_false:N \l_gotham_defaultRotateFooter },

	rotateFooter~default / unknown .code:n = { \PackageWarning{ gotham } { The~choice~'#1'~is~unknown~for~the~(known)~option~'rotateFooter~default',~so~being~ignored. }{helping~message: rotateFooter~default / unknown} },
}
%    \end{macrocode}
%   \end{macro}
% \end{implementation}

% \begin{documentation}
%   \begin{variable}{\gothamFootlineRuleLeftPadding, \gothamFootlineRuleHeight, \gothamFootlineRuleLength, \gothamHposLeftRotFooter, \gothamHposRightRotFooter, \gothamVposLeftRotFooter, \gothamVposRightRotFooter}
%     Lengths controlling the position of |footer|.
%     |\gothamFootlineRuleLeftPadding| is controlling the horizontal space between the left border of the page and the left side of the rule.
%     |\gothamFootlineRuleHeight| is controlling the height of the rule use to delimit the footer.
%     |\gothamFootlineRuleLength| is controlling the length of the rule use to delimit the footer.
%     |\gothamHposLeftRotFooter| is controlling the horizontal positioning of the left part of the rotatated footer.
%     |\gothamHposRightRotFooter| is controlling the horizontal positioning of the right part of the rotatated footer.
%     |\gothamVposLeftRotFooter| is controlling the vertical positioning of the left part of the rotatated footer.
%     |\gothamVposRightRotFooter| is controlling the vertical positioning of the right part of the rotatated footer.
%
%   \end{variable}
% \end{documentation}
%%%%%%
% \begin{implementation}
%   \begin{variable}{\gothamFootlineRuleLeftPadding, \gothamFootlineRuleHeight, \gothamFootlineRuleLength, \gothamHposLeftRotFooter, \gothamHposRightRotFooter, \gothamVposLeftRotFooter, \gothamVposRightRotFooter}
%     Lengths used in |footer| template.
%    \begin{macrocode}
\newlength{\gothamFootlineRuleLeftPadding}
\newlength{\gothamFootlineRuleHeight}
\newlength{\gothamFootlineRuleLength}

\setlength{\gothamFootlineRuleLeftPadding}{7mm}
\setlength{\gothamFootlineRuleHeight}{0.0pt}
% \setlength{\gothamFootlineRuleHeight}{0.5pt} % This is nice also but have a cleaner default, I turned it to 0.
\setlength{\gothamFootlineRuleLength}{15mm}

% horizontal position (in picture env) for  the rotated footer.
\newlength{\gothamHposLeftRotFooter}
\newlength{\gothamHposRightRotFooter}
\newlength{\gothamVposLeftRotFooter}
\newlength{\gothamVposRightRotFooter}

\setlength{\gothamHposLeftRotFooter}{-7pt}
\setlength{\gothamHposRightRotFooter}{2pt}
\setlength{\gothamVposLeftRotFooter}{15pt}
\setlength{\gothamVposRightRotFooter}{15pt}
%    \end{macrocode}
%   \end{variable}
% \end{implementation}

% \begin{implementation}
%   \begin{variable}{\hlenRightRotFooter, \hlenLeftRotFooter}
%     Temporary variables for the horizontal length of the rotated footer
%    \begin{macrocode}
% Not used yet because I need to have a latex3 settowidth equivalent.
% I will maybe take inspiration from https://tex.stackexchange.com/questions/492367/does-expl3-have-alternative-to-settowidth-and-settoheight
% \dim_new:N \l__gotham_HLen_rightRotFooter_dim
% \dim_new:N \l__gotham_HLen_leftRotFooter_dim
\newlength{\hlenRightRotFooter}
\newlength{\hlenLeftRotFooter}
%    \end{macrocode}
%   \end{variable}
% \end{implementation}

% \begin{implementation}
%   \begin{macro}{\defbeamertemplate{frame~footer}{default/gotham}}
%     Template for frame footer used by gotham, allowing a rotated footer.
% 		\changes{v1.2.0}{2024-11-11}{add hook gothamHookFooter and gothamFootlineHRightOffset}
%     \UnitTested
%     \TestFiles{gotham-test-048}
%    \begin{macrocode}
\providecommand{\gothamHookFooter}{}
\defbeamertemplate{frame~footer}{default/gotham}{
	%%% Add a ruler but wihtout affecting the dimensions of the footline
	\vbox to 0pt{
		% Vertical stretch to ensure proper spacing
		\vss
		\hbox to 0pt{
			\hspace*{\gothamFootlineRuleLeftPadding}
			% \usebeamercolor{frametitle}
			% \color{frametitle.bg}
			\usebeamercolor{footlineRule}
			\color{footlineRule.fg}
			\rule{\gothamFootlineRuleLength}{\gothamFootlineRuleHeight}
			\vspace*{
				\dimexpr \gothamFootlineHeight -0.25em\relax
			}
			% Horizontal stretch to ensure proper spacing
			\hss
		}
	}
	%%% Add Hook
	\gothamHookFooter{}
	%%% Add short date
	\hspace{\gothamLeftFooterPadding}
	\settowidth{\hlenLeftRotFooter}{\hspace{-\gothamLeftFooterPadding}}
	\addtolength{\hlenLeftRotFooter}{\gothamHposLeftRotFooter}
	% \ifbool{rotateFooter}{
	\bool_if:NTF \l_gotham_RotateFooter {
		% rotateFooter true
		\begin{picture}(0,0)(0,0)
			\put(\hlenLeftRotFooter,\gothamVposLeftRotFooter){\rotatebox{90}{\insertshortdate}}
		\end{picture}
	}{
		% rotateFooter false
		\insertshortdate
	}
	\hfill \
	%%% Add short title
	\hfill \ \insertshorttitle
		% make sure that the vertical space is constant: strut.
		\gotham@strut
	\hfill \
	\hfill \
	%%% Add short author
	\bool_if:NTF \l_gotham_RotateFooter {
		% rotateFooter true
		\settowidth{\hlenRightRotFooter}{\hspace{\gothamRightFooterPadding}\usebeamertemplate{page~number~in~head/foot}\hspace*{\gothamFootlineHRightOffset}}
		\addtolength{\hlenRightRotFooter}{\gothamHposRightRotFooter}
		\begin{picture}(0,0)(0,0)
			\put(\hlenRightRotFooter,\gothamVposRightRotFooter){\rotatebox{90}{\insertshortauthor}}
		\end{picture}
	}{
		% rotateFooter false
		\insertshortauthor
	}
	%%% Decrease space between progress bar and footer
	\vspace*{\gothamFooterHOffset}
}
\prop_put:Nnn \l__gotham_template_name_prop {frame~footer/default} {gotham}
%    \end{macrocode}
%   \end{macro}
% \end{implementation}

% \begin{documentation}
% \begin{function}{\useoutertheme}
%	\begin{syntax}
%		\cs{useoutertheme}\oarg{option1=value1, ...}\marg{gotham}
%		\textrm{where the options are (default marked as} \defopt{default}\textrm{):}
%     \meta{footer template} = \oarg{\defopt{gotham} \textbar ... }
%	\end{syntax}
% 	The option |footer template| can which template to use as a footer.
% \end{function}
% \end{documentation}
%%%%
% \begin{implementation}
% 	\begin{macro}{outer key -- interface}
% 		Controls the outer settings for footer template.
% 		\UnitTested
% 		\TestFiles{gotham-test-048}
%    \begin{macrocode}
\keys_define:nn { gotham / outer }{
	% footer template
	footer~template .usage:n = { general },
	footer~template .default:n = { gotham },
	footer~template .code:n = {
		\__gotham_set_prop_template:nn{frame~footer/default}{#1}
		\setbeamertemplate{frame~footer}[
			default/\prop_item:Nn \l__gotham_template_name_prop {frame~footer/default}
		]
	}
}
%    \end{macrocode}
%   \end{macro}
% \end{implementation}


%%% Numbering %%%
%%%%%%%%%%%%%%%%%

% \begin{implementation}
%   \begin{macro}{\inserttotalframenumber}
%     We defined the number of total frame, if not defined or equal to 0 because of the first compilation, we set it to avoid arthimetical errors
%     \UnitTested
%     \TestFiles{gotham-test-046}
%    \begin{macrocode}
%
\def\inserttotalframenumber{100}
%    \end{macrocode}
%   \end{macro}
% \end{implementation}

% \begin{implementation}
%   \begin{macro}{\defbeamertemplate{page~number~in~head/foot}{none}}
%     Template to do not numbering the current frame.
%     \UnitTested
%     \TestFiles{gotham-test-048}
%    \begin{macrocode}
\defbeamertemplate{page~number~in~head/foot}{none}{ }
%    \end{macrocode}
%   \end{macro}
% \end{implementation}

% \begin{documentation}
%   \begin{variable}{\gothamCircleNumberingVshift, \gothamCircleNumberingHshift}
%     Variable lengths controling the vertical and horizontal positioning of the |circle| frame numbering template.
%   \end{variable}
% \end{documentation}
%%%%
% \begin{implementation}
%   \begin{variable}{\gothamCircleNumberingVshift, \gothamCircleNumberingHshift}
%     Length used in |raisebox| and |hspace| in |circle| frame numbering.
%    \begin{macrocode}
\newlength{\gothamCircleNumberingVshift}
\newlength{\gothamCircleNumberingHshift}
\setlength{\gothamCircleNumberingVshift}{1.4mm}
\setlength{\gothamCircleNumberingHshift}{2.6mm}
%    \end{macrocode}
%   \end{variable}
% \end{implementation}

% \begin{implementation}
%   \begin{macro}{\defbeamertemplate{page~number~in~head/foot}{circle}}
%     Template to add, in a circle, the number of the current frame over (slash) the total number of frames.
%     \UnitTested
%     \TestFiles{gotham-test-048}
%    \begin{macrocode}
\defbeamertemplate{page~number~in~head/foot}{circle}{
	% horizontal space between the circle and the right part of the footer (email).
	\hspace{+2em}
	% \raisebox{lift}[height][depth]{text} => lift here = vertical space between the bottom of the page (or the progress bar) and the center of the circle
	\raisebox{\gothamCircleNumberingVshift}[0pt][0pt]{
		\begin{tikzpicture}[remember~picture, overlay]
			\coordinate (circleCenter);

			\usebeamercolor{frametitle}

			\draw[fill, color=frametitle.bg] (circleCenter) circle (6mm);
			\draw[fill, color=frametitle.fg] (circleCenter) circle (5mm);
			\node[color=frametitle.bg] at (circleCenter)
				{\small$^{\insertframenumber}\negmedspace/\negthinspace\sb{\inserttotalframenumber}$}
			;
		\end{tikzpicture}
		% horizontal space between the right border of the page and the center of the circle.
		\hspace{\gothamCircleNumberingHshift}
	}
}
%    \end{macrocode}
%   \end{macro}
% \end{implementation}

% \begin{documentation}
% \begin{function}{\useoutertheme}
%	\begin{syntax}
%		\cs{useoutertheme}\oarg{option1=value1, ...}\marg{gotham}
%		\textrm{where the options are (default marked as} \defopt{default}\textrm{):}
%     \meta{numbering} = \oarg{\defopt{none} \textbar framenumber \textbar totalframenumber \textbar appendixframenumber \textbar pagenumber \textbar totalpagenumber \textbar circle \textbar ... }
%		\meta{framesubtitle template} = \oarg{\defopt{gotham subnewline} \textbar ...}
%	\end{syntax}
%	The 'package' (useoutertheme) options can control |frame numbering|  templates used in |footer| template.
% \end{function}
% \end{documentation}
%%%%
% \begin{implementation}
% 	\begin{macro}{outer key -- interface}
% 		Controls the outer settings for frame numbering.
% 		\UnitTested
% 		\TestFiles{gotham-test-048}
%    \begin{macrocode}
\keys_define:nn { gotham / outer }{
	% numbering
	numbering .choice:,
	numbering .usage:n = { general },
	numbering .default:n = { none },

	% \__gotham_set_template:nn{title~page}{#1}
	numbering / none .code:n = { \setbeamertemplate{page~number~in~head/foot}[none] },
	numbering / framenumber .code:n = { \setbeamertemplate{page~number~in~head/foot}[framenumber] },
	numbering / totalframenumber .code:n = {\setbeamertemplate{page~number~in~head/foot}[totalframenumber] },
	numbering / appendixframenumber .code:n = {\setbeamertemplate{page~number~in~head/foot}[appendixframenumber] },
	numbering / pagenumber .code:n = { \setbeamertemplate{page~number~in~head/foot}[pagenumber] },
	numbering / totalpagenumber .code:n = {\setbeamertemplate{page~number~in~head/foot}[totalpagenumber] },
	numbering / circle .code:n = {\setbeamertemplate{page~number~in~head/foot}[circle] },

	numbering / unknown .code:n = { \PackageWarning{ gotham } { The~choice~'#1'~is~unknown~for~the~(known)~option~'numbering',~so~being~ignored. }{helping~message} },
}
%    \end{macrocode}
%   \end{macro}
% \end{implementation}


%%% MiniFrames \& Progress bar  %%%
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%

%%% MiniFrames %%%

% \begin{implementation}
% 	\begin{macro}{\defbeamertemplate{section~in~head/foot}{default/beamer}}
% 		Template control how the section appears by default when sections are add to the headline or footline.
% 		\UnitTested
% 		\TestFiles{gotham-test-048}
%    \begin{macrocode}
\defbeamertemplate{section~in~head/foot}{default/beamer}{
	\insertsectionhead
}
\defbeamertemplate{section~in~head/foot~shaded}{default/beamer}{
	\color{fg!50!bg}\usebeamertemplate{section~in~head/foot}
}

% \defbeamertemplate{includeLogo}{default/gotham~square}{
\prop_put:Nnn \l__gotham_template_name_prop {section~in~head/foot~shaded/default} {beamer}
% \defbeamertemplate{includeLogo}{default/gotham~square}{
\prop_put:Nnn \l__gotham_template_name_prop {section~in~head/foot/default} {beamer}
%    \end{macrocode}
%   \end{macro}
% \end{implementation}

% \begin{implementation}
% 	\begin{macro}{\defbeamertemplate{section~in~head/foot}{default/gotham~secSubsec}}
% 		Template for section and subsection in headline.
% 		\UnitTested
% 		\TestFiles{gotham-test-048}
%    \begin{macrocode}
\defbeamertemplate{section~in~head/foot}{default/gotham~secSubsec}{
	\insertsectionhead
	\ifx\insertsubsection\empty\else
		\ifdefempty{\subsecname}{\relax}{
		\ \textbar\ \insertsubsectionhead
		}
	\fi
}
\defbeamertemplate{section~in~head/foot~shaded}{default/gotham~secSubsec}{
	\insertsectionhead
}
%    \end{macrocode}
%   \end{macro}
% \end{implementation}

% \begin{implementation}
% 	\begin{macro}{\defbeamertemplate{section~in~head/foot}{default/empty}}
% 		Empty template for section in headline, compensating the height of a line.
% 		\UnitTested
% 		\TestFiles{gotham-test-048}
%    \begin{macrocode}
\defbeamertemplate{section~in~head/foot}{default/empty}{
	\vspace{3.875ex}
}
\defbeamertemplate{section~in~head/foot~shaded}{default/empty}{
	\vspace{3.875ex}
}
%    \end{macrocode}
%   \end{macro}
% \end{implementation}

% \begin{implementation}
% 	\begin{variable}{\gotham@temp@heightFrametitle, \gotham@temp@PaperheightFrametitle}
% 		Temporary length variables to compute the height of the frametitle and the height of the paper minus the frametitle.
%    \begin{macrocode}
\newlength{\gotham@temp@heightFrametitle}
\newlength{\gotham@temp@PaperheightFrametitle}
%    \end{macrocode}
%   \end{variable}
% \end{implementation}

% \begin{implementation}
% 	\begin{macro}{\defbeamertemplate*{mini~nav~progress~head/foot left right}{gotham~miniframes~theme}}
% 		Template to insert the navigation bar (using miniframes) that can be added to headline (or footline) left sidebar or righ sidebar.
% 		\UnitTested
% 		\TestFiles{gotham-test-048}
%    \begin{macrocode}
\defbeamertemplate*{mini~nav~progress~head/foot}{gotham~miniframes~theme}
{
	%,ht=1.75ex,dp=2.75ex
	\begin{beamercolorbox}[ignorebg]{section~in~head/foot}
		\hfuzz=\paperwidth
		\insertnavigation{\paperwidth}
		% \dohead
		\vspace{0.05cm}
	\end{beamercolorbox}
}
\defbeamertemplate*{mini~nav~progress~left}{gotham~miniframes~theme}
{
	\settoheight{\gotham@temp@heightFrametitle}{\gotham@strut}
	\addtolength{\gotham@temp@heightFrametitle}{\gothamFrametitleToppading+\gothamFrametitleBottompading+\gothamProgressHeadFootLineheight}

	\setlength{\gotham@temp@PaperheightFrametitle}{\paperheight-\gotham@temp@heightFrametitle-\gothamFootlineHeight-\gothamFootlineDepth-\gothamProgressHeadFootLineheight}

	\vspace{-0.6\paperheight}
	\rotatebox{90}{
		%,ht=1.75ex,dp=2.75ex
		\begin{beamercolorbox}[ignorebg]{section~in~head/foot}
			\hfuzz=\gotham@temp@PaperheightFrametitle
			\insertnavigation{\gotham@temp@PaperheightFrametitle}
			% \dohead
			% \vspace{0.05cm}
		\end{beamercolorbox}
	}
}
\defbeamertemplate*{mini~nav~progress~right}{gotham~miniframes~theme}
{
	\settoheight{\gotham@temp@heightFrametitle}{\gotham@strut}
	\addtolength{\gotham@temp@heightFrametitle}{\gothamFrametitleToppading+\gothamFrametitleBottompading+\gothamProgressHeadFootLineheight}

	\setlength{\gotham@temp@PaperheightFrametitle}{\paperheight-\gotham@temp@heightFrametitle-\gothamFootlineHeight-\gothamFootlineDepth-\gothamProgressHeadFootLineheight}

	\vspace{\gotham@temp@heightFrametitle}
	\hspace{-2.3em}
	\rotatebox{-90}{
		%,ht=1.75ex,dp=2.75ex
		\begin{beamercolorbox}[ignorebg]{section~in~head/foot}
			\hfuzz=\gotham@temp@PaperheightFrametitle
			\insertnavigation{\gotham@temp@PaperheightFrametitle}
			% \dohead
			% \vspace{0.05cm}
		\end{beamercolorbox}
	}
}
%    \end{macrocode}
%   \end{macro}
% \end{implementation}

%% Select the bullets shape
% \begin{implementation}
% 	\begin{macro}{\defbeamertemplate{mini~frame}{gotham~box}}
% 		Template to add a new shape for miniframes |gotham box|.
% 		\UnitTested
% 		\TestFiles{gotham-test-048}
%    \begin{macrocode}
\defbeamertemplate{mini~frame}{gotham~box}
{
	\begin{pgfpicture}{0pt}{0pt}{.1cm}{.1cm}
		\pgfpathrectangle{\pgfpointorigin}{\pgfpoint{0.1cm}{0.1cm}}
		\pgfusepath{fill,stroke}
	\end{pgfpicture}
}[action]{
	\setbeamersize{mini~frame~size=.14cm, mini~frame~offset=.05cm}
}
%
\defbeamertemplate{mini~frame~in~current~subsection}{gotham~box}
{
	\begin{pgfpicture}{0pt}{0pt}{.1cm}{.1cm}
		\pgfpathrectangle{\pgfpointorigin}{\pgfpoint{0.1cm}{0.1cm}}
		\pgfusepath{stroke}
	\end{pgfpicture}
}
%    \end{macrocode}
%   \end{macro}
% \end{implementation}

% \begin{implementation}
% 	\begin{macro}{\defbeamertemplate{mini~frame}{gotham~minibox}}
% 		Template to add a new shape for miniframes |gotham minibox|.
% 		\UnitTested
% 		\TestFiles{gotham-test-048}
%    \begin{macrocode}
\defbeamertemplate{mini~frame}{gotham~minibox}
{
	\begin{pgfpicture}{0pt}{0pt}{.05cm}{.05cm}
		\pgfpathrectangle{\pgfpointorigin}{\pgfpoint{0.05cm}{0.05cm}}
		\pgfusepath{fill,stroke}
	\end{pgfpicture}
}[action]{
	\setbeamersize{mini~frame~size=.08cm, mini~frame~offset=.05cm}
}
%
\defbeamertemplate{mini~frame~in~current~subsection}{gotham~minibox}
{
	\begin{pgfpicture}{0pt}{0pt}{.05cm}{.05cm}
		\pgfpathrectangle{\pgfpointorigin}{\pgfpoint{0.05cm}{0.05cm}}
		\pgfusepath{stroke}
	\end{pgfpicture}
}
%    \end{macrocode}
%   \end{macro}
% \end{implementation}

% \begin{implementation}
% 	\begin{macro}{\defbeamertemplate{mini~frame}{gotham~minibullet}}
% 		Template to add a new shape for miniframes |gotham minibullet|.
% 		\UnitTested
% 		\TestFiles{gotham-test-048}
%    \begin{macrocode}
\defbeamertemplate{mini~frame}{gotham~minibullet}
{
	\beamer@xelatex@fixminiframes
	\begin{pgfpicture}{0pt}{0pt}{0.05cm}{0.05cm}
		\pgfpathcircle{\pgfpoint{0.03cm}{0.03cm}}{0.03cm}
		\pgfusepath{fill,stroke}
	\end{pgfpicture}
}[action]{
	\setbeamersize{mini~frame~size=.09cm, mini~frame~offset=.05cm}
}
%
\defbeamertemplate{mini~frame~in~current~subsection}{gotham~minibullet}
{
	\beamer@xelatex@fixminiframes
	\begin{pgfpicture}{0pt}{0pt}{0.05cm}{0.05cm}
		\pgfpathcircle{\pgfpoint{0.03cm}{0.03cm}}{0.03cm}
		\pgfusepath{stroke}
	\end{pgfpicture}
}
%    \end{macrocode}
%   \end{macro}
% \end{implementation}

% \begin{documentation}
% \begin{function}{\useoutertheme}
%	\begin{syntax}
%		\cs{useoutertheme}\oarg{option1=value1, ...}\marg{gotham}
%		\textrm{where the options are (default marked as} \defopt{default}\textrm{):}
%     \meta{mini frames shape} = \oarg{\defopt{gotham minibullet} \textbar default (bullet from beamer) \textbar tick \textbar box \textbar gotham box \textbar gotham minibox \textbar ... }
%		\meta{framesubtitle template} = \oarg{\defopt{gotham subnewline} \textbar ...}
%	\end{syntax}
%	The 'package' (useoutertheme) options can control |frame numbering|  templates used in |footer| template.
% \end{function}
% \end{documentation}
%%%%
% \begin{implementation}
% 	\begin{macro}{outer key -- interface}
% 		Controls the outer settings for mini frames shape template.
% 		\UnitTested
% 		\TestFiles{gotham-test-048}
%    \begin{macrocode}
\keys_define:nn { gotham / outer }{
	%% mini~frames~shape
	% mini~frames~shape .choice:,
	mini~frames~shape .usage:n = { general },
	mini~frames~shape .default:n = { gotham~minibullet },
	% \__gotham_set_template:nn{title~page}{#1}
	mini~frames~shape .code:n = {
		% \__gotham_set_template:nn{mini~frames}{#1}% This can not work since this is an alias, so go back to normal
		\setbeamertemplate{mini~frames}[#1]
	},
	% mini~frames~shape / unknown .code:n = { \PackageWarning{ gotham } { The~choice~'#1'~is~unknown~for~the~(known)~option~'numbering',~so~being~ignored. }{helping~message} },
}
%    \end{macrocode}
%   \end{macro}
% \end{implementation}

% \begin{implementation}
% 	\begin{macro}{\defbeamertemplate*{miniframe~home}}
% 		Template to adapt Beamer to the internal modification brought by Gotham: differientiation between slide to come and those done, idem for section, subsection...
% 		\UnitTested
% 		\TestFiles{gotham-test-048}
%    \begin{macrocode}
\defbeamertemplate*{miniframe~home}{beamer}{
	% $\equiv$
}
\defbeamertemplate*{miniframe~current~slide}{beamer}{
	\usebeamertemplate{mini~frame}
}
\defbeamertemplate*{miniframe~done~current~section}{beamer}{
	\usebeamertemplate{mini~frame~in~current~subsection}
}
\defbeamertemplate*{miniframe~todo~current~section}{beamer}{
	\usebeamertemplate{mini~frame~in~current~subsection}
}
\defbeamertemplate*{miniframe~done~other~section}{beamer}{
	\usebeamertemplate{mini~frame~in~other~subsection}
}
\defbeamertemplate*{miniframe~todo~other~section}{beamer}{
	\usebeamertemplate{mini~frame~in~other~subsection}
}
% Templates about should appear sectioning in mini frame.
% \defbeamertemplate*{miniframe~part}{beamer}{}
\defbeamertemplate*{miniframe~section~current}{beamer}{}
\defbeamertemplate*{miniframe~section~done}{beamer}{}
\defbeamertemplate*{miniframe~section~todo}{beamer}{}
\defbeamertemplate*{miniframe~subsection~current}{beamer}{}
\defbeamertemplate*{miniframe~subsection~todo}{beamer}{}
\defbeamertemplate*{miniframe~subsection~done}{beamer}{}
% \defbeamertemplate*{miniframe~subsubsection}{beamer}{}
\defbeamertemplate*{miniframe~section~done~in~other~section}{default}[1][50]
{
	\color{fg!#1!bg}\usebeamertemplate{miniframe~section~done}
}
\defbeamertemplate*{miniframe~section~todo~in~other~section}{default}[1][50]
{
	\color{fg!#1!bg}\usebeamertemplate{miniframe~section~todo}
}
\defbeamertemplate*{miniframe~subsection~done~in~other~section}{default}[1][50]
{
	\color{fg!#1!bg}\usebeamertemplate{miniframe~subsection~done}
}
\defbeamertemplate*{miniframe~subsection~todo~in~other~section}{default}[1][50]
{
	\color{fg!#1!bg}\usebeamertemplate{miniframe~subsection~todo}
}
%    \end{macrocode}
%   \end{macro}
% \end{implementation}

% \begin{implementation}
% 	\begin{macro}{\defbeamertemplate{miniframe~home}{gotham~mini}}
% 		Templates for miniframes using a Gotham style inspired by a miniaturization than the one from Beamer.
% 		\UnitTested
% 		\TestFiles{gotham-test-048}
%    \begin{macrocode}
\defbeamertemplate{miniframe~home}{gotham~mini}{
	\resizebox{0.85\beamer@boxsize}{\beamer@boxsize}{$\equiv$}
	% \scalebox{0.5}[0.95]{$\equiv$}
}
\defbeamertemplate{miniframe~current~slide}{gotham~mini}{
	\usebeamercolor[fg]{alerted~text}
	\usebeamertemplate{mini~frame}
}
\defbeamertemplate{miniframe~done~current~section}{gotham~mini}{
	\usebeamertemplate{mini~frame}
}
\defbeamertemplate{miniframe~todo~current~section}{gotham~mini}{
	\usebeamertemplate{mini~frame~in~current~subsection}
}
\defbeamertemplate{miniframe~done~other~section}{gotham~mini}[1][50]{
	\color{fg!#1!bg}\usebeamertemplate{mini~frame}
}
\defbeamertemplate{miniframe~todo~other~section}{gotham~mini}[1][50]{
	\color{fg!#1!bg}\usebeamertemplate{mini~frame~in~other~subsection}
}
% Templates about should appear sectioning in mini frame.
% \defbeamertemplate{miniframe~part}{gotham~mini}[1][]{
% 	p
% }
\defbeamertemplate{miniframe~section~current}{gotham~mini}{
	\fontsize{3pt}{0pt}\selectfont
	% \color{blue}
	\tl_use:N \l__gotham_minif_tmpa_tl
	\hspace{1.pt}
}
\defbeamertemplate{miniframe~section~done}{gotham~mini}{
	\fontsize{3pt}{0pt}\selectfont
	% \color{green}
	\tl_use:N \l__gotham_minif_tmpa_tl
	\hspace{1.pt}
}
\defbeamertemplate{miniframe~section~todo}{gotham~mini}{
	\fontsize{3pt}{0pt}\selectfont
	% \color{red}
	\tl_use:N \l__gotham_minif_tmpa_tl
	\hspace{1.pt}
}
\defbeamertemplate{miniframe~subsection~current}{gotham~mini}{
	\usebeamercolor[fg]{alerted~text}
	\hspace{-0.15pt}
	\resizebox{\beamer@boxsize}{!}{\hspace{-0.75pt}$\blacklozenge$}
}
\defbeamertemplate{miniframe~subsection~todo}{gotham~mini}{
	\hspace{-0.15pt}
	\resizebox{\beamer@boxsize}{!}{\hspace{-0.75pt}$\lozenge$}
}
\defbeamertemplate{miniframe~subsection~done}{gotham~mini}{
	\hspace{-0.15pt}
	\resizebox{\beamer@boxsize}{!}{\hspace{-0.75pt}$\blacklozenge$}
}
% \defbeamertemplate{miniframe~subsubsection}{gotham~mini}{
% 	d
% }
%    \end{macrocode}
%   \end{macro}
% \end{implementation}

% \begin{implementation}
% 	\begin{macro}{\defbeamertemplate{miniframe~home}{gotham~nano}}
% 		Template for Gotham mini frame style using even less space.
% 		\UnitTested
% 		\TestFiles{gotham-test-048}
%    \begin{macrocode}
\defbeamertemplate{miniframe~home}{gotham~nano}{
	% \resizebox{\beamer@boxsize}{!}{$\equiv$}
	\scalebox{0.5}[0.95]{$\equiv$}
}
\defbeamertemplate{miniframe~current~slide}{gotham~nano}{
	o
}
\defbeamertemplate{miniframe~done~current~section}{gotham~nano}{
	x
}
\defbeamertemplate{miniframe~todo~current~section}{gotham~nano}{
	$\cdot$
}
\defbeamertemplate{miniframe~done~other~section}{gotham~nano}{
	x
}
\defbeamertemplate{miniframe~todo~other~section}{gotham~nano}{
	$\cdot$
}
% Templates about should appear sectioning in mini frame.
% \defbeamertemplate{miniframe~part}{gotham~nano}[1][]{
% 	p
% }
\defbeamertemplate{miniframe~section~current}{gotham~nano}{
	\tl_use:N \l__gotham_minif_tmpa_tl
}
\defbeamertemplate{miniframe~section~done}{gotham~nano}{
	\tl_use:N \l__gotham_minif_tmpa_tl
}
\defbeamertemplate{miniframe~section~todo}{gotham~nano}{
	\tl_use:N \l__gotham_minif_tmpa_tl
}
\defbeamertemplate{miniframe~subsection~current}{gotham~nano}{
	\usebeamercolor[fg]{alerted~text}$\diamond$
}
\defbeamertemplate{miniframe~subsection~todo}{gotham~nano}{
	$\diamond$
}
\defbeamertemplate{miniframe~subsection~done}{gotham~nano}{
	$\diamond$
}
%    \end{macrocode}
%   \end{macro}
% \end{implementation}

% \begin{implementation}
% 	\begin{macro}{\defbeamertemplateparent{mini~frames~bundle}}
% 		Define a parent template to set the 6 templates at once.
% 		\UnitTested
% 		\TestFiles{gotham-test-048}
%    \begin{macrocode}
\defbeamertemplateparent{mini~frames~bundle}
{ 	miniframe~home, miniframe~current~slide,
	miniframe~done~current~section, miniframe~todo~current~section, miniframe~done~other~section, miniframe~todo~other~section,
	miniframe~section~current, miniframe~section~done, miniframe~section~todo,
	miniframe~subsection~current, miniframe~subsection~done, miniframe~subsection~todo,
}{}
%\setbeamertemplate{mini~frames~bundle}[gotham~mini]%[beamer]%[gotham~nano]%
%    \end{macrocode}
%   \end{macro}
% \end{implementation}

% \begin{documentation}
% \begin{function}{\useoutertheme}
%	\begin{syntax}
%		\cs{useoutertheme}\oarg{option1=value1, ...}\marg{gotham}
%		\textrm{where the options are (default marked as} \defopt{default}\textrm{):}
%     \meta{mini frames bundle} = \oarg{\defopt{gotham minibullet} \textbar default (bullet from beamer) \textbar tick \textbar box \textbar gotham box \textbar gotham minibox \textbar ... }
%		\meta{framesubtitle template} = \oarg{\defopt{gotham subnewline} \textbar ...}
%	\end{syntax}
%	The 'package' (useoutertheme) options can control |mini frame|  templates.
% \end{function}
% \end{documentation}
%%%%
% \begin{implementation}
% 	\begin{macro}{outer key -- interface}
% 		Controls the outer settings for mini frames bundle template.
% 		\UnitTested
% 		\TestFiles{gotham-test-050}
%    \begin{macrocode}
\keys_define:nn { gotham / outer }{
	%% mini~frames~bundle
	% mini~frames~bundle .choice:,
	mini~frames~bundle .usage:n = { general },
	mini~frames~bundle .default:n = { gotham~mini },
	% \__gotham_set_template:nn{title~page}{#1}
	mini~frames~bundle .code:n = {
		% \__gotham_set_template:nn{mini~frames}{#1}% This can not work since this is an alias, so go back to normal
		\setbeamertemplate{mini~frames~bundle}[#1]
	},
	% mini~frames~bundle / unknown .code:n = { \PackageWarning{ gotham } { The~choice~'#1'~is~unknown~for~the~(known)~option~'numbering',~so~being~ignored. }{helping~message} },
}
%    \end{macrocode}
%   \end{macro}
% \end{implementation}


%%% MiniFrames Navigation %%%

% \begin{documentation}
% \begin{function}{\useoutertheme}
%	\begin{syntax}
%		\cs{useoutertheme}\oarg{option1=value1, ...}\marg{gotham}
%		\textrm{where the options are (default marked as} \defopt{default}\textrm{):}
%     \meta{mini frames compress} = \oarg{\defopt{on} \textbar off }
%	\end{syntax}
%	The 'package' (useoutertheme) options can control |compress| option in mini frames.
% \end{function}
% \end{documentation}
%%%%
% \begin{implementation}
% 	\begin{macro}{outer key -- interface}
% 		Controls the outer settings for mini frames compress template.
% 		\UnitTested
% 		\TestFiles{gotham-test-050}
%    \begin{macrocode}
\keys_define:nn { gotham / outer }{
	% mini~frames~compress default
	mini~frames~compress .choice:,
	mini~frames~compress .usage:n = { general },
	mini~frames~compress .default:n = { true },

	mini~frames~compress / true .code:n = { \beamer@compresstrue },
	mini~frames~compress / on .code:n = { \beamer@compresstrue },
	mini~frames~compress / enable .code:n = { \beamer@compresstrue },

	mini~frames~compress / false .code:n = { \beamer@compressfalse },
	mini~frames~compress / off .code:n = { \beamer@compressfalse },
	mini~frames~compress / disable .code:n = { \beamer@compressfalse },

	mini~frames~compress / unknown .code:n = { \PackageWarning{ gotham } { The~choice~'#1'~is~unknown~for~the~(known)~option~'mini~frames~compress',~so~being~ignored. }{helping~message: mini~frames~compress / unknown} },
}
%    \end{macrocode}
%   \end{macro}
% \end{implementation}

% \begin{implementation}
% 	\begin{variable}{\l__gotham_minif_tmpa_tl, \gotham@temp@MiniframeSubsecDim, \gotham@temp@lastSec}
% 		Temporary variables used for the store dimension of the miniframe subsection, check if the last section treated and the pass the value of the section to the section template.
%    \begin{macrocode}
\newlength{\gotham@temp@MiniframeSubsecDim}
\newlength{\gotham@temp@MiniframeSecDim}
\def\gotham@temp@lastSec{-1}
\tl_new:N \l__gotham_minif_tmpa_tl
\tl_new:N \l__gotham_minif_tmpb_tl
%    \end{macrocode}
%   \end{variable}
% \end{implementation}

% \begin{implementation}
% 	\begin{function}{\renewcommand{\slideentry}}
% 		Redefinition of the slideentry command from Beamer in order to add home page symbol, section symbol, subsection symbol to come and done.
% 		\TestFiles{gotham-test-048}
%    \begin{macrocode}
% definition from Beamerbasenavigation.sty
% \def\slideentry#1#2#3#4#5#6{%
\renewcommand{\slideentry}[6]{%
   %section number, subsection number, slide number, first/last frame, page number, part number
	\ifnum#6=\c@part\ifnum#3>0%\ifnum#6=\c@part\ifnum#1>0\ifnum#3>0 MODIF
		\ifbeamer@compress%
			\advance\beamer@xpos by1\relax%
		\else%
			\ifnum#2=0%
				\beamer@ypos@offset=1\relax%
			\fi%
			\beamer@xpos=#3\relax%
			\beamer@ypos=#2\relax%
			\advance\beamer@ypos by \beamer@ypos@offset\relax%
		\fi%
		%% Add section number and subsection symbol to miniframes.
		%% MODIF below, inspired from https://tex.stackexchange.com/questions/722523
		\ifnum#3=1%\c@subsectionslide=#3 % if =1, so it has been reset  => new section or subsection
			\ifnum#1>0\ifnum#2<2% => there no subsection in this section.
				\ifnum\gotham@temp@lastSec=#1%
					% this means, that we already went through: there no subsec, then the first subsec has been defined.
				\else%
					\tl_set:Nn \l__gotham_minif_tmpa_tl {#1}
					\settowidth{\gotham@temp@MiniframeSecDim}{\usebeamertemplate{miniframe~section~current}}%
					% \addtolength{\gotham@temp@MiniframeSecDim}{1.5pt}
					\hbox to 0pt{%
						\beamer@tempdim=-\beamer@vboxoffset%
						\advance\beamer@tempdim by-\beamer@boxsize%
						\multiply\beamer@tempdim by\beamer@ypos%
						\advance\beamer@tempdim by -.05cm%
						\raise\beamer@tempdim\hbox{%
							\beamer@tempdim=\beamer@boxsize%
							\multiply\beamer@tempdim by\beamer@xpos%
							\advance\beamer@tempdim by -\beamer@boxsize%
							\advance\beamer@tempdim by -\gotham@temp@MiniframeSecDim% NEW
							\advance\beamer@tempdim by 1pt%
							\kern\beamer@tempdim%
							\global\beamer@section@min@dim\beamer@tempdim%
							\hbox{\beamer@link(#4){%
								% \usebeamertemplate{miniframe~section}%
								% if not first page then check if it is the current section.
								\ifnum\c@section=#1%
									% check if it is the current slide
									\ifnum\c@subsectionslide=#3%
										\usebeamertemplate{miniframe~section~current}
									\else%
										\ifnum\c@subsectionslide<#3
											\usebeamertemplate{miniframe~section~todo}
										\else%
											\usebeamertemplate{miniframe~section~done}
										\fi%
									\fi%
								\else% \ifnum\c@section=#1%
									\ifnum\c@section<#1
										\usebeamertemplate{miniframe~section~todo~in~other~section}
									\else%
										\usebeamertemplate{miniframe~section~done~in~other~section}
									\fi%
								\fi% \ifnum\c@section=#1
							}}%
						}%
					}%
					\def\gotham@temp@lastSec{#1}%
				\fi%
			\fi\fi%
			\ifnum#2>0%
				% Check if the miniframe subsection template is empty
				\ifbeamertemplateempty{miniframe~subsection~current}{
					% do nothing
				}{
					\tl_set:Nn \l__gotham_minif_tmpb_tl {#2}
					\settowidth{\gotham@temp@MiniframeSubsecDim}{}%\usebeamertemplate{miniframe~subsection~current}}%
					\addtolength{\gotham@temp@MiniframeSubsecDim}{+1.\beamer@boxsize}%
					\advance\beamer@xpos by1\relax%
					\hbox to 0pt{%
						\beamer@tempdim=-\beamer@vboxoffset%
						\advance\beamer@tempdim by-\beamer@boxsize%
						\multiply\beamer@tempdim by\beamer@ypos%
						\advance\beamer@tempdim by -.05cm%
						\raise\beamer@tempdim\hbox{%
							\beamer@tempdim=\beamer@boxsize%
							\multiply\beamer@tempdim by\beamer@xpos%
							\advance\beamer@tempdim by -\beamer@boxsize%
							\advance\beamer@tempdim by -\gotham@temp@MiniframeSubsecDim% NEW
							\advance\beamer@tempdim by 1pt%
							\kern\beamer@tempdim%
							\global\beamer@section@min@dim\beamer@tempdim%
							\hbox{\beamer@link(#4){%
								% \usebeamertemplate{miniframe~subsection~current}%
								% if not first page then check if it is the current section.
								\ifnum\c@section=#1%
									% check if it is the current subsection
									\ifnum\c@subsection=#2%
										% check if it is the current slide
										\ifnum\c@subsectionslide=#3%
											\usebeamertemplate{miniframe~subsection~current}
										\else%
											\ifnum\c@subsectionslide<#3
												\usebeamertemplate{miniframe~subsection~todo}
											\else%
												\usebeamertemplate{miniframe~subsection~done}
											\fi%
										\fi%
									\else% \ifnum\c@subsection=#2%
										\ifnum\c@subsection<#2
											\usebeamertemplate{miniframe~subsection~todo}
										\else%
											\usebeamertemplate{miniframe~subsection~done}
										\fi%
									\fi% \ifnum\c@subsection=#2%
								\else% \ifnum\c@section=#1%
									\ifnum\c@section<#1
										\usebeamertemplate{miniframe~subsection~todo~in~other~section}
									\else%
										\usebeamertemplate{miniframe~subsection~done~in~other~section}
									\fi%
								\fi% \ifnum\c@section=#1
							}}% \hbox{\beamer@link
						}% raisebox
					}% hbox
				}% end if template empty
			\fi% \ifnum#2>0
		\else
			\ifbeamer@compress%
				% \advance\beamer@xpos by1\relax%
			\else%
				\ifbeamertemplateempty{miniframe~subsection~current}{
					% NEW
					% do nothing
				}{
					\advance\beamer@xpos by 1\relax%
				}
			\fi%
		\fi% \ifnum#3=1

		%% end of modif to add section number and subsection symbol.
		\hbox to 0pt{%
			\beamer@tempdim=-\beamer@vboxoffset%
			\advance\beamer@tempdim by-\beamer@boxsize%
			\multiply\beamer@tempdim by\beamer@ypos%
			\advance\beamer@tempdim by -.05cm%
			\raise\beamer@tempdim\hbox{%
				\beamer@tempdim=\beamer@boxsize%
				\multiply\beamer@tempdim by\beamer@xpos%
				\advance\beamer@tempdim by -\beamer@boxsize%
				\advance\beamer@tempdim by 1pt%
				\kern\beamer@tempdim
				\global\beamer@section@min@dim\beamer@tempdim
				\hbox{\beamer@link(#4){%
					\usebeamerfont{mini~frame}%
					% \ifnum\c@section=#1%
					% 	\ifnum\c@subsection=#2%
					% 	\usebeamercolor[fg]{mini~frame}%
					% 	\ifnum\c@subsectionslide=#3%
					% 		\usebeamertemplate{mini~frame}%\beamer@minislidehilight%
					% 	\else%
					% 		\usebeamertemplate{mini~frame~in~current~subsection}%\beamer@minisliderowhilight%
					% 	\fi%
					% 	\else%
					% 	\usebeamercolor{mini~frame}%
					% 	%\color{fg!50!bg}%
					% 	\usebeamertemplate{mini~frame~in~other~subsection}%\beamer@minislide%
					% 	\fi%
					% \else%
					% 	\usebeamercolor{mini~frame}%
					% 	%\color{fg!50!bg}%
					% 	\usebeamertemplate{mini~frame~in~other~subsection}%\beamer@minislide%
					% \fi%
					%%
					%% CHANGE FROM HERE: I rewrote this part.
					% If first page (ie. 1/1)
					\def\gotham@temp@i{1/1}
					\def\gotham@temp@ii{#4}
					\ifx\gotham@temp@i\gotham@temp@ii
						% If first page (ie. title page) then apply a special mini frame
						\usebeamertemplate{miniframe~home}
					\else
						% if not first page then check if it is the current section.
						\ifnum\c@section=#1%
							% check if it is the current subsection
							\ifnum\c@subsection=#2%
								\usebeamercolor[fg]{mini~frame}%
								% check if it is the current slide
								\ifnum\c@subsectionslide=#3%
									\usebeamertemplate{miniframe~current~slide}
									% \usebeamertemplate{mini~frame}% \beamer@minislidehilight%
								\else%
									% \usebeamertemplate{mini~frame~in~current~subsection}% \beamer@minisliderowhilight%
									\ifnum\c@subsectionslide<#3
										\usebeamertemplate{miniframe~todo~current~section}
									\else%
										\usebeamertemplate{miniframe~done~current~section}
									\fi%
								\fi%
							\else% \ifnum\c@subsection=#2%
								\usebeamercolor{mini~frame}%
								% \usebeamertemplate{mini~frame~in~other~subsection}% \beamer@minislide%
								\ifnum\c@subsection<#2
									\usebeamertemplate{miniframe~todo~other~section}
								\else%
									\usebeamertemplate{miniframe~done~other~section}
								\fi%
							\fi% \ifnum\c@subsection=#2%
						\else% \ifnum\c@section=#1%
							\usebeamercolor{mini~frame}%
							% \usebeamertemplate{mini~frame~in~other~subsection}% \beamer@minislide%
							\ifnum\c@section<#1
								\usebeamertemplate{miniframe~todo~other~section}
							\else%
								\usebeamertemplate{miniframe~done~other~section}
							\fi%
						\fi% \ifnum\c@section=#1
					\fi% \ifx\gotham@temp@i\gotham@temp@ii
			}}}\hskip-10cm plus 1fil%
		}\fi% \ifnum#1>0\ifnum#3>0%
	\else% \ifnum#6=\c@part
		\fakeslideentry{#1}{#2}{#3}{#4}{#5}{#6}%
	\fi\ignorespaces%
	% \def\gotham@temp@lastSec{-1}%
}%
%    \end{macrocode}
%   \end{function}
% \end{implementation}

% \begin{documentation}
% \begin{variable}{gothamZerosectionframes}
% 	Boolean variable to flag if they are frame in a zeroth section.
%  This variable helps to adapt the spreading of |mini frames nav| bar.
%  This variable is automatically set if the spread is set correctly at the beginning of the presention.
%  If the spreading or the mini frame nav is disable at the zeroth section then reactivated latter, it might create unwanted spreading.
%  In such situation the variable has to be set manually to correct the spreading.
% \end{variable}
% \end{documentation}
%%%%
% \begin{implementation}
% 	\begin{variable}{gothamZerosectionframes}
% 		Boolean variable to flag if they are frame in a zeroth section.
%    \begin{macrocode}
\providebool{gothamZerosectionframes}
\boolfalse{gothamZerosectionframes}
%    \end{macrocode}
%   \end{variable}
% \end{implementation}

% \begin{implementation}
% 	\begin{macro}{\insertnavigation,\sectionentry}
% 		Patches for |\insertnavigation| and |\sectionentry| to be able to adapt with spreading values.
% 		\UnitTested
% 		\TestFiles{gotham-test-048}
%    \begin{macrocode}
\providecommand{\gothamInsertNavlength}{
	% spreading by default
	\ifbool{gothamZerosectionframes}{
		%true
		% spreading
		\hskip-0.5ex~plus~1fill
	}{
		%false
		\hskip-1.875ex~plus-1fill
	}%
}
\providecommand{\gothamPatchInsertNav}{
	% Don't patch for now
	\box\beamer@sectionbox\hfil\hskip.3cm
}
\providecommand{\gothamPatchSectionentry}{
	% Don't patch for now
	\hskip1.875ex~plus~1fill
}
\providecommand{\gothamPatchSectionbox}{
	% Don't patch for now
	\ht\beamer@sectionbox=1.875ex
	\dp\beamer@sectionbox=0.75ex
}
\ExplSyntaxOff
	% To let the 0-th section appear.
	\patchcmd{\insertnavigation}{\hskip-1.875ex plus-1fill}{%
		\ifnum\value{section}=0%
		\ifnum\value{framenumber}>0%
			\hskip-0ex%
			\global\booltrue{gothamZerosectionframes}%
		\fi\fi%
		\gothamInsertNavlength%
	}{}{}
	%% Remove hfill between sections => flush right bullet bar, if not corrected.
	\patchcmd{\sectionentry}{\hskip1.875ex plus 1fill}{\gothamPatchSectionentry}{}{}
	%% Centering the bullet bar
	\patchcmd{\insertnavigation}{\box\beamer@sectionbox\hfil\hskip.3cm}{\gothamPatchInsertNav}{}{}
	% Patch size of sectionbox
	\patchcmd{\insertnavigation}{\ht\beamer@sectionbox=1.875ex%
		\dp\beamer@sectionbox=0.75ex%
	}{
		\gothamPatchSectionbox
	}{}{}
	\patchcmd{\sectionentry}{\ht\beamer@sectionbox=1.875ex%
		\dp\beamer@sectionbox=0.75ex%
	}{
		\gothamPatchSectionbox
	}{}{}
\ExplSyntaxOn
%    \end{macrocode}
%   \end{macro}
% \end{implementation}

% \begin{documentation}
% \begin{function}{\useoutertheme}
%	\begin{syntax}
%		\cs{useoutertheme}\oarg{option1=value1, ...}\marg{gotham}
%		\textrm{where the options are (default marked as} \defopt{default}\textrm{):}
%     \meta{mini frames nav spreading} = \oarg{\defopt{centering} \textbar spreading \textbar left \textbar right }
%	\end{syntax}
%	The 'package' (useoutertheme) options can control spreading of the mini frames navigation.
% \end{function}
% \end{documentation}
%%%%
% \begin{implementation}
% 	\begin{macro}{outer key -- interface}
% 		Controls the outer settings for mini frames navigation spreading.
% 		\UnitTested
% 		\TestFiles{gotham-test-051}
%    \begin{macrocode}
\keys_define:nn { gotham / outer }{
	% mini~frames~nav~spreading default
	mini~frames~nav~spreading .choice:,
	mini~frames~nav~spreading .usage:n = { general },
	mini~frames~nav~spreading .default:n = { spreading },

	mini~frames~nav~spreading / spreading .code:n = {
		%
		\renewcommand{\gothamInsertNavlength}{
			\ifbool{gothamZerosectionframes}{
				%true
				% spreading
				\hskip-0.5ex
			}{
				%false
				\hskip-1.875ex~plus-1fill
			}%
		}
		% No other patch needed, but renewcommand if it has been modified previously.
		\renewcommand{\gothamPatchInsertNav}{
			% Don't patch for now
			\box\beamer@sectionbox\hfil\hskip.3cm
		}
		\renewcommand{\gothamPatchSectionentry}{
			% Don't patch for now
			\hskip1.875ex~plus~1fill
		}
	},
	mini~frames~nav~spreading / centering .code:n = {
		%
		\renewcommand{\gothamInsertNavlength}{
			\ifbool{gothamZerosectionframes}{
				%true
				% centering +patch sectionenty +patch insertnav @sectionbox
				\hskip-0.5ex~plus~1fill
			}{
				%false
				% \patchcmd{\insertnavigation}{\hskip-1.875ex plus-1fill}{\hfill}{}{}
				\hfill
			}%
		}
		% Centering the bullet bar
		% \patchcmd{\insertnavigation}{\box\beamer@sectionbox\hfil\hskip.3cm}{ \box\beamer@sectionbox\hfill\hskip.3cm}{}{}
		\renewcommand{\gothamPatchInsertNav}{
			\box\beamer@sectionbox\hfill\hskip.3cm
		}
		%% Remove hfill between sections => flush right bullet bar, if not corrected.
		% \patchcmd{\sectionentry}{\hskip1.875ex plus 1fill}{\hskip 3.5ex}{}{}
		\renewcommand{\gothamPatchSectionentry}{
			\hskip~3.5ex
		}
	},
	mini~frames~nav~spreading / left .code:n = {
		%
		\renewcommand{\gothamInsertNavlength}{
			\ifbool{gothamZerosectionframes}{
				%true
				% flush left +patch sectionenty
				\hskip-0.5ex
			}{
				%false
				% no patch
				\hskip-1.875ex plus-1fill
			}%
		}
		% Centering the bullet bar : NO
		% no patch
		\renewcommand{\gothamPatchInsertNav}{
			\box\beamer@sectionbox\hfil\hskip.3cm
		}
		%% Remove hfill between sections => flush right bullet bar, if not corrected.
		% \patchcmd{\sectionentry}{\hskip1.875ex plus 1fill}{\hskip 3.5ex}{}{}
		\renewcommand{\gothamPatchSectionentry}{
			\hskip~3.5ex
		}
	},
	mini~frames~nav~spreading / right .code:n = {
		%
		\renewcommand{\gothamInsertNavlength}{
			\ifbool{gothamZerosectionframes}{
				%true
				% flush right +patch sectionenty
				\hskip-0.5ex~plus~1fill
			}{
				%false
				% no patch
				\hskip-1.875ex plus-1fill
			}%
		}
		% Centering the bullet bar : NO
		% no patch
		\renewcommand{\gothamPatchInsertNav}{
			\box\beamer@sectionbox\hfil\hskip.3cm
		}
		%% Remove hfill between sections => flush right bullet bar, if not corrected.
		% \patchcmd{\sectionentry}{\hskip1.875ex plus 1fill}{\hskip 3.5ex}{}{}
		\renewcommand{\gothamPatchSectionentry}{
			\hskip~3.5ex
		}
	},
	mini~frames~nav~spreading / unknown .code:n = { \PackageWarning{ gotham } { The~choice~'#1'~is~unknown~for~the~(known)~option~'mini~frames~nav~spreading',~so~being~ignored. }{helping~message: mini~frames~nav~spreading / unknown} },
}
%    \end{macrocode}
%   \end{macro}
% \end{implementation}

% \begin{documentation}
% \begin{function}{\useoutertheme}
%	\begin{syntax}
%		\cs{useoutertheme}\oarg{option1=value1, ...}\marg{gotham}
%		\textrm{where the options are (default marked as} \defopt{default}\textrm{):}
%     \meta{mini frames nav sectioning} = \oarg{\defopt{on} \textbar off }
%	\end{syntax}
%	The 'package' (useoutertheme) options can control navigation sectioning option in mini frames.
% \end{function}
% \end{documentation}
%%%%
% \begin{implementation}
% 	\begin{macro}{outer key -- interface}
% 		Controls the outer settings for mini frames navigation sectioning template.
% 		\UnitTested
% 		\TestFiles{gotham-test-051}
%    \begin{macrocode}
\keys_define:nn { gotham / outer }{
	% mini~frames~nav~sectioning default
	mini~frames~nav~sectioning .choice:,
	mini~frames~nav~sectioning .usage:n = { general },
	mini~frames~nav~sectioning .default:n = { secsubsection },

	mini~frames~nav~sectioning / none .code:n = {
		%
		\__gotham_set_template:nn{section~in~head/foot~shaded}{default/empty}
		\__gotham_set_template:nn{section~in~head/foot}{default/empty}
		\renewcommand{\gothamPatchSectionbox}{
			% patch to set section box height to 0.
			\ht\beamer@sectionbox=0pt
			\dp\beamer@sectionbox=0pt
		}
	},
	mini~frames~nav~sectioning / section .code:n = {
		%
		\__gotham_set_template:nn{section~in~head/foot~shaded}{default} %from Beamer
		\__gotham_set_template:nn{section~in~head/foot}{default} %from Beamer
	},
	mini~frames~nav~sectioning / secsubsection .code:n = {
		%
		\__gotham_set_template:nn{section~in~head/foot~shaded}{default/gotham~secSubsec}
		\__gotham_set_template:nn{section~in~head/foot}{default/gotham~secSubsec}
	},

	mini~frames~nav~sectioning / unknown .code:n = { \PackageWarning{ gotham } { The~choice~'#1'~is~unknown~for~the~(known)~option~'mini~frames~nav~sectioning',~so~being~ignored. }{helping~message: mini~frames~nav~sectioning / unknown} },
}
%    \end{macrocode}
%   \end{macro}
% \end{implementation}

% \begin{documentation}
% \begin{function}{\useoutertheme}
%	\begin{syntax}
%		\cs{useoutertheme}\oarg{option1=value1, ...}\marg{gotham}
%		\textrm{where the options are (default marked as} \defopt{default}\textrm{):}
%     \meta{mini frames nav position} = \oarg{\defopt{none} \textbar head \textbar foot \textbar left \textbar right}
%	\end{syntax}
%	The 'package' (useoutertheme) options can control navigation position option in mini frames.
% \end{function}
% \end{documentation}
%%%%
% \begin{implementation}
% 	\begin{macro}{outer key -- interface}
% 		Controls the outer settings for mini frames navigation position template.
% 		\UnitTested
% 		\TestFiles{gotham-test-051}
%    \begin{macrocode}
\tl_new:N \l__gotham_out_tmp_mfnposi_tl
\tl_new:N \l__gotham_out_tmp_pbar_tl
\keys_define:nn { gotham / outer }{
	% mini~frames~nav~position default
	mini~frames~nav~position .choice:,
	mini~frames~nav~position .usage:n = { general },
	mini~frames~nav~position .default:n = { none },

	mini~frames~nav~position / none .code:n = {
		%
		% reset if it has modified by another progressbar strategy
		% \__gotham_set_prop_template:nn{sidebar~canvas~right/default}{#1}
		\tl_set:Nn \l__gotham_out_tmp_mfnposi_tl {none}

		% head
		\tl_if_eq:VnTF \l__gotham_out_tmp_pbar_tl {head} {
			% True: nothing to do it is already occupied.
		}{
			\setbeamertemplate{headline}[default/\prop_item:Nn \l__gotham_template_name_prop {headline/default}]
		}
		% frametitle
		% \tl_if_eq:VnTF \l__gotham_out_tmp_pbar_tl {frametitle} {
		% 	% True: nothing to do it is already occupied.
		% }{
		% 	\setbeamertemplate{frametitle}[default/\prop_item:Nn \l__gotham_template_name_prop {frametitle/default}]
		% }
		% foot
		\tl_if_eq:VnTF \l__gotham_out_tmp_pbar_tl {footline} {
			% True: nothing to do it is already occupied.
		}{
			\setbeamertemplate{footline}[default/\prop_item:Nn \l__gotham_template_name_prop {footline/default}]
		}
		% left
		\tl_if_eq:VnTF \l__gotham_out_tmp_pbar_tl {left} {
			% True: nothing to do it is already occupied.
		}{
			\setbeamertemplate{sidebar~left}[default/\prop_item:Nn \l__gotham_template_name_prop {sidebar~left/default}]
		}
		% right
		\tl_if_eq:VnTF \l__gotham_out_tmp_pbar_tl {right} {
			% True: nothing to do it is already occupied.
		}{
			\setbeamertemplate{sidebar~right}[default/\prop_item:Nn \l__gotham_template_name_prop {sidebar~right/default}]
		}
	},
	mini~frames~nav~position / head .code:n = {
		%
		\tl_if_eq:VnTF \l__gotham_out_tmp_mfnposi_tl {head} {
			% True: nothing to do it is already done.
		}{
			% False : remember that choice in order to do not apply it several time and add to beamer template.
			\tl_set:Nn \l__gotham_out_tmp_mfnposi_tl {head}

			\tl_if_eq:VnTF \l__gotham_out_tmp_pbar_tl {head} {
				% True: nothing to do it is already occupied.
			}{
				\setbeamertemplate{headline}[default/\prop_item:Nn \l__gotham_template_name_prop {headline/default}]
			}
			% \tl_if_eq:VnTF \l__gotham_out_tmp_pbar_tl {frametitle} {
			% 	% True: nothing to do it is already occupied.
			% }{
			% 	\setbeamertemplate{frametitle}[default/\prop_item:Nn \l__gotham_template_name_prop {frametitle/default}]
			% }
			\tl_if_eq:VnTF \l__gotham_out_tmp_pbar_tl {footline} {
				% True: nothing to do it is already occupied.
			}{
				\setbeamertemplate{footline}[default/\prop_item:Nn \l__gotham_template_name_prop {footline/default}]
			}
			\tl_if_eq:VnTF \l__gotham_out_tmp_pbar_tl {left} {
				% True: nothing to do it is already occupied.
			}{
				\setbeamertemplate{sidebar~left}[default/\prop_item:Nn \l__gotham_template_name_prop {sidebar~left/default}]
			}
			\tl_if_eq:VnTF \l__gotham_out_tmp_pbar_tl {right} {
				% True: nothing to do it is already occupied.
			}{
				\setbeamertemplate{sidebar~right}[default/\prop_item:Nn \l__gotham_template_name_prop {sidebar~right/default}]
			}

			%
			\addtobeamertemplate{headline}{}{
				\tl_if_eq:VnTF \l__gotham_out_tmp_mfnposi_tl {head} {
					\usebeamertemplate*{mini~nav~progress~head/foot}
				}{}
			}
		}
	},
	mini~frames~nav~position / foot .code:n = {
		%
		\tl_if_eq:VnTF \l__gotham_out_tmp_mfnposi_tl {foot} {
			% True: nothing to do it is already done.
		}{
			% False : remember that choice in order to do not apply it several time and add to beamer template.
			\tl_set:Nn \l__gotham_out_tmp_mfnposi_tl {foot}

			\tl_if_eq:VnTF \l__gotham_out_tmp_pbar_tl {head} {
				% True: nothing to do it is already occupied.
			}{
				\setbeamertemplate{headline}[default/\prop_item:Nn \l__gotham_template_name_prop {headline/default}]
			}
			% \tl_if_eq:VnTF \l__gotham_out_tmp_pbar_tl {frametitle} {
			% 	% True: nothing to do it is already occupied.
			% }{
			% 	\setbeamertemplate{frametitle}[default/\prop_item:Nn \l__gotham_template_name_prop {frametitle/default}]
			% }
			\tl_if_eq:VnTF \l__gotham_out_tmp_pbar_tl {footline} {
				% True: nothing to do it is already occupied.
			}{
				\setbeamertemplate{footline}[default/\prop_item:Nn \l__gotham_template_name_prop {footline/default}]
			}
			\tl_if_eq:VnTF \l__gotham_out_tmp_pbar_tl {left} {
				% True: nothing to do it is already occupied.
			}{
				\setbeamertemplate{sidebar~left}[default/\prop_item:Nn \l__gotham_template_name_prop {sidebar~left/default}]
			}
			\tl_if_eq:VnTF \l__gotham_out_tmp_pbar_tl {right} {
				% True: nothing to do it is already occupied.
			}{
				\setbeamertemplate{sidebar~right}[default/\prop_item:Nn \l__gotham_template_name_prop {sidebar~right/default}]
			}

			\addtobeamertemplate{footline}{}{
				\tl_if_eq:VnTF \l__gotham_out_tmp_mfnposi_tl {foot} {
					\usebeamertemplate*{mini~nav~progress~head/foot}
				}{}
			}
		}
	},
	mini~frames~nav~position / left .code:n = {
		%
		\tl_if_eq:VnTF \l__gotham_out_tmp_mfnposi_tl {left} {
			% True: nothing to do it is already done.
		}{
			% False : remember that choice in order to do not apply it several time and add to beamer template.
			\tl_set:Nn \l__gotham_out_tmp_mfnposi_tl {left}

			\tl_if_eq:VnTF \l__gotham_out_tmp_pbar_tl {head} {
				% True: nothing to do it is already occupied.
			}{
				\setbeamertemplate{headline}[default/\prop_item:Nn \l__gotham_template_name_prop {headline/default}]
			}
			% \tl_if_eq:VnTF \l__gotham_out_tmp_pbar_tl {frametitle} {
			% 	% True: nothing to do it is already occupied.
			% }{
			% 	\setbeamertemplate{frametitle}[default/\prop_item:Nn \l__gotham_template_name_prop {frametitle/default}]
			% }
			\tl_if_eq:VnTF \l__gotham_out_tmp_pbar_tl {footline} {
				% True: nothing to do it is already occupied.
			}{
				\setbeamertemplate{footline}[default/\prop_item:Nn \l__gotham_template_name_prop {footline/default}]
			}
			\tl_if_eq:VnTF \l__gotham_out_tmp_pbar_tl {left} {
				% True: nothing to do it is already occupied.
			}{
				\setbeamertemplate{sidebar~left}[default/\prop_item:Nn \l__gotham_template_name_prop {sidebar~left/default}]
			}
			\tl_if_eq:VnTF \l__gotham_out_tmp_pbar_tl {right} {
				% True: nothing to do it is already occupied.
			}{
				\setbeamertemplate{sidebar~right}[default/\prop_item:Nn \l__gotham_template_name_prop {sidebar~right/default}]
			}

			%
			\addtobeamertemplate{sidebar~left}{}{
				\tl_if_eq:VnTF \l__gotham_out_tmp_mfnposi_tl {left} {
					\usebeamertemplate*{mini~nav~progress~left}
				}{}
			}
		}
	},
	mini~frames~nav~position / right .code:n = {
		%
		\tl_if_eq:VnTF \l__gotham_out_tmp_mfnposi_tl {right} {
			% True: nothing to do it is already done.
		}{
			% False : remember that choice in order to do not apply it several time and add to beamer template.
			\tl_set:Nn \l__gotham_out_tmp_mfnposi_tl {right}

			\tl_if_eq:VnTF \l__gotham_out_tmp_pbar_tl {head} {
				% True: nothing to do it is already occupied.
			}{
				\setbeamertemplate{headline}[default/\prop_item:Nn \l__gotham_template_name_prop {headline/default}]
			}
			% \tl_if_eq:VnTF \l__gotham_out_tmp_pbar_tl {frametitle} {
			% 	% True: nothing to do it is already occupied.
			% }{
			% 	\setbeamertemplate{frametitle}[default/\prop_item:Nn \l__gotham_template_name_prop {frametitle/default}]
			% }
			\tl_if_eq:VnTF \l__gotham_out_tmp_pbar_tl {footline} {
				% True: nothing to do it is already occupied.
			}{
				\setbeamertemplate{footline}[default/\prop_item:Nn \l__gotham_template_name_prop {footline/default}]
			}
			\tl_if_eq:VnTF \l__gotham_out_tmp_pbar_tl {left} {
				% True: nothing to do it is already occupied.
			}{
				\setbeamertemplate{sidebar~left}[default/\prop_item:Nn \l__gotham_template_name_prop {sidebar~left/default}]
			}
			\tl_if_eq:VnTF \l__gotham_out_tmp_pbar_tl {right} {
				% True: nothing to do it is already occupied.
			}{
				\setbeamertemplate{sidebar~right}[default/\prop_item:Nn \l__gotham_template_name_prop {sidebar~right/default}]
			}

			%
			\addtobeamertemplate{sidebar~right}{}{
				\tl_if_eq:VnTF \l__gotham_out_tmp_mfnposi_tl {right} {
					\usebeamertemplate*{mini~nav~progress~right}
				}{}
			}
		}
	},

	mini~frames~nav~position / unknown .code:n = { \PackageWarning{ gotham } { The~choice~'#1'~is~unknown~for~the~(known)~option~'mini~frames~nav~position',~so~being~ignored. }{helping~message: mini~frames~nav~position / unknown} },
}
%    \end{macrocode}
%   \end{macro}
% \end{implementation}


%%% Progress bar %%%

% \begin{documentation}
%   \begin{variable}{\gothamProgressHeadFootLineheight}
%     Variable vertical length defining the height of the progressbar.
%   \end{variable}
% \end{documentation}
%%%%%%
% \begin{implementation}
%   \begin{variable}{\gothamProgressHeadFootLineheight}
%     Lengths used in tikz rectangle.
%    \begin{macrocode}
\newlength{\gotham@progressinheadfoot}
\newlength{\gothamProgressHeadFootLineheight}
\setlength{\gothamProgressHeadFootLineheight}{1.2ex}
%    \end{macrocode}
%   \end{variable}
% \end{implementation}

% \begin{documentation}
%   \begin{variable}{\l_gotham_ProgCircleMoving_bool, \l_gotham_progbar_advancement_tlbr_bool, \l_gotham_pmfn_bool}
%     Boolean variables controlling the direction of progression and if the current frame number is moving with the progression.
%   \end{variable}
% \end{documentation}
%%%%%%
% \begin{implementation}
%   \begin{variable}{\l_gotham_ProgCircleMoving_bool, \l_gotham_progbar_advancement_tlbr_bool, \l_gotham_pmfn_bool}
%     Boolean variables controlling the direction of progression and if the current frame number is moving with the progression and if the miniframes navigation should be printed inside the progress bar.
%    \begin{macrocode}
\bool_new:N \l_gotham_ProgCircleMoving_bool
\bool_set_true:N \l_gotham_ProgCircleMoving_bool

\bool_new:N \l_gotham_progbar_advancement_tlbr_bool
\bool_set_true:N \l_gotham_progbar_advancement_tlbr_bool

\bool_new:N \l_gotham_pmfn_bool
\bool_set_false:N \l_gotham_pmfn_bool
%    \end{macrocode}
%   \end{variable}
% \end{implementation}

% \begin{implementation}
% 	\begin{function}{\__gotham_rectangle_box_progressbar:n}
%     \begin{arguments}
%       \item |width| of the progress bar.
%     \end{arguments}
% 		Command to draw a rectangular progress bar that can go from left to right or the opposite and that can include a navigation miniframes bar.
% 		\TestFiles{gotham-test-048}
%    \begin{macrocode}
% #1: 'linewidth'
\cs_new_protected:Npn \__gotham_rectangle_box_progressbar:n #1
{
	%
	\setlength{\gotham@progressinheadfoot}{
		#1 * \ratio{\insertframenumber pt}{\inserttotalframenumber pt}
	}

	%
	\begin{beamercolorbox}[wd=#1]{progress~bar~in~head/foot}
		\begin{tikzpicture}
			\usebeamercolor{progress~bar~in~head/foot}

			% gray rectangle in the background.
			\fill[color=progress~bar~in~head/foot.bg]
				(0pt, 0pt) rectangle ++ (#1, \gothamProgressHeadFootLineheight)
			;

			\bool_if:NTF \l_gotham_progbar_advancement_tlbr_bool {
				% from left to right
				% orange rectangle progressing
				\fill[color=progress~bar~in~head/foot.fg]
					(0pt, 0pt) rectangle ++ (\gotham@progressinheadfoot, \gothamProgressHeadFootLineheight)
				;
			}{
				% from right to left
				% orange rectangle progressing
				\fill[color=progress~bar~in~head/foot.fg]
					(#1, \gothamProgressHeadFootLineheight) rectangle ++ (-\gotham@progressinheadfoot, -\gothamProgressHeadFootLineheight)
				;
			}

			\bool_if:NTF \l_gotham_pmfn_bool {
				% progress miniframes navigation is on.
				\node at (#1/2, \gothamProgressHeadFootLineheight/2)
					[text~height=0.1pt, text~depth=0.05pt, inner~sep=0pt] %draw=red,
					{
						\usebeamercolor[fg]{normal~text}
						% \fontsize{3.5pt}{0pt}\selectfont
						\raisebox{0.5\gothamProgressHeadFootLineheight+1.4pt}[0pt][0pt]{
							%\dohead
							\hfuzz=#1
							\insertnavigation{#1}
						}
					}
				;
			}{
				% false
				% nothing to do since progress miniframes navigation is off.
			}
		\end{tikzpicture}
	\end{beamercolorbox}
}
%    \end{macrocode}
%   \end{function}
% \end{implementation}

% \begin{implementation}
%   \begin{macro}{\defbeamertemplate{progress~bar~in~head/foot}{gotham~rectangle}}
%     template displaying the progress bar in head, frametitle or footline.
%     \UnitTested
%     \TestFiles{gotham-test-046, gotham-test-046b, gotham-test-047, gotham-test-048}
%    \begin{macrocode}
\defbeamertemplate{progress~bar~in~head/foot}{gotham~rectangle}{
	\nointerlineskip
	\__gotham_rectangle_box_progressbar:n {\paperwidth}
}
%    \end{macrocode}
%   \end{macro}
% \end{implementation}

% \begin{implementation}
%   \begin{macro}{\defbeamertemplate{progress~bar~in~left/right}{gotham~rectangle}}
%     template displaying the progress bar in left or right.
%     \UnitTested
%     \TestFiles{gotham-test-046, gotham-test-046b, gotham-test-047,gotham-test-048}
%    \begin{macrocode}
\defbeamertemplate{progress~bar~in~left}{gotham~rectangle}{
	\nointerlineskip

	\settoheight{\gotham@temp@heightFrametitle}{\gotham@strut}
	\addtolength{\gotham@temp@heightFrametitle}{\gothamFrametitleToppading+\gothamFrametitleBottompading+\gothamProgressHeadFootLineheight}

	\setlength{\gotham@temp@PaperheightFrametitle}{\paperheight-\gotham@temp@heightFrametitle-\gothamFootlineHeight-\gothamFootlineDepth-0.25\baselineskip}

	\vspace{0.12275\paperheight}
	\rotatebox{90}{
		\__gotham_rectangle_box_progressbar:n {\gotham@temp@PaperheightFrametitle}
	}
}
\defbeamertemplate{progress~bar~in~right}{gotham~rectangle}{
	\nointerlineskip

	\settoheight{\gotham@temp@heightFrametitle}{\gotham@strut}
	\addtolength{\gotham@temp@heightFrametitle}{\gothamFrametitleToppading+\gothamFrametitleBottompading+\gothamProgressHeadFootLineheight}

	\setlength{\gotham@temp@PaperheightFrametitle}{\paperheight-\gotham@temp@heightFrametitle-\gothamFootlineHeight-\gothamFootlineDepth-0.25\baselineskip}

	\hspace{-\gothamProgressHeadFootLineheight}
	\vspace{\gotham@temp@heightFrametitle-27.75pt}
	\rotatebox{-90}{
		\__gotham_rectangle_box_progressbar:n {\gotham@temp@PaperheightFrametitle}
	}
}
%    \end{macrocode}
%   \end{macro}
% \end{implementation}

% \begin{implementation}
% 	\begin{function}{\__gotham_rounded_box_progressbar:nnnn}
%     \begin{arguments}
%       \item |width| Name of the option to add, this name should also correspond to the name of the environment followed by the suffix 'env'.
%       \item |ratio progressbar/extra command|
%       \item |colorbox name|
%       \item |extra command|
%     \end{arguments}
% 		Command to draw a rounded box progress bar that can go from left to right or the opposite and that can include a navigation miniframes bar.
%     The fourth argument is a command to control what to display at the right side of the rounded box.
% 		\TestFiles{gotham-test-048}
%    \begin{macrocode}
% #1: 'linewidth'
% #2: ratio of the progress bar
% #3: colorbox name
% #4: command for percent of progress
\cs_new_protected:Npn \__gotham_rounded_box_progressbar:nnnn #1#2#3#4
{
	\setlength{\gotham@progressinheadfoot}{
		#2#1 * \ratio{\insertframenumber pt}{\inserttotalframenumber pt}
	}

	% 1.035\gothamProgressHeadFootLineheight is to include the border inside the box.
	\begin{beamercolorbox}[wd=#1, ht=1.035\gothamProgressHeadFootLineheight]{#3}
		\;\hfill
		%\tikzexternaldisable%
		\begin{tikzpicture}[rounded~corners=0.5\gothamProgressHeadFootLineheight, very~thin]
			\usebeamercolor{progress~bar~in~head/foot}

			% gray rectangle in the background.
			\shade[top~color=progress~bar~in~head/foot.bg!65, bottom~color=progress~bar~in~head/foot.bg!65, middle~color=progress~bar~in~head/foot.bg]
				(0pt, 0pt) rectangle ++ (#2#1, \gothamProgressHeadFootLineheight)
			;

			\bool_if:NTF \l_gotham_progbar_advancement_tlbr_bool {
				% from left to right
				% orange rectangle progressing
				\shade[draw=progress~bar~in~head/foot.fg, top~color=progress~bar~in~head/foot.fg!70, bottom~color=progress~bar~in~head/foot.fg!70, middle~color=progress~bar~in~head/foot.fg]
					(0pt, 0pt) rectangle ++ (\gotham@progressinheadfoot, \gothamProgressHeadFootLineheight)
				;
			}{
				% from right to left
				% orange rectangle progressing
				\shade[draw=progress~bar~in~head/foot.fg, top~color=progress~bar~in~head/foot.fg!70, bottom~color=progress~bar~in~head/foot.fg!70, middle~color=progress~bar~in~head/foot.fg]
					(#2#1, \gothamProgressHeadFootLineheight) rectangle ++ (-\gotham@progressinheadfoot, -\gothamProgressHeadFootLineheight)
				;
			}

			\bool_if:NTF \l_gotham_pmfn_bool {
				% progress miniframes navigation is on.
				\node at (#2#1/2, \gothamProgressHeadFootLineheight/2)
					[text~height=0.1pt, text~depth=0.05pt, inner~sep=0pt] %draw=red,
					{
						\usebeamercolor[fg]{normal~text}
						% \fontsize{3.5pt}{0pt}\selectfont
						\raisebox{0.5\gothamProgressHeadFootLineheight+1.4pt}[0pt][0pt]{
							\hfuzz=#2#1
							%\dohead
							\insertnavigation{#2#1}
						}
					}
				;
			}{
				% false
				% nothing to do since progress miniframes navigation is off.
			}
		\end{tikzpicture}
		#4
		\hfill \;
	\end{beamercolorbox}
}
% \cs_generate_variant:Nn \__gotham_rounded_box_progressbar:nnnn { Nnnn }
%    \end{macrocode}
%   \end{function}
% \end{implementation}

% \begin{implementation}
%   \begin{macro}{\defbeamertemplate{progress~bar~in~head/foot}{gotham~rounded~box}}
%     template displaying the progress bar in head, frametitle or footline.
%     \UnitTested
%     \TestFiles{gotham-test-046, gotham-test-046b, gotham-test-047,gotham-test-048}
%    \begin{macrocode}
\defbeamertemplate{progress~bar~in~head/foot}{gotham~rounded~box}{
	\nointerlineskip
	\__gotham_rounded_box_progressbar:nnnn {\paperwidth}{0.93}{footline}{
		\hfill
		\raisebox{0.5\gothamProgressHeadFootLineheight-1.75pt}[0pt][0pt]{
			\fontsize{5pt}{0pt}\selectfont
			\usebeamercolor[fg]{normal~text}
			\fp_eval:n {round(\insertframenumber*100/\inserttotalframenumber,0)}\,\%
		}
	}
	% \__gotham_rounded_box_progressbar:nnnn {\paperwidth}{0.53}{progress~bar~in~head/foot}{}
}
%    \end{macrocode}
%   \end{macro}
% \end{implementation}

% \begin{implementation}
%   \begin{macro}{\defbeamertemplate{progress~bar~in~left/right}{gotham~rounded~box}}
%     template displaying the progress bar in left or right sidebar.
%     \UnitTested
%     \TestFiles{gotham-test-046, gotham-test-046b, gotham-test-047,gotham-test-048}
%    \begin{macrocode}
\defbeamertemplate{progress~bar~in~left}{gotham~rounded~box}{
	\nointerlineskip

	\settoheight{\gotham@temp@heightFrametitle}{\gotham@strut}
	\addtolength{\gotham@temp@heightFrametitle}{\gothamFrametitleToppading+\gothamFrametitleBottompading+\gothamProgressHeadFootLineheight}

	\setlength{\gotham@temp@PaperheightFrametitle}{\paperheight-\gotham@temp@heightFrametitle-\gothamFootlineHeight-\gothamFootlineDepth-0.25\baselineskip}

	\vspace{0.12275\paperheight}
	% \hspace{\gothamProgressHeadFootLineheight}
	\rotatebox{90}{
		\__gotham_rounded_box_progressbar:nnnn {\gotham@temp@PaperheightFrametitle}{0.89}{footline}{
			\hfill
			\raisebox{0.5\gothamProgressHeadFootLineheight-1.75pt}[0pt][0pt]{
				\fontsize{5pt}{0pt}\selectfont
				\fp_eval:n {round(\insertframenumber*100/\inserttotalframenumber,0)}\,\%
			}
		}
	}
}
\defbeamertemplate{progress~bar~in~right}{gotham~rounded~box}{
	\nointerlineskip

	\settoheight{\gotham@temp@heightFrametitle}{\gotham@strut}
	\addtolength{\gotham@temp@heightFrametitle}{\gothamFrametitleToppading+\gothamFrametitleBottompading+\gothamProgressHeadFootLineheight}

	\setlength{\gotham@temp@PaperheightFrametitle}{\paperheight-\gotham@temp@heightFrametitle-\gothamFootlineHeight-\gothamFootlineDepth-0.25\baselineskip}

	\hspace{-\gothamProgressHeadFootLineheight-0.2pt}
	\vspace{\gotham@temp@heightFrametitle-27.75pt}
	\rotatebox{-90}{
		\__gotham_rounded_box_progressbar:nnnn {\gotham@temp@PaperheightFrametitle}{0.89}{footline}{
			\hfill
			\raisebox{0.5\gothamProgressHeadFootLineheight-1.75pt}[0pt][0pt]{
				\fontsize{5pt}{0pt}\selectfont
				\fp_eval:n {round(\insertframenumber*100/\inserttotalframenumber,0)}\,\%
			}
		}
	}
}
%    \end{macrocode}
%   \end{macro}
% \end{implementation}

% \begin{documentation}
%   \begin{variable}{\gothamProgressCircHeight, \gothamCounterCircleRadius, \gothamProgressCircBorderWidth}
%     Lengths controlling the aspect of |progress circle|.
%     |\gothamProgressCircHeight| is controlling the inner height of the circle (related to its diameter).
%     |\gothamCounterCircleRadius| is controlling the size of the counter circle containing the frame number.
%     |\gothamProgressCircBorderWidth| is controlling width of the progress circle.
%   \end{variable}
% \end{documentation}
%%%%%%
% \begin{implementation}
%   \begin{variable}{\gothamProgressCircHeight, \gothamCounterCircleRadius, \gothamProgressCircBorderWidth}
%     Lengths used in tikz rectangle.
%    \begin{macrocode}
%the height of the header is 1.8 times the lineheight of the frame title
\newlength{\gothamProgressCircHeight}
\setlength{\gothamProgressCircHeight}{1.8\baselineskip}
%\setlength{\gothamProgressCircHeight}{2\baselineskip}
\newlength{\gothamCounterCircleRadius}
\setlength{\gothamCounterCircleRadius}{1.12ex}
% width of the border
\newlength{\gothamProgressCircBorderWidth}
\setlength{\gothamProgressCircBorderWidth}{1.65mm}

%% Induced length used internally, but can still be tuned manually by inspired people.
% radius of the logo
\newlength{\gothamProgressCircLogoRadius}
\setlength{\gothamProgressCircLogoRadius}{1.2\gothamProgressCircHeight/2}
% inner radius of border of the logo frame
\newlength{\gothamProgressCircLogoInnerRadius}
\setlength{\gothamProgressCircLogoInnerRadius}{1.1\gothamProgressCircLogoRadius}
% radius of the outer border of the logo frame
\newlength{\gothamProgressCircLogoOuterRadius}
\setlength{\gothamProgressCircLogoOuterRadius}{\gothamProgressCircLogoInnerRadius+\gothamProgressCircBorderWidth}
% radius of the counters
\newlength{\gothamCounterRadius}
\setlength{\gothamCounterRadius}{\gothamProgressCircLogoInnerRadius/2+\gothamProgressCircLogoOuterRadius/2}
%    \end{macrocode}
%   \end{variable}
% \end{implementation}

% \begin{implementation}
%   \begin{variable}{\l_gotham_ratio_progresscircle_fp, \l_gotham_angle_counterradius_fp}
%     angle ratio of the progress in degree and angle of the counter circle intercepted by the half of the border.
%    \begin{macrocode}
% \fp_new:N \l_gotham_ratio_progress_fp
\fp_new:N \l_gotham_ratio_progresscircle_fp
% the angle token by the counter radius
\fp_new:N \l_gotham_angle_counterradius_fp
% requires xfp for asind
\fp_set:Nn \l_gotham_angle_counterradius_fp {
	\fpeval{ 2* asind (\gothamCounterCircleRadius / (2*\gothamCounterRadius)) }
}
%    \end{macrocode}
%   \end{variable}
% \end{implementation}

% \begin{documentation}
%   \begin{function}{\gothamInstituteLogoCircle[#1]}
%     \begin{syntax}
%       \cs{gothamInstituteLogoCircle} \oarg{height (4ex)}
%     \end{syntax}
%     Command that have to be redefined in order to include your circular logo.
%     For example your can do |\renewcommand{\gothamInstituteLogoCircle}[1][4ex]{\includegraphics[height=#1]{gotham-logo.pdf}}|.
%   \end{function}
% \end{documentation}
%%%%%%
% \begin{implementation}
%   \begin{function}{\gothamInstituteLogoCircle[#1]}
%     \begin{arguments}
%       \item |height| of the picture
%     \end{arguments}
%     Command to be redefined by users.
%     \TestFiles{ gotham-test-046b}
%    \begin{macrocode}
\providecommand{\gothamInstituteLogoCircle}[1][4ex]{
	\includegraphics[height=#1]{gotham-logo.pdf}
}
%    \end{macrocode}
%   \end{function}
% \end{implementation}

% \begin{implementation}
%   \begin{function}{\gothamProgressCircle}
%     Internal command plotting the circle progress and that is used internal in the instituteLogo template within the frametitle template.
%     \TestFiles{ gotham-test-046b}
%    \begin{macrocode}
\providecommand{\gothamProgressCircle}{
	% \tikzexternaldisable
	\begin{tikzpicture}[remember~picture,overlay]
		% Load colors
		\usebeamercolor{standin}
		\usebeamercolor{frametitle}
		\usebeamercolor{progress~bar~in~head/foot}

		% Define center
		\coordinate (localCenter);
		% draw the outer circle
      \fill[fill=progress~bar~in~head/foot.bg] (localCenter) circle (\gothamProgressCircLogoOuterRadius);
      % draw the inner circle
      \fill[fill=frametitle.bg] (localCenter) circle (\gothamProgressCircLogoInnerRadius);
		\node at (localCenter) {\gothamInstituteLogoCircle[1.9\gothamProgressCircLogoRadius]};

		%% draw progress circle/bar
		\bool_if:NTF \l_gotham_ProgCircleMoving_bool {
			% the circular counter with a moving counter

			%% compute the angle for the progress circle
			\bool_if:NTF \l_gotham_progbar_advancement_tlbr_bool {
				\fp_set:Nn \l_gotham_ratio_progresscircle_fp {-(360)*\insertframenumber/\inserttotalframenumber }
			}{
				%\else% clockwise rotation
				\fp_set:Nn \l_gotham_ratio_progresscircle_fp {(360)*(\insertframenumber/\inserttotalframenumber)}
			}
			%\fi

			% draw the arc progress bar
			\draw[
				color=progress~bar~in~head/foot.fg,
				line~width=0.6*\gothamProgressCircBorderWidth
			]
				(localCenter)
				++
				([
					xshift=\gothamCounterRadius
				]localCenter)
				arc[
					radius=\gothamCounterRadius,
					start~angle=0,
					end~angle={\fp_eval:n \l_gotham_ratio_progresscircle_fp}
				]
			;

			% draw a point at the beginning of the progress circle
			\fill[fill=frametitle.bg]
				([
					xshift={\gothamCounterRadius}
				]localCenter.center)
				circle (0.3*\gothamProgressCircBorderWidth)
			;
			% place the current frame number
			\node[
				% fill=standin.bg, draw=progress~bar~in~head/foot.bg, thick, circle, minimum~width={\gothamCounterCircleRadius}, text~width={0pt}
			]
				(pagenumframe) at (
					[rotate=
							{\fp_eval:n {\l_gotham_ratio_progresscircle_fp}},
						xshift=\gothamCounterRadius
					]localCenter) {}
			;
			\filldraw[
				draw=progress~bar~in~head/foot.bg,
				fill=standin.bg,
				thick,
			]
				(pagenumframe) circle (\gothamCounterCircleRadius)
			;
			% place the frame number in another node to avoid unwanted rescaling.
			\node[at=(pagenumframe.center), anchor=center] {
				{\usebeamercolor[fg]{standin}\tiny\insertframenumber}
			};
		}{
			%\else gothamProgCircleMoving
			% the circular counter with a fixed counter

			%% compute the angle for the progress circle
			\bool_if:NTF \l_gotham_progbar_advancement_tlbr_bool {
				\fp_set:Nn \l_gotham_ratio_progresscircle_fp {-(360-2\l_gotham_angle_counterradius_fp)*\insertframenumber/\inserttotalframenumber -\l_gotham_angle_counterradius_fp}
			}{
				%\else% clockwise rotation
				\fp_set:Nn \l_gotham_ratio_progresscircle_fp {(360-2\l_gotham_angle_counterradius_fp)*(\insertframenumber/\inserttotalframenumber) +\l_gotham_angle_counterradius_fp}
			}
			%\fi

			% draw the arc progress bar
			\draw[
				color=progress~bar~in~head/foot.fg,
				line~width=0.6*\gothamProgressCircBorderWidth
			]
				(localCenter)
				++
				([rotate={\fp_eval:n {\l_gotham_angle_counterradius_fp}},
					xshift=\gothamCounterRadius
				]localCenter)
				arc[
					radius=\gothamCounterRadius,
					start~angle={\fp_eval:n \l_gotham_angle_counterradius_fp},
					end~angle={\fp_eval:n \l_gotham_ratio_progresscircle_fp}
				]
			;

			% draw a point at the end of the progress circle
			\fill[fill=frametitle.bg]
				([
					rotate={\fp_eval:n {\l_gotham_ratio_progresscircle_fp}}, xshift={\gothamCounterRadius}
				]localCenter.center)
				circle (0.3*\gothamProgressCircBorderWidth)
			;
			% place the total number of frames
			\node[] (leftick)
			at ([xshift={\gothamProgressCircLogoOuterRadius+1.25ex}]localCenter) {}
			;
			%% draw a line ticks
			\draw[
				color=frametitle.fg,
				fill=frametitle.fg,
			]
				([xshift=\gothamProgressCircLogoOuterRadius,yshift={-0.05ex}] localCenter)
				rectangle ([yshift={0.05ex}] leftick)
			;
			\node[ at=(leftick), anchor=west, inner~sep = 1pt,]
				{\usebeamercolor[fg]{frametitle}\tiny\inserttotalframenumber}
			;
			% place the current frame number
			\node[
				% fill=standin.bg, draw=progress~bar~in~head/foot.bg, thick, circle, minimum~width={\gothamCounterCircleRadius}, text~width={0pt}
			]
				(pagenumframe) at ([xshift=\gothamCounterRadius]localCenter) {}
			;
			\filldraw[
				draw=progress~bar~in~head/foot.bg,
				fill=standin.bg,
				thick,
			]
				(pagenumframe) circle (\gothamCounterCircleRadius)
			;
			% place the frame number in another node to avoid unwanted rescaling.
			\node[at=(pagenumframe.center), anchor=center] {
				{\usebeamercolor[fg]{standin}\tiny\insertframenumber}
			};
		}
		%\fi gothamProgCircleMoving
	\end{tikzpicture}
	\bool_if:NTF \l_gotham_ProgCircleMoving_bool {
		% nothing
		\hspace{\gothamProgressCircLogoOuterRadius+0.75ex}
	}{
		% else
		% extra space to compensate the total number of frame
		\hspace{\gothamProgressCircLogoOuterRadius+3ex}
	}
  	% \tikzexternalenable
}
%    \end{macrocode}
%   \end{function}
% \end{implementation}

% \begin{documentation}
% \begin{function}{\useoutertheme}
%	\begin{syntax}
%		\cs{useoutertheme}\oarg{option1=value1, ...}\marg{gotham}
%		\textrm{where the options are (default marked as} \defopt{default}\textrm{):}
%     \meta{progressbar~position} = \oarg{\defopt{foot} \textbar none \textbar head \textbar circlehead \textbar ... }
%	\end{syntax}
%	The 'package' (useoutertheme) options can control |progress bar|  templates that be placed in the head (over the frametitle), frametitle (under it), below the footer or the circlehead (around the logo in the frametitle).
% \end{function}
% \end{documentation}
%%%%
% \begin{implementation}
% 	\begin{macro}{outer key -- interface}
% 		Controls the outer settings for progress bar.
% 		\UnitTested
% 		\TestFiles{gotham-test-048}
%    \begin{macrocode}
% token list to remember what is the current state
% \tl_new:N \l__gotham_out_tmp_pbar_tl
\keys_define:nn { gotham / outer }{
	% progressbar~position default
	progressbar~position .choice:,
	progressbar~position .usage:n = { general },
	progressbar~position .default:n = { none },

	progressbar~position / none .code:n = {
		% reset if it has modified by another progressbar~position strategy
		% \__gotham_set_prop_template:nn{sidebar~canvas~right/default}{#1}
		\tl_set:Nn \l__gotham_out_tmp_pbar_tl {none}

		% head
		\tl_if_eq:VnTF \l__gotham_out_tmp_mfnposi_tl {head} {
			% True: nothing to do it is already occupied.
		}{
			\setbeamertemplate{headline}[default/\prop_item:Nn \l__gotham_template_name_prop {headline/default}]
		}
		% frametitle
		% \tl_if_eq:VnTF \l__gotham_out_tmp_mfnposi_tl {frametitle} {
		% 	% True: nothing to do it is already occupied.
		% }{
			\setbeamertemplate{frametitle}[default/\prop_item:Nn \l__gotham_template_name_prop {frametitle/default}]
		% }
		% foot
		\tl_if_eq:VnTF \l__gotham_out_tmp_mfnposi_tl {foot} {
			% True: nothing to do it is already occupied.
		}{
			\setbeamertemplate{footline}[default/\prop_item:Nn \l__gotham_template_name_prop {footline/default}]
		}
		% left
		\tl_if_eq:VnTF \l__gotham_out_tmp_mfnposi_tl {left} {
			% True: nothing to do it is already occupied.
		}{
			\setbeamertemplate{sidebar~left}[default/\prop_item:Nn \l__gotham_template_name_prop {sidebar~left/default}]
		}
		% right
		\tl_if_eq:VnTF \l__gotham_out_tmp_mfnposi_tl {right} {
			% True: nothing to do it is already occupied.
		}{
			\setbeamertemplate{sidebar~right}[default/\prop_item:Nn \l__gotham_template_name_prop {sidebar~right/default}]
		}

		% logo
		\__gotham_set_prop_template:nn{includeLogo/default}{gotham~square}
		% section in head
		\setbeamertemplate{section~in~head/foot~shaded}[default/\prop_item:Nn \l__gotham_template_name_prop {section~in~head/foot~shaded/default}]
		\setbeamertemplate{section~in~head/foot}[default/\prop_item:Nn \l__gotham_template_name_prop {section~in~head/foot/default}]
	},
	progressbar~position / head .code:n = {
		\tl_if_eq:VnTF \l__gotham_out_tmp_pbar_tl {head} {
			% True: nothing to do it is already done.
		} {
			% False : remember that choice in order to do not apply it several time and add to beamer template.
			\tl_set:Nn \l__gotham_out_tmp_pbar_tl {head}

			\tl_if_eq:VnTF \l__gotham_out_tmp_mfnposi_tl {head} {
				% True: nothing to do it is already occupied.
			}{
				\setbeamertemplate{headline}[default/\prop_item:Nn \l__gotham_template_name_prop {headline/default}]
			}
			% \tl_if_eq:VnTF \l__gotham_out_tmp_mfnposi_tl {frametitle} {
			% 	% True: nothing to do it is already occupied.
			% }{
				\setbeamertemplate{frametitle}[default/\prop_item:Nn \l__gotham_template_name_prop {frametitle/default}]
			% }
			\tl_if_eq:VnTF \l__gotham_out_tmp_mfnposi_tl {foot} {
				% True: nothing to do it is already occupied.
			}{
				\setbeamertemplate{footline}[default/\prop_item:Nn \l__gotham_template_name_prop {footline/default}]
			}
			\tl_if_eq:VnTF \l__gotham_out_tmp_mfnposi_tl {left} {
				% True: nothing to do it is already occupied.
			}{
				\setbeamertemplate{sidebar~left}[default/\prop_item:Nn \l__gotham_template_name_prop {sidebar~left/default}]
			}
			\tl_if_eq:VnTF \l__gotham_out_tmp_mfnposi_tl {right} {
				% True: nothing to do it is already occupied.
			}{
				\setbeamertemplate{sidebar~right}[default/\prop_item:Nn \l__gotham_template_name_prop {sidebar~right/default}]
			}

			%
			\addtobeamertemplate{headline}{}{
				\tl_if_eq:VnTF \l__gotham_out_tmp_pbar_tl {head} {
					\usebeamertemplate*{progress~bar~in~head/foot}
				}{}
			}
		}
	},
	progressbar~position / frametitle .code:n = {
		\tl_if_eq:VnTF \l__gotham_out_tmp_pbar_tl {frametitle} {
			% True: nothing to do it is already done.
		} {
			% False : remember that choice in order to do not apply it several time and add to beamer template.
			\tl_set:Nn \l__gotham_out_tmp_pbar_tl {frametitle}

			\tl_if_eq:VnTF \l__gotham_out_tmp_mfnposi_tl {head} {
				% True: nothing to do it is already occupied.
			}{
				\setbeamertemplate{headline}[default/\prop_item:Nn \l__gotham_template_name_prop {headline/default}]
			}
			% \tl_if_eq:VnTF \l__gotham_out_tmp_mfnposi_tl {frametitle} {
			% 	% True: nothing to do it is already occupied.
			% }{
				\setbeamertemplate{frametitle}[default/\prop_item:Nn \l__gotham_template_name_prop {frametitle/default}]
			% }
			\tl_if_eq:VnTF \l__gotham_out_tmp_mfnposi_tl {foot} {
				% True: nothing to do it is already occupied.
			}{
				\setbeamertemplate{footline}[default/\prop_item:Nn \l__gotham_template_name_prop {footline/default}]
			}
			\tl_if_eq:VnTF \l__gotham_out_tmp_mfnposi_tl {left} {
				% True: nothing to do it is already occupied.
			}{
				\setbeamertemplate{sidebar~left}[default/\prop_item:Nn \l__gotham_template_name_prop {sidebar~left/default}]
			}
			\tl_if_eq:VnTF \l__gotham_out_tmp_mfnposi_tl {right} {
				% True: nothing to do it is already occupied.
			}{
				\setbeamertemplate{sidebar~right}[default/\prop_item:Nn \l__gotham_template_name_prop {sidebar~right/default}]
			}

			%
			\addtobeamertemplate{frametitle}{}{
				\tl_if_eq:VnTF \l__gotham_out_tmp_pbar_tl {frametitle} {
					\usebeamertemplate*{progress~bar~in~head/foot}
				}{}
			}
		}
	},
	progressbar~position / foot .code:n = {
		\tl_if_eq:VnTF \l__gotham_out_tmp_pbar_tl {footline} {
			% True: nothing to do it is already done.
		} {
			% False : remember that choice in order to do not apply it several time and add to beamer template.
			\tl_set:Nn \l__gotham_out_tmp_pbar_tl {footline}

			\tl_if_eq:VnTF \l__gotham_out_tmp_mfnposi_tl {head} {
				% True: nothing to do it is already occupied.
			}{
				\setbeamertemplate{headline}[default/\prop_item:Nn \l__gotham_template_name_prop {headline/default}]
			}
			% \tl_if_eq:VnTF \l__gotham_out_tmp_mfnposi_tl {frametitle} {
			% 	% True: nothing to do it is already occupied.
			% }{
				\setbeamertemplate{frametitle}[default/\prop_item:Nn \l__gotham_template_name_prop {frametitle/default}]
			% }
			\tl_if_eq:VnTF \l__gotham_out_tmp_mfnposi_tl {foot} {
				% True: nothing to do it is already occupied.
			}{
				\setbeamertemplate{footline}[default/\prop_item:Nn \l__gotham_template_name_prop {footline/default}]
			}
			\tl_if_eq:VnTF \l__gotham_out_tmp_mfnposi_tl {left} {
				% True: nothing to do it is already occupied.
			}{
				\setbeamertemplate{sidebar~left}[default/\prop_item:Nn \l__gotham_template_name_prop {sidebar~left/default}]
			}
			\tl_if_eq:VnTF \l__gotham_out_tmp_mfnposi_tl {right} {
				% True: nothing to do it is already occupied.
			}{
				\setbeamertemplate{sidebar~right}[default/\prop_item:Nn \l__gotham_template_name_prop {sidebar~right/default}]
			}

			%
			\addtobeamertemplate{footline}{}{
				\tl_if_eq:VnTF \l__gotham_out_tmp_pbar_tl {footline} {
					\usebeamertemplate*{progress~bar~in~head/foot}
				}{}
			}
		}
	},
	progressbar~position / circlehead .code:n = {
		\tl_if_eq:VnTF \l__gotham_out_tmp_pbar_tl {circlehead} {
			% True: nothing to do it is already done.
		} {
			% False : remember that choice in order to do not apply it several time and add to beamer template.
			\tl_set:Nn \l__gotham_out_tmp_pbar_tl {circlehead}

			%
			%%%\prop_put:Nnn \l__gotham_template_name_SAVE_prop {includeLogo/default} {gotham~square} % not needed after all.
			\__gotham_set_prop_template:nn{includeLogo/default}{gotham~circle}
			\__gotham_set_template:nn{section~in~head/foot~shaded}{default/gotham~secSubsec}
			\__gotham_set_template:nn{section~in~head/foot}{default/gotham~secSubsec}
			% \__gotham_set_template:nn{headline}{default/gotham~section}
			% \setbeamertemplate{headline}[default/gotham~section]

			\tl_if_eq:VnTF \l__gotham_out_tmp_mfnposi_tl {head} {
				% True: it is already occupied, so let's emulate the gotham section
				\addtobeamertemplate{headline}{}{
					\tl_if_eq:VnTF \l__gotham_out_tmp_pbar_tl {circlehead} {
						\begin{beamercolorbox}[wd=1.0\paperwidth, ht=2.5ex, dp=1.4ex, left]{headfoot}
							\usebeamerfont{section~in~head/foot}\hspace*{3.5ex}
							\usebeamertemplate{section~in~head/foot}
						\end{beamercolorbox}
					}{}
				}
			}{
				% \setbeamertemplate{headline}[default/\prop_item:Nn \l__gotham_template_name_prop {headline/default}]
				\__gotham_set_template:nn{headline}{default/gotham~section}
			}
			% \tl_if_eq:VnTF \l__gotham_out_tmp_mfnposi_tl {frametitle} {
			% 	% True: nothing to do it is already occupied.
			% }{
				\setbeamertemplate{frametitle}[default/\prop_item:Nn \l__gotham_template_name_prop {frametitle/default}]
			% }
			\tl_if_eq:VnTF \l__gotham_out_tmp_mfnposi_tl {foot} {
				% True: nothing to do it is already occupied.
			}{
				\setbeamertemplate{footline}[default/\prop_item:Nn \l__gotham_template_name_prop {footline/default}]
			}
			\tl_if_eq:VnTF \l__gotham_out_tmp_mfnposi_tl {left} {
				% True: nothing to do it is already occupied.
			}{
				\setbeamertemplate{sidebar~left}[default/\prop_item:Nn \l__gotham_template_name_prop {sidebar~left/default}]
			}
			\tl_if_eq:VnTF \l__gotham_out_tmp_mfnposi_tl {right} {
				% True: nothing to do it is already occupied.
			}{
				\setbeamertemplate{sidebar~right}[default/\prop_item:Nn \l__gotham_template_name_prop {sidebar~right/default}]
			}
		}
	},
	progressbar~position / left .code:n = {
		\tl_if_eq:VnTF \l__gotham_out_tmp_pbar_tl {left} {
			% True: nothing to do it is already done.
		} {
			% False : remember that choice in order to do not apply it several time and add to beamer template.
			\tl_set:Nn \l__gotham_out_tmp_pbar_tl {left}

			\tl_if_eq:VnTF \l__gotham_out_tmp_mfnposi_tl {head} {
				% True: nothing to do it is already occupied.
			}{
				\setbeamertemplate{headline}[default/\prop_item:Nn \l__gotham_template_name_prop {headline/default}]
			}
			% \tl_if_eq:VnTF \l__gotham_out_tmp_mfnposi_tl {frametitle} {
			% 	% True: nothing to do it is already occupied.
			% }{
				\setbeamertemplate{frametitle}[default/\prop_item:Nn \l__gotham_template_name_prop {frametitle/default}]
			% }
			\tl_if_eq:VnTF \l__gotham_out_tmp_mfnposi_tl {foot} {
				% True: nothing to do it is already occupied.
			}{
				\setbeamertemplate{footline}[default/\prop_item:Nn \l__gotham_template_name_prop {footline/default}]
			}
			\tl_if_eq:VnTF \l__gotham_out_tmp_mfnposi_tl {left} {
				% True: nothing to do it is already occupied.
			}{
				\setbeamertemplate{sidebar~left}[default/\prop_item:Nn \l__gotham_template_name_prop {sidebar~left/default}]
			}
			\tl_if_eq:VnTF \l__gotham_out_tmp_mfnposi_tl {right} {
				% True: nothing to do it is already occupied.
			}{
				\setbeamertemplate{sidebar~right}[default/\prop_item:Nn \l__gotham_template_name_prop {sidebar~right/default}]
			}

			%
			\addtobeamertemplate{sidebar~left}{}{
				\tl_if_eq:VnTF \l__gotham_out_tmp_pbar_tl {left} {
					\usebeamertemplate*{progress~bar~in~left}
				}{}
			}
		}
	},
	progressbar~position / right .code:n = {
		\tl_if_eq:VnTF \l__gotham_out_tmp_pbar_tl {right} {
			% True: nothing to do it is already done.
		} {
			% False : remember that choice in order to do not apply it several time and add to beamer template.
			\tl_set:Nn \l__gotham_out_tmp_pbar_tl {right}

			\tl_if_eq:VnTF \l__gotham_out_tmp_mfnposi_tl {head} {
				% True: nothing to do it is already occupied.
			}{
				\setbeamertemplate{headline}[default/\prop_item:Nn \l__gotham_template_name_prop {headline/default}]
			}
			% \tl_if_eq:VnTF \l__gotham_out_tmp_mfnposi_tl {frametitle} {
			% 	% True: nothing to do it is already occupied.
			% }{
				\setbeamertemplate{frametitle}[default/\prop_item:Nn \l__gotham_template_name_prop {frametitle/default}]
			% }
			\tl_if_eq:VnTF \l__gotham_out_tmp_mfnposi_tl {foot} {
				% True: nothing to do it is already occupied.
			}{
				\setbeamertemplate{footline}[default/\prop_item:Nn \l__gotham_template_name_prop {footline/default}]
			}
			\tl_if_eq:VnTF \l__gotham_out_tmp_mfnposi_tl {left} {
				% True: nothing to do it is already occupied.
			}{
				\setbeamertemplate{sidebar~left}[default/\prop_item:Nn \l__gotham_template_name_prop {sidebar~left/default}]
			}
			\tl_if_eq:VnTF \l__gotham_out_tmp_mfnposi_tl {right} {
				% True: nothing to do it is already occupied.
			}{
				\setbeamertemplate{sidebar~right}[default/\prop_item:Nn \l__gotham_template_name_prop {sidebar~right/default}]
			}

			%
			\addtobeamertemplate{sidebar~right}{}{
				\tl_if_eq:VnTF \l__gotham_out_tmp_pbar_tl {right} {
					\usebeamertemplate*{progress~bar~in~right}
				}{}
			}
		}
	},

	progressbar~position / unknown .code:n = { \PackageWarning{ gotham } { The~choice~'#1'~is~unknown~for~the~(known)~option~'progressbar~position',~so~being~ignored. }{helping~message: progressbar~position / unknown} },
}
%    \end{macrocode}
%   \end{macro}
% \end{implementation}

% \begin{documentation}
% \begin{function}{\useoutertheme}
%	\begin{syntax}
%		\cs{useoutertheme}\oarg{option1=value1, ...}\marg{gotham}
%		\textrm{where the options are (default marked as} \defopt{default}\textrm{):}
%     \meta{progressbar style} = \oarg{\defopt{rectangle} \textbar rounded box \textbar moving circle \textbar fixed circle }
%	\end{syntax}
%	The 'package' (useoutertheme) options can control |progress bar style|  templates that .
% \end{function}
% \end{documentation}
%%%%
% \begin{implementation}
% 	\begin{macro}{outer key -- interface}
% 		Controls the outer settings for progress bar style.
% 		\UnitTested
% 		\TestFiles{gotham-test-049}
%    \begin{macrocode}
% token list to remember what is the current state
\keys_define:nn { gotham / outer }{
	% progressbar~style default
	progressbar~style .choice:,
	progressbar~style .usage:n = { general },
	progressbar~style .default:n = { rectangle },

	progressbar~style / rectangle .code:n = {
		%
		% \defbeamertemplate*{progress~bar~in~head/foot}{gotham~rectangle}
		\__gotham_set_template:nn{progress~bar~in~head/foot}{gotham~rectangle}
		\__gotham_set_template:nn{progress~bar~in~left}{gotham~rectangle}
		\__gotham_set_template:nn{progress~bar~in~right}{gotham~rectangle}
	},

	progressbar~style / rounded~box .code:n = {
		%
		\__gotham_set_template:nn{progress~bar~in~head/foot}{gotham~rounded~box}
		\__gotham_set_template:nn{progress~bar~in~left}{gotham~rounded~box}
		\__gotham_set_template:nn{progress~bar~in~right}{gotham~rounded~box}
	},

	progressbar~style / moving~circle .code:n = {
		%
		\bool_set_true:N \l_gotham_ProgCircleMoving_bool
	},

	progressbar~style / fixed~circle .code:n = {
		%
		\bool_set_false:N \l_gotham_ProgCircleMoving_bool
	},

	progressbar~style / unknown .code:n = { \PackageWarning{ gotham } { The~choice~'#1'~is~unknown~for~the~(known)~option~'progressbar~style',~so~being~ignored. }{helping~message: progressbar~style / unknown} },
}
%    \end{macrocode}
%   \end{macro}
% \end{implementation}

% \begin{documentation}
% \begin{function}{\useoutertheme}
%	\begin{syntax}
%		\cs{useoutertheme}\oarg{option1=value1, ...}\marg{gotham}
%		\textrm{where the options are (default marked as} \defopt{default}\textrm{):}
%     \meta{progressbar~advancement} = \oarg{\defopt{tlbr} \textbar brlt }
%	\end{syntax}
%	The 'package' (useoutertheme) options can control |progress bar| advandement: tlbr) from top left corner to the bottom and right or brlt) from the bottom right to the left and top.
% \end{function}
% \end{documentation}
%%%%
% \begin{implementation}
% 	\begin{macro}{outer key -- interface}
% 		Controls the outer settings for progress bar style.
% 		\UnitTested
% 		\TestFiles{gotham-test-049}
%    \begin{macrocode}
% token list to remember what is the current state
\keys_define:nn { gotham / outer }{
	% progressbar~advancement default
	progressbar~advancement .choice:,
	progressbar~advancement .usage:n = { general },
	progressbar~advancement .default:n = { tlbr },

	progressbar~advancement / tlbr .code:n = {
		%
		\bool_set_true:N \l_gotham_progbar_advancement_tlbr_bool
	},
	progressbar~advancement / TLBR .code:n = {
		%
		\bool_set_true:N \l_gotham_progbar_advancement_tlbr_bool
	},

	progressbar~advancement / brlt .code:n = {
		%
		\bool_set_false:N \l_gotham_progbar_advancement_tlbr_bool
	},
	progressbar~advancement / BRLT .code:n = {
		%
		\bool_set_false:N \l_gotham_progbar_advancement_tlbr_bool
	},

	progressbar~advancement / unknown .code:n = { \PackageWarning{ gotham } { The~choice~'#1'~is~unknown~for~the~(known)~option~'progressbar~advancement',~so~being~ignored. }{helping~message: progressbar~advancement / unknown} },
}
%    \end{macrocode}
%   \end{macro}
% \end{implementation}

% \begin{documentation}
% \begin{function}{\useoutertheme}
%	\begin{syntax}
%		\cs{useoutertheme}\oarg{option1=value1, ...}\marg{gotham}
%		\textrm{where the options are (default marked as} \defopt{default}\textrm{):}
%     \meta{progressbar mfn} = \oarg{\defopt{off} \textbar on }
%	\end{syntax}
%	The 'package' (useoutertheme) options can control if the progress bar includes a miniframe navigation.
% \end{function}
% \end{documentation}
%%%%
% \begin{implementation}
% 	\begin{macro}{outer key -- interface}
% 		Controls the outer settings for progress bar style.
% 		\UnitTested
% 		\TestFiles{gotham-test-049}
%    \begin{macrocode}
% token list to remember what is the current state
\keys_define:nn { gotham / outer }{
	% progressbar~mfn default
	progressbar~mfn .choice:,
	progressbar~mfn .usage:n = { general },
	progressbar~mfn .default:n = { off },

	progressbar~mfn / true .code:n = {
		\bool_set_true:N \l_gotham_pmfn_bool

		\__gotham_set_template:nn{section~in~head/foot~shaded}{default/empty}
		\__gotham_set_template:nn{section~in~head/foot}{default/empty}
		\renewcommand{\gothamPatchSectionbox}{
			% patch to set section box height to 0.
			\ht\beamer@sectionbox=0.ex
			\dp\beamer@sectionbox=0.ex
		}
	},
	progressbar~mfn / on .code:n = {
		\bool_set_true:N \l_gotham_pmfn_bool

		\__gotham_set_template:nn{section~in~head/foot~shaded}{default/empty}
		\__gotham_set_template:nn{section~in~head/foot}{default/empty}
		\renewcommand{\gothamPatchSectionbox}{
			% patch to set section box height to 0.
			\ht\beamer@sectionbox=0.ex
			\dp\beamer@sectionbox=0.ex
		}
	},
	progressbar~mfn / enable .code:n = {
		\bool_set_true:N \l_gotham_pmfn_bool

		\__gotham_set_template:nn{section~in~head/foot~shaded}{default/empty}
		\__gotham_set_template:nn{section~in~head/foot}{default/empty}
		\renewcommand{\gothamPatchSectionbox}{
			% patch to set section box height to 0.
			\ht\beamer@sectionbox=0.ex
			\dp\beamer@sectionbox=0.ex
		}
	},

	progressbar~mfn / false .code:n = { \bool_set_false:N \l_gotham_pmfn_bool },
	progressbar~mfn / off .code:n = { \bool_set_false:N \l_gotham_pmfn_bool },
	progressbar~mfn / disable .code:n = { \bool_set_false:N \l_gotham_pmfn_bool },

	progressbar~mfn / unknown .code:n = { \PackageWarning{ gotham } { The~choice~'#1'~is~unknown~for~the~(known)~option~'progressbar~mfn',~so~being~ignored. }{helping~message: progressbar~mfn / unknown} },
}
%    \end{macrocode}
%   \end{macro}
% \end{implementation}


%%%%%%%%%%%%%%%%%%%%%%%%%%%%

% \begin{implementation}
% 	\begin{macro}{Default outer keys}
%		Apply default key options.
% 		\UnitTested
% 		\TestFiles{gotham-test-048}
%    \begin{macrocode}
% when no value is given, default is called.
\keys_set:nn { gotham / outer } {
	sidebar~canvas~right~template, sidebar~canvas~left~template,
	edging~default,
	frametitle~template, framesubtitle~template, frametitle~continuation~template,
	numbering,
	rotateFooter~default,
	footer~template,
	mini~frames~shape, mini~frames~bundle,
	mini~frames~compress,
	mini~frames~nav~spreading,
	mini~frames~nav~sectioning,
	mini~frames~nav~position,
	progressbar~position, progressbar~style, progressbar~advancement, progressbar~mfn,
}
%    \end{macrocode}
% \end{macro}
% \end{implementation}

% \begin{implementation}
% 	\begin{macro}{Process outer keys}
%		Process package options.
% 		\UnitTested
% 		\TestFiles{gotham-test-048}
%    \begin{macrocode}
\ProcessKeyOptions[ gotham / outer ]
% \mode<all>
%    \end{macrocode}
% \end{macro}
% \end{implementation}

%
%
% \begin{implementation}
%    \begin{macrocode}
%\endinput
%</outer>
%    \end{macrocode}
% \end{implementation}
%
% ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
%
%
%\begin{implementation}
%    \begin{macrocode}
%<*package>
\RequirePackage{expl3}
% \RequirePackage{ifxetex}
% \RequirePackage{ifluatex}
% \RequirePackage{etoolbox}
% \RequirePackage{xcolor}
% \RequirePackage{tikz}
% \RequirePackage{calc} % I think I can remove it with a bit of work
% \RequirePackage{xfp}
%    \end{macrocode}
% \end{implementation}
%
% \begin{implementation}
%    \begin{macrocode}
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%%%%%%%%%%%%   PACKAGE   %%%%%%%%%%%%%
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%
%
%    \end{macrocode}
% \end{implementation}
%
% Most options are passed off to the component sub-packages.
% \begin{implementation}
%    \begin{macrocode}

%
\usefonttheme{gotham}
\usecolortheme{gotham}
\useinnertheme{gotham}
\useoutertheme{gotham}
%
%
%

%%%%%  Setting keys  %%%%%

% set new counter for how many time the lookup is used
\int_new:N \l_gotham_lookup_cnt
\int_set:Nn \l_gotham_lookup_cnt {0}

\seq_const_from_clist:Nn \c__gotham_load_submodules_seq { font, color, inner, outer }

\cs_new_protected:Npn \__gotham_lookup_keymodules:nn #1#2
{
	\int_incr:N \l_gotham_lookup_cnt
	% \int_show:n \l_gotham_lookup_cnt

	% if lookup counter is lower than the number of submodules-1 [before it was +1, not completely clear to me], do nothing (let the other submodules do their job), otherwise lookup in the submodules
	\if_int_compare:w \l_gotham_lookup_cnt < 2
		%true : do nothing
	\else:
		% \int_show:n \l_gotham_lookup_cnt
		\seq_map_inline:Nn \c__gotham_load_submodules_seq
		{
			\keys_if_exist:nnT { gotham / ##1 } {#1}
			{
				% missing feature in l3keys, we have no better way to detect an omitted value, so we have to guess that all empty values are in fact omitted values.
				\tl_if_empty:nTF {#2}
				{ \keys_set:nn { gotham / ##1 } { #1 } }
				{ \keys_set:nn { gotham / ##1 } { #1 = {#2} } }
				\prg_break:
			}
		}
		\msg_error:nnn { gotham } { unknown-key } {#1}
		\prg_break_point:
	\fi:
}
\cs_generate_variant:Nn \__gotham_lookup_keymodules:nn { Vn }
\msg_new:nnn { gotham } { unknown-key } { Unknown~ key~ #1~ encountered. }

% Property list for all groups.
\prop_new:N \l__gotham_all_all_user_keys_prop
\prop_const_from_keyval:Nn \c__gotham_all_pkg_keys_prop {}

\keys_define:nn { gotham / all / all }
{
	unknown .code:n =
	{\__gotham_lookup_keymodules:Vn \l_keys_key_str {#1}}
}

% Set default keys/options from keyval
% \__gotham_set_default_from_keyval: variant, keyval, group command
\cs_new_protected:Npn \__gotham_set_default_from_keyval:nnn #1 #2 #3
{	%%
	% Check if keyvalues have been given.
	\tl_if_novalue:nTF {#2}
	{ % no user keys given so _user_keys_prop is taking pkg prop
		\prop_set_eq:cc { l__gotham_#3_#1_user_keys_prop } { c__gotham_#3_pkg_keys_prop }
	}{ % user key given and put it in prop
		\prop_put_from_keyval:cn { l__gotham_#3_#1_user_keys_prop } {#2}
	}% end if
	%
	% xx
	\__gotham_set_default_auxi:cnn { l__gotham_#3_#1_user_keys_prop } {#1} {#3}
	%
	% xx
	\keys_set:nn { gotham/#3/#1 } { default }
}
%
% prop-key-val, variant, group command
\cs_new_protected:Npn \__gotham_set_default_auxi:Nnn #1 #2 #3
{
	\__gotham_set_default_auxii:fnn { \prop_to_keyval:N #1 } {#2} {#3}
}
\cs_generate_variant:Nn \__gotham_set_default_auxi:Nnn { c }
%
% key-val, variant, group command
\cs_new_protected:Npn \__gotham_set_default_auxii:nnn #1 #2 #3
{
	\keys_define:nn { gotham/#3/#2 } { default .meta:n = {#1} }
}
\cs_generate_variant:Nn \__gotham_set_default_auxii:nnn { f }
%
%
% (re)set keys/options by default for a group of commands.
% \gothamset m:options:#1
\DeclareDocumentCommand{\gothamset}{ m }
{
	\__gotham_set_default_from_keyval:nnn { all } {#1} { all }
	\keys_set:nn { gotham/all/all } { default }
}

\def\gotham@plaintitleformat#1{#1}
\providecommand{\mreducelistspacing}{\vspace{-\topsep}}

\ProcessOptionsBeamer
\keys_define:nn { gotham / font }
{
	unknown .code:n =
	{\__gotham_lookup_keymodules:Vn \l_keys_key_str {#1}}
}
\keys_define:nn { gotham / color }
{
	unknown .code:n =
	{\__gotham_lookup_keymodules:Vn \l_keys_key_str {#1}}
}
\keys_define:nn { gotham / inner }
{
	unknown .code:n =
	{\__gotham_lookup_keymodules:Vn \l_keys_key_str {#1}}
}
\keys_define:nn { gotham / outer }
{
	unknown .code:n =
	{\__gotham_lookup_keymodules:Vn \l_keys_key_str {#1}}
}

\ProcessKeyOptions[ gotham / font ]
\ProcessKeyOptions[ gotham / color ]
\ProcessKeyOptions[ gotham / inner ]
\ProcessKeyOptions[ gotham / outer ]

%
%    \end{macrocode}
% \end{implementation}

% \begin{documentation}
%   \begin{function}{\gothamreset}
%     \begin{syntax}
%       \cs{gothamreset}
%     \end{syntax}
%     Command to reset gotham to default. Mainly useful when other theme have left some definitions.
%   \end{function}
% \end{documentation}
%%%%%%
% \begin{implementation}
%   \begin{function}{\gothamreset}
%     \begin{arguments}
%       \item |height| of the picture
%     \end{arguments}
%     Command to be redefined by users.
%     \TestFiles{gotham-test-046b}
%    \begin{macrocode}
\DeclareDocumentCommand{\gothamreset}{m}{
	% commands
	\renewcommand{\gothamInstituteLogoSquare}[1][4ex]{ }
	\renewcommand{\gothamInstituteLogoCircle}[1][4ex]{ }
	\renewcommand{\gothamHookPostColorBGSet}{
		\colorlet{colorStandout}{colorA}
		\colorlet{colorFrametitle}{colorA}
		\colorlet{colorProgBar}{colorC}
		\setbeamercolor{frametitle}{
			use=primary~palette,
			parent=primary~palette,
			bg=colorFrametitle,
			fg=colorBG
		}
		\setbeamercolor{standout}{bg=colorStandout, fg=colorPale}
	}
	\renewcommand{\gothamtitlepagelogo}{}
	\renewcommand{\gothamtitlepagebg}{}
	\renewcommand{\gothamRightFiligrane}{}
	\renewcommand{\gothamLeftFiligrane}{}
	\renewcommand{\gothamHookFooter}{}

	% lengths
	\setlength{\gothamProgressSectionHeight}{3pt}
	\setlength{\sectionhoffset}{0pt}
	\setlength{\sidebarRightHOffset}{-2.5ex}
	\setlength{\sidebarLeftHOffset}{+0.5ex}
	\setlength{\gothamFrametitleToppading}{2.2ex}
	\setlength{\gothamFrametitleBottompading}{2.2ex}
	\setlength{\gothamFrametitleLeftpading}{2.2ex}
	\setlength{\gothamFrametitleRightpading}{2.2ex}
	\setlength{\gothamFramesubtitleStrutend}{0pt}
	\setlength{\gothamFootlineVOffset}{-0.5ex}
	\setlength{\gothamFootlineDepth}{0.1ex}
	\setlength{\gothamFootlineHeight}{1.5ex}
	\setlength{\gothamFootlineHRightOffset}{\spaceskip}
	\setlength{\gothamHposLeftRotFooter}{-7pt}
	\setlength{\gothamHposRightRotFooter}{2pt}
	\setlength{\gothamVposLeftRotFooter}{15pt}
	\setlength{\gothamVposRightRotFooter}{15pt}
	\setlength{\gothamLeftFooterPadding}{2.0ex}
	\setlength{\gothamRightFooterPadding}{3.5ex}
	\setlength{\gothamFooterHOffset}{0pt}
	\setlength{\gothamFootlineRuleLeftPadding}{7mm}
	\setlength{\gothamFootlineRuleHeight}{0.0pt}
	\setlength{\gothamFootlineRuleLength}{15mm}
	\setlength{\gothamProgressCircHeight}{1.8\baselineskip}
	\setlength{\gothamCounterCircleRadius}{1.12ex}
	\setlength{\gothamProgressCircBorderWidth}{1.65mm}
	\setlength{\gothamCircleNumberingVshift}{1.4mm}
	\setlength{\gothamCircleNumberingHshift}{2.6mm}
	\setlength{\gothamProgressHeadFootLineheight}{1.2ex}

	% options to default
	\keys_set:nn { gotham/all/all } { default }
}
%    \end{macrocode}
%   \end{function}
% \end{implementation}

% \begin{implementation}
%    \begin{macrocode}
%\endinput
%</package>
%    \end{macrocode}
% \end{implementation}
%
%
\endinput
%
% \Finale
