From deada505e9173fcc10c61b211de976af52c3b906 Mon Sep 17 00:00:00 2001
From: Frank Fuhlbrück
Date: Fri, 28 Jan 2022 18:53:11 +0100
Subject: don't do sheet page actions for skipped sheets

---
 exercisesheets.sty | 8 ++++++--
 1 file changed, 6 insertions(+), 2 deletions(-)

(limited to 'exercisesheets.sty')

diff --git a/exercisesheets.sty b/exercisesheets.sty
index 9406beb..3eb8d9f 100644
--- a/exercisesheets.sty
+++ b/exercisesheets.sty
@@ -585,7 +585,7 @@
 \newcounter{sheetid}% only used to disambiguate hyperref labels
 \newenvironment{sheet}[1][]{%
   \pgfkeys{exsh,every sheet,#1}%
-  \pgfkeysvalueof{/exsh/sheet start page action}%
+%   \pgfkeysvalueof{/exsh/sheet start page action}%
   \stepcounter{sheetid}%
   \ifthenelse{\equal{}{\pgfkeysvalueof{/exsh/title}}}{%
     \numdef\exsh@tmp{\value{part}+1}%
@@ -615,7 +615,9 @@
   \par
   \begingroup
   \ifnum\value{page}=1\thispagestyle{empty}\fi
-  \pgfkeysvalueof{/exsh/sheet end page action}%
+  \ifexsh@isinrange
+    \pgfkeysvalueof{/exsh/sheet end page action}%
+  \fi
   \endgroup
   \ifexsh@exnumsheet
     \setcounter{section}{\exsh@exnumstore}%
@@ -737,6 +739,7 @@
 %%%%%%%%%%%%%%% BEGIN BEAMER-SPECIFIC: %%%%%%%%%%%%%%%%%%%%%%%%%%%%
 \ifexsh@beamer 
 \def\exsh@sheethead{%
+  \pgfkeysvalueof{/exsh/sheet start page action}%
   \pgfkeysgetvalue{/exsh/title}{\exsh@tmp}%
   \ifexsh@solutions
     \expandafter\edef\expandafter\exsh@tmp{\expandonce\exsh@tmp:\noexpand~\pgfkeysvalueof{/exsh/strings/solutions}}%
@@ -780,6 +783,7 @@
 }
 \else%--------- NON-BEAMER: ---------------------------------------
 \def\exsh@sheethead{%
+  \pgfkeysvalueof{/exsh/sheet start page action}%
   \pgfkeysgetvalue{/exsh/title}{\exsh@tmp}%
   \ifexsh@solutions
     \expandafter\edef\expandafter\exsh@tmp{\expandonce\exsh@tmp:\noexpand~\pgfkeysvalueof{/exsh/strings/solutions}}%
-- 
cgit v1.2.3

