
% Beamer style adaption for slides with black background
% (c) 2014 by M. Kauers. Distributed under the terms of GPL.
%
% (re)defines the following macros:
%
% \red, \blue, \green
% \movie{starting slide}{starting file index}{number of frames}{file name prefix}{file name suffix}{width}
% \highlight <range(opt)> [color(opt)] <range> [color(opt)] ... {material}
% \bubble<range>{color}{bubbled material}(vector){label text}
%

\usepackage{fix-cm}
\usepackage{amsmath}
\usepackage{amssymb}
\usepackage{tikz}
\usepackage{euler}

\userightsidebartemplate{0pt}{} % kills navigation bar

\overfullrule=5pt
\fboxsep=2pt

\def\clap#1{\hbox to0pt{\hss#1\hss}}

\def\pdfstringdefDisableCommands{}%
\def\Hy@writebookmark#1#2#3#4#5{}%

% #1: starting slide
% #2: starting file index
% #3: number of frames
% #4: file name prefix
% #5: file name suffix
% #6: width
\def\movie#1#2#3#4#5#6{%
  \leavevmode
  \count17=#1\count18=#2\count19=#3
  \loop
   \advance\count19 by-1%
   \only<\ifnum\count17=#1-\fi
         \the\count17
         \ifnum\count19=0-\fi>{\includegraphics[width=#6]{#4\the\count18#5}}%
   \advance\count17 by1%
   \advance\count18 by1%
  \ifnum\count19>0\repeat
}

 \def\mathfamilydefault{\rmdefault}
 \beamer@sansmathfalse

\useframetitletemplate{\begin{center}\structure{\large\textbf{\insertframetitle}}\end{center}}
\setbeamertemplate{footline}{\rule[-1em]{0pt}{0pt}\hfill\textcolor{white}{\arabic{framenumber}}\quad\null}
\setbeamercolor{item}{fg=normal text.fg}
\setbeamertemplate{itemize item}{$\bullet$}
\setbeamertemplate{itemize subitem}{$\circ$}
\setbeamertemplate{itemize subsubitem}{$\cdot$}
\setbeamertemplate{enumerate item}{\textbf{\theenumi}}
\setbeamertemplate{enumerate subitem}{\textbf{\theenumii}}
\setbeamertemplate{enumerate subsubitem}{\textbf{\theenumiii}}

 \definecolor{primary}{rgb}{1,.8,0} % == yellow!80!red
 \definecolor{primary--}{rgb}{.5,.4,0} 
 \definecolor{primary-}{rgb}{.66,.528,0} 
 \definecolor{primary+}{rgb}{1,.868,.34}
 \definecolor{primary++}{rgb}{1,.9,.5} 

 \definecolor{secondary}{rgb}{0,.45,1} % == blue!55!cyan
 \definecolor{secondary--}{rgb}{0,.225,.5}
 \definecolor{secondary-}{rgb}{0,.297,.66}
 \definecolor{secondary+}{rgb}{.34,.637,1}
 \definecolor{secondary++}{rgb}{.5,.725,1}

 \definecolor{good}{rgb}{0,.8,.2} % == green!80!blue
 \definecolor{good--}{rgb}{0,.4,.1}
 \definecolor{good-}{rgb}{0,.528,.132}
 \definecolor{good+}{rgb}{.34,.868,.472}
 \definecolor{good++}{rgb}{.5,.9,.6}
 
 \definecolor{bad}{rgb}{1,.1,.19} % == red!90!magenta!90!white
 \definecolor{bad--}{rgb}{.5,.05,.095}
 \definecolor{bad-}{rgb}{.66,.066,.1254}
 \definecolor{bad+}{rgb}{1,.406,.4654}
 \definecolor{bad++}{rgb}{1,.55,.595}

\setbeamercolor{normal text}{bg=black,fg=white}
\setbeamercolor{structure}{fg=primary}

\def\emph#1{\structure{#1}}

%% \highlight <range(opt)> [color(opt)] <range> [color(opt)] ... {material}
%% places a filled rectangle below the material, which may have different colors on
%% different page ranges. the default color is structure. for slides which are not
%% part of any page range, the default background color is taken. 
%% when slide ranges overlap, the rightmost color wins. 
%% Examples: \highlight<3>{something} or \highlight<3>[green]<4>[red]{something}
\def\highlight{\toks41={}\@ifnextchar<\highlightWithRange\highlightWithoutRange}
\def\highlightWithoutRange{\highlightWithRange<1->}
\def\highlightWithRange<#1>{\edef\highlightrange{#1}\@ifnextchar[\highlightWithColor\highlightWithoutColor}
\def\highlightWithoutColor{\highlightWithColor[structure]}
\def\highlightWithColor[#1]{\expandafter\highlightWithRangeAndColor\expandafter{\highlightrange}{#1}}
\def\highlightWithRangeAndColor#1#2{%
  \toks41=\expandafter{\the\toks41\color<#1>{#2}}%
  \@ifnextchar<\highlightWithRange\highlightmain
}
\def\highlightmain#1{{%
  \setbox41=\hbox{#1}%
  \dimen41=\dp41\advance\dimen41by\fboxsep
  \dimen42=\ht41\advance\dimen42by\fboxsep\advance\dimen42\dimen41%
  \leavevmode
  \rlap{\kern-\fboxsep\usebeamercolor[bg]{normal text}\the\toks41%
    \raisebox{-\fboxsep}{\raisebox{\ht41}{\rlap{\tikz\fill (0,0) circle(\fboxsep);}}}%
    \raisebox{-\fboxsep}{\raisebox{-\dp41}{\rlap{\tikz\fill (0,0) circle(\fboxsep);}}}%
    \rlap{\rule[-\dp41]{\fboxsep}{\dp41}}\rule{\fboxsep}{\ht41}%
    \rule[-\dimen41]{\wd41}{\dimen42}%
    \raisebox{-\fboxsep}{\raisebox{\ht41}{\rlap{\kern-\fboxsep\tikz\fill (0,0) circle(\fboxsep);}}}%
    \raisebox{-\fboxsep}{\raisebox{-\dp41}{\rlap{\kern-\fboxsep\tikz\fill (0,0) circle(\fboxsep);}}}%
    \rlap{\rule[-\dp41]{\fboxsep}{\dp41}}\rule{\fboxsep}{\ht41}%
  }%
  \box41
}}

% <#1> (optional): page range
% #2: main color
% #3: material to be bubbled 
% (#4,#5): label position relative to center of bubble
% #6: label text
% example: \bubble<3->{green}{material}(0,1){label}
\def\bubble{\@ifnextchar<\bubbleWithRange\bubbleWithoutRange}
\def\bubbleWithoutRange{\bubbleWithRange<1->}
\def\bubbleWithRange<#1>#2#3(#4,#5)#6{%
  \ifmmode 
  \setbox42=\hbox{$#3$}%
  \else
  \setbox42=\hbox{#3}%
  \fi
  \leavevmode
  \rlap{\kern-\fboxsep\kern-10cm\smash{\begin{tikzpicture}[thick,baseline=0pt]
    \clip (-10,-10) rectangle (10,10);
    \only<#1>{
    \draw[#2,shorten >=5pt] (\the\wd42/2+\the\fboxsep,\the\ht42/2) -- +(#4,#5) node {\strut #6};
    \fill[#2!50!normal text.bg,draw=#2,rounded corners=\fboxsep] (0,-\the\dp42-\the\fboxsep) rectangle 
    (\the\wd42+2*\the\fboxsep,\the\ht42+\the\fboxsep);
    }
  \end{tikzpicture}}}\box42\relax
}

