Make title progress bar optional

This commit is contained in:
Matthias Vogelgesang 2014-10-04 02:54:38 +02:00
parent 4bd094304b
commit 58fb92ac7c
2 changed files with 31 additions and 24 deletions

View File

@ -17,6 +17,10 @@ Thus to compile the demo with `make` you must
* install the [Fira Sans](https://github.com/mozilla/Fira) font and * install the [Fira Sans](https://github.com/mozilla/Fira) font and
* have a usable TikZ installation. * have a usable TikZ installation.
### Package options
* `titleprogressbar` adds a thin progress bar similar to the section progress
bar underneath *each* slide.
### License ### License

View File

@ -23,10 +23,11 @@
%}}} %}}}
%{{{ --- Options ---------------------- %{{{ --- Options ----------------------
\newif\if@doSectionPage \newif\if@useTitleProgressBar
\@doSectionPagefalse \@useTitleProgressBarfalse
\DeclareOption{nosectionpages}{\@doSectionPagetrue} \DeclareOption{titleprogressbar}{\@useTitleProgressBartrue}
\ProcessOptions
\ProcessOptions\relax
%}}} %}}}
%{{{ --- Titlepage -------------------- %{{{ --- Titlepage --------------------
@ -73,7 +74,8 @@
%{{{ --- Progressbar ------------------ %{{{ --- Progressbar ------------------
\makeatletter \makeatletter
\def\progressbar@progressbar{} % the progress bar \def\progressbar@sectionprogressbar{}
\def\progressbar@titleprogressbar{}
\newcount\progressbar@tmpcounta % auxiliary counter \newcount\progressbar@tmpcounta % auxiliary counter
\newcount\progressbar@tmpcountb % auxiliary counter \newcount\progressbar@tmpcountb % auxiliary counter
\newdimen\progressbar@pbht % progressbar height \newdimen\progressbar@pbht % progressbar height
@ -84,7 +86,7 @@
\progressbar@pbht=0.5pt \progressbar@pbht=0.5pt
% the progress bar % the progress bar
\def\progressbar@progressbar{% \def\progressbar@sectionprogressbar{%
\progressbar@tmpcounta=\insertframenumber \progressbar@tmpcounta=\insertframenumber
\progressbar@tmpcountb=\inserttotalframenumber \progressbar@tmpcountb=\inserttotalframenumber
\progressbar@tmpdim=\progressbar@pbwd \progressbar@tmpdim=\progressbar@pbwd
@ -105,18 +107,20 @@
} }
} }
\def\progressbar@progressbarfoo{% \if@useTitleProgressBar
\progressbar@tmpcounta=\insertframenumber \def\progressbar@titleprogressbar{%
\progressbar@tmpcountb=\inserttotalframenumber \progressbar@tmpcounta=\insertframenumber
\progressbar@tmpdim=\paperwidth \progressbar@tmpcountb=\inserttotalframenumber
\multiply\progressbar@tmpdim by \progressbar@tmpcounta \progressbar@tmpdim=\paperwidth
\divide\progressbar@tmpdim by \progressbar@tmpcountb \multiply\progressbar@tmpdim by \progressbar@tmpcounta
\divide\progressbar@tmpdim by \progressbar@tmpcountb
\begin{tikzpicture}[tight background] \begin{tikzpicture}[tight background]
\draw[mDarkBrown, fill=mDarkBrown] (0, 0) rectangle (\paperwidth, 0.2pt); \draw[mDarkBrown, fill=mDarkBrown] (0, 0) rectangle (\paperwidth, 0.2pt);
\draw[mLightBrown, fill=mLightBrown] (0, 0) rectangle (\progressbar@tmpdim, 0.2pt); \draw[mLightBrown, fill=mLightBrown] (0, 0) rectangle (\progressbar@tmpdim, 0.2pt);
\end{tikzpicture} \end{tikzpicture}
} }
\fi
%}}} %}}}
%{{{ --- Commands --------------------- %{{{ --- Commands ---------------------
@ -147,8 +151,6 @@
%}}} %}}}
%{{{ --- Sections --------------------- %{{{ --- Sections ---------------------
\if@doSectionPage\@empty
\else
% Insert frame with section title at every section start % Insert frame with section title at every section start
\AtBeginSection[] \AtBeginSection[]
{ {
@ -156,11 +158,10 @@
\setbeamercolor{background canvas}{bg=mDarkTeal} \setbeamercolor{background canvas}{bg=mDarkTeal}
\begin{frame}[plain] \begin{frame}[plain]
\vspace{2em}\usebeamerfont{section title} \vspace{2em}\usebeamerfont{section title}
\progressbar@progressbar% \progressbar@sectionprogressbar%
\end{frame} \end{frame}
\endgroup \endgroup
} }
\fi
%}}} %}}}
%{{{ --- Captions --------------------- %{{{ --- Captions ---------------------
@ -187,9 +188,11 @@
\usebeamerfont{frametitle}\MakeLowercase{\insertframetitle}% \usebeamerfont{frametitle}\MakeLowercase{\insertframetitle}%
\end{beamercolorbox}% \end{beamercolorbox}%
\vspace{-.5em} \vspace{-.5em}
\begin{beamercolorbox}[wd=\paperwidth,ht=1pt,dp=0pt]{frametitle} \if@useTitleProgressBar
\progressbar@progressbarfoo \begin{beamercolorbox}[wd=\paperwidth,ht=1pt,dp=0pt]{frametitle}
\end{beamercolorbox} \progressbar@titleprogressbar
\end{beamercolorbox}
\fi
} }
%}}} %}}}