From 0b07c510c42afe553397dfe8842768647e775a2b Mon Sep 17 00:00:00 2001 From: Erich Schubert Date: Thu, 13 Sep 2018 16:59:55 +0200 Subject: [PATCH 1/2] Use `pgfmathsetlength`, and max progress bars out at 1 Fixes #274 for frame --- source/beamerouterthememetropolis.dtx | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) diff --git a/source/beamerouterthememetropolis.dtx b/source/beamerouterthememetropolis.dtx index a1d91f19..3b96062f 100644 --- a/source/beamerouterthememetropolis.dtx +++ b/source/beamerouterthememetropolis.dtx @@ -191,9 +191,7 @@ \setlength{\metropolis@progressinheadfoot@linewidth}{0.4pt} \setbeamertemplate{progress bar in head/foot}{ \nointerlineskip - \setlength{\metropolis@progressinheadfoot}{% - \paperwidth * \ratio{\insertframenumber pt}{\inserttotalframenumber pt}% - }% + \pgfmathsetlength{\metropolis@progressinheadfoot}{\paperwidth * min(1,\insertframenumber/\inserttotalframenumber} \begin{beamercolorbox}[wd=\paperwidth]{progress bar in head/foot} \tikzexternaldisable% \begin{tikzpicture} From e4d30420571925cdb6e73badc1302bc4be303165 Mon Sep 17 00:00:00 2001 From: Erich Schubert Date: Thu, 13 Sep 2018 17:03:54 +0200 Subject: [PATCH 2/2] Use `pgfmathsetlength`, which has a `min` to max the bar at 1 This should also avoid the problem described below (which in turn should also have occurred in the title progressbar?) --- source/beamerinnerthememetropolis.dtx | 18 +----------------- 1 file changed, 1 insertion(+), 17 deletions(-) diff --git a/source/beamerinnerthememetropolis.dtx b/source/beamerinnerthememetropolis.dtx index f65378fc..4afe0e1e 100644 --- a/source/beamerinnerthememetropolis.dtx +++ b/source/beamerinnerthememetropolis.dtx @@ -335,9 +335,7 @@ \newlength{\metropolis@progressonsectionpage@linewidth} \setlength{\metropolis@progressonsectionpage@linewidth}{0.4pt} \setbeamertemplate{progress bar in section page}{ - \setlength{\metropolis@progressonsectionpage}{% - \textwidth * \ratio{\insertframenumber pt}{\inserttotalframenumber pt}% - }% + \pgfmathsetlength{\metropolis@progressonsectionpage}{\textwidth * min(1,\insertframenumber/\inserttotalframenumber}% \tikzexternaldisable% \begin{tikzpicture} \fill[bg] (0,0) rectangle (\textwidth, \metropolis@progressonsectionpage@linewidth); @@ -346,20 +344,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 -% |\metropolis@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} % %