aboutsummaryrefslogtreecommitdiff
path: root/exercisesheets-beamer.sty
diff options
context:
space:
mode:
authorFrank Fuhlbrück2022-01-21 18:01:24 +0100
committerFrank Fuhlbrück2022-01-21 18:01:24 +0100
commit0f1e5c6c1712957a86654177d55175aaf7cd2f8e (patch)
tree63120bd2ac9ef3055d2865898d72e329e8835279 /exercisesheets-beamer.sty
parent392ef991c763e22a148b0b8bd344c18c42b94069 (diff)
downloadexercisesheets-0f1e5c6c1712957a86654177d55175aaf7cd2f8e.tar.gz
exercisesheets-0f1e5c6c1712957a86654177d55175aaf7cd2f8e.tar.bz2
exercisesheets-0f1e5c6c1712957a86654177d55175aaf7cd2f8e.zip
environments for main task and subtasks
Diffstat (limited to 'exercisesheets-beamer.sty')
-rw-r--r--exercisesheets-beamer.sty64
1 files changed, 63 insertions, 1 deletions
diff --git a/exercisesheets-beamer.sty b/exercisesheets-beamer.sty
index 5ac11f4..1cc949e 100644
--- a/exercisesheets-beamer.sty
+++ b/exercisesheets-beamer.sty
@@ -18,7 +18,7 @@
%\NeedsTeXFormat{LaTeX2e}[1994/12/01]
% don't forget to update the version and date in exercisesheets.tex
-\def\exsh@version{0.10-Beamer}
+\def\exsh@version{0.10+}
\def\exsh@date{2022/01/12}
\ProvidesPackage{exercisesheets-beamer}[\exsh@date\space\exsh@version\space Typesetting of exercise sheets]
@@ -46,6 +46,7 @@
% configuration keys
\newif\ifexsh@patchenumerate\exsh@patchenumeratetrue
+\newif\ifexsh@savetasks
\newif\ifexsh@solutions
\newif\ifexsh@oralsolutions
\newif\ifexsh@nonoralsolutions
@@ -80,6 +81,8 @@
\pgfkeys{/exsh/.is family,/exsh,
patchenumerate/.is if=exsh@patchenumerate,
patchenumerate/.default=true,
+ savetasks/.is if=exsh@savetasks,
+ savetasks/.default=true,
solutions/.is choice,
solutions/true/.code=\exsh@solutionstrue\exsh@oralsolutionstrue\exsh@nonoralsolutionstrue,
solutions/oral/.code=\exsh@solutionstrue\exsh@oralsolutionstrue\exsh@nonoralsolutionsfalse,
@@ -212,6 +215,7 @@
optional/.value forbidden,
exercisemark/.initial={},
difficult/.style={/exsh/exercisemark=*},difficult/.value forbidden,
+ savetasks/.initial=false,
%
% translatable strings
strings/sheet/.initial={},
@@ -309,6 +313,9 @@
sheet title font/.initial=\Large\bfseries,
exercise title font/.initial=\bfseries,
points font/.initial=\itshape,
+ main task font/.initial={},
+ subtask font/.initial={},
+ task restate font/.initial=\itshape,
hint font/.initial={},
hint title font/.initial=\itshape,
solution font/.initial={},
@@ -929,6 +936,61 @@
% reset equation numbering for each exercise
\@addtoreset{equation}{section}
+\long\def\exsh@savemaintask#1{%
+ \global\def\exsh@restatetaskmain{#1}%
+ #1%
+}
+
+\newenvironment{maintask}[1][]{%
+ \pgfkeys{exsh,#1}%
+ \pgfkeysvalueof{/exsh/main task font}%
+ \ifbool{exsh@savetasks}{\Collect@Body\exsh@savemaintask}{}%
+ \ignorespaces
+}{}
+
+%we ignore everything before the frist item
+%and process everything afterwards
+\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
+}
+
+\long\def\exsh@collectedsubtasks#1{
+\begin{enumerate}
+\exsh@processsubtasks#1\item\item
+\end{enumerate}%
+}
+
+\def\exsh@subtaskenv{enumerate}
+\def\exsh@subtaskitm{item}
+\def\exsh@subtaskctr{enumi}
+\newenvironment{subtasks}[1][]{%
+ \pgfkeys{exsh,#1}%
+ \begin{\exsh@subtaskenv}
+ \ignorespaces
+}{
+ \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]{%
+ {\pgfkeysvalueof{/exsh/task restate font}%
+ \csname exsh@restatetask#1\endcsname}%
+}
+
\newenvironment{hint}[1][]{%
\par
\pgfkeys{exsh,every hint,#1,hint font}%