aboutsummaryrefslogtreecommitdiff
path: root/exercisesheets.sty
diff options
context:
space:
mode:
Diffstat (limited to 'exercisesheets.sty')
-rw-r--r--exercisesheets.sty30
1 files changed, 21 insertions, 9 deletions
diff --git a/exercisesheets.sty b/exercisesheets.sty
index 9da1f41..fd0f574 100644
--- a/exercisesheets.sty
+++ b/exercisesheets.sty
@@ -1,5 +1,5 @@
%% exercisesheets.sty
-%% Copyright 2008-2017 Sebastian Kuhnert, Frank Fuhlbrück
+%% Copyright 2008-2022 Sebastian Kuhnert, Frank Fuhlbrück
%
% This work may be distributed and/or modified under the conditions
% of the LaTeX Project Public License, either version 1.3c of this
@@ -329,7 +329,7 @@
exercise title font/.initial=\bfseries,
points font/.initial=\itshape,
main task font/.initial={},
- subtasks font/.initial={},
+ subtask font/.initial={},
task restate font/.initial=\itshape,
hint font/.initial={},
hint title font/.initial=\itshape,
@@ -954,6 +954,7 @@
\long\def\exsh@processsubtasks#1\item#2\item{%
\ifstrequal{#2}{}{}{%
\item #2%
+\csgdef{exsh@restatetask\arabic{enumi}}{#2}%
\exsh@processsubtasks\item%new "frist" \item to ignore
}%no whitespace here is crucial for end detecttion
}
@@ -964,20 +965,31 @@
\end{enumerate}%
}
+\def\exsh@subtaskenv{enumerate}
+\def\exsh@subtaskitm{item}
+\def\exsh@subtaskctr{enumi}
\newenvironment{subtasks}[1][]{%
\pgfkeys{exsh,#1}%
- \pgfkeysvalueof{/exsh/subtasks font}%
- \ifbool{exsh@savetasks}{\Collect@Body\exsh@collectedsubtasks}{
- \begin{enumerate}
- }%
+ \begin{\exsh@subtaskenv}
\ignorespaces
}{
- \ifbool{exsh@savetasks}{}{\end{enumerate}}
+ \end{\exsh@subtaskenv}%
+}
+
+\newcommand{\subtask}[2][]{%
+ \begingroup
+ \pgfkeys{exsh,#1}%
+ \csname\exsh@subtaskitm\endcsname%
+ {\pgfkeysvalueof{/exsh/subtask font} #2}%
+ \ifbool{exsh@savetasks}{%
+ \csgdef{exsh@restatetask\arabic{\exsh@subtaskctr}}{#2}%
+ }{}%
+ \endgroup
}
-\newcommand{\restatetask}[1][main]{
+\newcommand{\restatetask}[1][main]{%
{\pgfkeysvalueof{/exsh/task restate font}%
- \csname exsh@restatetask#1\endcsname}
+ \csname exsh@restatetask#1\endcsname}%
}
\newenvironment{hint}[1][]{%