diff options
| author | Frank Fuhlbrück | 2022-11-07 13:39:29 +0100 |
|---|---|---|
| committer | Frank Fuhlbrück | 2022-11-07 13:39:29 +0100 |
| commit | c4ea6a1d69c73656db55d45aebb396d5e0e78951 (patch) | |
| tree | 9f63a5a540987db3cca03e6a0de1a38c2f03cb33 | |
| parent | 676e0757a8da271e0695d32ee2c096f37a071b60 (diff) | |
| download | exercisesheets-0.13.tar.gz exercisesheets-0.13.tar.bz2 exercisesheets-0.13.zip | |
v. 0.13: better handling of restatetask and subtask references0.13
| -rw-r--r-- | exercisesheets.sty | 32 | ||||
| -rw-r--r-- | exercisesheets.tex | 56 |
2 files changed, 70 insertions, 18 deletions
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}% diff --git a/exercisesheets.tex b/exercisesheets.tex index 2e74f6c..d73c540 100644 --- a/exercisesheets.tex +++ b/exercisesheets.tex @@ -53,7 +53,7 @@ \usepackage[english,iso]{isodate} \title{The \exsh Package} \author{Sebastian Kuhnert\and Frank Fuhlbrück} -\date{Version 0.12, \printdateTeX{2022/09/02}} +\date{Version 0.13, \printdateTeX{2022/11/07}} \begin{document} \maketitle @@ -469,26 +469,43 @@ much mandatory structure inside exercises. Furthermore, the situations where we want more explicit structure, for instance to have special font for the main task or the subtasks or to reuse some of the tasks later. This is especially handy if using the -beamer variant where the origial task and a part of the solution might be on different slides. In the future it might be possible to +beamer variant where the original task and a part of the solution might be on different slides. In the future it might be possible to use other counters then \verb|enumi|, which is also only possible if sub-exercises are not simply \verb|\item|s in -\verb|enumerate|. +\verb|enumerate|. If you want to reuse the main or any subtasks +you may use \verb|\restatetask| or \verb|\restatetaskbeamer| +(this shows noting if not compiled with beamer). There is also +a starred version (\verb|\restatetask*| / +\verb|\restatetaskbeamer*|) for each of them, which adds a newline. +All four have an optional argument that allows to restate +a subtask instead of the main task. This argument is either +\option{main}, a number of a \textbf{previous} subtask or +\option{cur} for the current subtask. + \begin{lstlisting} -\begin{exercise}[points=sum]%sum produces 4+6 +\begin{exercise}[points=oral] \begin{maintask} - This is the main task. + A and B are true. \end{maintask} \begin{subtasks} - \subtask{first} - \subtask{second} + \subtask{A is true} + \begin{solution}[framed] + We want to show: \restatestask %A and B are true. + \newframe + Out first step is to show: \restatetask[cur] %A is true + \end{solution} + \subtask{If A is true, B is true.} + \begin{solution}[framed] + Obvious (i.e.: homework). + \end{solution} + \subtask{B is true} + \begin{solution}[framed] + We already know: \restatestask[1] and + \restatestask[2], therefore B is also true. + \end{solution} \end{subtasks} - \begin{solution}[framed] - We want to show: \restatestask %This is the main task. - \newframe - Out first step is to show: \restatetask[1] %first - \end{solution} \end{exercise} \end{lstlisting} @@ -822,7 +839,20 @@ This also works well in combination with a make file that generates \label{sec:changelog} \begin{itemize} - \item[v. 0.12.2:] 2022-10-20 + \item[v. 0.13:] 2022-11-07 + \begin{itemize} + \item bugfix: \verb|\begingroup| and \verb|\endgroup| + within \verb|\subtask| now contain everything up to the + next \verb|\subtask|. + \item \verb|\restatestask| has now a starred version that + adds a newline and beamer versions for both the + regular and the starred version. Furthermore, there + is an argument \option{cur} to restate the current + subtask (the one just given before). This is only + defined within the aforementioned group, i.e., + throws an error after \verb|\end{subtasks}|. + \end{itemize} + \item[v. 0.12.2:] 2022-10-20 \begin{itemize} \item bugfix: dofile with \verb|kpse.find_file| \item docs: document option \option{fragile} |
