From dee8b303267c2567d9bb8e847bcbb45480bacf5c Mon Sep 17 00:00:00 2001 From: Sebastian Kuhnert Date: Fri, 27 Nov 2009 12:12:00 +0000 Subject: exercisesheets.sty: add ifsolutions key --- exercisesheets.sty | 5 +++++ exercisesheets.tex | 24 +++++++++++++++++++++++- 2 files changed, 28 insertions(+), 1 deletion(-) diff --git a/exercisesheets.sty b/exercisesheets.sty index 0c9da03..42470e5 100644 --- a/exercisesheets.sty +++ b/exercisesheets.sty @@ -187,6 +187,11 @@ below exercise title skip/.initial={\parskip}, above solution skip/.initial={1ex}, above hint skip/.initial={1ex}, + % + % conditionals + ifsolutions/.code 2 args={\ifsolutions{\pgfkeysalso{#1}}{\pgfkeysalso{#2}}}, + iforalsolutions/.code 2 args={\iforalsolutions{\pgfkeysalso{#1}}{\pgfkeysalso{#2}}}, + ifnonoralsolutions/.code 2 args={\ifnonoralsolutions{\pgfkeysalso{#1}}{\pgfkeysalso{#2}}}, } % default values diff --git a/exercisesheets.tex b/exercisesheets.tex index 256f7d7..751735a 100644 --- a/exercisesheets.tex +++ b/exercisesheets.tex @@ -404,11 +404,33 @@ The following options allow fine-tuning of the spacing: \ifnonoralsolutions{(*\param{if true}*)}{(*\param{if false}*)} \end{lstlisting} -Example: Only include points for sub-exercises when solutions are typeset: +There are also special options for conditionals to be used in the arguments of +the environments defined by this package: +\begin{description} + \item[\option{ifsolutions=\{\param{options if true}\}\{\param{options if + false}\}}] Execute \param{options if true} if solutions are included in + the current document, \param{options if false} otherwise. + \item[\option{iforalsolutions=\{\param{options if true}\}\{\param{options if + false}\}}] Execute \param{options if true} if solutions for oral exercises + are included in the current document, \param{options if false} otherwise. + \item[\option{ifnonoralsolutions=\{\param{options if true}\}\{\param{options if + false}\}}] Execute \param{options if true} if solutions for non-oral + exercises are included in the current document, \param{options if false} + otherwise. +\end{description} + +Example 1: Only include points for sub-exercises when solutions are typeset: \begin{lstlisting} \ifsolutions{}{\renewcommand{\points}[2][]{}} \end{lstlisting} +Example 2: Modify the sheet header spacing in the non-solution version: +\begin{lstlisting} +\begin{sheet}[ifsolutions={}{above title skip=2ex}]% usually 4ex + \dots +\end{sheet} +\end{lstlisting} + \subsection{Using Hooks} There are several hooks used by \exsh: \begin{description} -- cgit v1.2.3