Skip to content

Commit

Permalink
Limit progress bar to 100%
Browse files Browse the repository at this point in the history
Adapted from matze/mtheme#343 by kno10
  • Loading branch information
MichaelEischer committed Dec 11, 2020
1 parent 63b33b9 commit ed9b470
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 20 deletions.
18 changes: 1 addition & 17 deletions beamertheme-source/beamerinnerthemeneo.dtx
Original file line number Diff line number Diff line change
Expand Up @@ -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);
Expand All @@ -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}
%
%
Expand Down
4 changes: 1 addition & 3 deletions beamertheme-source/beamerouterthemeneo.dtx
Original file line number Diff line number Diff line change
Expand Up @@ -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}
Expand Down

0 comments on commit ed9b470

Please sign in to comment.