mirror of
https://github.com/matze/mtheme.git
synced 2024-07-02 08:20:55 +02:00
Create common \progressbar command and simplify implementation with calc package.
This commit is contained in:
parent
aa25c6df4e
commit
ebcb4c9be4
|
@ -45,7 +45,7 @@
|
||||||
\setbeamercolor{date}{parent=palette primary}
|
\setbeamercolor{date}{parent=palette primary}
|
||||||
\setbeamercolor{institute}{parent=palette primary}
|
\setbeamercolor{institute}{parent=palette primary}
|
||||||
|
|
||||||
\setbeamercolor{section title}{parent=palette primary}
|
\setbeamercolor{section title}{parent=palette secondary}
|
||||||
\setbeamercolor{frametitle}{parent=palette secondary}
|
\setbeamercolor{frametitle}{parent=palette secondary}
|
||||||
\setbeamercolor{background canvas}{parent=palette primary}
|
\setbeamercolor{background canvas}{parent=palette primary}
|
||||||
\setbeamercolor{structure}{fg=mDarkTeal}
|
\setbeamercolor{structure}{fg=mDarkTeal}
|
||||||
|
|
|
@ -152,66 +152,19 @@
|
||||||
%}}}
|
%}}}
|
||||||
%{{{ --- Progressbar ------------------
|
%{{{ --- Progressbar ------------------
|
||||||
|
|
||||||
\makeatletter
|
\RequirePackage{calc}
|
||||||
\def\progressbar@sectionprogressbar{}
|
\newlength{\progressbar@percent}
|
||||||
\def\progressbar@titleprogressbar{}
|
\newcommand{\progressbar}[1]{%
|
||||||
\newcount\progressbar@tmpcounta % auxiliary counter
|
\setlength{\progressbar@percent}{%
|
||||||
\newcount\progressbar@tmpcountb % auxiliary counter
|
#1 * \ratio{\insertframenumber pt}{\inserttotalframenumber pt}%
|
||||||
\newdimen\progressbar@pbht % progressbar height
|
|
||||||
\newdimen\progressbar@pbwd % progressbar width
|
|
||||||
\newdimen\progressbar@tmpdim % auxiliary dimension
|
|
||||||
|
|
||||||
\progressbar@pbwd=22em
|
|
||||||
\progressbar@pbht=0.4pt
|
|
||||||
|
|
||||||
% the progress bar
|
|
||||||
\def\progressbar@sectionprogressbar{%
|
|
||||||
{\usebeamercolor{palette primary}%
|
|
||||||
\progressbar@tmpcounta=\insertframenumber
|
|
||||||
\progressbar@tmpcountb=\inserttotalframenumber
|
|
||||||
\progressbar@tmpdim=\progressbar@pbwd
|
|
||||||
\divide\progressbar@tmpdim by 100
|
|
||||||
\multiply\progressbar@tmpdim by \progressbar@tmpcounta
|
|
||||||
\divide\progressbar@tmpdim by \progressbar@tmpcountb
|
|
||||||
\multiply\progressbar@tmpdim by 100
|
|
||||||
|
|
||||||
% fixes very high linespacing introduced via \textsc{\MakeLowercase{...}}
|
|
||||||
\fontsize{1em}{1em}\selectfont
|
|
||||||
|
|
||||||
\makebox[\textwidth][c]{
|
|
||||||
\begin{tikzpicture}[tight background]
|
|
||||||
|
|
||||||
\node[anchor=south west, fg, inner sep=0pt, text width=\progressbar@pbwd] at (0pt, 0pt) {\insertsectionHEAD};
|
|
||||||
|
|
||||||
\draw[anchor=west, fg!20, fill=fg!20, inner sep=0pt]
|
|
||||||
(0, -1ex) rectangle ++ (\progressbar@pbwd, \progressbar@pbht);
|
|
||||||
|
|
||||||
\draw[anchor=west, fg, fill=fg, inner sep=0pt]
|
|
||||||
(0, -1ex) rectangle ++ (\progressbar@tmpdim, \progressbar@pbht);
|
|
||||||
\end{tikzpicture}%
|
|
||||||
}
|
|
||||||
} % end usebeamercolor{palette primary}
|
|
||||||
}
|
|
||||||
|
|
||||||
\if@useTitleProgressBar
|
|
||||||
\def\progressbar@titleprogressbar{%
|
|
||||||
\progressbar@tmpcounta=\insertframenumber
|
|
||||||
\progressbar@tmpcountb=\inserttotalframenumber
|
|
||||||
\progressbar@tmpdim=\paperwidth
|
|
||||||
\divide\progressbar@tmpdim by 100
|
|
||||||
\multiply\progressbar@tmpdim by \progressbar@tmpcounta
|
|
||||||
\divide\progressbar@tmpdim by \progressbar@tmpcountb
|
|
||||||
\multiply\progressbar@tmpdim by 100
|
|
||||||
{%
|
|
||||||
\usebeamercolor{palette quaternary}%
|
|
||||||
\usebeamercolor{alerted text}%
|
|
||||||
\begin{tikzpicture}[tight background]
|
|
||||||
\draw[palette quaternary.fg, fill=palette quaternary.fg] (0, 0) rectangle ($(\paperwidth, 0.6pt) - (0.4pt, 0)$);
|
|
||||||
\draw[alerted text.fg, fill=alerted text.fg] (0, 0) rectangle (\progressbar@tmpdim, 0.6pt);
|
|
||||||
\end{tikzpicture}%
|
|
||||||
}%
|
}%
|
||||||
|
\begin{tikzpicture}
|
||||||
|
\draw[fg, fill=fg] (0,0) rectangle (#1, 0.4pt);
|
||||||
|
\draw[alerted text.fg, fill=alerted text.fg] (0,0) rectangle (\progressbar@percent, 0.4pt);
|
||||||
|
\end{tikzpicture}%
|
||||||
}
|
}
|
||||||
\fi
|
|
||||||
|
|
||||||
%}}}
|
%}}}
|
||||||
%{{{ --- Commands ---------------------
|
%{{{ --- Commands ---------------------
|
||||||
|
|
||||||
|
@ -262,7 +215,7 @@
|
||||||
\setbeamercolor{background canvas}{parent=palette primary}
|
\setbeamercolor{background canvas}{parent=palette primary}
|
||||||
\begin{frame}[plain]
|
\begin{frame}[plain]
|
||||||
\vspace{2em}\usebeamerfont{section title}
|
\vspace{2em}\usebeamerfont{section title}
|
||||||
\progressbar@sectionprogressbar%
|
\progressbar{\textwidth}
|
||||||
\end{frame}
|
\end{frame}
|
||||||
\endgroup
|
\endgroup
|
||||||
\fi%
|
\fi%
|
||||||
|
@ -320,9 +273,10 @@
|
||||||
\fi%
|
\fi%
|
||||||
\end{beamercolorbox}%
|
\end{beamercolorbox}%
|
||||||
\if@useTitleProgressBar
|
\if@useTitleProgressBar
|
||||||
\vspace{-.5em}
|
\nointerlineskip
|
||||||
\begin{beamercolorbox}[wd=\paperwidth,ht=1pt,dp=0pt]{frametitle}
|
\begin{beamercolorbox}[wd=\paperwidth,ht=1pt,dp=0pt]{frametitle}
|
||||||
\progressbar@titleprogressbar
|
\usebeamercolor{palette quaternary}
|
||||||
|
\progressbar{\paperwidth}
|
||||||
\end{beamercolorbox}
|
\end{beamercolorbox}
|
||||||
\fi
|
\fi
|
||||||
\vspace{\@mtheme@voffset}
|
\vspace{\@mtheme@voffset}
|
||||||
|
|
Loading…
Reference in New Issue
Block a user