%% Package `edmaths' v1.0.0
%% File beamerthemeedmaths.sty
%% Copyright 2025 Josh Fogg
%%
%% beamerthemeedmaths.sty is a LaTeX style file for typesetting presentations
%% for the School of Mathematics at the University of Edinburgh, part of the
%% more general `edmaths' package. See README.md for usage instructions.
%%
%% This work may be distributed and/or modified under the conditions of the
%% LaTeX Project Public License, either version 1.3 of this license or (at
%% your option) any later version.
%%
%% The latest version of this license is in http://latex-project.org/lppl.txt
%% and version 1.3 or later is part of all distributions of LaTeX version
%% 2005/12/01 or later.
%% 
%% This work has the LPPL maintenance status `maintained' and the current
%% maintainer of this work is Josh Fogg. Originally written by Saturnino Luz
%% for the Usher Institute and made generic to UoE by Ben Brown.
%%
%% This work consists of the files beamerthemeedmaths.sty, but in addition
%% requires images `white-tied-in' and `edinburgh-logo' to compile. The images
%% distributed with this work in the `edmaths' package are registered trademarks;
%% they are not to be used as part of derived or independent works without the
%% permission of The University of Edinburgh. This does not affect use as part
%% of compiled LaTeX documents using this style for the university.

\ProvidesPackage{beamerthemeedmaths}[2025-09-03 Edinburgh maths beamer theme v1.0.0]
\RequirePackage{amsfonts,graphicx,lmodern,mathptmx}

% Colour definitions to choose between
\definecolor{UoEblue}{RGB}{0,50,95}           % #00325F
\definecolor{UoEcyan}{RGB}{69, 126, 129}      % #457E81
\definecolor{UoEgreen}{RGB}{156, 154, 0}      % #9C9A00
\definecolor{UoEgray}{RGB}{.392, .329, .329}  % VARIES
\definecolor{UoEorange}{RGB}{204, 89, 17}     % #CC5911

% Define colour command for use through rest of theme
\newcommand{\beamer@UoE@color}{UoEblue}
\DeclareOptionBeamer{colour}{\def\beamer@UoE@color{#1}}

% Change title height to fit styling
\newdimen\beamer@UoE@titleheight
\beamer@UoE@titleheight=10ex
\DeclareOptionBeamer{theight}{\beamer@UoE@titleheight=#1}

% Resolution is 9:5 (approx), as in ppt template
\geometry{paperwidth=25.40cm, paperheight=19.05cm}

\ProcessOptionsBeamer

\newcommand\crule[3][\beamer@UoE@color]{\textcolor{#1}{\rule{#2}{#3}}}

\setbeamerfont{title}{series=\bfseries,size=\fontsize{32}{36}}%
\setbeamerfont{subtitle}{size=\fontsize{24}{28}}
\setbeamerfont{author}{size={\fontsize{20}{24}}}
\setbeamerfont{institute}{size=\fontsize{22}{26}}
\setbeamerfont{pagexofy}{size=\tiny}
\setbeamerfont{caption}{size=\Large}
\setbeamerfont{frametitle}{family=\sffamily,series=\bfseries,size={\fontsize{23}{26}}}
\setbeamerfont{itemize item}{family=\sffamily,size={\fontsize{16}{18}}}
\setbeamerfont{itemize subitem}{family=\sffamily,size={\fontsize{16}{18}}}
\setbeamertemplate{itemize/enumerate body begin}{\fontsize{16}{19}\selectfont}
\setbeamertemplate{itemize/enumerate subbody begin}{\fontsize{16}{19}\selectfont}
\AtBeginDocument{\fontsize{18}{19}\selectfont}

%\setbeamertemplate{items}[ball]
\setbeamertemplate{navigation symbols}{}
\pgfdeclareimage[width=14.69cm]{white-tied-in}{images/white-tied-in}
\pgfdeclareimage[width=4.65cm]{edinburgh-logo}{images/edinburgh-logo}
\pgfdeclareimage[width=1.25cm]{little=u}{images/edinburgh-logo}
\setbeamerfont{alerted text}{series=\bfseries}
\setbeamercolor{alerted text}{fg=\beamer@UoE@color!80!black}
\setbeamercolor{title}{fg=black}
\setbeamercolor{normal text}{fg=black}
\setbeamertemplate{itemize item}{\color{\beamer@UoE@color}$\bullet$}
\setbeamertemplate{itemize subitem}{\color{\beamer@UoE@color}$\circ$}


\newcommand{\SetUoETitleMargin}[1]{\beamer@UoE@titleheight=#1}
\newcommand{\SetUoETitleHeight}[1]{\beamer@UoE@titleheight=#1}


\newlength\barheight\setlength\barheight{\paperheight}
\divide\barheight by 12


\setbeamertemplate{title page}{
    \raggedright
    % TITLE
    {\usebeamerfont{title}\textcolor{white}\inserttitle\par~}
    % SUBTITLE
    \ifx\insertsubtitle\@empty
    \else%
        \\[1ex]
        {\usebeamerfont{subtitle}\textcolor{white}\insertsubtitle}
    \fi
    \\[6ex]
    % AUTHOR
    {\usebeamerfont{author}\textcolor{white}\insertauthor}
    \ifx\insertinstitute\@empty
    \else%
        \\[3ex]
        {\\\usebeamerfont{institute}\textcolor{white}\insertinstitute}
    \fi
    % DATE
    \ifx\insertdate\empty
    \else%
        \\[1ex]
        \usebeamerfont{date}\textcolor{white}{\insertdate}
    \fi
}


\setbeamertemplate{background}{
    \setlength{\unitlength}{1cm}
    \begin{picture}(25.4,19.05)(0,0)
        % on first slide add UoE text logo across bottom left
        \ifnum\c@framenumber=1%
            \put(-.1, 0){\crule[\beamer@UoE@color]{25.4cm}{19.05cm}}
            \put(0.44, 0.1){\pgfuseimage{white-tied-in}}
        % on ever other slide add UoE logo at top of blue sidebar
        \else%
            \put(23.5, 0){\crule[\beamer@UoE@color]{1.80cm}{19.05cm}}
            \put(23.65, 17.3){\includegraphics[width=1.45cm,height=1.45cm]{images/edinburgh-logo}}
        \fi%
        % add slide numbering to bottom right
        \ifnum\c@framenumber<10%
            \put(23.7,0.3){\centering\Large\color{white}{\phantom{0}\insertframenumber/\inserttotalframenumber}}
        \else
            \put(23.7,0.3){\centering\Large\color{white}{\insertframenumber/\inserttotalframenumber}}
        \fi%
   \end{picture}
}


% Default slide formatting
\setbeamertemplate{frametitle}{
    % if not the starting fram, add a top margin
    \ifnum\c@framenumber=1%
        \empty%
    \else
        \vspace*{\beamer@UoE@titleheight}
    \fi
    % use the title colour from this class
    \usebeamercolor[fg]{title}
    % handle situation where there's no subtitle
    \ifx\insertframesubtitle\@empty
        \usebeamerfont{frametitle}{\insertframetitle}
    \else
        \usebeamerfont{frametitle}{\insertframetitle:~{\normalfont\insertframesubtitle}}
    \fi
    % ensures spacing after the title
    \vspace*{1em}
}

%\newcommand{\UoEsettitleheight}[1]{\makeatletter\beamer@UoE@titleheight=#1\makeatother}
\setbeamersize{text margin left=2cm,text margin right=2.5cm}

% Ensures images are compressed when brought in by PDF
\pdfcompresslevel=9
\pdfobjcompresslevel=3

%%% Local Variables:
%%% mode: latex
%%% TeX-master: "sample"
%%% End:
