Newer
Older
Lecture_repo / Lectures_my / MC_2016 / Lecture4 / beamerouterthemedecolines.sty
@mchrzasz mchrzasz on 29 Feb 2016 5 KB added Lecture2
% Copyright 2007 by Marco Barisione
%
% This file may be distributed and/or modified
%
% 1. under the LaTeX Project Public License and/or
% 2. under the GNU Public License.

\mode<presentation>

% String used between the current page and the total page count.
\def\beamer@decolines@pageofpages{/}
\DeclareOptionBeamer{pageofpages}{\def\beamer@decolines@pageofpages{#1}}

% Show a line below the frame title.
\DeclareOptionBeamer{titleline}[true]{\def\beamer@decolines@titleline{#1}}

% Image used for the watermark.
\def\beamer@decolines@watermarkorig{}
\DeclareOptionBeamer{watermark}{\def\beamer@decolines@watermarkorig{#1}}

% Height of the watermark.
\def\beamer@decolines@watermarkheight{100px}
\DeclareOptionBeamer{watermarkheight}{\def\beamer@decolines@watermarkheight{#1}}

% The original image height is watermarkheightmult * watermarkheight.
\def\beamer@decolines@watermarkheightmult{1}
\DeclareOptionBeamer{watermarkheightmult}{\def\beamer@decolines@watermarkheightmult{#1}}

\ExecuteOptionsBeamer{titleline=false}
\ProcessOptionsBeamer

% Enable/disable the watermark.
\def\watermarkon{%
  \def\beamer@decolines@watermark{\beamer@decolines@watermarkorig}%
}
\def\watermarkoff{\def\beamer@decolines@watermark{}}

% Initially enable the watermark.
\watermarkon

% Colors.
\setbeamercolor*{lineup}{parent=palette primary}
\setbeamercolor*{linemid}{parent=palette secondary}
\setbeamercolor*{linebottom}{parent=palette tertiary}
\setbeamercolor*{page header}{parent=titlelike}

% Lengths
\newlength{\headerheight}
\setlength{\headerheight}{.045\paperheight}
\newlength{\beamer@decolines@lineup}
\setlength{\beamer@decolines@lineup}{.025\paperheight}
\newlength{\beamer@decolines@linemid}
\setlength{\beamer@decolines@linemid}{.015\paperheight}
\newlength{\beamer@decolines@linebottom}
\setlength{\beamer@decolines@linebottom}{.01\paperheight}

% The height of the watermark part below the 3 bottom lines.
\newlength{\beamer@decolines@watermarkheightbottom}
\addtolength{\beamer@decolines@watermarkheightbottom}{\beamer@decolines@lineup}
\addtolength{\beamer@decolines@watermarkheightbottom}{\beamer@decolines@linemid}
\addtolength{\beamer@decolines@watermarkheightbottom}{\beamer@decolines@linebottom}

% The height of the watermark part over the 3 bottom lines before shrinking.
\newlength{\beamer@decolines@watermarkheightupperorig}
\setlength{\beamer@decolines@watermarkheightupperorig}{\beamer@decolines@watermarkheight}
\addtolength{\beamer@decolines@watermarkheightupperorig}{-\beamer@decolines@watermarkheightbottom}
\multiply\beamer@decolines@watermarkheightupperorig by \beamer@decolines@watermarkheightmult

% % Footer.
% \defbeamertemplate*{footline}{decolines theme}
% {
%   \leavevmode%
%   % Page number.
%   \hbox{%
%   \begin{beamercolorbox}[wd=.2\paperwidth,ht=0ex,dp=0ex,center]{}%
%     \usebeamerfont{palette primary}\insertframenumber{} \beamer@decolines@pageofpages{} \inserttotalframenumber%
%   \end{beamercolorbox}%
%   \begin{beamercolorbox}[wd=.8\paperwidth,ht=0ex,dp=0ex]{}%
%   \end{beamercolorbox}%
%   } %
%   % First line.
%   \hbox{%
%   \begin{beamercolorbox}[wd=.2\paperwidth,ht=\beamer@decolines@lineup,dp=0pt]{}%
%   \end{beamercolorbox}%
%   \begin{beamercolorbox}[wd=.8\paperwidth,ht=\beamer@decolines@lineup,dp=0pt]{lineup}%
%   \end{beamercolorbox}%
%   } %
%   % Second line.
%   \hbox{%
%   \begin{beamercolorbox}[wd=\paperwidth,ht=\beamer@decolines@linemid,dp=0pt]{linemid}%
%   \end{beamercolorbox}%
%   } %
%   % Third line.
%   \hbox{%
%   \begin{beamercolorbox}[wd=.1\paperwidth,ht=\beamer@decolines@linebottom,dp=0pt]{}%
%   \end{beamercolorbox}%
%   \begin{beamercolorbox}[wd=.9\paperwidth,ht=\beamer@decolines@linebottom,dp=0pt]{linebottom}%
%   \end{beamercolorbox}%
%   }%
%   % This seems to fix some alignment problems with the watermark. It has to be
%   % always applied if you do not want to see the footer moving up and down when
%   % moving from a page with watermark to a page without or vice versa.
%   \vskip-.5px%
%   % Watermark.
%   \if\beamer@decolines@watermark\@empty\else%
%     \vskip-\beamer@decolines@watermarkheightbottom%
%     \llap{\includegraphics[height=\beamer@decolines@watermarkheightbottom,clip=true,%
%       trim=0pt 0pt 0pt \beamer@decolines@watermarkheightupperorig]{\beamer@decolines@watermark}\hskip-\paperwidth}%
%   \fi%
% }

\defbeamertemplate*{headline}{decolines theme}
{
  \leavevmode%
  \hbox{%
  \begin{beamercolorbox}[wd=\paperwidth,ht=\headerheight,dp=0pt]{page header}%
  \end{beamercolorbox}%
  } %
  \vskip0pt%
}

\defbeamertemplate*{frametitle}{decolines theme}[1][left]
{
  \ifbeamercolorempty[bg]{frametitle}{}{\nointerlineskip}%
  \@tempdima=\textwidth%
  \advance\@tempdima by\beamer@leftmargin%
  \advance\@tempdima by\beamer@rightmargin%
  \vbox{}\vskip-.5\beamer@leftmargin%
  \begin{beamercolorbox}[sep=\beamer@leftmargin,#1,wd=\the\@tempdima]{}
    \usebeamerfont{frametitle}\usebeamercolor[bg]{framesubtitle}%
    \vbox{}\vskip0ex%
    \if@tempswa\else\csname beamer@fte#1\endcsname\fi%
    \strut\insertframetitle\strut\par%
    {%
      \ifx\insertframesubtitle\@empty%
      \else%
      {\usebeamerfont{framesubtitle}\usebeamercolor[bg]{framesubtitle}\insertframesubtitle\strut\par}%
      \fi
    }%
    \vskip-1ex%
    \if@tempswa\else\vskip-\beamer@leftmargin\fi
  \end{beamercolorbox}%
  \def\beamer@decolines@truetext{true}%
  \ifx\beamer@decolines@titleline\beamer@decolines@truetext%
    \vskip-.5\beamer@leftmargin%
    \begin{beamercolorbox}[wd=\textwidth,ht=.1ex,dp=0ex]{linemid}%
    \end{beamercolorbox}%
  \fi
}

% Frame title continuations, default
\defbeamertemplate*{frametitle continuation}{decolines theme}{(\insertcontinuationcount)}



\defbeamertemplate*{sidebar right}{decolines theme}
{
  \vskip.1\beamer@leftmargin%
  \llap{\insertlogo\hskip.5\beamer@leftmargin}%
  \vfill%
  \if\beamer@decolines@watermark\@empty\else%
  \llap{\includegraphics[height=\beamer@decolines@watermarkheight]{\beamer@decolines@watermark}}%
  \vskip-\beamer@decolines@watermarkheightbottom%
  \fi
}

\mode
<all>