From c4ea6a1d69c73656db55d45aebb396d5e0e78951 Mon Sep 17 00:00:00 2001
From: Frank Fuhlbrück
Date: Mon, 7 Nov 2022 13:39:29 +0100
Subject: v. 0.13: better handling of restatetask and subtask references

---
 exercisesheets.sty | 32 +++++++++++++++++++++++++++-----
 1 file changed, 27 insertions(+), 5 deletions(-)

(limited to 'exercisesheets.sty')

diff --git a/exercisesheets.sty b/exercisesheets.sty
index 7e2c77a..fa9f6d7 100644
--- a/exercisesheets.sty
+++ b/exercisesheets.sty
@@ -18,8 +18,8 @@
 %\NeedsTeXFormat{LaTeX2e}[1994/12/01]
 
 % don't forget to update the version and date in exercisesheets.tex
-\def\exsh@version{0.12.2}
-\def\exsh@date{2022/10/19}
+\def\exsh@version{0.13}
+\def\exsh@date{2022/11/07}
 
 \ProvidesPackage{exercisesheets}[\exsh@date\space\exsh@version\space Typesetting of exercise sheets]
 \message{`Typesetting of exercise sheets' \exsh@version\space <\exsh@date>}
@@ -1257,27 +1257,49 @@
 \newenvironment{subtasks}[1][]{%
   \pgfkeys{exsh,#1}%
   \begin{\exsh@subtaskenv}
-  \ignorespaces
+  \ignorespaces\begingroup
 }{
+  \endgroup
   \end{\exsh@subtaskenv}%
 }
 
 \newcommand{\subtask}[2][]{%
+  \endgroup
   \begingroup
   \pgfkeys{exsh,#1}%
   \csname\exsh@subtaskitm\endcsname%
     {\pgfkeysvalueof{/exsh/subtask font} #2}%
   \ifbool{exsh@savetasks}{%
     \csgdef{exsh@restatetask\arabic{\exsh@subtaskctr}}{#2}%
+    \csdef{exsh@restatetaskcur}{#2}%
   }{}%
-  \endgroup
 }
 
-\newcommand{\restatetask}[1][main]{%
+\def\restatetask{%
+  \@ifstar\exsh@restatetask@\exsh@restatetask%
+}
+
+\newcommand{\exsh@restatetask}[1][main]{%
   {\pgfkeysvalueof{/exsh/task restate font}%
   \csname exsh@restatetask#1\endcsname}%
 }
 
+\newcommand{\exsh@restatetask@}[1][main]{%
+  {\pgfkeysvalueof{/exsh/task restate font}%
+  \csname exsh@restatetask#1\endcsname}\\%
+}
+
+%%%%%%%%%%%%%%% BEGIN BEAMER-SPECIFIC: %%%%%%%%%%%%%%%%%%%%%%%%%%%%
+\ifexsh@beamer 
+  \let\restatetaskbeamer\restatetask
+\else%--------- NON-BEAMER: ---------------------------------------
+  \def\restatetaskbeamer{%
+    \@ifstar\exsh@restatetaskbeamer\exsh@restatetaskbeamer%
+  }
+  \newcommand{\exsh@restatetaskbeamer}[1][main]{}
+\fi
+%%%%%%%%%%%%%%% END BEAMER-SPECIFIC %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
+
 \newenvironment{hint}[1][]{%
   \par
   \pgfkeys{exsh,every hint,#1,hint font}%
-- 
cgit v1.2.3

