% Copyright 2007 by Till Tantau
% Copyright 2012--2015 by Vedran Mileti\'c, Joseph Wright
% Copyright 2017,2018 by Louis Stuart, Joseph Wright
%
% This file may be distributed and/or modified
%
% 1. under the LaTeX Project Public License and/or
% 2. under the GNU Public License.
%
% See the file doc/licenses/LICENSE for more details.

\mode<presentation>

% Some images:

\pgfdeclareimage[width=14pt,height=12pt]{beamericonbook}{beamericonbook}
\pgfdeclareimage[width=14pt,height=12pt]{beamericonbookshaded}{beamericonbook.20}
\pgfaliasimage{beamericonbook.!20opaque}{beamericonbookshaded}
\pgfaliasimage{beamericonbook.!15opaque}{beamericonbookshaded}
\pgfaliasimage{beamericonbook.!10opaque}{beamericonbookshaded}
\pgfaliasimage{beamericonbook.!5opaque}{beamericonbookshaded}
\pgfaliasimage{beamericonbook.!2opaque}{beamericonbookshaded}
\pgfdeclareimage[width=11pt,height=14pt]{beamericonarticle}{beamericonarticle}
\pgfdeclareimage[width=11pt,height=14pt]{beamericonarticleshaded}{beamericonarticle.20}
\pgfaliasimage{beamericonarticle.!20opaque}{beamericonarticleshaded}
\pgfaliasimage{beamericonarticle.!15opaque}{beamericonarticleshaded}
\pgfaliasimage{beamericonarticle.!10opaque}{beamericonarticleshaded}
\pgfaliasimage{beamericonarticle.!5opaque}{beamericonarticleshaded}
\pgfaliasimage{beamericonarticle.!2opaque}{beamericonarticleshaded}
\pgfdeclareimage[width=14pt,height=14pt]{beamericononline}{beamericononline}
\pgfdeclareimage[width=14pt,height=14pt]{beamericononlineshaded}{beamericononline.20}
\pgfaliasimage{beamericononline.!20opaque}{beamericononlineshaded}
\pgfaliasimage{beamericononline.!15opaque}{beamericononlineshaded}
\pgfaliasimage{beamericononline.!10opaque}{beamericononlineshaded}
\pgfaliasimage{beamericononline.!5opaque}{beamericononlineshaded}
\pgfaliasimage{beamericononline.!2opaque}{beamericononlineshaded}

% Title page: default

\defbeamertemplate*{title page}{default}[1][]
{
  \vbox{}
  \vfill
  \begingroup
    \centering
    \begin{beamercolorbox}[sep=8pt,center,#1]{title}
      \usebeamerfont{title}\inserttitle\par%
      \ifx\insertsubtitle\@empty%
      \else%
        \vskip0.25em%
        {\usebeamerfont{subtitle}\usebeamercolor[fg]{subtitle}\insertsubtitle\par}%
      \fi%     
    \end{beamercolorbox}%
    \vskip1em\par
    \begin{beamercolorbox}[sep=8pt,center,#1]{author}
      \usebeamerfont{author}\insertauthor
    \end{beamercolorbox}
    \begin{beamercolorbox}[sep=8pt,center,#1]{institute}
      \usebeamerfont{institute}\insertinstitute
    \end{beamercolorbox}
    \begin{beamercolorbox}[sep=8pt,center,#1]{date}
      \usebeamerfont{date}\insertdate
    \end{beamercolorbox}\vskip0.5em
    {\usebeamercolor[fg]{titlegraphic}\inserttitlegraphic\par}
  \endgroup
  \vfill
}


% Part page: default

\defbeamertemplate*{part page}{default}[1][]
{
  \begingroup
    \centering
    {\usebeamerfont{part name}\usebeamercolor[fg]{part name}\partname~\insertromanpartnumber}
    \vskip1em\par
    \begin{beamercolorbox}[sep=16pt,center,#1]{part title}
      \usebeamerfont{part title}\insertpart\par
    \end{beamercolorbox}
  \endgroup
}


% Section page: default

\defbeamertemplate*{section page}{default}[1][]
{
  \begingroup
    \centering
    {\usebeamerfont{section name}\usebeamercolor[fg]{section name}\sectionname~\insertsectionnumber}
    \vskip1em\par
    \begin{beamercolorbox}[sep=12pt,center,#1]{section title}
      \usebeamerfont{section title}\insertsection\par
    \end{beamercolorbox}
  \endgroup
}

% Subection page: default

\defbeamertemplate*{subsection page}{default}[1][]
{
  \begingroup
    \centering
    {\usebeamerfont{subsection name}\usebeamercolor[fg]{subsection name}\subsectionname~\insertsubsectionnumber}
    \vskip1em\par
    \begin{beamercolorbox}[sep=8pt,center,#1]{subsection title}
      \usebeamerfont{subsection title}\insertsubsection\par
    \end{beamercolorbox}
  \endgroup
}




%
% Table of contents
%

\defbeamertemplateparent{sections/subsections in toc}{section in toc,subsection in toc,subsubsection in toc}
{}

\defbeamertemplateparent{sections/subsections in toc shaded}{section in toc shaded,subsection in toc shaded,subsubsection in toc shaded}[1][20]
{[#1]}




% (sub-)section in toc: default

\defbeamertemplate*{section in toc}{default}
{\inserttocsection\par}

\defbeamertemplate*{subsection in toc}{default}
{\leavevmode\leftskip=1.5em\inserttocsubsection\par}

\defbeamertemplate*{subsubsection in toc}{default}
{\leavevmode\normalsize\usebeamerfont{subsection in toc}\leftskip=3em%
  \usebeamerfont{subsubsection in toc}\inserttocsubsubsection\par}


% (sub-)section in toc shaded, default

\defbeamertemplate*{section in toc shaded}{default}[1][20]
{\begin{colormixin}{#1!parent.bg}\usebeamertemplate{section in toc}\end{colormixin}\unskip}

\defbeamertemplate*{subsection in toc shaded}{default}[1][20]
{\begin{colormixin}{#1!parent.bg}\usebeamertemplate{subsection in toc}\end{colormixin}\unskip}

\defbeamertemplate*{subsubsection in toc shaded}{default}[1][20]
{\begin{colormixin}{#1!parent.bg}\usebeamertemplate{subsubsection in toc}\end{colormixin}\unskip}





%
% Item
%

\defbeamertemplateparent{items}{itemize items,enumerate items}
{}


% Itemize items

\defbeamertemplateparent{itemize items}{itemize item,itemize subitem,itemize subsubitem}
{}


% Itemize items, default

\defbeamertemplate*{itemize item}{default}{\usebeamerfont*{itemize item}\raise1.25pt\hbox{\donotcoloroutermaths$\blacktriangleright$}}
\defbeamertemplate*{itemize subitem}{default}{\usebeamerfont*{itemize subitem}\raise1.5pt\hbox{\donotcoloroutermaths$\blacktriangleright$}}
\defbeamertemplate*{itemize subsubitem}{default}{\usebeamerfont*{itemize subsubitem}\raise1.5pt\hbox{\donotcoloroutermaths$\blacktriangleright$}}


% Enumerate items, default

\defbeamertemplateparent{enumerate items}{enumerate item,enumerate subitem,enumerate subsubitem,enumerate mini template}
{}

\defbeamertemplate*{enumerate item}{default}{\insertenumlabel.}
\defbeamertemplate*{enumerate subitem}{default}{\insertenumlabel.\insertsubenumlabel}
\defbeamertemplate*{enumerate subsubitem}{default}{\insertenumlabel.\insertsubenumlabel.\insertsubsubenumlabel}
\defbeamertemplate*{enumerate mini template}{default}{\insertenumlabel}


% Description item, default

\defbeamertemplate*{description item}{default}{\insertdescriptionitem}


% Itemize/Enumerate body

\defbeamertemplate*{itemize/enumerate body begin}{default}{}
\defbeamertemplate*{itemize/enumerate body end}{default}{}

\defbeamertemplate*{itemize/enumerate subbody begin}{default}{}
\defbeamertemplate*{itemize/enumerate subbody end}{default}{}

\defbeamertemplate*{itemize/enumerate subsubbody begin}{default}{}
\defbeamertemplate*{itemize/enumerate subsubbody end}{default}{}

% Description body

\defbeamertemplate*{description body begin}{default}{}
\defbeamertemplate*{description body end}{default}{}


% Alerted text

\defbeamertemplate*{alerted text begin}{default}{\setbeamercolor{local structure}{parent=alerted text}}



% Structured text

% empyt defaults


% Bibliography items

\defbeamertemplate*{bibliography item}{default}
{\lower3.5pt\hbox{\hskip2pt\pgfuseimage{beamericonarticle}\hskip1pt}}

\defbeamertemplate*{bibliography entry article}{default}{}
\defbeamertemplate*{bibliography entry title}{default}{\par}
\defbeamertemplate*{bibliography entry location}{default}{\par}
\defbeamertemplate*{bibliography entry note}{default}{\par}


% Buttons

\newdimen\beamer@dima%
\newdimen\beamer@dimb%

\defbeamertemplate*{button}{default}
{%
  \setbox\beamer@tempbox=\hbox{{\insertbuttontext}}%
  \ht\beamer@tempbox=6pt%
  \dp\beamer@tempbox=0pt%
  \setbox\beamer@tempbox=\vbox{\box\beamer@tempbox\vskip2pt}%
  \beamer@tempdim=\wd\beamer@tempbox%
  \beamer@dima=\beamer@tempdim\advance\beamer@dima by2.2pt
  \beamer@dimb=\beamer@tempdim\advance\beamer@dimb by4pt
  \begin{pgfpicture}{-4pt}{0pt}{\the\beamer@tempdim}{8pt}
    \color{bg}
    \pgfsetlinewidth{0.8pt}
    \pgfpathqmoveto{0pt}{0pt}
    \pgfpathqcurveto{-2.2pt}{0pt}{-4pt}{1.8pt}{-4pt}{4pt}
    \pgfpathqcurveto{-4pt}{6.2pt}{-2.2pt}{8pt}{0pt}{8pt}
    \pgfpathlineto{\pgfpoint{\the\beamer@tempdim}{8pt}}
    \pgfpathcurveto%
    {\pgfpoint{\the\beamer@dima}{8pt}}%
    {\pgfpoint{\the\beamer@dimb}{6.2pt}}%
    {\pgfpoint{\the\beamer@dimb}{4pt}}
    \pgfpathcurveto%
    {\pgfpoint{\the\beamer@dimb}{1.8pt}}%
    {\pgfpoint{\the\beamer@dima}{0pt}}%
    {\pgfpoint{\the\beamer@tempdim}{0pt}}
    \pgfpathclose
    \pgfusepathqfill
    \colorlet{bg}{parent.bg}
    \usebeamercolor[fg]{button border}
    \pgfpathqmoveto{0pt}{0pt}
    \pgfpathqcurveto{-2.2pt}{0pt}{-4pt}{1.8pt}{-4pt}{4pt}
    \pgfpathqcurveto{-4pt}{6.2pt}{-2.2pt}{8pt}{0pt}{8pt}
    \pgfpathlineto{\pgfpoint{\the\beamer@tempdim}{8pt}}
    \pgfpathcurveto%
    {\pgfpoint{\the\beamer@dima}{8pt}}%
    {\pgfpoint{\the\beamer@dimb}{6.2pt}}%
    {\pgfpoint{\the\beamer@dimb}{4pt}}
    \pgfpathcurveto%
    {\pgfpoint{\the\beamer@dimb}{1.8pt}}%
    {\pgfpoint{\the\beamer@dima}{0pt}}%
    {\pgfpoint{\the\beamer@tempdim}{0pt}}
    \pgfpathclose
    \pgfusepathqstroke
  \end{pgfpicture}%
  \hskip-\beamer@tempdim%
  \box\beamer@tempbox%
  \kern4pt%
}


% Abstract

\defbeamertemplate*{abstract title}{default}
{%
  \begin{center}%
    \abstractname
  \end{center}%
}

\defbeamertemplate*{abstract begin}{default}
{\beamercolorbox[vmode]{abstract}\leftskip2em\rightskip2em plus 1fill\usebeamerfont*{abstract}}

\defbeamertemplate*{abstract end}{default}
{\medskip\endbeamercolorbox}


% Verse

\defbeamertemplate*{verse begin}{default}
{\beamercolorbox[vmode]{verse}}

\defbeamertemplate*{verse end}{default}
{\endbeamercolorbox}


% Quotation

\defbeamertemplate*{quotation begin}{default}
{\beamercolorbox[vmode]{quotation}}

\defbeamertemplate*{quotation end}{default}
{\endbeamercolorbox}


% Quote

\defbeamertemplate*{quote begin}{default}
{\beamercolorbox[vmode]{quote}}

\defbeamertemplate*{quote end}{default}
{\endbeamercolorbox}


% Footnotes

\defbeamertemplate*{footnote}{default}
{
  \parindent 1em\noindent%
  \raggedright
  \hbox to 1.8em{\hfil\insertfootnotemark}\insertfootnotetext\par%
}


% Captions

\defbeamertemplate*{caption}{default}
{%
  \raggedright
  {%
    \usebeamercolor[fg]{caption name}%
    \usebeamerfont*{caption name}%
    \insertcaptionname
    \usebeamertemplate{caption label separator}%
  }%
  \insertcaption\par
}
\defbeamertemplate*{caption label separator}{default}{:\ }

% Blocks

\defbeamertemplateparent{blocks}{block begin,block end,%
  block alerted begin,block alerted end,%
  block example begin,block example end}
{}

\defbeamertemplate*{block begin}{default}
{
  \par\vskip\medskipamount%
  \begin{beamercolorbox}[colsep*=.75ex]{block title}
    \usebeamerfont*{block title}\insertblocktitle%
  \end{beamercolorbox}%
  {\parskip0pt\par}%
  \ifbeamercolorempty[bg]{block title}
  {}
  {\ifbeamercolorempty[bg]{block body}{}{\nointerlineskip\vskip-0.5pt}}%
  \usebeamerfont{block body}%
  \begin{beamercolorbox}[colsep*=.75ex,vmode]{block body}%
    \ifbeamercolorempty[bg]{block body}{\vskip-.25ex}{\vskip-.75ex}\vbox{}%
}
\defbeamertemplate*{block end}{default}  
{\end{beamercolorbox}\vskip\smallskipamount}

\defbeamertemplate*{block alerted begin}{default}
{
  \par\vskip\medskipamount%
  \begin{beamercolorbox}[colsep*=.75ex]{block title alerted}
    \usebeamerfont*{block title alerted}\insertblocktitle%
  \end{beamercolorbox}%
  {\parskip0pt\par}%
  \ifbeamercolorempty[bg]{block title alerted}
  {}
  {\ifbeamercolorempty[bg]{block body alerted}{}{\nointerlineskip\vskip-0.5pt}}%
  \usebeamerfont{block body alerted}%
  \begin{beamercolorbox}[colsep*=.75ex,vmode]{block body alerted}%
    \ifbeamercolorempty[bg]{block body alerted}{\vskip-.25ex}{\vskip-.75ex}\vbox{}%
}

\defbeamertemplate*{block alerted end}{default}
{\end{beamercolorbox}\vskip\smallskipamount}


\defbeamertemplate*{block example begin}{default}
{
  \par\vskip\medskipamount%
  \begin{beamercolorbox}[colsep*=.75ex]{block title example}
    \usebeamerfont*{block title example}\insertblocktitle%
  \end{beamercolorbox}%
  {\parskip0pt\par}%
  \ifbeamercolorempty[bg]{block title example}
  {}
  {\ifbeamercolorempty[bg]{block body example}{}{\nointerlineskip\vskip-0.5pt}}%
  \usebeamerfont{block body example}%
  \begin{beamercolorbox}[colsep*=.75ex,vmode]{block body example}%
    \ifbeamercolorempty[bg]{block body example}{\vskip-.25ex}{\vskip-.75ex}\vbox{}%
}
\defbeamertemplate*{block example end}{default}
{\end{beamercolorbox}\vskip\smallskipamount}




% Theorems

\defbeamertemplateparent{theorems}{theorem begin,theorem end}
{}

\defbeamertemplate*{theorem begin}{default}
{%
  \begin{\inserttheoremblockenv}
  {%
    \inserttheoremname
    \ifx\inserttheoremaddition\@empty\else\ (\inserttheoremaddition)\fi%
  }%
}

\defbeamertemplate*{theorem end}{default}
{\end{\inserttheoremblockenv}}


% Proofs
\defbeamertemplate*{proof begin}{default}
{\begin{block}{\insertproofname}}

\defbeamertemplate*{proof end}{default}
{\end{block}}

\defbeamertemplate*{qed symbol}{default}
{\openbox}




\mode
<all>
