Commit ed9b4701 authored by Michael Eischer's avatar Michael Eischer
Browse files

Limit progress bar to 100%

Adapted from https://github.com/matze/mtheme/pull/343 by kno10
parent 63b33b9e
......@@ -359,9 +359,7 @@
\newlength{\neo@progressonsectionpage@linewidth}
\setlength{\neo@progressonsectionpage@linewidth}{0.4pt}
\setbeamertemplate{progress bar in section page}{
\setlength{\neo@progressonsectionpage}{%
\textwidth * \ratio{\insertframenumber pt}{\inserttotalframenumber pt}%
}%
\pgfmathsetlength{\neo@progressonsectionpage}{\textwidth * min(1,\insertframenumber/\inserttotalframenumber}%
\tikzexternaldisable%
\begin{tikzpicture}
\fill[bg] (0,0) rectangle (\textwidth, \neo@progressonsectionpage@linewidth);
......@@ -370,20 +368,6 @@
\tikzexternalenable%
}
% \end{macrocode}
%
% The above code assumes that |\insertframenumber| is less than or equal to
% |\inserttotalframenumber|. However, this is not true on the first compile;
% in the absence of an |.aux| file, |\inserttotalframenumber| defaults to 1.
% This behaviour could cause fatal errors for long presentations, as
% |\neo@progressonsectionpage| would exceed \TeX's maximum length
% (16383.99999pt, roughly 5.75 metres or 18.9 feet).
% To avoid this, we increase the default value for |\inserttotalframenumber|;
% presentations with over 4000 slides will still break on first compile, but
% users in that situation likely have deeper problems to solve.
%
% \begin{macrocode}
\def\inserttotalframenumber{100}
% \end{macrocode}
% \end{macro}
%
%
......
......@@ -307,9 +307,7 @@
\setlength{\neo@progressinheadfoot@linewidth}{0.8pt}
\setbeamertemplate{progress bar in head/foot}{
\nointerlineskip
\setlength{\neo@progressinheadfoot}{%
\paperwidth * \ratio{\insertframenumber pt}{\inserttotalframenumber pt}%
}%
\pgfmathsetlength{\neo@progressinheadfoot}{\paperwidth * min(1,\insertframenumber/\inserttotalframenumber}%
\begin{beamercolorbox}[wd=\paperwidth]{progress bar in head/foot}
\tikzexternaldisable%
\begin{tikzpicture}
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment