Скачиваний:
11
Добавлен:
22.08.2013
Размер:
9.65 Кб
Скачать
\ProvidesPackage{beamerouterthemeprogressbar}[2007/06/21]


% Beamer theme by Sylvain Bouveret <sylvain[dot]bouveret[aT]cert[DoT]fr>
% aug. 2009 version 0.4
%
% based on the LaTeX-Beamer package :
% Copyright 2003 by Till Tantau <tantau@users.sourceforge.net>
%
% This program can be redistributed and/or modified under the terms
% of the GNU Public License, version 2.

\RequirePackage{tikz}
\usetikzlibrary{arrows}

\makeatletter


%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%
% Some color definitions...
%
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%

\setbeamercolor{progressbar primary}{parent=palette primary}
\setbeamercolor{progressbar secondary}{parent=palette secondary}
\setbeamercolor{progressbar tertiary}{parent=palette tertiary}
\setbeamercolor{progressbar quaternary}{parent=palette quaternary}


%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%
% Some computations dedicated to the progressbar...
%
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%

\newdimen\progressbar@currentbarlength
\newdimen\progressbar@framenumberrectangle
\newdimen\progressbar@titlerectangle
\newdimen\progressbar@leftbar

\newdimen\progressbar@stepbar

\newcount\progressbar@tmpresult
\newcount\progressbar@numer
\newcount\progressbar@denom
\newcount\progressbar@barlength

\progressbar@framenumberrectangle=\paperwidth
\progressbar@titlerectangle=\paperwidth

\advance\progressbar@framenumberrectangle by -0.9cm
\advance\progressbar@titlerectangle by -1.1cm

\progressbar@barlength=115 % (in millimeters)
\progressbar@leftbar=\progressbar@titlerectangle
\advance\progressbar@leftbar by -\progressbar@barlength mm

\def\insertprogressbar{
  \ifnum\insertintermediateframenumber=1\else
    \progressbar@numer=\insertframenumber
    \advance\progressbar@numer by -1
    \progressbar@denom=\insertintermediateframenumber
    \advance\progressbar@denom by -1
    \progressbar@tmpresult=\progressbar@barlength
    \multiply\progressbar@tmpresult by \progressbar@numer
    \divide\progressbar@tmpresult by \progressbar@denom
    \progressbar@currentbarlength=\progressbar@tmpresult mm

    \progressbar@numer=1
    \progressbar@denom=\insertintermediateframenumber
    \advance\progressbar@denom by -1
    \progressbar@tmpresult=\progressbar@barlength
    \multiply\progressbar@tmpresult by \progressbar@numer
    \divide\progressbar@tmpresult by \progressbar@denom
    \progressbar@stepbar=\progressbar@tmpresult mm

    \begin{tikzpicture}[thin]
      \useasboundingbox (0, 0) rectangle  (\paperwidth, 0.6cm);
      \draw (\progressbar@framenumberrectangle, 0.21cm) node [anchor=mid west] {\color{structure.bg!90!structure.fg}\insertframenumber~/~\insertintermediateframenumber};
      \draw (\progressbar@titlerectangle, 0.21cm) node [anchor=south east] {\color{structure.bg!90!structure.fg}\insertshorttitle};
      \draw[structure.bg!30!structure.fg, <->, >=serif cm] (\progressbar@leftbar, 0.21cm) -- (\progressbar@titlerectangle, 0.21cm);
      \draw (\progressbar@currentbarlength, 0.21cm)
      ++(\progressbar@leftbar, 0cm) node[anchor=north] {\color{structure.bg!30!structure.fg}$\blacktriangle$};
    \end{tikzpicture}
    \fi
}


%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%
% Definition of the customized templates...
%
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%

\mode<presentation>

\newlength\progressbar@sectionboxwidth
\newlength\progressbar@sectionboxheight
\newbox\progressbar@sectionbox
\newbox\progressbar@sectionboxbox

\usesectionheadtemplate
  {\hfill
    \setbox\progressbar@sectionbox=\hbox{\insertsectionhead}%
    \progressbar@sectionboxwidth=\wd\progressbar@sectionbox
    \advance\progressbar@sectionboxwidth by 4pt
    \setbox\progressbar@sectionbox=\hbox{\pgfinterruptpicture t \endpgfinterruptpicture}%
    \progressbar@sectionboxheight=\ht\progressbar@sectionbox
    \advance\progressbar@sectionboxheight by 4pt
    \begin{tikzpicture}
      \useasboundingbox (-0.5\progressbar@sectionboxwidth, 0pt) rectangle (0.5\progressbar@sectionboxwidth, \progressbar@sectionboxheight);
      \draw[anchor=base] (0pt, 2pt) node {\color{structure.fg!80!structure.bg} \insertsectionhead};
      \draw[rounded corners=3pt, draw=structure.fg!80!structure.bg] (-0.5\progressbar@sectionboxwidth, 0pt) rectangle (0.5\progressbar@sectionboxwidth, \progressbar@sectionboxheight);
    \end{tikzpicture}
  }
  {\hfill
    \setbox\progressbar@sectionbox=\hbox{\pgfinterruptpicture\insertsectionhead\endpgfinterruptpicture}%
    \progressbar@sectionboxwidth=\wd\progressbar@sectionbox
    \advance\progressbar@sectionboxwidth by 4pt
    \setbox\progressbar@sectionboxbox=\hbox{\pgfinterruptpicture t \endpgfinterruptpicture}%
    \progressbar@sectionboxheight=\ht\progressbar@sectionboxbox
    \advance\progressbar@sectionboxheight by 4pt
    \begin{tikzpicture}
      \useasboundingbox (-0.5\progressbar@sectionboxwidth, 0pt) rectangle (0.5\progressbar@sectionboxwidth, \progressbar@sectionboxheight);
      \draw[anchor=base] (0pt, 2pt) node {\color{structure.fg!50!structure.bg} \insertsectionhead};
    \end{tikzpicture}
  }




%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%
% Headline...
%
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%


  \setbeamertemplate{headline}
  {%
  \edef\tempa{sections}
  \ifx\progressbar@headline\tempa
  \leavevmode%
  \begin{beamercolorbox}[ignorestructure.bg=true,wd=\paperwidth,ht=4ex,dp=1.125ex]{section in head/foot}%
    \insertsectionnavigationhorizontal{\paperwidth}{}{}%\hskip0pt plus1filll}{}%
  \end{beamercolorbox}%
  \else
  \leavevmode%
  \begin{beamercolorbox}[wd=\paperwidth,ht=4ex,dp=1.125ex]{structure.fg}%
  \end{beamercolorbox}%
  \fi
  }
  

%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%
% Footline...
%
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%

\defbeamertemplate*{footline}{progressbar theme}{
  \begin{beamercolorbox}[wd=\paperwidth,ht=0.6cm,dp=0ex]{structure.fg}%
    \insertprogressbar
  \end{beamercolorbox}%
}



%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%
% Title page...
%
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%


\defbeamertemplate*{title page}{progressbar theme}{
  \edef\tempa{picture}
  \ifx\progressbar@titlepage\tempa
  \vfill
  \parbox{0.28\textwidth}{
    \pgfimage[width=0.27\textwidth]{\progressbar@imagename}
  }\hfill
  \parbox{0.7\textwidth}{
    \begin{center}
      {\usebeamerfont{title}\usebeamercolor{title}{\color{fg}\inserttitle}}
      \ifx\insertsubtitle\@empty\\[\baselineskip]
      \else{\\\usebeamerfont{subtitle}\usebeamercolor{subtitle}{\color{fg}\insertsubtitle}}\\[\baselineskip]\fi
      \hrule\vskip\baselineskip
      \ifx\insertauthor\@empty\ \\
      \else{\usebeamerfont{author}\usebeamercolor{author}{\color{fg}\insertauthor}}\\\fi
      \ifx\insertdate\@empty\ \\
      \else{\usebeamerfont{date}\usebeamercolor{date}{\color{fg}\insertdate}}\\\fi
      \ifx\insertinstitute\@empty 
      \else{\usebeamerfont{institute}\usebeamercolor{institute}{\color{fg}\insertinstitute}}\\\fi
      \insertlogo
    \end{center}
  }\vfill
  \else
  \pgfdeclarehorizontalshading{separationtitlepagelineshading}{0.5pt}{color(0cm)=(bg); 
    color(0.5\textwidth)=(structure.fg); color(\textwidth)=(bg)}
  \begin{center}
    \vfill
    {\usebeamerfont{title}\usebeamercolor{title}{\color{fg}\inserttitle}}

    \ifx\insertsubtitle\@empty 
    \else{\usebeamerfont{subtitle}\usebeamercolor{subtitle}{\color{fg}\insertsubtitle}}\\[\baselineskip]\fi

    \pgfuseshading{separationtitlepagelineshading}
    \vskip\baselineskip
    {\usebeamerfont{author}\usebeamercolor{author}{\color{fg}\insertauthor}}\\[\baselineskip]
    \ifx\insertinstitute\@empty 
    \else{\usebeamerfont{institute}\usebeamercolor{institute}{\color{fg}\insertinstitute}}\\[\baselineskip]\fi
    \ifx\insertlogo\@empty 
    \else{\insertlogo}\\[\baselineskip]\fi
    {\usebeamerfont{date}\usebeamercolor{date}{\color{fg}\insertdate}}
    \pgfuseshading{separationtitlepagelineshading}
    \vfill
  \end{center}
  \fi
}

\setbeamertemplate{title page}[progressbar theme]

% \defbeamertemplate*{title page}{progressbar theme}{
%   \pgfdeclarehorizontalshading{separationtitlepagelineshading}{0.5pt}{color(0cm)=(bg); color(0.5\textwidth)=(structure.fg); color(\textwidth)=(bg)}
  
%   \makeatletter
%   \begin{center}
%     \textbf{\textcolor{structure.fg}\large\inserttitle}
    
%     \pgfuseshading{separationtitlepagelineshading}
%     \vskip\baselineskip
%     \footnotesize\insertauthor\\[\baselineskip]
%     \ifx\insertinstitute\@empty \else\tiny\insertinstitute\\[\baselineskip]\fi
%     \insertlogo
%     \vskip\baselineskip
%     \pgfuseshading{separationtitlepagelineshading}
%     \vfill
%     \footnotesize    
%     \insertdate
%   \end{center}
%   \makeatother
% }
%\setbeamertemplate{title page}[mytitlepage]



%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%
% Background...
%
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%

\defbeamertemplate*{background canvas}{progressbar theme}{\pgfuseshading{background shading}}%

\AtBeginDocument{%
  {
    \usebeamercolor{background canvas}
    \pgfdeclareverticalshading{background shading}{\the\paperwidth}{color(0cm)=(fg); color(3cm)=(bg); color(0.6\paperheight)=(bg); color(0.9\paperheight)=(fg); color(\paperheight)=(black!60!fg)
    }
  }
}

\mode<handout>
\setbeamertemplate{background canvas}{}%

\mode
<all>

\makeatother
Соседние файлы в папке theme2