% Copyright 2007 by Till Tantau
% Edited by: Sebastian Jeworutzki 2012
%
% 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.

\ProvidesPackage{beamerinnerthemeRub}[27/09/12 15:28:08]

% Tikz wird benötigt
\RequirePackage{tikz}

% In den Präsentationsmodus wechseln
\mode<presentation>

% Standard-Stil für die Titelseite festlegen:
\DeclareOptionBeamer{alternativetitlepage}[normal]{\def\beamer@Rub@alternativetitlepage{#1}}
\ExecuteOptionsBeamer{alternativetitlepage=normal}
\ProcessOptionsBeamer

%% Bild definieren:
% Logo für die Titelseite
\pgfdeclareimage[width=1.8cm]{logoTitle}{logo}

% Bilder für das Literaturverzeichnis
\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}

% Hilfsfunktion für das Sponsor-Logo
\newcount\sponsor
\sponsor=0

\newcommand{\sponsorlogo}[2][\empty]{
    \pgfdeclareimage[#1]{sponsor}{#2}
    \sponsor=1
    }

% Funktion für das Titelbild Redefinieren -> Wenn diese nicht aufgerufen wird, MaxTitleImage nicht aufrufen
\renewcommand\titlegraphic[1]{\def\inserttitlegraphicrub{#1}}
\newcommand{\TitleImage}{\@ifundefined{inserttitlegraphicrub}{}{\MaxTitleImage}}

% Funktion für das Titelbild
% Sicherstellen, dass das Bild maximiert wird.
\RequirePackage{calc}
\newcommand{\MaxTitleImage}{
    \newlength\graphicheight    % Register anlegen
    \newlength\graphicwidth
    \setlength\graphicheight{\heightof{\includegraphics[width=\paperwidth]{\inserttitlegraphicrub}}}   %Standard: an Breite orientieren und Breite messen
    \setlength\graphicwidth{\widthof{\includegraphics[width=\paperwidth]{\inserttitlegraphicrub}}}
    \ifdim \graphicheight<\paperheight  % Sollte bei maximierter Breite, das Bild nicht hoch genug sein, an Höhe orientieren
        \includegraphics[height=\paperheight, keepaspectratio = true]{\inserttitlegraphicrub}
    \else
        \includegraphics[width=\paperwidth, keepaspectratio = true]{\inserttitlegraphicrub}
    \fi
    }
    


%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
% Title page
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%

%% Normal
\defbeamertemplate*{title page normal}{Rub} % Template definieren
{   % Beginn der Definition: Normal
\thispagestyle{empty}
\begin{tikzpicture}[remember picture,overlay]
    % Node mit dem weißen Hintergrund
    \node[anchor=north west, inner sep=0pt]  at (current page.north west) 
         {\begin{tikzpicture}
            \draw[style={white, line width=0pt, fill=white}] (0,0) rectangle (0.90\paperwidth,0.9\paperheight);%8.2cm);
          \end{tikzpicture}};
    % Node mit dem Text
    \node[anchor=north west, inner sep=0pt, xshift=1cm,yshift=-0.5cm]  at (current page.north west) {
        \begin{minipage}{11.5cm}
            \begin{beamercolorbox}{title}
		\begin{tiny}\textbf{RUHR-UNIVERSIT{\"A}T}~BOCHUM \end{tiny} \\ [1cm]
                \usebeamerfont{title}\inserttitle\par%
                \ifx\insertsubtitle\@empty% Falls kein Untertitel definiert wurde, nichts unternehmen
                \else%
                      \vskip0.25em% Ansonsten Abstand und Untertitel einfügen
                      {\usebeamerfont{subtitle}\usebeamercolor[fg]{subtitle}\insertsubtitle\par}%
                \fi%
            \end{beamercolorbox}%
            \vskip8pt%
            \begin{beamercolorbox}{date}
                \usebeamerfont{date}\insertdate
            \end{beamercolorbox}
            \vskip1em\par
            \begin{beamercolorbox}{institute}
                \usebeamerfont{institute}\insertinstitute
            \end{beamercolorbox}
            \begin{beamercolorbox}{author}
                \usebeamerfont{author}\insertauthor
            \end{beamercolorbox}
            \vspace{2em} 
            % Sponsorlogo einfügen - sponosr ist 0, falls kein Bild angebeben wurde
             \ifnum\sponsor>0
                 \pgfuseimage{sponsor}
              \else
              \fi
            \vfill
        \end{minipage}};
        % Node mit dem Logo
        \node[anchor=north west,xshift=-2.15cm, yshift=1pt, rectangle, inner sep=0pt,line width=0pt] at (current page.north east){\pgfuseimage{logoTitle}};
\end{tikzpicture}
} % Ende der Definition: Normal

%% Alternativ
\defbeamertemplate*{title page alternativ}{Rub}
{   % Beginn der Definition: Alternativ
\thispagestyle{empty}
\begin{tikzpicture}[remember picture,overlay]
% Erste Node: Setzt ganz oben links an, von dem Punkt aus kann dann in der zweiten tikzpicture Umgebung ausgegangen werden
\node[anchor=north west, inner sep=0pt]  at (current page.north west) {
    \begin{tikzpicture}[remember picture,overlay]
      % Node mit Titelgrafik.
      \node[anchor=north west, inner sep=0pt,yshift=0cm,xshift=-2mm,line width=0pt]  at (current page.north west) {\TitleImage};
      %Logo
      \node[anchor=north west,xshift=-2.45cm, yshift=1pt, rectangle, inner sep=0pt] at (current page.north east){\pgfuseimage{logoTitle}};
      % Weißer Hintergrund. Das Bild wird überdeckt.
      \draw[style={white, line width=0pt, fill=white}] (current page.south west) rectangle (\paperwidth,-52mm);
      % Node mit dem Text
      \node[anchor=north west, inner sep=0pt, xshift=7mm,yshift=-55mm]  at (current page.north west) {
        \begin{minipage}{\linewidth}
            \begin{beamercolorbox}{title}
%                 \pgfuseimage{wortmarkeTitle}\\[0.3cm]
		\begin{tiny}\textbf{RUHR-UNIVERSIT{\"A}T}~BOCHUM \end{tiny} \\ [0.3cm]
                \usebeamerfont{title}\inserttitle\par%
                \ifx\insertsubtitle\@empty%
                \else%
                  \vskip0.20em%
                  {\usebeamerfont{subtitle}\usebeamercolor[fg]{subtitle}\insertsubtitle\par}%
                 \fi%
            \end{beamercolorbox}%
            \vskip8pt%
            \begin{beamercolorbox}{date}
                \noindent\usebeamerfont{date}\insertdate
            \end{beamercolorbox}
            \vskip1em\par    
            \ifnum\sponsor=0 % Prüfen ob es ein Sponsorlogo gibt
	        \noindent\begin{minipage}{\linewidth} % wenn nein, ganze Zeile nutzen
            \else 
            \begin{minipage}{8cm}         % wenn ja, Platz fürs Logo lassen
            \fi
            \begin{beamercolorbox}[sep=0pt]{institute}
                \noindent\usebeamerfont{institute}\insertinstitute
            \end{beamercolorbox}
            \begin{beamercolorbox}{author}
                \noindent\usebeamerfont{author}\insertauthor
            \end{beamercolorbox}
            \end{minipage}
            \vfill
       \end{minipage}};
\end{tikzpicture}};
% Sponsor-Logo
        \node[anchor=north west, xshift=-45mm, yshift=17mm, rectangle, inner sep=0pt, line width=0pt, minimum width=35mm, text height=15mm, minimum height=15mm] at (current page.south east){
                    \ifnum\sponsor>0
                    \pgfuseimage{sponsor}
                    \else
                     \fi}; 
 \end{tikzpicture}      
}  % Ende der Definition: Alternativ



%% Alternativ mit großem Bild
\defbeamertemplate*{title page bild}{Rub}
{  % Beginn der Definition: Bild
\thispagestyle{empty}
\begin{tikzpicture}[remember picture,overlay]
% Erste Node: Setzt ganz oben links an, von dem Punkt aus kann dann in der zweiten tikzpicture Umgebung ausgegangen werden
\node[anchor=north west, inner sep=0pt]  at (current page.north west) {
    \begin{tikzpicture}[remember picture,overlay]
    % Bild im Hintergrund
    \node[anchor=north west, inner sep=0pt, xshift=-2mm]  at (current page.north west) {\TitleImage};
    % Weißer Fläche mit Text
    \draw[style={white, line width=0pt, fill=white}] (current page.north west) rectangle (0.90\paperwidth,-45mm);
    % Text
    \node[anchor=north west, inner sep=0pt, xshift=.3cm,yshift=-0.5cm]  at (current page.north west) {
        \begin{minipage}{\linewidth}
            \begin{beamercolorbox}{title}
%                 \pgfuseimage{wortmarkeTitle}\\[0.3cm]
		\begin{tiny}\textbf{RUHR-UNIVERSIT{\"A}T}~BOCHUM \end{tiny}\\ [0.3cm]
                \usebeamerfont{title}\inserttitle\par%
                    \ifx\insertsubtitle\@empty%
                      \else%
                          \vskip0.20em%
                         {\usebeamerfont{subtitle}\usebeamercolor[fg]{subtitle}\insertsubtitle\par}%
                    \fi%
            \end{beamercolorbox}%
            \vskip0.5em\par
            \begin{beamercolorbox}[sep=0pt]{date}
                \usebeamerfont{date}\insertdate
            \end{beamercolorbox}
            \vskip1em\par
            \ifnum\sponsor=0 % Prüfen ob es ein Sponsorlogo gibt
	        \begin{minipage}{\linewidth} % wenn nein, ganze Zeile nutzen
            \else 
            \begin{minipage}{8cm}         % wenn ja, Platz fürs Logo lassen
            \fi
            \begin{beamercolorbox}[sep=0pt]{institute}
                \usebeamerfont{institute}\insertinstitute
            \end{beamercolorbox}
            \begin{beamercolorbox}{author}
                 \usebeamerfont{author}\insertauthor
            \end{beamercolorbox}
            \vspace{1cm}
            \end{minipage}
            \end{minipage}};
         
        % Sponsor-Logo
        \node[anchor=north west,xshift=-50mm, yshift=-29mm, rectangle, inner sep=0pt, line width=0pt, minimum width=35mm, text height=15mm, minimum height=15mm] at (current page.north east){
                    \ifnum\sponsor>0
                    \pgfuseimage{sponsor}
                    \else
                     \fi}; 

    % Logo
    \node[anchor=north west,xshift=-2.25cm, yshift=1pt, rectangle, inner sep=0pt, line width=0pt] at (current page.north east){\pgfuseimage{logoTitle}}; 
      \end{tikzpicture}};
 \end{tikzpicture}  
}   % Ende der Definition: Bild


%% Alternativ mit großem Bild/empty (aufgeräumter Modus)
\defbeamertemplate*{title page bildempty}{Rub}
{  % Beginn der Definition: Bild
\thispagestyle{empty}
\begin{tikzpicture}[remember picture,overlay]
% Erste Node: Setzt ganz oben links an, von dem Punkt aus kann dann in der zweiten tikzpicture Umgebung ausgegangen werden
\node[anchor=north west, inner sep=0pt]  at (current page.north west) {
    \begin{tikzpicture}[remember picture,overlay]
    % Bild im Hintergrund
        \node[anchor=north west, inner sep=0pt, xshift=-2mm]  at (current page.north west) {\TitleImage};
    % Text
    \node[anchor=north west, inner sep=0pt, xshift=.3cm,yshift=-0.5cm]  at (current page.north west) {
        \begin{minipage}{\linewidth}
            \begin{beamercolorbox}{title}
%                 \pgfuseimage{wortmarkeTitle}\\[0.3cm]
		\begin{tiny}\textbf{RUHR-UNIVERSIT{\"A}T}~BOCHUM \end{tiny} \\ [0.3cm]
                \usebeamerfont{title}\inserttitle\par%
                    \ifx\insertsubtitle\@empty%
                      \else%
                          \vskip0.20em%
                         {\usebeamerfont{subtitle}\usebeamercolor[fg]{subtitle}\insertsubtitle\par}%
                    \fi%
            \end{beamercolorbox}%
            \begin{beamercolorbox}[sep=8pt]{date}
                \usebeamerfont{date}\hspace{-0.5em}\insertdate
            \end{beamercolorbox}
            \vskip1em\par
            \ifnum\sponsor=0 % Prüfen ob es ein Sponsorlogo gibt
	        \begin{minipage}{\linewidth} % wenn nein, ganze Zeile nutzen
            \else 
            \begin{minipage}{8cm}         % wenn ja, Platz fürs Logo lassen
            \fi
            \begin{beamercolorbox}[sep=-1pt]{institute}
                \usebeamerfont{institute}\insertinstitute
            \end{beamercolorbox}
            \begin{beamercolorbox}{author}
                 \usebeamerfont{author}\insertauthor
            \end{beamercolorbox}
            \vspace{1cm}
            \end{minipage}
            \end{minipage}};
         
        % Sponsor-Logo
        \node[anchor=north west,xshift=-50mm, yshift=-29mm, rectangle, inner sep=0pt, line width=0pt, minimum width=35mm, text height=15mm, minimum height=15mm] at (current page.north east){
                    \ifnum\sponsor>0
                    \pgfuseimage{sponsor}
                    \else
                     \fi}; 

    % Logo
    \node[anchor=south west,xshift=3mm, yshift=3mm, rectangle, inner sep=0pt, line width=0pt] at (current page.south west){\pgfuseimage{logoTitle}}; 
      \end{tikzpicture}};
 \end{tikzpicture}  
}   % Ende der Definition: Bild


% Optionen zum Titelseitenformat ausführen
\defbeamertemplate*{title page}{Rub}[1][]
{
\usebeamertemplate{title page \beamer@Rub@alternativetitlepage}% hier wird der Wert der Variable aus dem Optionsfeld eingesetzt, und somit das entsprechende Titelbild definiert
}

% Macro zum Aufruf der Titelseite (um Fußzeile zu löschen)
\newcommand{\titleframe}{
\setbeamertemplate{footline}{}
\setbeamertemplate{headline}{}
\frame{\titlepage} 
\setbeamertemplate{footline}[Rub theme]
\setbeamertemplate{headline}[Rub theme]
    }


% Part page: Rub
\defbeamertemplate*{part page}{Rub}[1][]
{
  \begin{centering}
    {\usebeamerfont{part name}\usebeamercolor[fg]{part name}\partname~\insertromanpartnumber}
    \vskip1em\par
    \begin{beamercolorbox}[sep=8pt,center,#1]{part title}
      \usebeamerfont{part title}\insertpart\par
    \end{beamercolorbox}
  \end{centering}
} 


%
% 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: Rub
\defbeamertemplate*{section in toc}{Rub}
{\inserttocsection\par}

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

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


% (sub-)section in toc shaded, Rub
\defbeamertemplate*{section in toc shaded}{Rub}[1][20]
{\begin{colormixin}{#1!parent.bg}\usebeamertemplate{section in toc}\end{colormixin}\unskip}

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

\defbeamertemplate*{subsubsection in toc shaded}{Rub}[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, Rub
\defbeamertemplate*{itemize item}{Rub}{\scriptsize\raise1.25pt\hbox{\donotcoloroutermaths$\blacktriangleright$}}
\defbeamertemplate*{itemize subitem}{Rub}{\tiny\raise1.5pt\hbox{\donotcoloroutermaths$\blacktriangleright$}}
\defbeamertemplate*{itemize subsubitem}{Rub}{\tiny\raise1.5pt\hbox{\donotcoloroutermaths$\blacktriangleright$}}


% Enumerate items, Rub
%\defbeamertemplateparent{enumerate items}{enumerate item,enumerate subitem,enumerate subsubitem,enumerate mini}
%{}

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


% Description item width
\defbeamertemplate*{description item}{Rub}{\insertdescriptionitem}



% Itemize/Enumerate body
\defbeamertemplate*{itemize/enumerate body begin}{Rub}{}
\defbeamertemplate*{itemize/enumerate body end}{Rub}{}

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

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



% Alerted text
\defbeamertemplate*{alerted text begin}{Rub}{\setbeamercolor{local structure}{parent=alerted text}}



% Structured text
% empyt Rubs


% Bibliography items
\defbeamertemplate*{bibliography item}{Rub}
{\hspace{3.2mm}\lower3.5pt\hbox{\hskip2pt\pgfuseimage{beamericonarticle}\hskip1pt}}

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


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

\defbeamertemplate*{button}{Rub}
{%
  \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}{Rub}
{%
  \begin{center}%
    \abstractname
  \end{center}%
}

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

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


% Verse
\defbeamertemplate*{verse begin}{Rub}
{\beamercolorbox[vmode]{verse}}

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


% Quotation
\defbeamertemplate*{quotation begin}{Rub}
{\beamercolorbox[vmode]{quotation}}

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


% Quote
\defbeamertemplate*{quote begin}{Rub}
{\beamercolorbox[vmode]{quote}}

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


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


% Captions
\defbeamertemplate*{caption}{Rub}
{%
  \raggedright
  {%
    \usebeamercolor[fg]{caption name}%
    \usebeamerfont*{caption name}%
    \insertcaptionname:%
  }
  \insertcaption\par
}


% Blocks
\defbeamertemplate*{block begin}{Rub}
{
  \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}{Rub}  
{\end{beamercolorbox}\vskip\smallskipamount}

\defbeamertemplate*{block alerted begin}{Rub}
{
  \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}{Rub}
{\end{beamercolorbox}\vskip\smallskipamount}


\defbeamertemplate*{block example begin}{Rub}
{
  \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}{Rub}
{\end{beamercolorbox}\vskip\smallskipamount}

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

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

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


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

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

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


\setbeamertemplate{sections/subsections in toc}[square]
\setbeamertemplate{items}[square]


\mode
<all>
