aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorSebastian Kuhnert2008-10-23 08:29:35 +0000
committerSebastian Kuhnert2008-10-23 08:29:35 +0000
commit05339793b0a7443b95d76cb051b7b4766fc20082 (patch)
tree4e8d855d25e0921aa1b1e3d2c0c198f3241b44d8
parent4138a5296448f9216f4e8af646ea204f26ac3be4 (diff)
downloadexercisesheets-05339793b0a7443b95d76cb051b7b4766fc20082.tar.gz
exercisesheets-05339793b0a7443b95d76cb051b7b4766fc20082.tar.bz2
exercisesheets-05339793b0a7443b95d76cb051b7b4766fc20082.zip
exercisesheets.sty: add option solutions=oral
-rw-r--r--exercisesheets.sty58
-rw-r--r--exercisesheets.tex8
2 files changed, 43 insertions, 23 deletions
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)}}}
diff --git a/exercisesheets.tex b/exercisesheets.tex
index fb74d6b..01d5c3b 100644
--- a/exercisesheets.tex
+++ b/exercisesheets.tex
@@ -35,7 +35,7 @@
\title{The \exsh Package}
\author{Sebastian Kuhnert}
-\date{July 31th, 2008}
+\date{October 23rd, 2008}
\begin{document}
\maketitle
@@ -112,10 +112,12 @@ The following options are available:
\end{description}
\item[\option{all}] Typeset all sheets (equivalent to \option{only=-}). This is
the default.
- \item[\option{solutions\opt{=\param{true/false}}}] By default, solutions
+ \item[\option{solutions\opt{=\param{true/false/oral}}}] By default, solutions
(provided in the \texttt{solution} environment) are not included in the
output. By providing the option \option{solutions=true} (or just
- \option{solutions}) this can be changed.
+ \option{solutions}) this can be changed. Choosing \option{solutions=oral}
+ shows only solutions for exercises marked \option{oral}. The latter is useful
+ for printouts taken to class.
\item[\option{solutionsby=\param{name/names}}] Use this to give the authors of the
solutions. They are credited at the beginning of each sheet, if the solutions
are included in the output.