From 05339793b0a7443b95d76cb051b7b4766fc20082 Mon Sep 17 00:00:00 2001
From: Sebastian Kuhnert
Date: Thu, 23 Oct 2008 08:29:35 +0000
Subject: exercisesheets.sty: add option solutions=oral

---
 exercisesheets.sty | 58 +++++++++++++++++++++++++++++++++++-------------------
 1 file changed, 38 insertions(+), 20 deletions(-)

(limited to 'exercisesheets.sty')

diff --git a/exercisesheets.sty b/exercisesheets.sty
index a079221..a119b99 100644
--- a/exercisesheets.sty
+++ b/exercisesheets.sty
@@ -1,5 +1,5 @@
-\def\fileversion{0.5}
-\def\filedate{2008/07/31}
+\def\fileversion{0.5a}
+\def\filedate{2008/10/23}
 
 % TODO: fix loading of babel before this package
 
@@ -21,8 +21,13 @@
 % configuration keys
 
 \newif\ifexsh@solutions
+\newif\ifexsh@nonoralsolutions\exsh@nonoralsolutionstrue
 \pgfkeys{/exsh/.is family,/exsh,
-  solutions/.is if=exsh@solutions,solutions/.default=true,
+  solutions/.is choice,
+  solutions/true/.code=\exsh@solutionstrue\exsh@nonoralsolutionstrue,
+  solutions/oral/.code=\exsh@solutionstrue\exsh@nonoralsolutionsfalse,
+  solutions/false/.code=\exsh@solutionsfalse\exsh@nonoralsolutionsfalse,
+  solutions/.default=true,
   only/.initial={-},
   all/.style={/exsh/only={-}},all/.value forbidden,
   solutionsby/.code={\def\exsh@solutionsby{#1}},solutionsby/.value required,
@@ -471,24 +476,37 @@
 }
 \newenvironment{solution}[1][]{%
   \pgfkeys{exsh,every solution,#1,solution font}%
-  \exsh@startsolution
-}{}
-\ifexsh@solutions
-  \def\exsh@startsolution{\@afterindentfalse
-    \vskip\pgfkeysvalueof{/exsh/above solution skip}\relax%
-    {\parindent \z@
-      \pgfkeysvalueof{/exsh/solution title font}\nobreak
-      \pgfkeysvalueof{/exsh/strings/solution}:\par\nobreak}\nobreak%
-    \@afterheading
+  \ifbool{exsh@solutions}{%
+    \ifbool{exsh@nonoralsolutions}{%
+      \let\next\exsh@startsolution
+    }{%
+      \ifthenelse{\equal{oral}{\pgfkeysvalueof{/exsh/points}}}{%
+        \let\next\exsh@startsolution
+      }{%
+        \let\next\exsh@skipsolution
+      }%
+    }%
+  }{%
+    \let\next\next\exsh@skipsolution
   }%
-\else
-  \long\def\exsh@startsolution#1{%
-    \ifstrequal{#1}{\end}{\exsh@endsolution}{\exsh@startsolution}%
-  }
-  \def\exsh@endsolution#1{%
-    \ifstrequal{#1}{solution}{\end{solution}}{\exsh@startsolution}%
-  }
-\fi
+  \next
+}{}
+
+\def\exsh@startsolution{\@afterindentfalse
+  \vskip\pgfkeysvalueof{/exsh/above solution skip}\relax%
+  {\parindent \z@
+    \pgfkeysvalueof{/exsh/solution title font}\nobreak
+    \pgfkeysvalueof{/exsh/strings/solution}:\par\nobreak}\nobreak%
+  \@afterheading
+}%
+
+\long\def\exsh@skipsolution#1{%
+  \ifstrequal{#1}{\end}{\exsh@endsolution}{\exsh@skipsolution}%
+}
+\def\exsh@endsolution#1{%
+  \ifstrequal{#1}{solution}{\end{solution}}{\exsh@skipsolution}%
+}
+
 
 \newcommand{\pun}[1][]{\space\hspace*{\fill}{\pgfkeysvalueof{/exsh/points font}\mbox{(#1)}}}
 
-- 
cgit v1.2.3

