aboutsummaryrefslogtreecommitdiff
path: root/exercisesheets.sty
diff options
context:
space:
mode:
authorFrank Fuhlbrück2022-01-19 16:29:14 +0100
committerFrank Fuhlbrück2022-01-19 16:29:14 +0100
commit392ef991c763e22a148b0b8bd344c18c42b94069 (patch)
treed62c4c83bd36573db92b7b734f9634a0a288bd7c /exercisesheets.sty
parent338d4d9cc7b9a6a42a08375087f79954f19c5f59 (diff)
downloadexercisesheets-392ef991c763e22a148b0b8bd344c18c42b94069.tar.gz
exercisesheets-392ef991c763e22a148b0b8bd344c18c42b94069.tar.bz2
exercisesheets-392ef991c763e22a148b0b8bd344c18c42b94069.zip
task evironments (NOT finished)
Diffstat (limited to 'exercisesheets.sty')
-rw-r--r--exercisesheets.sty54
1 files changed, 53 insertions, 1 deletions
diff --git a/exercisesheets.sty b/exercisesheets.sty
index 2d8298d..9da1f41 100644
--- a/exercisesheets.sty
+++ b/exercisesheets.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}
+\def\exsh@version{0.10+git}
\def\exsh@date{2022/01/12}
\ProvidesPackage{exercisesheets}[\exsh@date\space\exsh@version\space Typesetting of exercise sheets]
@@ -29,6 +29,7 @@
\RequirePackage{etoolbox}%[2008/06/28]
\RequirePackage{scrlfile}
+\RequirePackage{environ}
\RequirePackage{pgfkeys}
\RequirePackage{keyval}
@@ -45,6 +46,7 @@
% configuration keys
\newif\ifexsh@patchenumerate\exsh@patchenumeratetrue
+\newif\ifexsh@savetasks
\newif\ifexsh@solutions
\newif\ifexsh@oralsolutions
\newif\ifexsh@nonoralsolutions
@@ -68,6 +70,7 @@
\PackageError{exercisesheets}{
beamercompatibility used twice}{}%
\else
+ %TODO:\only<>{A} -> {A} which breaks global effects of A
\let\pause\relax
\def\frame{}
\renewcommand{\frame}[1][]{}
@@ -96,6 +99,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,
@@ -225,6 +230,7 @@
optional/.value forbidden,
exercisemark/.initial={},
difficult/.style={/exsh/exercisemark=*},difficult/.value forbidden,
+ savetasks/.initial=false,
%
% translatable strings
strings/sheet/.initial={},
@@ -322,6 +328,9 @@
sheet title font/.initial=\Large\bfseries,
exercise title font/.initial=\bfseries,
points font/.initial=\itshape,
+ main task font/.initial={},
+ subtasks font/.initial={},
+ task restate font/.initial=\itshape,
hint font/.initial={},
hint title font/.initial=\itshape,
solution font/.initial={},
@@ -928,6 +937,49 @@
% 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%
+\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}%
+}
+
+\newenvironment{subtasks}[1][]{%
+ \pgfkeys{exsh,#1}%
+ \pgfkeysvalueof{/exsh/subtasks font}%
+ \ifbool{exsh@savetasks}{\Collect@Body\exsh@collectedsubtasks}{
+ \begin{enumerate}
+ }%
+ \ignorespaces
+}{
+ \ifbool{exsh@savetasks}{}{\end{enumerate}}
+}
+
+\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}%