From 95080bc66f5d1022cbcfbe7535a87055d02aa568 Mon Sep 17 00:00:00 2001 From: Karl Berry Date: Wed, 13 Mar 2013 22:35:46 +0000 Subject: probsoln (13mar13) git-svn-id: svn://tug.org/texlive/trunk@29371 c570f23f-e606-0410-a88d-b1316a301751 --- Master/texmf-dist/doc/latex/probsoln/CHANGES | 8 + Master/texmf-dist/doc/latex/probsoln/README | 4 +- .../doc/latex/probsoln/probsoln-manual.css | 170 +- .../doc/latex/probsoln/probsoln-manual.html | 3153 +++++++++++--------- .../doc/latex/probsoln/probsoln-manual.tex | 119 +- Master/texmf-dist/doc/latex/probsoln/probsoln.pdf | Bin 522144 -> 390794 bytes .../doc/latex/probsoln/samples/sample-exclude.tex | 129 + .../doc/latex/probsoln/samples/sample.pdf | Bin 127374 -> 81519 bytes .../doc/latex/probsoln/samples/sample.tex | 8 +- .../doc/latex/probsoln/samples/sample2.pdf | Bin 84459 -> 76287 bytes .../doc/latex/probsoln/samples/sample2.tex | 4 +- .../doc/latex/probsoln/samples/sample3.pdf | Bin 31901 -> 31901 bytes .../doc/latex/probsoln/samples/sample3.tex | 4 +- .../doc/latex/probsoln/samples/sample4.pdf | Bin 91464 -> 92920 bytes .../doc/latex/probsoln/samples/sample4.tex | 4 +- .../doc/latex/probsoln/samples/sample5.pdf | Bin 73995 -> 82851 bytes .../doc/latex/probsoln/samples/sample5.tex | 4 +- .../doc/latex/probsoln/samples/sample6.tex | 4 +- .../doc/latex/probsoln/samples/sample7.tex | 4 +- .../doc/latex/probsoln/samples/sample8.tex | 4 +- .../texmf-dist/source/latex/probsoln/probsoln.dtx | 750 ++++- .../texmf-dist/source/latex/probsoln/probsoln.ins | 8 +- Master/texmf-dist/tex/latex/probsoln/probsoln.sty | 264 +- 23 files changed, 3038 insertions(+), 1603 deletions(-) create mode 100644 Master/texmf-dist/doc/latex/probsoln/samples/sample-exclude.tex diff --git a/Master/texmf-dist/doc/latex/probsoln/CHANGES b/Master/texmf-dist/doc/latex/probsoln/CHANGES index 353a6ee6db8..3c3efc2c943 100644 --- a/Master/texmf-dist/doc/latex/probsoln/CHANGES +++ b/Master/texmf-dist/doc/latex/probsoln/CHANGES @@ -1,5 +1,13 @@ probsoln package versions: +Version 3.04: + + * fixed bug in textenum + +version 3.03: + + * added facility to exclude problems selected in the past n years + version 3.02: * Added xkeyval to required package list diff --git a/Master/texmf-dist/doc/latex/probsoln/README b/Master/texmf-dist/doc/latex/probsoln/README index d3a2a30d676..e3e0912a332 100644 --- a/Master/texmf-dist/doc/latex/probsoln/README +++ b/Master/texmf-dist/doc/latex/probsoln/README @@ -1,6 +1,6 @@ -LaTeX Package : probsoln v3.02 +LaTeX Package : probsoln v3.04 -Last Modified : 2011-12-10 +Last Modified : 2012-08-23 Author : Nicola L.C. Talbot diff --git a/Master/texmf-dist/doc/latex/probsoln/probsoln-manual.css b/Master/texmf-dist/doc/latex/probsoln/probsoln-manual.css index 0581f0a1a53..86f6de1a936 100644 --- a/Master/texmf-dist/doc/latex/probsoln/probsoln-manual.css +++ b/Master/texmf-dist/doc/latex/probsoln/probsoln-manual.css @@ -1,19 +1,86 @@ /* start css.sty */ -.ec-lmr-17{font-size:170%;} -.ec-lmr-12{font-size:120%;} -.ec-lmtt-12{font-size:120%; font-family: monospace;} -.ec-lmtt-12{ font-family: monospace;} -.ec-lmtt-12{ font-family: monospace;} -.ec-lmtt-12{ font-family: monospace;} -.ec-lmtt-12{ font-family: monospace;} -.ec-lmtt-12{ font-family: monospace;} -.ec-lmtt-12{ font-family: monospace;} -.ec-lmtt-12{ font-family: monospace;} -.ec-lmtt-12{ font-family: monospace;} -.ec-lmtt-12{ font-family: monospace;} -.ec-lmtt-12{ font-family: monospace;} -.ec-lmtt-12{ font-family: monospace;} +.ec-lmr-10x-x-109{} +.ec-lmss-10x-x-109{ font-family: sans-serif;} +.ec-lmss-10x-x-109{ font-family: sans-serif;} +.ec-lmss-10x-x-109{ font-family: sans-serif;} +.ec-lmss-10x-x-109{ font-family: sans-serif;} +.ec-lmss-10x-x-109{ font-family: sans-serif;} +.ec-lmss-10x-x-109{ font-family: sans-serif;} +.ec-lmss-10x-x-109{ font-family: sans-serif;} +.ec-lmss-10x-x-109{ font-family: sans-serif;} +.ec-lmss-10x-x-109{ font-family: sans-serif;} +.ec-lmss-10x-x-109{ font-family: sans-serif;} +.ec-lmss-10x-x-109{ font-family: sans-serif;} +.ec-lmss-10x-x-109{ font-family: sans-serif;} +.ec-lmss-10x-x-109{ font-family: sans-serif;} +.ec-lmssbx-10x-x-109{ font-family: sans-serif; font-weight: bold;} +.ec-lmssbx-10x-x-109{ font-family: sans-serif; font-weight: bold;} +.ec-lmssbx-10x-x-109{ font-family: sans-serif; font-weight: bold;} +.ec-lmssbx-10x-x-109{ font-family: sans-serif; font-weight: bold;} +.ec-lmssbx-10x-x-109{ font-family: sans-serif; font-weight: bold;} +.ec-lmssbx-10x-x-109{ font-family: sans-serif; font-weight: bold;} +.ec-lmssbx-10x-x-109{ font-family: sans-serif; font-weight: bold;} +.ec-lmssbx-10x-x-109{ font-family: sans-serif; font-weight: bold;} +.ec-lmssbx-10x-x-109{ font-family: sans-serif; font-weight: bold;} +.ec-lmssbx-10x-x-109{ font-family: sans-serif; font-weight: bold;} +.ec-lmssbx-10x-x-109{ font-family: sans-serif; font-weight: bold;} +.ec-lmssbx-10x-x-109{ font-family: sans-serif; font-weight: bold;} +.ec-lmssbx-10x-x-109{ font-family: sans-serif; font-weight: bold;} +.ec-lmssbx-10x-x-207{font-size:188%; font-family: sans-serif; font-weight: bold;} +.ec-lmssbx-10x-x-207{ font-family: sans-serif; font-weight: bold;} +.ec-lmssbx-10x-x-207{ font-family: sans-serif; font-weight: bold;} +.ec-lmssbx-10x-x-207{ font-family: sans-serif; font-weight: bold;} +.ec-lmssbx-10x-x-207{ font-family: sans-serif; font-weight: bold;} +.ec-lmssbx-10x-x-207{ font-family: sans-serif; font-weight: bold;} +.ec-lmssbx-10x-x-207{ font-family: sans-serif; font-weight: bold;} +.ec-lmssbx-10x-x-207{ font-family: sans-serif; font-weight: bold;} +.ec-lmssbx-10x-x-207{ font-family: sans-serif; font-weight: bold;} +.ec-lmssbx-10x-x-207{ font-family: sans-serif; font-weight: bold;} +.ec-lmssbx-10x-x-207{ font-family: sans-serif; font-weight: bold;} +.ec-lmssbx-10x-x-207{ font-family: sans-serif; font-weight: bold;} +.ec-lmssbx-10x-x-207{ font-family: sans-serif; font-weight: bold;} +.ec-lmr-12x-x-120{font-size:130%;} +.ec-lmtt-12x-x-120{font-size:130%; font-family: monospace;} +.ec-lmtt-12x-x-120{ font-family: monospace;} +.ec-lmtt-12x-x-120{ font-family: monospace;} +.ec-lmtt-12x-x-120{ font-family: monospace;} +.ec-lmtt-12x-x-120{ font-family: monospace;} +.ec-lmtt-12x-x-120{ font-family: monospace;} +.ec-lmtt-12x-x-120{ font-family: monospace;} +.ec-lmtt-12x-x-120{ font-family: monospace;} +.ec-lmtt-12x-x-120{ font-family: monospace;} +.ec-lmtt-12x-x-120{ font-family: monospace;} +.ec-lmtt-12x-x-120{ font-family: monospace;} +.ec-lmtt-12x-x-120{ font-family: monospace;} +.ec-lmtt-12x-x-120{ font-family: monospace;} +.ec-lmtt-10x-x-109{ font-family: monospace;} +.ec-lmtt-10x-x-109{ font-family: monospace;} +.ec-lmtt-10x-x-109{ font-family: monospace;} +.ec-lmtt-10x-x-109{ font-family: monospace;} +.ec-lmtt-10x-x-109{ font-family: monospace;} +.ec-lmtt-10x-x-109{ font-family: monospace;} +.ec-lmtt-10x-x-109{ font-family: monospace;} +.ec-lmtt-10x-x-109{ font-family: monospace;} +.ec-lmtt-10x-x-109{ font-family: monospace;} +.ec-lmtt-10x-x-109{ font-family: monospace;} +.ec-lmtt-10x-x-109{ font-family: monospace;} +.ec-lmtt-10x-x-109{ font-family: monospace;} +.ec-lmtt-10x-x-109{ font-family: monospace;} +.ec-lmbx-10x-x-109{ font-weight: bold;} +.ec-lmbx-10x-x-109{ font-weight: bold;} +.ec-lmbx-10x-x-109{ font-weight: bold;} +.ec-lmbx-10x-x-109{ font-weight: bold;} +.ec-lmbx-10x-x-109{ font-weight: bold;} +.ec-lmbx-10x-x-109{ font-weight: bold;} +.ec-lmbx-10x-x-109{ font-weight: bold;} +.ec-lmbx-10x-x-109{ font-weight: bold;} +.ec-lmbx-10x-x-109{ font-weight: bold;} +.ec-lmbx-10x-x-109{ font-weight: bold;} +.ec-lmbx-10x-x-109{ font-weight: bold;} +.ec-lmbx-10x-x-109{ font-weight: bold;} +.ec-lmbx-10x-x-109{ font-weight: bold;} +.ec-lmtt-10{font-size:90%; font-family: monospace;} .ec-lmtt-10{ font-family: monospace;} .ec-lmtt-10{ font-family: monospace;} .ec-lmtt-10{ font-family: monospace;} @@ -26,43 +93,27 @@ .ec-lmtt-10{ font-family: monospace;} .ec-lmtt-10{ font-family: monospace;} .ec-lmtt-10{ font-family: monospace;} -.ec-lmss-10{ font-family: sans-serif;} -.ec-lmss-10{ font-family: sans-serif;} -.ec-lmss-10{ font-family: sans-serif;} -.ec-lmss-10{ font-family: sans-serif;} -.ec-lmss-10{ font-family: sans-serif;} -.ec-lmss-10{ font-family: sans-serif;} -.ec-lmss-10{ font-family: sans-serif;} -.ec-lmss-10{ font-family: sans-serif;} -.ec-lmss-10{ font-family: sans-serif;} -.ec-lmss-10{ font-family: sans-serif;} -.ec-lmss-10{ font-family: sans-serif;} -.ec-lmss-10{ font-family: sans-serif;} -.ec-lmbx-10{ font-weight: bold;} -.ec-lmbx-10{ font-weight: bold;} -.ec-lmbx-10{ font-weight: bold;} -.ec-lmbx-10{ font-weight: bold;} -.ec-lmbx-10{ font-weight: bold;} -.ec-lmbx-10{ font-weight: bold;} -.ec-lmbx-10{ font-weight: bold;} -.ec-lmbx-10{ font-weight: bold;} -.ec-lmbx-10{ font-weight: bold;} -.ec-lmbx-10{ font-weight: bold;} -.ec-lmbx-10{ font-weight: bold;} -.ec-lmbx-10{ font-weight: bold;} -.ec-lmssbx-10{ font-family: sans-serif; font-weight: bold;} -.ec-lmssbx-10{ font-family: sans-serif; font-weight: bold;} -.ec-lmssbx-10{ font-family: sans-serif; font-weight: bold;} -.ec-lmssbx-10{ font-family: sans-serif; font-weight: bold;} -.ec-lmssbx-10{ font-family: sans-serif; font-weight: bold;} -.ec-lmssbx-10{ font-family: sans-serif; font-weight: bold;} -.ec-lmssbx-10{ font-family: sans-serif; font-weight: bold;} -.ec-lmssbx-10{ font-family: sans-serif; font-weight: bold;} -.ec-lmssbx-10{ font-family: sans-serif; font-weight: bold;} -.ec-lmssbx-10{ font-family: sans-serif; font-weight: bold;} -.ec-lmssbx-10{ font-family: sans-serif; font-weight: bold;} -.ec-lmssbx-10{ font-family: sans-serif; font-weight: bold;} -.ec-lmtt-9{font-size:90%; font-family: monospace;} +.rm-lmr-8x-x-103{font-size:74%;} +.lmmi-10x-x-109{} +.lmmi-8x-x-103{font-size:74%;} +.lmsy-10x-x-109{} +.ec-lmri-10x-x-109{ font-style:italic;} +.ec-lmri-10x-x-109{ font-style:italic;} +.ec-lmri-10x-x-109{ font-style:italic;} +.ec-lmri-10x-x-109{ font-style:italic;} +.ec-lmri-10x-x-109{ font-style:italic;} +.ec-lmri-10x-x-109{ font-style:italic;} +.ec-lmri-10x-x-109{ font-style:italic;} +.ec-lmri-10x-x-109{ font-style:italic;} +.ec-lmri-10x-x-109{ font-style:italic;} +.ec-lmri-10x-x-109{ font-style:italic;} +.ec-lmri-10x-x-109{ font-style:italic;} +.ec-lmri-10x-x-109{ font-style:italic;} +.ec-lmri-10x-x-109{ font-style:italic;} +.ec-lmr-10{font-size:90%;} +.ec-lmr-9{font-size:81%;} +.ec-lmtt-9{font-size:81%; font-family: monospace;} +.ec-lmtt-9{ font-family: monospace;} .ec-lmtt-9{ font-family: monospace;} .ec-lmtt-9{ font-family: monospace;} .ec-lmtt-9{ font-family: monospace;} @@ -74,22 +125,6 @@ .ec-lmtt-9{ font-family: monospace;} .ec-lmtt-9{ font-family: monospace;} .ec-lmtt-9{ font-family: monospace;} -.rm-lmr-8x-x-95{font-size:76%;} -.lmmi-8x-x-95{font-size:76%;} -.ec-lmri-10{ font-style:italic;} -.ec-lmri-10{ font-style:italic;} -.ec-lmri-10{ font-style:italic;} -.ec-lmri-10{ font-style:italic;} -.ec-lmri-10{ font-style:italic;} -.ec-lmri-10{ font-style:italic;} -.ec-lmri-10{ font-style:italic;} -.ec-lmri-10{ font-style:italic;} -.ec-lmri-10{ font-style:italic;} -.ec-lmri-10{ font-style:italic;} -.ec-lmri-10{ font-style:italic;} -.ec-lmri-10{ font-style:italic;} -.ec-lmr-9{font-size:90%;} -.ec-lmr-8{font-size:80%;} p.noindent { text-indent: 0em } td p.noindent { text-indent: 0em; margin-top:0em; } p.nopar { text-indent: 0em; } @@ -198,6 +233,7 @@ div.thanks{text-align:left; margin-left:10%; font-size:85%; font-style:italic; } .quotation {margin-bottom:0.25em; margin-top:0.25em; margin-left:1em; } .abstract p {margin-left:5%; margin-right:5%;} div.abstract {width:100%;} +span.footnote-mark sup.textsuperscript, span.footnote-mark a sup.textsuperscript{ font-size:80%; } table.multicols { width:100%; margin-left:1em; margin-top:1em; margin-bottom:1em; } .equation td{text-align:center; } .equation-star td{text-align:center; } diff --git a/Master/texmf-dist/doc/latex/probsoln/probsoln-manual.html b/Master/texmf-dist/doc/latex/probsoln/probsoln-manual.html index 5f2552db5b0..55dfa44a832 100644 --- a/Master/texmf-dist/doc/latex/probsoln/probsoln-manual.html +++ b/Master/texmf-dist/doc/latex/probsoln/probsoln-manual.html @@ -1,36 +1,102 @@ - + -probsoln v3.02: creating problem sheets optionally with solutions - +probsoln v3.04: creating problem sheets optionally with solutions + - + - + -
+
- - +
+
-

probsoln v3.02: creating problem sheets optionally -with solutions

-
Nicola L.C. Talbot -
School of Computing Sciences -
University of East Anglia -
Norwich. Norfolk +

probsoln v3.04: creating problem +sheets optionally with solutions

+
Nicola L.C. Talbot
NR4 7TJ. United Kingdom. +class="ec-lmr-12x-x-120">School of Computing Sciences +
University of East Anglia +
Norwich. Norfolk +
NR4 7TJ. United Kingdom.
http://theoval.cmp.uea.ac.uk/~nlct/

+class="ec-lmtt-12x-x-120">http://theoval.cmp.uea.ac.uk/~nlct/

2011-12-10
-
-

2012-08-23

+ +

Contents

-
- 1 + 1 Introduction -
2 2 Package Options -
3 3 Verbatim -
4 4 Showing and Hiding Solutions -
5 5 General Formatting Commands -
6 6 Defining a Problem -
7 7 Using a Problem -
8 8 Loading Problems From External Files -
9 Iterating Through Datasets -
10 Random Number Generator -
11 Compatibility With Versions Prior to 3.0 -
Index -
+
 8.1 Randomly Selecting Problems Not Selected in Previous Documents +
9 Iterating Through Datasets +
10 Random Number Generator +
11 Compatibility With Versions Prior to 3.0 +
Index + + +

-

1 1 Introduction

The probsoln package is designed for teachers or lecturers who want to create problem -sheets for their students. This package was designed with mathematics problems in -mind, but can be used for other subjects as well. The idea is to create a file -containing a large number of problems with their solutions which can be read in - - - -by LATEX, and then select a number of problems to typeset. This means -that once the database has been set up, each year you can easily create a new -problem sheet that is sufficiently different from the previous year, thus preventing -the temptation of current students seeking out the previous year’s students, -and checking out their answers. There is also an option that can be passed to -the package to determine whether or not the solutions should be printed. In -this way, one file can either produce the student’s version or the teacher’s +class="ec-lmss-10x-x-109">probsoln package is designed for teachers or lecturers who want to +create problem sheets for their students. This package was designed with +mathematics problems in mind, but can be used for other subjects as well. The +idea is to create a file containing a large number of problems with their +solutions which can be read in by LATEX, and then select a number of +problems to typeset. This means that once the database has been set up, +each year you can easily create a new problem sheet that is sufficiently +different from the previous year, thus preventing the temptation of current +students seeking out the previous year’s students, and checking out their +answers. There is also an option that can be passed to the package +to determine whether or not the solutions should be printed. In this +way, one file can either produce the student’s version or the teacher’s version.

Top

2 Top

2 Package Options

The following options may be passed to this package:

answersanswers
Show the answers
noanswersnoanswers
Don’t show the answers (default)
draftdraft
Display the label and dataset name when a problem is used
finalfinal
Don’t display label and dataset name when a problem is used
usedefaultargsusedefaultargs
Make \thisproblem use the default arguments supplied in the - problem definition. +class="ec-lmtt-10x-x-109">\thisproblem use the default arguments supplied in + the problem definition. + +
nousedefaultargsnousedefaultargs
Make \thisproblem prompt for problem arguments (default).
+class="description">Make \thisproblem prompt for problem arguments + (default).

Top

3 Top

3 Verbatim

-

As from version 3.02, problems and solutions may contain verbatim text, but you must -use the

As from version 3.02, problems and solutions may contain verbatim text, but +you must use the fragile (or fragile=true) option for the associated environments. -

Alternatively, if most of your problems contain verbatim, you can globally set this -option using: +class="ec-lmtt-10x-x-109">fragile (or fragile=true) option for the associated +environments. +

Alternatively, if most of your problems contain verbatim, you can globally set +this option using: -

-
+
\setkeys{probsoln}{fragile}

You can switch off this option using fragile=false. -

The fragile option writes information to a temporary file. This defaults to +class="ec-lmtt-10x-x-109">fragile=false. +

The fragile option writes information to a temporary file. This defaults to \jobname.vrb but the name may be changed. The extension (.vrb) is given +class="ec-lmtt-10x-x-109">\jobname.vrb but the name may be changed. The extension (.vrb) is given by: -


\ProbSolnFragileExt 


\ProbSolnFragileExt  \ProbSolnFragileExt

+class="ec-lmtt-10x-x-109">\ProbSolnFragileExt

The base name (\jobname) is given by: -


\ProbSolnFragileFile \jobname) is given by: +


\ProbSolnFragileFile  \ProbSolnFragileFile

+class="ec-lmtt-10x-x-109">\ProbSolnFragileFile

Top

4 Top

4 Showing and Hiding Solutions

In addition to the answersanswers and noanswers package options, it is also possible to show or -suppress the solutions using -


\showanswers noanswers package options, it is also possible to +show or suppress the solutions using +


\showanswers  \showanswers

+class="ec-lmtt-10x-x-109">\showanswers

and -


\hideanswers 


\hideanswers  \hideanswers

+class="ec-lmtt-10x-x-109">\hideanswers

respectively. -

The boolean variable showanswers

The boolean variable showanswers determines whether the answers should be displayed. You can use this value with the ifthen package to specify different text -depending on whether the solutions should be displayed. For example: +class="ec-lmss-10x-x-109">ifthen package to specify +different text depending on whether the solutions should be displayed. For +example: -

-
+
Assignment 1\ifthenelse{\boolean{showanswers}}{ (Solution Sheet)}{}

Alternatively you can use \ifshowanswers\ifshowanswers\else\fi: +class="ec-lmtt-10x-x-109">\else…\fi: -

-
+
Assignment 1\ifshowanswers\space (Solution Sheet)\fi

-

For longer passages, you can use the environments -


onlyproblem 

For longer passages, you can use the environments +


onlyproblem  \begin{onlyproblem}[option]

+class="ec-lmtt-10x-x-109">\begin{onlyproblem}[option]

and -


onlysolution 


onlysolution  \begin{onlysolution}[option]

+class="ec-lmtt-10x-x-109">\begin{onlysolution}[option]

For example: -

-
+
\begin{onlyproblem}%  
What is the derivative of $f(x) = x^2$?  
\end{onlyproblem}% @@ -492,130 +531,130 @@ For example:  
\end{onlysolution}

The above will only display the question if showanswers is false and will only display -the solution if showanswers is true. If you want the question to appear in the answer -sheet as well as the solution, then don’t put the question in the onlyproblemshowanswers is false and will only +display the solution if showanswers is true. If you want the question to appear in +the answer sheet as well as the solution, then don’t put the question in the +onlyproblem -environment: + id="dx1-5015"> environment: -

-
+
What is the derivative of $f(x) = x^2$?  
\begin{onlysolution}%  
Solution: $f’(x) = 2x$  
\end{onlysolution}

-

If you want to include verbatim text in the body of onlyproblem

If you want to include verbatim text in the body of onlyproblem or onlysolution or +onlysolution, you -need to specify fragile in the optional argument of the environment. (See , you need to specify fragile in the optional argument of the +environment. (See §3 Verbatim -for further details.)
+href="#x1-40003">Verbatim for further details.)

-

If you use onlysolution within the defproblem

If you use onlysolution within the defproblem environment, the problem will be -tagged as having a solution and will be added to the list used by \foreachsolution. -The optional argument of onlysolution (and onlyproblem) is inherited from the parent + id="dx1-5021"> environment, the problem will +be tagged as having a solution and will be added to the list used by defproblem\foreachsolution. The optional argument of onlysolution (and onlyproblem) is +inherited from the parent defproblem setting.

Top

5 Top

5 General Formatting Commands

The commands and environments described in this section are provided to assist formatting problems and their solutions. -


solution 


solution  \begin{solution}text\end{solution}

+class="ec-lmtt-10x-x-109">\begin{solution}text\end{solution}

By default, this is equivalent to -
\par\noindent\textbf{\solutionname}: text -
+
\par\noindent\textbf{\solutionname}: text +
where \solutionname \solutionname \solutionname defaults to “Solution”. Note that you must -place the solution\solutionname defaults to “Solution”. Note that you +must place the solution environment inside the onlysolution environment or between -\ifshowanswersonlysolution environment or +between \ifshowanswers\fi to ensure that it is suppressed when the solutions are not wanted. -(See \fi to ensure that it is suppressed when the solutions +are not wanted. (See §4 Showing and Hiding Solutions.) -

Note that the probsoln package will only define the solution

Note that the probsoln package will only define the solution environment if it is not -already defined. -


textenum  environment if it +is not already defined. +


textenum  \begin{textenum}\end{textenum}

+class="ec-lmtt-10x-x-109">\begin{textenum}\end{textenum}

The textenum environment is like the enumeratetextenum environment is like the enumerate environment but is in-line. It uses -the same counter that the enumerate environment would use at that level so -the question can be compact but the answer can use enumerate instead. For + id="dx1-6012"> environment but is in-line. It +uses the same counter that the enumerate environment would use at that level +so the question can be compact but the answer can use enumerate instead. For + + example: -

-
+
\begin{onlyproblem}%  
  Differentiate the following:  
  \begin{textenum} @@ -640,65 +679,64 @@ example:  
\end{onlysolution}

In this example, the items in the question are brief, so an enumerateenumerate environment -would result in a lot of unnecessary white space, but the answers require more space, so -an enumerate environment is more appropriate. Since the textenum environment uses -the same counters as the enumerate environment, the question and answer sheets use -consistent labelling. Note that there are other packages available on CTAN -that you can use to create in-line lists. Check the TeX Catalogue for further -details. -

\correctitem  +environment would result in a lot of unnecessary white space, but the answers +require more space, so an enumerate environment is more appropriate. Since the +textenum environment uses the same counters as the enumerate environment, the +question and answer sheets use consistent labelling. Note that there are other +packages available on CTAN that you can use to create in-line lists. Check the +TeX Catalogue for further details. +

\correctitem \incorrectitem \incorrectitem  -


\correctitem


\correctitem
\incorrectitem

+class="ec-lmtt-10x-x-109">\incorrectitem

You can use the commands \correctitem and \incorrectitem in place of +class="ec-lmtt-10x-x-109">\correctitem and \incorrectitem in place of \item\item. If the solutions are suppressed, these commands behave in the same way as \item, otherwise they format the item label using one of the commands: +class="ec-lmtt-10x-x-109">\item, otherwise they format the item label using one of the commands: \correctitemformat \correctitemformat \incorrectitemformat \incorrectitemformat  -


\correctitemformat{label}


\correctitemformat{label}
\incorrectitemformat{label}

+class="ec-lmtt-10x-x-109">\incorrectitemformat{label}

For example: -

-
+
Under which of the following functions does $S=\{a_1,a_2\}$  
become a probability space?  
\begin{enumerate} @@ -709,146 +747,147 @@ Under which of the following functions   
\end{enumerate}

The default definition of \correctitemformat puts a frame around the label. +class="ec-lmtt-10x-x-109">\correctitemformat puts a frame around the +label.

Top

6 Top

6 Defining a Problem

-

It is possible to construct a problem sheet with solutions using the commands described -in the previous sections, however it is also possible to define a set of problems for later -use. In this way you can create an external file containing many problems some or all of -which can be loaded and used in a document. The probsoln package has a default data -set labelled “default” in which you can store problems. Alternatively, you can -create multiple data sets. You can then iterate through each problem in a -problem set. You can use a previously defined problem more than once, which -means that by judicious use of onlyproblem

It is possible to construct a problem sheet with solutions using the commands +described in the previous sections, however it is also possible to define a set of +problems for later use. In this way you can create an external file containing +many problems some or all of which can be loaded and used in a document. The +probsoln package has a default data set labelled “default” in which you can +store problems. Alternatively, you can create multiple data sets. You +can then iterate through each problem in a problem set. You can use a +previously defined problem more than once, which means that by judicious +use of onlyproblem, onlysolutiononlysolution or the showanswers -boolean variable in conjunction with \showanswersshowanswers boolean variable +in conjunction with \showanswers and \hideanswers, you can -print the solutions in a different location to the questions (for example in an +class="ec-lmtt-10x-x-109">\hideanswers, you can print +the solutions in a different location to the questions (for example in an appendix). -


defproblem 


defproblem  \begin{defproblem}[n][default args]{label}[option]
\begin{defproblem}[n][default args]{label}[option]
definition
definition
\end{defproblem}

+class="ec-lmtt-10x-x-109">\end{defproblem}

This defines the problem whose label is given by label. The label must be unique for a -given data set and should not contain active characters or a comma. (Active characters -include the special characters such as $ and &, but some packages may make other -symbols active, such as the colon (:) character. For example, the ngermanlabel. The label must be +unique for a given data set and should not contain active characters or +a comma. (Active characters include the special characters such as $ +and &, but some packages may make other symbols active, such as the +colon (:) character. For example, the ngerman and babel -packages make certain punctuation active. Check the relevant package documentation -for details.) -

The final optional argument optionmay be fragile to indicate that the problem -contains verbatim text. Any occurrences of onlyproblembabel packages make +certain punctuation active. Check the relevant package documentation for +details.) + + +

The final optional argument optionmay be fragile to indicate that the +problem contains verbatim text. Any occurrences of onlyproblem or onlysolutiononlysolution contained within -defproblem are inherited from defproblem. (See +contained within defproblem are inherited from defproblem. (See §3 Verbatim for further details.) -
+href="#x1-40003">Verbatim for +further details.)

-

If defproblem

If defproblem occurs in the document or is included via \input\input or \include, then -the problem will be added to the default data set. If defproblem occurs in an external -file that is loaded using one of the commands defined in \include, +then the problem will be added to the default data set. If defproblem occurs in +an external file that is loaded using one of the commands defined in §8 Loading Problems - - - -From External Files then the problem will be added to the specified data -set. -

The contents of the defproblemLoading +Problems From External Files then the problem will be added to the specified +data set. +

The contents of the defproblem environment should be the text that defines the -problem. This may include any of the commands defined in environment should be the text that defines +the problem. This may include any of the commands defined in §4 Showing and Hiding -Solutions and Showing and +Hiding Solutions and §5 General Formatting Commands. -

The problem may optionally take narguments (where nis from 0 to 9). The -arguments can be referenced in the definition via #1,…,#9. If nis omitted then the -problem doesn’t take any arguments. The following example defines a problem with one -argument: +

The problem may optionally take narguments (where nis from 0 to 9). +The arguments can be referenced in the definition via #1,…,#9. If nis omitted +then the problem doesn’t take any arguments. The following example defines a +problem with one argument: -

-
+
\begin{defproblem}[1]{diffsin}  
Differentiate $f(x)=\sin(#1x)$.  
\begin{onlysolution}% @@ -859,26 +898,25 @@ argument:  
\end{defproblem}

-

The second optional argument default argssupplies default problem arguments -that will automatically be used within \thisproblem when used in \foreachproblem -in conjunction with the package option usedefaultargs

The second optional argument default argssupplies default problem +arguments that will automatically be used within \thisproblem when used in +\foreachproblem in conjunction with the package option usedefaultargs. (See §9 Iterating Through -Datasets.) For example: +href="#x1-110009">§9 +Iterating Through Datasets.) For example: -

-
+
\begin{defproblem}[1][{2}]{diffsin}  
Differentiate $f(x)=\sin(#1x)$.  
\begin{onlysolution}% @@ -889,74 +927,73 @@ Datasets.) For example:  
\end{defproblem}

-


\newproblem 


\newproblem  \newproblem[n][default args]{label}{problem}{solution} +class="ec-lmtt-10x-x-109">\newproblem[n][default args]{label}{problem}{solution}

This is a shortcut command for: - \begin{defproblem}[n][default args]{label}% -
problem% -
\begin{onlysolution}% -
\begin{solution}% -
solution% -
\end{solution}% -
\end{onlysolution}% -
\end{defproblem}
-

For example: + \begin{defproblem}[n][default args]{label}% +
problem% +
\begin{onlysolution}% +
\begin{solution}% +
solution% +
\end{solution}% +
\end{onlysolution}% +
\end{defproblem} +

For example: -

-
+
\newproblem[1]{diffsin}{%  
  \(f(x) = \sin(#1x)\)  
}% @@ -966,10 +1003,9 @@ class="ec-lmtt-10">\end{defproblem}

is equivalent to -

-
+
\begin{defproblem}[1]{diffcos}%  
  \(f(x) = \cos(#1x)\)  
\begin{onlysolution}% @@ -979,22 +1015,21 @@ class="ec-lmtt-10">\end{defproblem}  
\end{onlysolution}%  
\end{defproblem}
-

(In this example, the argument will need to be a positive number to avoid a double -minus in the answer. If you want to perform floating point arithmetic on the arguments, -then try the fp

(In this example, the argument will need to be a positive number to avoid a +double minus in the answer. If you want to perform floating point arithmetic on +the arguments, then try the fp or pgfmathpgfmath packages.) -

Alternatively, if you want to supply default arguments to use when iterating through -problems with \foreachproblem

Alternatively, if you want to supply default arguments to use when iterating +through problems with \foreachproblem: -

-
+
\newproblem[1][{3}]{diffsin}{%  
  \(f(x) = \sin(#1x)\)  
}% @@ -1003,135 +1038,134 @@ class="ec-lmtt-10">\foreachproblem}

-


\newproblem* 


\newproblem*  \newproblem*[n][default args]{label}{definition} +class="ec-lmtt-10x-x-109">\newproblem*[n][default args]{label}{definition}

This is a shortcut for: - \begin{defproblem}[n][default args]{label}% -
definition% -
\end{defproblem}
-

Note that you can’t use verbatim text with \newproblem or \newproblem*. Use the -defproblem\begin{defproblem}[n][default args]{label}% +
definition% +
\end{defproblem} +

+class="ec-lmtt-10x-x-109">fragile option.

Top

7 Top

7 Using a Problem

Once you have defined a problem using defproblemdefproblem or \newproblem\newproblem (see §6 Defining a -Problem), you can later display the problem using: -


\useproblem §6 +Defining a Problem), you can later display the problem using: +


\useproblem  \useproblem[data set]{label}{arg1}…{argN}

+class="ec-lmtt-10x-x-109">\useproblem[data set]{label}{arg1}…{argN} +

where data setis the name of the data set that contains the problem (the default data -set is used if omitted), labelis the label identifying the required problem and arg1, …, -argNare the arguments to pass to the problem, if the problem was defined to have -arguments (where N is the number of arguments specified when the problem was -defined). -

For example, in the previous section the problem diffcos was defined to have one -argument, so it can be used as follows: +class="lmsy-10x-x-109">⟨data setis the name of the data set that contains the problem (the +default data set is used if omitted), labelis the label identifying the required +problem and arg1, …, argNare the arguments to pass to the problem, if the +problem was defined to have arguments (where N is the number of arguments +specified when the problem was defined). +

For example, in the previous section the problem diffcos was defined to have +one argument, so it can be used as follows: -

-
+
\useproblem{diffcos}{3}

This will be equivalent to: -

-
+
\(f(x) = \cos(3x)\)  
\begin{onlysolution}%  
\begin{solution}% @@ -1143,367 +1177,575 @@ argument, so it can be used as follows:

Top

8 Top

8 Loading Problems From External Files

You can store all your problem definitions (see §6 Defining a Problem) in an external -file. These problems can all be appended to the default data set by including the file via -\input or they can be appended to other data sets using one of the commands -described below. Once you have loaded all the required problems, you can iterate -through the data sets using the commands described in §9 Iterating Through Datasets. -Note that the commands below will create a new data set, if the named data set doesn’t +href="#x1-70006">Defining a Problem) in an +external file. These problems can all be appended to the default data set by +including the file via \input or they can be appended to other data sets +using one of the commands described below. Once you have loaded all +the required problems, you can iterate through the data sets using the +commands described in §9 Iterating Through Datasets. Note that the +commands below will create a new data set, if the named data set doesn’t exist. -


\loadallproblems 


\loadallproblems  \loadallproblems[data set]{filename}

+class="ec-lmtt-10x-x-109">\loadallproblems[data set]{filename}

This will load all problems defined in filenameand append them to the specified -data set, in the order in which they are defined in the file. If data setis -omitted, the default data set will be used. If data setdoesn’t exist, it will be +class="lmsy-10x-x-109">⟨filenameand append them to the +specified data set, in the order in which they are defined in the file. If data set +is omitted, the default data set will be used. If data setdoesn’t exist, it will be created. -


\loadselectedproblems 


\loadselectedproblems  \loadselectedproblems[data set]{labels}{filename} +class="ec-lmtt-10x-x-109">\loadselectedproblems[data set]{labels}{filename}

This is like \loadallproblems, but only those problems whose label is listed in the -comma-separated list labelsare loaded. For example, if I have some problems defined -in the file derivatives.tex, then +class="ec-lmtt-10x-x-109">\loadallproblems, but only those problems whose label is listed in +the comma-separated list labelsare loaded. For example, if I have some +problems defined in the file derivatives.tex, then -

-
+
\loadselectedproblems{diffsin,diffcos}{derivatives}

will only load the problems whose labels are diffsin and diffcos, respectively. All -the other problems in the file will remain undefined. -


\loadexceptproblems diffsin and diffcos, +respectively. All the other problems in the file will remain undefined. +


\loadexceptproblems  \loadexceptproblems[data set]{exception list}{filename} -

+class="ec-lmtt-10x-x-109">\loadexceptproblems[data set]{exception +list}{filename}

This is the reverse of \loadselectedproblems. This loads all problems except those -whose labels are listed in exception list. -


\loadrandomproblems \loadselectedproblems. This loads all problems except +those whose labels are listed in exception list. +


\loadrandomproblems  \loadrandomproblems[data set]{n}{filename} +class="ec-lmtt-10x-x-109">\loadrandomproblems[data set]{n}{filename}

This randomly loads nproblems from filenameand adds them to the given data -set. If data setis omitted, the default data set is assumed. Note that the -problems will be added to the data set in a random order, not in the order -in which they were defined. There must be at least nproblems defined in +class="lmsy-10x-x-109">⟨nproblems from filenameand adds them to the given +data set. If data setis omitted, the default data set is assumed. Note that the +problems will be added to the data set in a random order, not in the order in +which they were defined. There must be at least nproblems defined in filename. -


\loadrandomexcept filename. +


\loadrandomexcept  \loadrandomexcept[data set]{n}{filename}{exception +class="ec-lmtt-10x-x-109">\loadrandomexcept[data set]{n}{filename}{exception list}

+class="ec-lmri-10x-x-109">list}

This is similar to \loadrandomproblems except that it won’t load those problems -whose labels are listed in exception list. -

Note that the random number generator has been modified in version 3.01 in order -to fix a bug. If you want to ensure that your random numbers are compatible with -earlier versions, you can switch to the old generator using -


\PSNuseoldrandom \loadrandomproblems except that it won’t load those +problems whose labels are listed in exception list. If you want to +automatically exclude problems included in previous documents, see +§8.1 Randomly Selecting Problems Not Selected in Previous +Documents. +

Note that the random number generator has been modified in version 3.01 in +order to fix a bug. If you want to ensure that your random numbers are +compatible with earlier versions, you can switch to the old generator +using +


\PSNuseoldrandom  \PSNuseoldrandom

-

-

It is generally not a good idea to place anything in filenamethat is not inside the -body of defproblem\PSNuseoldrandom

+

+

It is generally not a good idea to place anything in filenamethat is not +inside the body of defproblem or in the arguments to \newproblem or \newproblem*. All -the commands in this section input the external file within a local scope, so -command definitions would need to be made global to have any effect. In addition, +class="ec-lmtt-10x-x-109">\newproblem or \loadrandomproblems has to load each file twice, which means that anything outside a -problem definition will be parsed twice.
-

-

-

-

Top

9 Iterating Through Datasets

-

Once you have defined all your problems for a given data set, you can use an individual -problem with \useproblem (see §7 Using a Problem) but it is more likely that you will -want to iterate through all the problems so that you don’t need to remember the labels -of all the problems you have defined. +class="ec-lmtt-10x-x-109">\newproblem*. All the commands in this section input the external file within a +local scope, so command definitions would need to be made global to have any +effect. In addition, \loadrandomproblems has to load each file twice, which +means that anything outside a problem definition will be parsed twice. +

- -


\foreachproblem 

+

+

+

Top

8.1 Randomly Selecting Problems Not Selected in Previous Documents

+

Suppose you have a large set of questions that you want to randomly select for +assignments and exams. The chances are, you don’t want to include questions +that have been previously set for, say, the last three years. That is, you don’t +want to select questions the students may already have seen. As from version +3.03, you can now do this. +

The probsoln package defaults to the UK academic year, which starts in +September. If this isn’t appropriate, you can change it using: +


\SetStartMonth  \foreachproblem[data set]{body}

-

+class="ec-lmtt-10x-x-109">\SetStartMonth{n}


+

+where nis the number of the month. (1 = January, 2 = February, +etc.) +

The start year is the calender year in effect when the academic +year started. For example, if this is the academic year 2011/12, then +the start year is 2011. This is automatically set to the start of the +current academic year. It is also updated when \SetStartMonth is +used.1 +If you want to set it to a specific year, you can use: +


\SetStartYear  \SetStartYear{year}

+

+For example: \SetStartYear{2008} indicates the academic year 2008/9. +

There are two files concerned with previously used labels. They are: +

+The previously used labels file
This keeps track of all problems used in + previous years, as well as problems used by other documents that have + this as their previously used labels file, and it contains the problem + labels from the last run of the current document. +
+The current used labels file
This defaults to \jobname.prb, but the name can + be changed using: +


\SetUsedFileName  \SetUsedFileName{name}

+

+ This file keeps track of all the labels used in the current document from + the previous LATEX run. Note that if you want to delete this file, first + clear it using + + +


\ClearUsedFile  \ClearUsedFile{file}

+

+ in place of \ExcludePreviousFile{file}, described below. The + argument fileis the previously used labels file described above. + \ClearUsedFile will remove all labels in the current used labels file from + the previously used labels file and clear the current used labels file. Once + this file is empty, it may then be deleted. +

+
+

Before loading randomly selected problems, first specify the previously used +labels file with the command: +


\ExcludePreviousFile  \ExcludePreviousFile[number of years]{file +name}

+

+where file nameis the name of the previously used file. The optional argument +number of yearsspecifies the year cut-off. This defaults to 3, which means that +only those labels used this year or the previous 2 years will be kept. Any +problems used before then may be reused. +

Suppose I’m lecturing a first year undergraduate mathematics course +(designated, say, mth101). I want to set assignments on each topic and an exam +at the end of the year (as well as a resit or second sitting paper). I’ve got +databases with problems for each topic, but the first and second sitting +exams mustn’t include any of the problems used in the assignments +or any problems used in assignments or exams for the previous two +academic years. I’m going to arrange my directory structure as follows: +

+
    +
  • mth101/ +
      +
    • assignment1/ (differentiation) +
        +
      • assignment1.tex
      +
    • +
    • assignment2/ (probability spaces) +
        +
      • assignment2.tex
      +
    • +
    • assignment3/ (linear algebra) +
        +
      • assignment3.tex
      + + +
    • +
    • exams/ +
        +
      • exam.tex (first sitting) +
      • +
      • resit.tex (second sitting)
      +
    • +
    • databases/ +
        +
      • differentiation.tex +
      • +
      • probabilityspaces.tex +
      • +
      • linearalgebra.tex
      +
    • +
    • previouslabels.tex (created by probsoln)
    +
+

+

+

Top

9 Iterating Through Datasets

+

Once you have defined all your problems for a given data set, you can use an +individual problem with \useproblem (see §7 Using a Problem) but it is more +likely that you will want to iterate through all the problems so that +you don’t need to remember the labels of all the problems you have +defined. +


\foreachproblem  \foreachproblem[data set]{body}

+

This does bodyfor each problem in the given data set. If data setis omitted, the -default data set is used. Within bodyyou can use -


\thisproblem  \thisproblem

-

+class="lmsy-10x-x-109">⟨bodyfor each problem in the given data set. If data setis omitted, +the default data set is used. Within bodyyou can use +


\thisproblem  \thisproblem

+

to use the current problem and -


\thisproblemlabel  \thisproblemlabel

-

+


\thisproblemlabel  \thisproblemlabel

+

to access the current label. If the problem requires arguments, and no default -arguments were supplied in the problem definition or the package option usedefaultargs -was not used, then you will be prompted for arguments, so if you want to use this -approach you will need to use LATEX in interactive mode. If you do provide -arguments, they will be stored in the event that you need to iterate through the data -set again. The arguments will be included in \thisproblem, so you only need to use +arguments were supplied in the problem definition or the package option \thisproblem without having to specify \useproblem. -

For example, to iterate through all problems in the default data set: +class="ec-lmss-10x-x-109">usedefaultargs was not used, then you will be prompted for arguments, so if you + + +want to use this approach you will need to use LATEX in interactive mode. If +you do provide arguments, they will be stored in the event that you need to +iterate through the data set again. The arguments will be included in +\thisproblem, so you only need to use \thisproblem without having to specify +\useproblem. +

For example, to iterate through all problems in the default data set: -

-
+
\begin{enumerate}  
\foreachproblem{\item\thisproblem}  
\end{enumerate}
-

-


\foreachsolution  \foreachsolution[data set]{body}

-

+

+


\foreachsolution  \foreachsolution[data set]{body}

+

This is equivalent to \foreachsolution, but only iterates through problems that -contain the onlysolution environment. Note that you still need to use \showanswers or -the answers package option for the contents of the onlysolution environment to -appear. -


\foreachdataset  \foreachdataset{cmd}{body}

-

+class="ec-lmtt-10x-x-109">\foreachsolution, but only iterates through problems +that contain the onlysolution environment. Note that you still need to use +\showanswers or the answers package option for the contents of the onlysolution +environment to appear. +


\foreachdataset  \foreachdataset{cmd}{body}

+

This does bodyfor each of the defined data sets. Within body, cmdwill be set to -the name of the current data set. For example, to display all problems in all data -sets: +class="lmsy-10x-x-109">⟨bodyfor each of the defined data sets. Within body, cmdwill be +set to the name of the current data set. For example, to display all problems in +all data sets: -

-
+
\begin{enumerate}  
\foreachdataset{\thisdataset}{%  
\foreachproblem[\thisdataset]{\item\thisproblem}}  
\end{enumerate}
-

-

Suppose I have two external files called derivatives.tex and probspaces.tex -which define problems using both onlyproblem and onlysolution for example: +

+

Suppose I have two external files called derivatives.tex and +probspaces.tex which define problems using both onlyproblem and onlysolution +for example: -

-
+
\begin{defproblem}{cosxsqsinx}%  
\begin{onlyproblem}%  
$y = \cos(x^2)\sin x$.% @@ -1513,30 +1755,30 @@ class="ec-lmss-10">onlysolution\end{onlysolution}%  
\end{defproblem}
-

I can write a document that creates two data sets, one for the derivative problems and -one for the problems about probability spaces. I can then use \hideanswers and iterate -through the require data set to produce the problems. Later, I can use \showanswers -and iterate over all problems defined in both data sets to produce the chapter -containing all the answers. When displaying the questions, I have taken advantage of -the fact that I can cross-reference items within an enumerate environment, -and redefined \theenumi to label the questions according to the chapter. The -cross-reference label is constructed from the problem label and is referenced -in the answer section to ensure that the answers have the same label as the +

I can write a document that creates two data sets, one for the derivative +problems and one for the problems about probability spaces. I can then use +\hideanswers and iterate through the require data set to produce the +problems. Later, I can use \showanswers and iterate over all problems defined +in both data sets to produce the chapter containing all the answers. When +displaying the questions, I have taken advantage of the fact that I can +cross-reference items within an enumerate environment, and redefined +\theenumi to label the questions according to the chapter. The cross-reference +label is constructed from the problem label and is referenced in the +answer section to ensure that the answers have the same label as the questions. -

-
+
\documentclass{report}  
\usepackage{probsoln}  
\begin{document} @@ -1571,241 +1813,234 @@ questions.  
\end{itemize}  
\end{document}
-

-

-

-

Top

10 Random Number Generator

-

This package provides a pseudo-random number generator that is used by -\loadrandomproblems. As noted earlier the random number generator has been +

- -modified in version 3.01 in order to fix a bug. If you want to ensure that your random -numbers are compatible with earlier versions, you can switch to the old generator -using -


\PSNuseoldrandom  \PSNuseoldrandom

-

-


\PSNrandseed  \PSNrandseed{n}

-

+

+

+

Top

10 Random Number Generator

+

This package provides a pseudo-random number generator that is used by +\loadrandomproblems. As noted earlier the random number generator has been +modified in version 3.01 in order to fix a bug. If you want to ensure that your +random numbers are compatible with earlier versions, you can switch to the old +generator using +


\PSNuseoldrandom  \PSNuseoldrandom

+

+


\PSNrandseed  \PSNrandseed{n}

+

This sets the seed to nwhich must be a non-zero integer. For example, to +class="lmsy-10x-x-109">⟨nwhich must be a non-zero integer. For example, to generate a different set of random numbers every time you LATEX your document,1 +href="#fn2x0" id="fn2x0-bk">2 put the following in your preamble: -

-
+
\PSNrandseed{\time}
-

or to generate a different set of random numbers every year you LAT

or to generate a different set of random numbers every year you LATEX your document: -

-
+
\PSNrandseed{\year}
-

-


\PSNgetrandseed  \PSNgetrandseed{register}

-

+

+


\PSNgetrandseed  \PSNgetrandseed{register}

+

This stores the current seed in the count register specified by register. For +class="lmsy-10x-x-109">⟨register. For example: -

-
+
\newcount\myseed  
\PSNgetrandseed{\myseed}
-

-


\PSNrandom  \PSNrandom{register}{n}

-

+

+


\PSNrandom  \PSNrandom{register}{n}

+

Generates a random integer from 1 to nand stores in the count register specified by -register. For example, the following generates an integer from 1 to 10 and stores it in -the register \myreg: +class="lmsy-10x-x-109">⟨nand stores in the count register +specified by register. For example, the following generates an integer from 1 to +10 and stores it in the register \myreg: -

-
+
\newcount\myreg  
\PSNrandom{\myreg}{10}
-

-


\random  \random{counter}{min}{max}

-

+

+


\random  \random{counter}{min}{max}

+

Generates a random integer from minto maxand stores in the given counter. For -example, the following generates a random number between 3 and 8 (inclusive) and -stores it in the counter myrand. +class="lmsy-10x-x-109">⟨minto maxand stores in the given +counter. For example, the following generates a random number between 3 and +8 (inclusive) and stores it in the counter myrand. -

-
+
\newcounter{myrand}  
\random{myrand}{3}{8}
-

-


\doforrandN  \doforrandN{n}{cmd}{list}{text}

-

+

+


\doforrandN  \doforrandN{n}{cmd}{list}{text}

+

Randomly selects nvalues from the comma-separated list given by listand iterates -through this subset. On each iteration it sets cmdto the current value and does +class="lmsy-10x-x-109">⟨nvalues from the comma-separated list given by +listand iterates through this subset. On each iteration it sets cmd +to the current value and does text. For example, the following will +load a randomly selected problem from two of the listed files (where text. For example, the following will load a randomly selected problem from two of the -listed files (where file1.tex, file2.tex and file3.tex are files containing at least -one problem): +class="ec-lmtt-10x-x-109">file1.tex, file2.tex and file3.tex are files containing at least one +problem): -

-
+
\doforrandN{2}{\thisfile}{file1,file2,file3}{%  
\loadrandomproblems{1}{\thisfile}}
-

-

+

+

-

Top

11 Compatibility With Versions Prior to 3.0

-

Version 3.0 of the probsoln package completely changed the structure of the package, -but the commands described in this section have been provided to maintain -compatibility with earlier versions. The only problems that are likely to occur -are those where commands are contained within groups. This will effect any -commands that are contained in external files that are outside of the arguments to -\newproblem and \newproblem*. However, since the external files had to be -parsed twice in order to load the problems, this shouldn’t be an issue as adding -anything other than problem definitions in those files would be problematic -anyway. -

The other likely difference is where the random generator is used in a group. This -includes commands such as \selectrandomly. For example, if your document -contained something like: +

Top

11 Compatibility With Versions Prior to 3.0

+

Version 3.0 of the probsoln package completely changed the structure of the +package, but the commands described in this section have been provided to +maintain compatibility with earlier versions. The only problems that are likely +to occur are those where commands are contained within groups. This will effect +any commands that are contained in external files that are outside of the +arguments to \newproblem and \newproblem*. However, since the external files +had to be parsed twice in order to load the problems, this shouldn’t be an issue +as adding anything other than problem definitions in those files would be +problematic anyway. +

The other likely difference is where the random generator is used in a group. +This includes commands such as \selectrandomly. For example, if your +document contained something like: -

-
+
\begin{enumerate}  
\selectrandomly{file1}{8}  
\item Solve the following: @@ -1815,18 +2050,17 @@ contained something like:  
\selectrandomly{file3}{2}  
\end{enumerate}
-

Then using versions prior to v3.0 will produce a different set of random numbers since -the second \selectrandomly is in a different level of grouping. If you want to -ensure that the document produces exactly the same random set with the -new version as with the old version, you will need to get and set the random -number seed. For example, the above would need to be modified so that it -becomes: +

Then using versions prior to v3.0 will produce a different set of random +numbers since the second \selectrandomly is in a different level of grouping. If +you want to ensure that the document produces exactly the same random set +with the new version as with the old version, you will need to get and set the +random number seed. For example, the above would need to be modified so that +it becomes: -

-
+
\begin{enumerate}  
\selectrandomly{file1}{8}  
\item Solve the following: @@ -1839,424 +2073,451 @@ becomes:  
\selectrandomly{file3}{2}  
\end{enumerate}
-

-


\selectrandomly  \selectrandomly{filename}{n}

-

+

+


\selectrandomly  \selectrandomly{filename}{n}

+

This is now equivalent to: - {\loadrandomproblems[filename]{n}{filename}}% -
\foreachproblem[filename]{\PSNitem\thisproblem\endPSNitem}
-


\selectallproblems  \selectallproblems{filename}

-

+ {\loadrandomproblems[filename]{n}{filename}}% +
\foreachproblem[filename]{\PSNitem\thisproblem\endPSNitem} +


\selectallproblems  \selectallproblems{filename}

+

This is now equivalent to: - {\loadallproblems[filename]{filename}}% -
\foreachproblem[filename]{\PSNitem\thisproblem\endPSNitem}
-

Note that in both the above cases, a new data set is created with the same name as -the file name. - - - -

{\loadallproblems[filename]{filename}}% +
\foreachproblem[filename]{\PSNitem\thisproblem\endPSNitem} +

Note that in both the above cases, a new data set is created with the same +name as the file name. + + +

+ id="Q1-1-14">

Top

Index

+ id="x1-1400011">Index

B +class="ec-lmbx-10x-x-109">B

-
babel package  babel package  1

C +class="ec-lmbx-10x-x-109">C +\ClearUsedFile  2
\correctitem  \correctitem  2
+class="ec-lmri-10x-x-109">3
\correctitemformat  \correctitemformat  3
+class="ec-lmri-10x-x-109">4

D +class="ec-lmbx-10x-x-109">D defproblem (environment)  4, 5, defproblem (environment)  5, 6, 6, 7, 8, 9, 10, 11
+class="ec-lmri-10x-x-109">7, 8, 9, 10, 11, 12
\doforrandN  12
+class="ec-lmtt-10x-x-109">\doforrandN  13

E +class="ec-lmbx-10x-x-109">E enumerate (environment)  13, 14, 15
+class="ec-lmtt-10x-x-109">enumerate (environment)  14, 15, 16
environments:
    defproblem  16, 17, defproblem  17, 18, 18, 19, 20, 21, 22, 23
+class="ec-lmri-10x-x-109">19, 20, 21, 22, 23, 24
    enumerate  24, 25, 26
+class="ec-lmtt-10x-x-109">enumerate  25, 26, 27
    onlyproblem  onlyproblem  27, 28, 29, 30, 31, 32, 33
+class="ec-lmri-10x-x-109">28, 29, 30, 31, 32, 33, 34
    onlysolution  onlysolution  34, 35, 36, 37, 38, 39, 40
+class="ec-lmri-10x-x-109">35, 36, 37, 38, 39, 40, 41
    solution  solution  41, 42, 43
+class="ec-lmri-10x-x-109">42, 43, 44
    textenum  textenum  44
+class="ec-lmri-10x-x-109">45
+\ExcludePreviousFile  46

F +class="ec-lmbx-10x-x-109">F \foreachdataset  45
+class="ec-lmtt-10x-x-109">\foreachdataset  47
\foreachproblem  46, 47, 48
+class="ec-lmtt-10x-x-109">\foreachproblem  48, 49, 50
\foreachsolution  49, 50
+class="ec-lmtt-10x-x-109">\foreachsolution  51, 52
fp package  51
+class="ec-lmss-10x-x-109">fp package  53
fragile  52
+href="probsoln-manual.html#dx1-4001" >54

H +class="ec-lmbx-10x-x-109">H \hideanswers  \hideanswers  53, 54, 55
+class="ec-lmri-10x-x-109">55, 56, 57
+ +

I +class="ec-lmbx-10x-x-109">I \ifshowanswers  56, 57
+class="ec-lmtt-10x-x-109">\ifshowanswers  58, 59
ifthen package  58
+class="ec-lmss-10x-x-109">ifthen package  60
\include  59
+class="ec-lmtt-10x-x-109">\include  61
\incorrectitem  \incorrectitem  60
- - - +class="ec-lmri-10x-x-109">62
\incorrectitemformat  \incorrectitemformat  61
+class="ec-lmri-10x-x-109">63
\input  62, 63
+class="ec-lmtt-10x-x-109">\input  64, 65
\item  64
+class="ec-lmtt-10x-x-109">\item  66

L +class="ec-lmbx-10x-x-109">L \loadallproblems  \loadallproblems  65
+class="ec-lmri-10x-x-109">67
\loadexceptproblems  \loadexceptproblems  66
+class="ec-lmri-10x-x-109">68
\loadrandomexcept  \loadrandomexcept  67
+class="ec-lmri-10x-x-109">69
\loadrandomproblems  \loadrandomproblems  68, 69
+class="ec-lmri-10x-x-109">70, 71
\loadselectedproblems  \loadselectedproblems  70
+class="ec-lmri-10x-x-109">72

N +class="ec-lmbx-10x-x-109">N \newproblem  \newproblem  71, 72, 73, 74
+class="ec-lmri-10x-x-109">73, 74, 75, 76
\newproblem*  \newproblem*  75, 76, 77
+class="ec-lmri-10x-x-109">77, 78, 79
ngerman package  78
+class="ec-lmss-10x-x-109">ngerman package  80

O +class="ec-lmbx-10x-x-109">O onlyproblem (environment)  onlyproblem (environment)  79, 80, 81, 82, 83, 84, 85
+class="ec-lmri-10x-x-109">81, 82, 83, 84, 85, 86, 87
onlysolution (environment)  onlysolution (environment)  86, 87, 88, 89, 90, 91, 92
+class="ec-lmri-10x-x-109">88, 89, 90, 91, 92, 93, 94

P +class="ec-lmbx-10x-x-109">P package options:
    answers  93, 94, 95
+class="ec-lmss-10x-x-109">answers  95, 96, 97
    draft  96
+class="ec-lmss-10x-x-109">draft  98
    final  97
+class="ec-lmss-10x-x-109">final  99
    noanswers  98, 99
+class="ec-lmss-10x-x-109">noanswers  100, 101
    nousedefaultargs  100
+class="ec-lmss-10x-x-109">nousedefaultargs  102
    usedefaultargs  101, 102, 103
+class="ec-lmss-10x-x-109">usedefaultargs  103, 104, 105
pgfmath package  104
+class="ec-lmss-10x-x-109">pgfmath package  106
probsoln package  105
+class="ec-lmss-10x-x-109">probsoln package  107, 108, 109
\ProbSolnFragileExt  \ProbSolnFragileExt  106
+class="ec-lmri-10x-x-109">110
\ProbSolnFragileFile  \ProbSolnFragileFile  107
+class="ec-lmri-10x-x-109">111
+ + \PSNgetrandseed  108
+class="ec-lmtt-10x-x-109">\PSNgetrandseed  112
\PSNrandom  109
+class="ec-lmtt-10x-x-109">\PSNrandom  113
\PSNrandseed  110
+class="ec-lmtt-10x-x-109">\PSNrandseed  114
\PSNuseoldrandom  \PSNuseoldrandom  111, 112
+class="ec-lmri-10x-x-109">115, 116

R +class="ec-lmbx-10x-x-109">R \random  113
+class="ec-lmtt-10x-x-109">\random  117

S +class="ec-lmbx-10x-x-109">S \selectallproblems  114
+class="ec-lmtt-10x-x-109">\selectallproblems  118
\selectrandomly  115, 116
+class="ec-lmtt-10x-x-109">\selectrandomly  119, 120
\showanswers  \SetStartMonth  121
+\SetStartYear  122
+\SetUsedFileName  123
+\showanswers  117, 118, 119, 120
- - - +class="ec-lmri-10x-x-109">124, 125, 126, 127
showanswers boolean variable  121, 122, 123, 124
+class="ec-lmss-10x-x-109">showanswers boolean variable  128, 129, 130, 131
solution (environment)  solution (environment)  125, 126, 127
+class="ec-lmri-10x-x-109">132, 133, 134
\solutionname  \solutionname  128
+class="ec-lmri-10x-x-109">135

T +class="ec-lmbx-10x-x-109">T textenum (environment)  textenum (environment)  129
+class="ec-lmri-10x-x-109">136
\theenumi  130
+class="ec-lmtt-10x-x-109">\theenumi  137
\thisproblem  131, 132, 133, 134
+class="ec-lmtt-10x-x-109">\thisproblem  138, 139, 140, 141
\thisproblemlabel  135
+class="ec-lmtt-10x-x-109">\thisproblemlabel  142

U +class="ec-lmbx-10x-x-109">U \useproblem  \useproblem  136, 137, 138
+class="ec-lmri-10x-x-109">143, 144, 145

-

1assuming you leave at least a minute between runs.

+

+1So don’t use \SetStartMonth after \SetStartYear.

+2assuming you leave at least a minute between runs.

diff --git a/Master/texmf-dist/doc/latex/probsoln/probsoln-manual.tex b/Master/texmf-dist/doc/latex/probsoln/probsoln-manual.tex index 83f12ca68e6..d2822c6093d 100644 --- a/Master/texmf-dist/doc/latex/probsoln/probsoln-manual.tex +++ b/Master/texmf-dist/doc/latex/probsoln/probsoln-manual.tex @@ -16,7 +16,7 @@ \RecordChanges \PageIndex -\CheckSum{1484} +\CheckSum{1822} \newcommand*{\dq}[1]{``#1''} @@ -24,7 +24,7 @@ \MakeShortVerb{"} \DeleteShortVerb{\|} - \title{probsoln v3.02: + \title{probsoln v3.04: creating problem sheets optionally with solutions} \author{Nicola L.C. Talbot\\[10pt] School of Computing Sciences\\ @@ -33,7 +33,7 @@ Norwich. Norfolk\\ NR4 7TJ. United Kingdom.\\ \url{http://theoval.cmp.uea.ac.uk/~nlct/}} - \date{2011-12-10} + \date{2012-08-23} \maketitle \tableofcontents @@ -493,6 +493,8 @@ set}\marg{n}\marg{filename}\marg{exception list} \end{definition} This is similar to \cs{loadrandomproblems} except that it won't load those problems whose labels are listed in \meta{exception list}. +\textbf{If you want to automatically exclude problems included in +previous documents, see \sectionref{sec:exprev}.} Note that the random number generator has been modified in version 3.01 in order to fix a bug. If you want to ensure that your random @@ -513,6 +515,117 @@ has to load each file twice, which means that anything outside a problem definition will be parsed twice. \end{important} +\subsection{Randomly Selecting Problems Not Selected in Previous +Documents} +\label{sec:exprev} + +Suppose you have a large set of questions that you want to randomly +select for assignments and exams. The chances are, you don't want to +include questions that have been previously set for, say, the last +three years. That is, you don't want to select questions the +students may already have seen. As from version 3.03, you can now do +this. + +The \sty{probsoln} package defaults to the UK academic year, which +starts in September. If this isn't appropriate, you can change it +using: +\begin{definition}[\DescribeMacro{\SetStartMonth}] +\cs{SetStartMonth}\marg{n} +\end{definition} +where \meta{n} is the number of the month. (1 = January, 2 = +February, etc.) + +The \emph{start year} is the calender year in effect when the +academic year started. For example, if this is the academic year +2011/12, then the start year is 2011. This is automatically set to +the start of the current academic year. It is also updated when +\cs{SetStartMonth} is used.\footnote{So don't use \cs{SetStartMonth} +after \cs{SetStartYear}.} If you want to set it to a specific year, +you can use: +\begin{definition}[\DescribeMacro{\SetStartYear}] +\cs{SetStartYear}\marg{year} +\end{definition} +For example: \verb|\SetStartYear{2008}| indicates the academic year +2008/9. + +There are two files concerned with previously used labels. They are: +\begin{description} + + \item[The previously used labels file] This keeps track of all + problems used in previous years, as well as problems used by + other documents that have this as their previously used labels + file, and it contains the problem labels from the last run of + the current document. + + \item[The current used labels file] This defaults to +\cs{jobname}\texttt{.prb}, but the name can be changed using: + \begin{definition}[\DescribeMacro{\SetUsedFileName}] + \cs{SetUsedFileName}\marg{name} + \end{definition} + This file keeps track of all the labels used in the current + document from the previous \LaTeX\ run. Note that if you want to + delete this file, first clear it using + \begin{definition}[\DescribeMacro{\ClearUsedFile}] + \cs{ClearUsedFile}\marg{file} + \end{definition} + in place of \cs{ExcludePreviousFile}\marg{file}, described below. + The argument \meta{file} is the previously used labels file + described above. \cs{ClearUsedFile} will remove all labels in + the current used labels file from the previously used labels file + and clear the current used labels file. Once this file is empty, + it may then be deleted. + +\end{description} + +Before loading randomly selected problems, first specify the +previously used labels file with the command: +\begin{definition}[\DescribeMacro{\ExcludePreviousFile}] +\cs{ExcludePreviousFile}\oarg{number of years}\marg{file name} +\end{definition} +where \meta{file name} is the name of the previously used file. The +optional argument \meta{number of years} specifies the year cut-off. +This defaults to 3, which means that only those labels used this +year or the previous 2 years will be kept. Any problems used before +then may be reused. + +Suppose I'm lecturing a first year undergraduate mathematics course +(designated, say, mth101). I want to set assignments on each topic +and an exam at the end of the year (as well as a resit or second +sitting paper). I've got databases with problems for each topic, but +the first and second sitting exams mustn't include any of the +problems used in the assignments or any problems used in assignments +or exams for the previous two academic years. I'm going to arrange +my directory structure as follows: +\begin{itemize} +\item \texttt{mth101/} + \begin{itemize} + \item \texttt{assignment1/} (differentiation) + \begin{itemize} + \item \texttt{assignment1.tex} + \end{itemize} + \item \texttt{assignment2/} (probability spaces) + \begin{itemize} + \item \texttt{assignment2.tex} + \end{itemize} + \item \texttt{assignment3/} (linear algebra) + \begin{itemize} + \item \texttt{assignment3.tex} + \end{itemize} + \item \texttt{exams/} + \begin{itemize} + \item \texttt{exam.tex} (first sitting) + \item \texttt{resit.tex} (second sitting) + \end{itemize} + \item \texttt{databases/} + \begin{itemize} + \item \texttt{differentiation.tex} + \item \texttt{probabilityspaces.tex} + \item \texttt{linearalgebra.tex} + \end{itemize} + \item \texttt{previouslabels.tex} (created by \sty{probsoln}) + \end{itemize} +\end{itemize} + \section{Iterating Through Datasets}\label{sec:foreach} Once you have defined all your problems for a given data set, you diff --git a/Master/texmf-dist/doc/latex/probsoln/probsoln.pdf b/Master/texmf-dist/doc/latex/probsoln/probsoln.pdf index 50eb3513ddf..e0bbc92904f 100644 Binary files a/Master/texmf-dist/doc/latex/probsoln/probsoln.pdf and b/Master/texmf-dist/doc/latex/probsoln/probsoln.pdf differ diff --git a/Master/texmf-dist/doc/latex/probsoln/samples/sample-exclude.tex b/Master/texmf-dist/doc/latex/probsoln/samples/sample-exclude.tex new file mode 100644 index 00000000000..8295015352e --- /dev/null +++ b/Master/texmf-dist/doc/latex/probsoln/samples/sample-exclude.tex @@ -0,0 +1,129 @@ +%% +%% This is file `sample-exclude.tex', +%% generated with the docstrip utility. +%% +%% The original source files were: +%% +%% probsoln.dtx (with options: `sample-exclude.tex,package') +%% +%% probsoln.dtx +%% Copyright 2013 Nicola Talbot +%% +%% This work may be distributed and/or modified under the +%% conditions of the LaTeX Project Public License, either version 1.3 +%% of this license of (at your option) any later version. +%% The latest version of this license is in +%% http://www.latex-project.org/lppl.txt +%% and version 1.3 or later is part of all distributions of LaTeX +%% version 2005/12/01 or later. +%% +%% This work has the LPPL maintenance status `maintained'. +%% +%% The Current Maintainer of this work is Nicola Talbot. +%% +%% This work consists of the files probsoln.dtx and probsoln.ins and the derived files probsoln.sty, sample-exclude.tex, sample.tex, sample2.tex, sample3.tex, sample4.tex, sample5.tex, sample6.tex, sample7.tex, sample8.tex, prob-1stprncp.tex, prob-args.tex, prob-easy.tex, prob-easy2.tex, prob-implicit.tex, prob-mchoice.tex, prob-mixed.tex, prob-newdata.tex, prob-nosoln.tex, prob-probspaces.tex, prob-probspaces2.tex, prob-tabmchoice.tex, prob-verb.tex. +%% +%% \CharacterTable +%% {Upper-case \A\B\C\D\E\F\G\H\I\J\K\L\M\N\O\P\Q\R\S\T\U\V\W\X\Y\Z +%% Lower-case \a\b\c\d\e\f\g\h\i\j\k\l\m\n\o\p\q\r\s\t\u\v\w\x\y\z +%% Digits \0\1\2\3\4\5\6\7\8\9 +%% Exclamation \! Double quote \" Hash (number) \# +%% Dollar \$ Percent \% Ampersand \& +%% Acute accent \' Left paren \( Right paren \) +%% Asterisk \* Plus \+ Comma \, +%% Minus \- Point \. Solidus \/ +%% Colon \: Semicolon \; Less than \< +%% Equals \= Greater than \> Question mark \? +%% Commercial at \@ Left bracket \[ Backslash \\ +%% Right bracket \] Circumflex \^ Underscore \_ +%% Grave accent \` Left brace \{ Vertical bar \| +%% Right brace \} Tilde \~} +%% randomly select 25 problems from derivatives.tex and add to +%% the data set called 'deriv' +%% Display the problems +%% You may need to change \theenumi back here +%% randomly select 25 problems from probspaces.tex and add to +%% the data set called 'spaces' +%% Display the problems +%% You may need to change \theenumi back here + % This file is public domain +\documentclass[a4paper]{article} + +\usepackage{probsoln} + %uncomment the following line to display the answers + %\showanswers + + % Set the academic year to be 2011/12 (if omitted assume current + % academic year): + \SetStartYear{2011} + + % Set the seed for the random number generator: + \PSNrandseed{\GetStartYear} + + % Exclude problems that have been used this year or the previous + % two academic years. (Creates a file called 'excluded.tex' to + % store labels of used problems. Also creates a file called + % \jobname.prb that stores labels of problems used in this + % document, so they don't get excluded on subsequent runs.) + \ExcludePreviousFile[3]{excluded} + + % To clear the used problems file (\jobname.prb) of the labels + % generated in the previous run, comment the above and uncomment + % below: + % \ClearUsedFile{excluded} + + % Load 1 problem randomly selected from the given file + % and store in database 'firstprinciples': +\loadrandomproblems[firstprinciples]{1}{prob-1stprncp} + + % Load 5 problems randomly selected from the given file + % and store in database 'easy': +\loadrandomproblems[easy]{5}{prob-easy} + + % Load 2 problems randomly selected from the given file + % and store in database 'implicit': +\loadrandomproblems[implicit]{2}{prob-implicit} + + % Load 2 problems randomly selected from the given file + % and store in database 'probspaces': +\loadrandomproblems[probspaces]{2}{prob-probspaces} + + % Load 1 problem randomly selected from the given file + % and store in database 'mchoice': +\loadrandomproblems[mchoice]{1}{prob-mchoice} + + % Load 1 problem randomly selected from the given file + % and store in database 'nosoln': +\loadrandomproblems[nosoln]{1}{prob-nosoln} + +\begin{document} +\title{Sample Problem Sheet} +\author{Nicola Talbot} +\maketitle + +\begin{enumerate} + % Differentiation from first principles + \foreachproblem[firstprinciples]{\item \thisproblem} + +\item Differentiate the following functions: +\begin{enumerate} + \foreachproblem[easy]{\item \thisproblem} +\end{enumerate} + + % Implicit differentiation +\foreachproblem[implicit]{\item \thisproblem} + + % Finite probability spaces +\foreachproblem[probspaces]{\item \thisproblem} + + % Multiple choice question +\foreachproblem[mchoice]{\item \thisproblem} + + % select one essay style question that doesn't come with a solution + +\foreachproblem[nosoln]{\item \thisproblem} +\end{enumerate} +\end{document} +\endinput +%% +%% End of file `sample-exclude.tex'. diff --git a/Master/texmf-dist/doc/latex/probsoln/samples/sample.pdf b/Master/texmf-dist/doc/latex/probsoln/samples/sample.pdf index b5b7adf2538..43f13544672 100644 Binary files a/Master/texmf-dist/doc/latex/probsoln/samples/sample.pdf and b/Master/texmf-dist/doc/latex/probsoln/samples/sample.pdf differ diff --git a/Master/texmf-dist/doc/latex/probsoln/samples/sample.tex b/Master/texmf-dist/doc/latex/probsoln/samples/sample.tex index 8b927bd5588..c5b631659e6 100644 --- a/Master/texmf-dist/doc/latex/probsoln/samples/sample.tex +++ b/Master/texmf-dist/doc/latex/probsoln/samples/sample.tex @@ -7,7 +7,7 @@ %% probsoln.dtx (with options: `sample.tex,package') %% %% probsoln.dtx -%% Copyright 2011 Nicola Talbot +%% Copyright 2013 Nicola Talbot %% %% This work may be distributed and/or modified under the %% conditions of the LaTeX Project Public License, either version 1.3 @@ -21,7 +21,7 @@ %% %% The Current Maintainer of this work is Nicola Talbot. %% -%% This work consists of the files probsoln.dtx and probsoln.ins and the derived files probsoln.sty, sample.tex, sample2.tex, sample3.tex, sample4.tex, sample5.tex, sample6.tex, sample7.tex, sample8.tex, prob-1stprncp.tex, prob-args.tex, prob-easy.tex, prob-easy2.tex, prob-implicit.tex, prob-mchoice.tex, prob-mixed.tex, prob-newdata.tex, prob-nosoln.tex, prob-probspaces.tex, prob-probspaces2.tex, prob-tabmchoice.tex, prob-verb.tex. +%% This work consists of the files probsoln.dtx and probsoln.ins and the derived files probsoln.sty, sample-exclude.tex, sample.tex, sample2.tex, sample3.tex, sample4.tex, sample5.tex, sample6.tex, sample7.tex, sample8.tex, prob-1stprncp.tex, prob-args.tex, prob-easy.tex, prob-easy2.tex, prob-implicit.tex, prob-mchoice.tex, prob-mixed.tex, prob-newdata.tex, prob-nosoln.tex, prob-probspaces.tex, prob-probspaces2.tex, prob-tabmchoice.tex, prob-verb.tex. %% %% \CharacterTable %% {Upper-case \A\B\C\D\E\F\G\H\I\J\K\L\M\N\O\P\Q\R\S\T\U\V\W\X\Y\Z @@ -50,8 +50,8 @@ \documentclass[a4paper]{article} \usepackage{probsoln} - %uncomment the following line to display the answers -\showanswers + % uncomment the following line to display the answers + % \showanswers % The following will generate a different set of % problems each year diff --git a/Master/texmf-dist/doc/latex/probsoln/samples/sample2.pdf b/Master/texmf-dist/doc/latex/probsoln/samples/sample2.pdf index 545b648d531..a54bc6f77d3 100644 Binary files a/Master/texmf-dist/doc/latex/probsoln/samples/sample2.pdf and b/Master/texmf-dist/doc/latex/probsoln/samples/sample2.pdf differ diff --git a/Master/texmf-dist/doc/latex/probsoln/samples/sample2.tex b/Master/texmf-dist/doc/latex/probsoln/samples/sample2.tex index 57580107254..72a2f6df6a3 100644 --- a/Master/texmf-dist/doc/latex/probsoln/samples/sample2.tex +++ b/Master/texmf-dist/doc/latex/probsoln/samples/sample2.tex @@ -7,7 +7,7 @@ %% probsoln.dtx (with options: `sample2.tex,package') %% %% probsoln.dtx -%% Copyright 2011 Nicola Talbot +%% Copyright 2013 Nicola Talbot %% %% This work may be distributed and/or modified under the %% conditions of the LaTeX Project Public License, either version 1.3 @@ -21,7 +21,7 @@ %% %% The Current Maintainer of this work is Nicola Talbot. %% -%% This work consists of the files probsoln.dtx and probsoln.ins and the derived files probsoln.sty, sample.tex, sample2.tex, sample3.tex, sample4.tex, sample5.tex, sample6.tex, sample7.tex, sample8.tex, prob-1stprncp.tex, prob-args.tex, prob-easy.tex, prob-easy2.tex, prob-implicit.tex, prob-mchoice.tex, prob-mixed.tex, prob-newdata.tex, prob-nosoln.tex, prob-probspaces.tex, prob-probspaces2.tex, prob-tabmchoice.tex, prob-verb.tex. +%% This work consists of the files probsoln.dtx and probsoln.ins and the derived files probsoln.sty, sample-exclude.tex, sample.tex, sample2.tex, sample3.tex, sample4.tex, sample5.tex, sample6.tex, sample7.tex, sample8.tex, prob-1stprncp.tex, prob-args.tex, prob-easy.tex, prob-easy2.tex, prob-implicit.tex, prob-mchoice.tex, prob-mixed.tex, prob-newdata.tex, prob-nosoln.tex, prob-probspaces.tex, prob-probspaces2.tex, prob-tabmchoice.tex, prob-verb.tex. %% %% \CharacterTable %% {Upper-case \A\B\C\D\E\F\G\H\I\J\K\L\M\N\O\P\Q\R\S\T\U\V\W\X\Y\Z diff --git a/Master/texmf-dist/doc/latex/probsoln/samples/sample3.pdf b/Master/texmf-dist/doc/latex/probsoln/samples/sample3.pdf index 2a4bdd77839..1b0e3717ade 100644 Binary files a/Master/texmf-dist/doc/latex/probsoln/samples/sample3.pdf and b/Master/texmf-dist/doc/latex/probsoln/samples/sample3.pdf differ diff --git a/Master/texmf-dist/doc/latex/probsoln/samples/sample3.tex b/Master/texmf-dist/doc/latex/probsoln/samples/sample3.tex index e10158ae4db..f40e4755ae4 100644 --- a/Master/texmf-dist/doc/latex/probsoln/samples/sample3.tex +++ b/Master/texmf-dist/doc/latex/probsoln/samples/sample3.tex @@ -7,7 +7,7 @@ %% probsoln.dtx (with options: `sample3.tex,package') %% %% probsoln.dtx -%% Copyright 2011 Nicola Talbot +%% Copyright 2013 Nicola Talbot %% %% This work may be distributed and/or modified under the %% conditions of the LaTeX Project Public License, either version 1.3 @@ -21,7 +21,7 @@ %% %% The Current Maintainer of this work is Nicola Talbot. %% -%% This work consists of the files probsoln.dtx and probsoln.ins and the derived files probsoln.sty, sample.tex, sample2.tex, sample3.tex, sample4.tex, sample5.tex, sample6.tex, sample7.tex, sample8.tex, prob-1stprncp.tex, prob-args.tex, prob-easy.tex, prob-easy2.tex, prob-implicit.tex, prob-mchoice.tex, prob-mixed.tex, prob-newdata.tex, prob-nosoln.tex, prob-probspaces.tex, prob-probspaces2.tex, prob-tabmchoice.tex, prob-verb.tex. +%% This work consists of the files probsoln.dtx and probsoln.ins and the derived files probsoln.sty, sample-exclude.tex, sample.tex, sample2.tex, sample3.tex, sample4.tex, sample5.tex, sample6.tex, sample7.tex, sample8.tex, prob-1stprncp.tex, prob-args.tex, prob-easy.tex, prob-easy2.tex, prob-implicit.tex, prob-mchoice.tex, prob-mixed.tex, prob-newdata.tex, prob-nosoln.tex, prob-probspaces.tex, prob-probspaces2.tex, prob-tabmchoice.tex, prob-verb.tex. %% %% \CharacterTable %% {Upper-case \A\B\C\D\E\F\G\H\I\J\K\L\M\N\O\P\Q\R\S\T\U\V\W\X\Y\Z diff --git a/Master/texmf-dist/doc/latex/probsoln/samples/sample4.pdf b/Master/texmf-dist/doc/latex/probsoln/samples/sample4.pdf index 3abaeb7843e..fba702a13fb 100644 Binary files a/Master/texmf-dist/doc/latex/probsoln/samples/sample4.pdf and b/Master/texmf-dist/doc/latex/probsoln/samples/sample4.pdf differ diff --git a/Master/texmf-dist/doc/latex/probsoln/samples/sample4.tex b/Master/texmf-dist/doc/latex/probsoln/samples/sample4.tex index 8d0355a2f2b..e79fd08340d 100644 --- a/Master/texmf-dist/doc/latex/probsoln/samples/sample4.tex +++ b/Master/texmf-dist/doc/latex/probsoln/samples/sample4.tex @@ -7,7 +7,7 @@ %% probsoln.dtx (with options: `sample4.tex,package') %% %% probsoln.dtx -%% Copyright 2011 Nicola Talbot +%% Copyright 2013 Nicola Talbot %% %% This work may be distributed and/or modified under the %% conditions of the LaTeX Project Public License, either version 1.3 @@ -21,7 +21,7 @@ %% %% The Current Maintainer of this work is Nicola Talbot. %% -%% This work consists of the files probsoln.dtx and probsoln.ins and the derived files probsoln.sty, sample.tex, sample2.tex, sample3.tex, sample4.tex, sample5.tex, sample6.tex, sample7.tex, sample8.tex, prob-1stprncp.tex, prob-args.tex, prob-easy.tex, prob-easy2.tex, prob-implicit.tex, prob-mchoice.tex, prob-mixed.tex, prob-newdata.tex, prob-nosoln.tex, prob-probspaces.tex, prob-probspaces2.tex, prob-tabmchoice.tex, prob-verb.tex. +%% This work consists of the files probsoln.dtx and probsoln.ins and the derived files probsoln.sty, sample-exclude.tex, sample.tex, sample2.tex, sample3.tex, sample4.tex, sample5.tex, sample6.tex, sample7.tex, sample8.tex, prob-1stprncp.tex, prob-args.tex, prob-easy.tex, prob-easy2.tex, prob-implicit.tex, prob-mchoice.tex, prob-mixed.tex, prob-newdata.tex, prob-nosoln.tex, prob-probspaces.tex, prob-probspaces2.tex, prob-tabmchoice.tex, prob-verb.tex. %% %% \CharacterTable %% {Upper-case \A\B\C\D\E\F\G\H\I\J\K\L\M\N\O\P\Q\R\S\T\U\V\W\X\Y\Z diff --git a/Master/texmf-dist/doc/latex/probsoln/samples/sample5.pdf b/Master/texmf-dist/doc/latex/probsoln/samples/sample5.pdf index e8b50cfa542..3d50533dc6c 100644 Binary files a/Master/texmf-dist/doc/latex/probsoln/samples/sample5.pdf and b/Master/texmf-dist/doc/latex/probsoln/samples/sample5.pdf differ diff --git a/Master/texmf-dist/doc/latex/probsoln/samples/sample5.tex b/Master/texmf-dist/doc/latex/probsoln/samples/sample5.tex index fd31bef8d66..4f515585196 100644 --- a/Master/texmf-dist/doc/latex/probsoln/samples/sample5.tex +++ b/Master/texmf-dist/doc/latex/probsoln/samples/sample5.tex @@ -7,7 +7,7 @@ %% probsoln.dtx (with options: `sample5.tex,package') %% %% probsoln.dtx -%% Copyright 2011 Nicola Talbot +%% Copyright 2013 Nicola Talbot %% %% This work may be distributed and/or modified under the %% conditions of the LaTeX Project Public License, either version 1.3 @@ -21,7 +21,7 @@ %% %% The Current Maintainer of this work is Nicola Talbot. %% -%% This work consists of the files probsoln.dtx and probsoln.ins and the derived files probsoln.sty, sample.tex, sample2.tex, sample3.tex, sample4.tex, sample5.tex, sample6.tex, sample7.tex, sample8.tex, prob-1stprncp.tex, prob-args.tex, prob-easy.tex, prob-easy2.tex, prob-implicit.tex, prob-mchoice.tex, prob-mixed.tex, prob-newdata.tex, prob-nosoln.tex, prob-probspaces.tex, prob-probspaces2.tex, prob-tabmchoice.tex, prob-verb.tex. +%% This work consists of the files probsoln.dtx and probsoln.ins and the derived files probsoln.sty, sample-exclude.tex, sample.tex, sample2.tex, sample3.tex, sample4.tex, sample5.tex, sample6.tex, sample7.tex, sample8.tex, prob-1stprncp.tex, prob-args.tex, prob-easy.tex, prob-easy2.tex, prob-implicit.tex, prob-mchoice.tex, prob-mixed.tex, prob-newdata.tex, prob-nosoln.tex, prob-probspaces.tex, prob-probspaces2.tex, prob-tabmchoice.tex, prob-verb.tex. %% %% \CharacterTable %% {Upper-case \A\B\C\D\E\F\G\H\I\J\K\L\M\N\O\P\Q\R\S\T\U\V\W\X\Y\Z diff --git a/Master/texmf-dist/doc/latex/probsoln/samples/sample6.tex b/Master/texmf-dist/doc/latex/probsoln/samples/sample6.tex index 1edcbaad89b..321fda452a9 100644 --- a/Master/texmf-dist/doc/latex/probsoln/samples/sample6.tex +++ b/Master/texmf-dist/doc/latex/probsoln/samples/sample6.tex @@ -7,7 +7,7 @@ %% probsoln.dtx (with options: `sample6.tex,package') %% %% probsoln.dtx -%% Copyright 2011 Nicola Talbot +%% Copyright 2013 Nicola Talbot %% %% This work may be distributed and/or modified under the %% conditions of the LaTeX Project Public License, either version 1.3 @@ -21,7 +21,7 @@ %% %% The Current Maintainer of this work is Nicola Talbot. %% -%% This work consists of the files probsoln.dtx and probsoln.ins and the derived files probsoln.sty, sample.tex, sample2.tex, sample3.tex, sample4.tex, sample5.tex, sample6.tex, sample7.tex, sample8.tex, prob-1stprncp.tex, prob-args.tex, prob-easy.tex, prob-easy2.tex, prob-implicit.tex, prob-mchoice.tex, prob-mixed.tex, prob-newdata.tex, prob-nosoln.tex, prob-probspaces.tex, prob-probspaces2.tex, prob-tabmchoice.tex, prob-verb.tex. +%% This work consists of the files probsoln.dtx and probsoln.ins and the derived files probsoln.sty, sample-exclude.tex, sample.tex, sample2.tex, sample3.tex, sample4.tex, sample5.tex, sample6.tex, sample7.tex, sample8.tex, prob-1stprncp.tex, prob-args.tex, prob-easy.tex, prob-easy2.tex, prob-implicit.tex, prob-mchoice.tex, prob-mixed.tex, prob-newdata.tex, prob-nosoln.tex, prob-probspaces.tex, prob-probspaces2.tex, prob-tabmchoice.tex, prob-verb.tex. %% %% \CharacterTable %% {Upper-case \A\B\C\D\E\F\G\H\I\J\K\L\M\N\O\P\Q\R\S\T\U\V\W\X\Y\Z diff --git a/Master/texmf-dist/doc/latex/probsoln/samples/sample7.tex b/Master/texmf-dist/doc/latex/probsoln/samples/sample7.tex index 5b1997c8f39..0b48c4cc85e 100644 --- a/Master/texmf-dist/doc/latex/probsoln/samples/sample7.tex +++ b/Master/texmf-dist/doc/latex/probsoln/samples/sample7.tex @@ -7,7 +7,7 @@ %% probsoln.dtx (with options: `sample7.tex,package') %% %% probsoln.dtx -%% Copyright 2011 Nicola Talbot +%% Copyright 2013 Nicola Talbot %% %% This work may be distributed and/or modified under the %% conditions of the LaTeX Project Public License, either version 1.3 @@ -21,7 +21,7 @@ %% %% The Current Maintainer of this work is Nicola Talbot. %% -%% This work consists of the files probsoln.dtx and probsoln.ins and the derived files probsoln.sty, sample.tex, sample2.tex, sample3.tex, sample4.tex, sample5.tex, sample6.tex, sample7.tex, sample8.tex, prob-1stprncp.tex, prob-args.tex, prob-easy.tex, prob-easy2.tex, prob-implicit.tex, prob-mchoice.tex, prob-mixed.tex, prob-newdata.tex, prob-nosoln.tex, prob-probspaces.tex, prob-probspaces2.tex, prob-tabmchoice.tex, prob-verb.tex. +%% This work consists of the files probsoln.dtx and probsoln.ins and the derived files probsoln.sty, sample-exclude.tex, sample.tex, sample2.tex, sample3.tex, sample4.tex, sample5.tex, sample6.tex, sample7.tex, sample8.tex, prob-1stprncp.tex, prob-args.tex, prob-easy.tex, prob-easy2.tex, prob-implicit.tex, prob-mchoice.tex, prob-mixed.tex, prob-newdata.tex, prob-nosoln.tex, prob-probspaces.tex, prob-probspaces2.tex, prob-tabmchoice.tex, prob-verb.tex. %% %% \CharacterTable %% {Upper-case \A\B\C\D\E\F\G\H\I\J\K\L\M\N\O\P\Q\R\S\T\U\V\W\X\Y\Z diff --git a/Master/texmf-dist/doc/latex/probsoln/samples/sample8.tex b/Master/texmf-dist/doc/latex/probsoln/samples/sample8.tex index d52549da9eb..503488f5e2e 100644 --- a/Master/texmf-dist/doc/latex/probsoln/samples/sample8.tex +++ b/Master/texmf-dist/doc/latex/probsoln/samples/sample8.tex @@ -7,7 +7,7 @@ %% probsoln.dtx (with options: `sample8.tex,package') %% %% probsoln.dtx -%% Copyright 2011 Nicola Talbot +%% Copyright 2013 Nicola Talbot %% %% This work may be distributed and/or modified under the %% conditions of the LaTeX Project Public License, either version 1.3 @@ -21,7 +21,7 @@ %% %% The Current Maintainer of this work is Nicola Talbot. %% -%% This work consists of the files probsoln.dtx and probsoln.ins and the derived files probsoln.sty, sample.tex, sample2.tex, sample3.tex, sample4.tex, sample5.tex, sample6.tex, sample7.tex, sample8.tex, prob-1stprncp.tex, prob-args.tex, prob-easy.tex, prob-easy2.tex, prob-implicit.tex, prob-mchoice.tex, prob-mixed.tex, prob-newdata.tex, prob-nosoln.tex, prob-probspaces.tex, prob-probspaces2.tex, prob-tabmchoice.tex, prob-verb.tex. +%% This work consists of the files probsoln.dtx and probsoln.ins and the derived files probsoln.sty, sample-exclude.tex, sample.tex, sample2.tex, sample3.tex, sample4.tex, sample5.tex, sample6.tex, sample7.tex, sample8.tex, prob-1stprncp.tex, prob-args.tex, prob-easy.tex, prob-easy2.tex, prob-implicit.tex, prob-mchoice.tex, prob-mixed.tex, prob-newdata.tex, prob-nosoln.tex, prob-probspaces.tex, prob-probspaces2.tex, prob-tabmchoice.tex, prob-verb.tex. %% %% \CharacterTable %% {Upper-case \A\B\C\D\E\F\G\H\I\J\K\L\M\N\O\P\Q\R\S\T\U\V\W\X\Y\Z diff --git a/Master/texmf-dist/source/latex/probsoln/probsoln.dtx b/Master/texmf-dist/source/latex/probsoln/probsoln.dtx index 9515bfe3a4a..0468d92c632 100644 --- a/Master/texmf-dist/source/latex/probsoln/probsoln.dtx +++ b/Master/texmf-dist/source/latex/probsoln/probsoln.dtx @@ -9,7 +9,7 @@ % -doc "probsoln-manual.tex" % -author "Nicola Talbot" % probsoln -% Created on 2011/12/10 17:17 +% Created on 2013/3/13 15:28 %\fi %\iffalse %<*package> @@ -32,7 +32,7 @@ %\fi % \iffalse % Doc-Source file to use with LaTeX2e -% Copyright (C) 2011 Nicola Talbot, all rights reserved. +% Copyright (C) 2013 Nicola Talbot, all rights reserved. % \fi % \iffalse %<*driver> @@ -54,7 +54,7 @@ \RecordChanges \PageIndex -\CheckSum{1484} +\CheckSum{1822} \newcommand*{\dq}[1]{``#1''} @@ -66,7 +66,7 @@ %\MakeShortVerb{"} %\DeleteShortVerb{\|} % -% \title{probsoln v3.02: +% \title{probsoln v3.04: %creating problem sheets optionally with solutions} % \author{Nicola L.C. Talbot\\[10pt] %School of Computing Sciences\\ @@ -75,7 +75,7 @@ %NR4 7TJ. United Kingdom.\\ %\url{http://theoval.cmp.uea.ac.uk/~nlct/}} % -% \date{2011-12-10} +% \date{2012-08-23} % \maketitle %\tableofcontents % @@ -535,6 +535,8 @@ %\end{definition} %This is similar to \cs{loadrandomproblems} except that it won't load %those problems whose labels are listed in \meta{exception list}. +%\textbf{If you want to automatically exclude problems included in +%previous documents, see \sectionref{sec:exprev}.} % %Note that the random number generator has been modified in version %3.01 in order to fix a bug. If you want to ensure that your random @@ -555,6 +557,117 @@ %a problem definition will be parsed twice. %\end{important} % +%\subsection{Randomly Selecting Problems Not Selected in Previous +%Documents} +%\label{sec:exprev} +% +%Suppose you have a large set of questions that you want to randomly +%select for assignments and exams. The chances are, you don't want to +%include questions that have been previously set for, say, the last +%three years. That is, you don't want to select questions the +%students may already have seen. As from version 3.03, you can now do +%this. +% +%The \sty{probsoln} package defaults to the UK academic year, which +%starts in September. If this isn't appropriate, you can change it +%using: +%\begin{definition}[\DescribeMacro{\SetStartMonth}] +%\cs{SetStartMonth}\marg{n} +%\end{definition} +%where \meta{n} is the number of the month. (1 = January, 2 = +%February, etc.) +% +%The \emph{start year} is the calender year in effect when the +%academic year started. For example, if this is the academic year +%2011/12, then the start year is 2011. This is automatically set to +%the start of the current academic year. It is also updated when +%\cs{SetStartMonth} is used.\footnote{So don't use \cs{SetStartMonth} +%after \cs{SetStartYear}.} If you want to set it to a specific year, +%you can use: +%\begin{definition}[\DescribeMacro{\SetStartYear}] +%\cs{SetStartYear}\marg{year} +%\end{definition} +%For example: \verb|\SetStartYear{2008}| indicates the academic year +%2008/9. +% +%There are two files concerned with previously used labels. They are: +%\begin{description} +% +% \item[The previously used labels file] This keeps track of all +% problems used in previous years, as well as problems used by +% other documents that have this as their previously used labels +% file, and it contains the problem labels from the last run of +% the current document. +% +% \item[The current used labels file] This defaults to +%\cs{jobname}\texttt{.prb}, but the name can be changed using: +% \begin{definition}[\DescribeMacro{\SetUsedFileName}] +% \cs{SetUsedFileName}\marg{name} +% \end{definition} +% This file keeps track of all the labels used in the current +% document from the previous \LaTeX\ run. Note that if you want to +% delete this file, first clear it using +% \begin{definition}[\DescribeMacro{\ClearUsedFile}] +% \cs{ClearUsedFile}\marg{file} +% \end{definition} +% in place of \cs{ExcludePreviousFile}\marg{file}, described below. +% The argument \meta{file} is the previously used labels file +% described above. \cs{ClearUsedFile} will remove all labels in +% the current used labels file from the previously used labels file +% and clear the current used labels file. Once this file is empty, +% it may then be deleted. +% +%\end{description} +% +%Before loading randomly selected problems, first specify the +%previously used labels file with the command: +%\begin{definition}[\DescribeMacro{\ExcludePreviousFile}] +%\cs{ExcludePreviousFile}\oarg{number of years}\marg{file name} +%\end{definition} +%where \meta{file name} is the name of the previously used file. The +%optional argument \meta{number of years} specifies the year cut-off. +%This defaults to 3, which means that only those labels used this +%year or the previous 2 years will be kept. Any problems used before +%then may be reused. +% +%Suppose I'm lecturing a first year undergraduate mathematics course +%(designated, say, mth101). I want to set assignments on each topic +%and an exam at the end of the year (as well as a resit or second +%sitting paper). I've got databases with problems for each topic, but +%the first and second sitting exams mustn't include any of the +%problems used in the assignments or any problems used in assignments +%or exams for the previous two academic years. I'm going to arrange +%my directory structure as follows: +%\begin{itemize} +%\item \texttt{mth101/} +% \begin{itemize} +% \item \texttt{assignment1/} (differentiation) +% \begin{itemize} +% \item \texttt{assignment1.tex} +% \end{itemize} +% \item \texttt{assignment2/} (probability spaces) +% \begin{itemize} +% \item \texttt{assignment2.tex} +% \end{itemize} +% \item \texttt{assignment3/} (linear algebra) +% \begin{itemize} +% \item \texttt{assignment3.tex} +% \end{itemize} +% \item \texttt{exams/} +% \begin{itemize} +% \item \texttt{exam.tex} (first sitting) +% \item \texttt{resit.tex} (second sitting) +% \end{itemize} +% \item \texttt{databases/} +% \begin{itemize} +% \item \texttt{differentiation.tex} +% \item \texttt{probabilityspaces.tex} +% \item \texttt{linearalgebra.tex} +% \end{itemize} +% \item \texttt{previouslabels.tex} (created by \sty{probsoln}) +% \end{itemize} +%\end{itemize} +% %\section{Iterating Through Datasets}\label{sec:foreach} % %Once you have defined all your problems for a given data set, you @@ -854,7 +967,7 @@ % \end{macrocode} % Identify this package and version: % \begin{macrocode} -\ProvidesPackage{probsoln}[2011/12/10 v3.02 (NLCT)] +\ProvidesPackage{probsoln}[2012/08/23 v3.04 (NLCT)] % \end{macrocode} % Required packages: %\changes{3.01}{2011/08/22}{substr package no longer required} @@ -862,6 +975,11 @@ \RequirePackage{ifthen} \RequirePackage{amsmath} % \end{macrocode} +%\changes{3.03}{2011/01/16}{added etoolbox to list of required +%packages} +% \begin{macrocode} +\RequirePackage{etoolbox} +% \end{macrocode} % \subsection{Package Options} %\begin{macro}{\ifshowanswers} % Define boolean to determine whether or not to show the @@ -979,6 +1097,393 @@ % \end{macrocode} %\end{macro} % +%\begin{macro}{\probsoln@startyear} +%\changes{3.03}{2011/01/16}{new} +% The year as at the start of the new academic year. (For example, +% if the academic year starts in September and today is any date +% between 2011-09-01 and 2012-08-30, then the start year is 2011.) +% \begin{macrocode} +\newcount\probsoln@startyear +% \end{macrocode} +%\end{macro} +% +%\begin{macro}{\SetStartYear} +%\changes{3.03}{2011/01/16}{new} +% Provide command to set the starting year manually. +% \begin{macrocode} +\newcommand*{\SetStartYear}[1]{% + \probsoln@startyear=#1\relax + \renewcommand\SetStartMonth[1]{% + \PackageError{probsoln}{\string\SetStartMonth\space + can't be used after \string\SetStartYear}{}}% +} +% \end{macrocode} +%\end{macro} +% +%\begin{macro}{\GetStartYear} +% Gets the value of the start year count register: +% \begin{macrocode} +\newcommand*{\GetStartYear}{\probsoln@startyear} +% \end{macrocode} +%\end{macro} +% +%\begin{macro}{\probsoln@startmonth} +%\changes{3.03}{2011/01/16}{new} +% The month starting the academic year. (1=January, 2=February, +% etc). +% \begin{macrocode} +\newcount\probsoln@startmonth +% \end{macrocode} +%\end{macro} +%\begin{macro}{\SetStartMonth} +%\changes{3.03}{2011/01/16}{new} +% Define command to set the month starting the academic year. This +% also sets the starting year. +% \begin{macrocode} +\newcommand*{\SetStartMonth}[1]{% + \probsoln@startmonth=#1\relax + \probsoln@startyear=\year\relax + \ifnum\month<\probsoln@startmonth + \advance\probsoln@startyear by -1\relax + \fi +} +% \end{macrocode} +%\end{macro} +% +% Set the default starting month to 9 (September): +% \begin{macrocode} +\SetStartMonth{9} +% \end{macrocode} +% +%\begin{macro}{\probsoln@prev} +%\changes{3.03}{2011/01/16}{new} +% File handle for file containing previous labels. +% \begin{macrocode} +\newwrite\probsoln@prev +% \end{macrocode} +%\end{macro} +% +%\begin{macro}{\probsoln@used} +%\changes{3.03}{2011/01/16}{new} +% File handle for file containing previous used. +% \begin{macrocode} +\newwrite\probsoln@used +% \end{macrocode} +%\end{macro} +% +%\begin{macro}{\probsoln@prev@cutoff} +%\changes{3.03}{2011/01/16}{new} +% Cut-off year. Problems excluded if the year they were set is +% greater than the cut-off year. +% \begin{macrocode} +\newcount\probsoln@prev@cutoff +% \end{macrocode} +%\end{macro} +% +%\begin{macro}{\@probsoln@usedfilename} +% Stores the file name for the used problems file. (Defaults to +% \cs{jobname}\texttt{.prb}) +% \begin{macrocode} +\newcommand*{\@probsoln@usedfilename}{\jobname.prb} +% \end{macrocode} +%\end{macro} +% +%\begin{macro}{\SetUsedFileName} +% Set the name of the used problems file. +% \begin{macrocode} +\newcommand*{\SetUsedFileName}[1]{% + \renewcommand*{\@probsoln@usedfilename}{#1}% +} +% \end{macrocode} +%\end{macro} +% +%\begin{macro}{\ClearUsedFile} +%\changes{3.03}{2011/01/16}{new} +% Clear the contents of the used file (\cs{@probsoln@usedfilename}) +% and remove corresponding entries from the previous file (as +% specified in \cs{ExcludePreviousFile}). +% Not to be used after \cs{ExcludePreviousFile}. +% \begin{macrocode} +\newcommand*{\ClearUsedFile}[1]{% + \probsoln@prev@cutoff=0\relax + \@probsoln@readprev{#1}% +% \end{macrocode} +% Only write labels that aren't in the used file. +% \begin{macrocode} + \@for\@this@db:=\prob@databases\do{% + {% + \edef\@prev@list{\csname probsoln@prev@list@\@this@db\endcsname}% + \ifdefempty{\@prev@list}% + {}% + {% + \@for\@this@label:=\@prev@list\do{% + \ifcsundef{@used@problem@\@this@db @\@this@label}% + {% + \immediate\write\probsoln@prev{% + \string\previousproblem{\@this@label}{\@this@db}% + {\csname @prev@problem@\@this@db @\@this@label\endcsname}}% + }% + {}% + }% + }% + }% + }% + \immediate\closeout\probsoln@prev + \immediate\closeout\probsoln@used + \@disable@exclude@prev +} +% \end{macrocode} +%\end{macro} +% +%\begin{macro}{\ExcludePreviousFile} +%\changes{3.03}{2011/01/16}{new} +% Exclude problems used in the last \meta{n} years. +% \begin{macrocode} +\newcommand*{\ExcludePreviousFile}[2][3]{% + \probsoln@prev@cutoff=\probsoln@startyear\relax + \advance\probsoln@prev@cutoff by -#1\relax + \@probsoln@readprev{#2}% + \@write@prev + \def\ExcludePreviousFile[2][3]{\PackageError{probsoln}{Only one + instance of \string\ExcludePreviousFile\space allowed}{You've + already used this command. You are only allowed to use it once}}% + \def\ClearUsedFile[1]{% + \PackageError{probsoln}% + {\string\ClearUsedFile\space may not be used after + \string\ExcludePreviousFile}{}}% +} +% \end{macrocode} +%\end{macro} +% +%\begin{macro}{\@probsoln@readprev} +% Read contents of previous and used files and open for writing. +% \begin{macrocode} +\newcommand*{\@probsoln@readprev}[1]{% + \@enable@exclude@prev + \InputIfFileExists{#1}% + {\PackageInfo{probsoln}% + {Excluded problem file `#1' found}}% + {\PackageInfo{probsoln}% + {Excluded problem file `#1' not found. A new one will be + created}}% + \InputIfFileExists{\@probsoln@usedfilename}% + {\PackageInfo{probsoln}% + {Current problems file `\@probsoln@usedfilename' found}}% + {\PackageInfo{probsoln}% + {No current problem file `\@probsoln@usedfilename' found. A new one will be created}}% + \immediate\openout\probsoln@prev=#1 + \immediate\openout\probsoln@used=\@probsoln@usedfilename +} +% \end{macrocode} +%\end{macro} +% +%\begin{macro}{\probsoln@prev@list} +%\changes{3.03}{2011/01/16}{new} +% Maintain a list of all previous problem labels: +% \begin{macrocode} +\newcommand*{\probsoln@prev@list@default}{} +% \end{macrocode} +%\end{macro} +% +%\begin{macro}{\@write@prev} +%\changes{3.03}{2011/01/16}{new} +% Write all previous labels to file. +% \begin{macrocode} +\newcommand*{\@write@prev}{% + \@for\@this@db:=\prob@databases\do{% + {% + \edef\@prev@list{\csname probsoln@prev@list@\@this@db\endcsname}% + \ifdefempty{\@prev@list}% + {}% + {% + \@for\@this@label:=\@prev@list\do{% + \immediate\write\probsoln@prev{% + \string\previousproblem{\@this@label}{\@this@db}% + {\csname @prev@problem@\@this@db @\@this@label\endcsname}}% + }% + }% + }% + }% +} +% \end{macrocode} +%\end{macro} +% +%\begin{macro}{\@enable@exclude@prev} +%\changes{3.03}{2011/01/16}{new} +% Enable commands for excluding previously selected problems. +% \begin{macrocode} +\newcommand*{\@enable@exclude@prev}{% +% \end{macrocode} +% Redefine macro that adds used problem to used problem file and +% previous problem file. +% \begin{macrocode} + \renewcommand*{\@add@used@problem}[2]{% + \immediate\write\probsoln@used{\string\usedproblem{##1}{##2}{\number\probsoln@startyear}}% + \ifcsundef{@prev@problem@##2@##1}% + {% + \immediate\write\probsoln@prev{% + \string\previousproblem{##1}{##2}{\number\probsoln@startyear}}% + \expandafter\xdef\csname @prev@problem@##2@##1\endcsname{% + \number\probsoln@startyear}% + }% + {% + \expandafter\ifnum\csname @prev@problem@##2@##1\endcsname + <\probsoln@startyear + \immediate\write\probsoln@prev{% + \string\previousproblem{##1}{##2}{\number\probsoln@startyear}}% + \expandafter\xdef\csname @prev@problem@##2@##1\endcsname{% + \number\probsoln@startyear}% + \fi + }% + }% +% \end{macrocode} +% Redefine macro that fetches the exclusion list. (First argument is +% the macro in which to store the list, the second argument is the +% database.) +% \begin{macrocode} + \renewcommand*{\@fetch@excluded@list}[2]{% + \def##1{}% + \ifcsdef{probsoln@prev@list@##2}% + {% + \edef\@prev@list{\csname probsoln@prev@list@##2\endcsname}% + \@for\@this@label:=\@prev@list\do{% +% \end{macrocode} +% If it isn't one of the used problems, it can be added to the +% exclusion list: +% \begin{macrocode} + \ifcsundef{@used@problem@##2@\@this@label}% + {% +% \end{macrocode} +% It isn't, so label can be added to the exclusion list: +% \begin{macrocode} + \ifcsempty{##1}% + {\edef##1{\@this@label}}% + {\edef##1{##1,\@this@label}}% + }% + {}% + }% + }% + {}% + }% +% \end{macrocode} +% Add new previous list for given database: +% \begin{macrocode} + \renewcommand*{\@add@newprevlist}[1]{% + \expandafter\gdef\csname probsoln@prev@list@##1\endcsname{}% + }% +% \end{macrocode} +% Redefine macro that closes the exclusion-related files. +% \begin{macrocode} + \renewcommand*{\close@probsoln@prev}{% + \closeout\probsoln@prev + \closeout\probsoln@used + }% +} +% \end{macrocode} +%\end{macro} +%\begin{macro}{\@disable@exclude@prev} +%\changes{3.03}{2011/01/16}{new} +% Disable commands for excluding previously selected problems. +% \begin{macrocode} +\newcommand*{\@disable@exclude@prev}{% + \renewcommand*{\@add@used@problem}[2]{}% + \renewcommand*{\@fetch@excluded@list}[2]{\def##1{}}% + \renewcommand*{\@add@newprevlist}[1]{}% + \renewcommand*{\close@probsoln@prev}{}% +} +% \end{macrocode} +%\end{macro} +% +% By default, the commands for excluding previously selected +% problems are disabled. +%\begin{macro}{\@add@used@problem} +%\changes{3.03}{2011/01/16}{new} +% Adds problem to used problems list. (First argument is the label, +% the second argument is the database name.) +% \begin{macrocode} +\newcommand*{\@add@used@problem}[2]{} +% \end{macrocode} +%\end{macro} +% +%\begin{macro}{\@fetch@excluded@list} +%\changes{3.03}{2011/01/16}{new} +% Fetches the excluded list. (First argument macro in which to store +% the list. The second argument is the database name.) +% \begin{macrocode} +\newcommand*{\@fetch@excluded@list}[2]{% + \def#1{}% +} +% \end{macrocode} +%\end{macro} +% +%\begin{macro}{\@add@newprevlist} +%\changes{3.03}{2011/01/16}{new} +% Adds a new previous list for the given database: +% \begin{macrocode} +\newcommand*{\@add@newprevlist}[1]{} +% \end{macrocode} +%\end{macro} +% +%\begin{macro}{\close@probsoln@prev} +%\changes{3.03}{2011/01/16}{new} +% Close file used for previous labels +% \begin{macrocode} +\newcommand*{\close@probsoln@prev}{} +% \end{macrocode} +%\end{macro} +% +% At the end of the document, close file if required: +% \begin{macrocode} +\AtEndDocument{\close@probsoln@prev} +% \end{macrocode} +% +%\begin{macro}{\previousproblem} +%\changes{3.03}{2011/01/16}{new} +% Identifies problem that has been selected and the year it was +% selected. (First argument label, second argument database name, +% third argument year.) +% \begin{macrocode} +\newcommand*{\previousproblem}[3]{% + \ifnum#3>\probsoln@prev@cutoff +% \end{macrocode} +% If data set hasn't been defined, define it: +% \begin{macrocode} + \ifcsundef{prob@db@#2}{\prob@newdb{#2}}{}% +% \end{macrocode} +% Define command that stores the year the problem was used: +% \begin{macrocode} + \expandafter\gdef\csname @prev@problem@#2@#1\endcsname{#3}% +% \end{macrocode} +% Add label to the previous list for this data set: +% \begin{macrocode} + \edef\@prev@list{\csname probsoln@prev@list@#2\endcsname}% + \ifdefempty{\@prev@list}% + {% + \expandafter\xdef\csname probsoln@prev@list@#2\endcsname{#1}% + }% + {% + \expandafter\xdef\csname probsoln@prev@list@#2\endcsname{% + \@prev@list,#1}% + }% + \fi +} +% \end{macrocode} +%\end{macro} +% +%\begin{macro}{\usedproblem} +%\changes{3.03}{2011/01/16}{new} +% Don't want to exclude problems that were selected in the previous +% run of this document for the current year, so they need to be +% identified in the aux file. +% \begin{macrocode} +\newcommand*{\usedproblem}[3]{% + \ifnum#3=\probsoln@startyear + \expandafter\def\csname @used@problem@#2@#1\endcsname{#3}% + \fi +} +% \end{macrocode} +%\end{macro} +% %\subsection{Databases} % All the problems are stored in data bases. Each data base % \meta{name} is represented as a macro \cs{prob@db@}\meta{name} @@ -1014,12 +1519,18 @@ % Creates a new (empty) data base. % \begin{macrocode} \newcommand*{\prob@newdb}[1]{% -\@ifundefined{prob@db@#1}{% - \expandafter\gdef\csname prob@db@#1\endcsname{}% - \xdef\prob@databases{\prob@databases,#1}% - \expandafter\gdef\csname prob@db@#1@solutions\endcsname{}% - }{% - \PackageError{probsoln}{Data set `#1' is already defined}{}}} + \ifcsundef{prob@db@#1}% + {% + \expandafter\gdef\csname prob@db@#1\endcsname{}% + \xdef\prob@databases{\prob@databases,#1}% + \expandafter\gdef\csname prob@db@#1@solutions\endcsname{}% + \@add@newprevlist{#1}% + }% + {% + \PackageError{probsoln}{Data set `#1' is already defined}% + {Data set names must be unique}% + }% +} % \end{macrocode} %\end{macro} % @@ -1067,12 +1578,14 @@ % \end{macrocode} % Add label to target data base % \begin{macrocode} - \expandafter\ifx\csname prob@db@#3\endcsname\@empty + \ifcsempty{prob@db@#3}% + {% \expandafter\xdef\csname prob@db@#3\endcsname{#1}% - \else + }% + {% \expandafter\xdef\csname prob@db@#3\endcsname{% \csname prob@db@#3\endcsname,#1}% - \fi + }% % \end{macrocode} % Redefine \cs{prob@data@}\meta{source}"@"\meta{label} as % \cs{prob@data@}\meta{target}"@"\meta{label}. @@ -1665,6 +2178,7 @@ Please specify (e.g. \csname @prob@getargs@eg@\romannumeral#1\endcsname):}% \def\@prob@currentlabel{#2}% \def\prob@currentdb{#1}% \prob@showdraftlabel{#1}{#2}% + \@add@used@problem{#2}{#1}% \let\@useprob@next=\relax \@ifundefined{prob@data@#1@#2}% {% @@ -1793,9 +2307,11 @@ Please specify (e.g. \csname @prob@getargs@eg@\romannumeral#1\endcsname):}% %\cs{loadrandomproblems}\oarg{db name}\marg{n}\marg{filename} %\end{definition} % Loads \meta{n} randomly selected problems from \meta{filename}. +%\changes{3.03}{2011/01/16}{fetch exclusion list} % \begin{macrocode} \newcommand{\loadrandomproblems}[3][default]{% - \@loadrandomproblems{#1}{#2}{#3}{}% + \@fetch@excluded@list{\@excl@list}{#1}% + \@loadrandomproblems{#1}{#2}{#3}{\@excl@list}% } % \end{macrocode} %\end{macro} @@ -1835,8 +2351,13 @@ Please specify (e.g. \csname @prob@getargs@eg@\romannumeral#1\endcsname):}% % \begin{macrocode} \@probselN=0\relax \@for\@thislabel:=\prob@selectedlabels\do{% - \expandafter\DTLifinlist\expandafter - {\@thislabel}{#4}{}% +% \end{macrocode} +%\changes{3.03}{2011/01/16}{ensure arguments expanded in +%\cs{DTLifinlist}} +% \begin{macrocode} + \edef\@if@in@list{\noexpand\DTLifinlist{\@thislabel}{#4}}% + \@if@in@list + {}% {% \advance\@probselN by 1\relax \expandafter @@ -1844,16 +2365,41 @@ Please specify (e.g. \csname @prob@getargs@eg@\romannumeral#1\endcsname):}% \@thislabel}% }% }% - \shuffle{@prob@tmp@}{\@probselN}% - \ifnum\@probselN<#2\relax % \end{macrocode} -%\changes{3.01}{2011/08/22}{changed error to warning} +%\changes{3.03}{2012/01/16}{added exclusion list to warning messages} % \begin{macrocode} - \PackageWarning{probsoln}{You have requested - \number#2\space\space problem(s) but `#3' only contains - \number\@probselN\space problems. All problems will be selected}% + \edef\@do@excludedlist{#4}% + \ifdefempty{\@do@excludedlist}% + {}% + {\def\@do@excludedlist{(Excluded list: #4.) }}% +% \end{macrocode} +%\changes{3.03}{2012/01/16}{added check for 0 available problems} +% \begin{macrocode} + \ifnum\@probselN=0\relax + \PackageWarning{probsoln}{You have requested + \number#2\space\space problem(s) but there are no available + problems in `#3'. \@do@excludedlist No problems will be selected}% \else - \@probselN=#2\relax + \shuffle{@prob@tmp@}{\@probselN}% + \ifnum\@probselN<#2\relax +% \end{macrocode} +%\changes{3.01}{2011/08/22}{changed error to warning} +% \begin{macrocode} + \ifnum\@probselN=1\relax + \PackageWarning{probsoln}{You have requested + \number#2\space\space problem(s) but there is only + 1 problem available in `#3'. \@do@excludedlist + Only 1 problem will be selected}% + \else + \PackageWarning{probsoln}{You have requested + \number#2\space\space problem(s) but there are only + \number\@probselN\space problems available in `#3'. + \@do@excludedlist + Only \number\@probselN\space problems will be selected}% + \fi + \else + \@probselN=#2\relax + \fi \fi % \end{macrocode} % Store only the first \meta{n} of the shuffled labels. @@ -2139,33 +2685,38 @@ Please specify (e.g. \csname @prob@getargs@eg@\romannumeral#1\endcsname):}% %\loadrandomproblems{1}{\tmp}} %\end{verbatim} % +%\changes{3.03}{}{added count register to keep track of level to +%allow for nested loops} % \begin{macrocode} \newcount\@ps@forrand +\newcount\@ps@forrand@level \newcommand{\doforrandN}[4]{% + \global\advance\@ps@forrand@level by 1\relax {% \@ps@forrand=0\relax \@for#2:=#3\do{% \advance\@ps@forrand by 1\relax \expandafter - \edef\csname @doforrandN@\romannumeral\@ps@forrand\endcsname{#2}% + \edef\csname @doforrandN@\number\@ps@forrand@level @\romannumeral\@ps@forrand\endcsname{#2}% }% \ifnum\@ps@forrand<#1\relax - \PackageError{probsoln}{Can't randomly select \number#1 item(s)}{You - have requested \number#1 item(s), but there - are only \number\@ps@forrand item(s) in the list}% + \PackageError{probsoln}{Can't randomly select \number#1\space item(s)}{You + have requested \number#1\space item(s), but there + are only \number\@ps@forrand\space item(s) in the list: #3}% \else - \shuffle{@doforrandN@}{\@ps@forrand}% + \shuffle{@doforrandN@\number\@ps@forrand@level @}{\@ps@forrand}% \ifnum#1>0\relax \@ps@forrand=0\relax \loop \advance\@ps@forrand by 1\relax - \edef#2{\csname @doforrandN@\romannumeral\@ps@forrand\endcsname}% + \edef#2{\csname @doforrandN@\number\@ps@forrand@level @\romannumeral\@ps@forrand\endcsname}% #4% \ifnum\@ps@forrand<#1\relax \repeat \fi \fi }% + \global\advance\@ps@forrand@level by -1\relax } % \end{macrocode} %\end{macro} @@ -2264,12 +2815,13 @@ Please specify (e.g. \csname @prob@getargs@eg@\romannumeral#1\endcsname):}% % environment's counters. %\begin{environment}{textenum} %\changes{2007 Oct 6}{2.05}{new} +%\changes{2012/08/23}{3.04}{fixed bug that interfered with depth counter} % \begin{macrocode} \newenvironment{textenum}{% \ifnum\@enumdepth>\thr@@ \@toodeep \else - \advance\@enumdepth\@ne\relax + \advance\@enumdepth by 1\relax \edef\@enumctr{enum\romannumeral\the\@enumdepth}% \let\@item\@textitem \def\@itemlabel{% @@ -2281,7 +2833,6 @@ Please specify (e.g. \csname @prob@getargs@eg@\romannumeral#1\endcsname):}% \ignorespaces }% {% - \global\advance\@enumdepth\m@ne\relax } % \end{macrocode} %\end{environment} @@ -2359,7 +2910,7 @@ Please specify (e.g. \csname @prob@getargs@eg@\romannumeral#1\endcsname):}% %\fi %\iffalse % \begin{macrocode} -%<*sample.tex> +%<*sample-exclude.tex> % \end{macrocode} %\fi %\iffalse @@ -2369,7 +2920,100 @@ Please specify (e.g. \csname @prob@getargs@eg@\romannumeral#1\endcsname):}% \usepackage{probsoln} %uncomment the following line to display the answers -\showanswers + %\showanswers + + % Set the academic year to be 2011/12 (if omitted assume current + % academic year): + \SetStartYear{2011} + + % Set the seed for the random number generator: + \PSNrandseed{\GetStartYear} + + % Exclude problems that have been used this year or the previous + % two academic years. (Creates a file called 'excluded.tex' to + % store labels of used problems. Also creates a file called + % \jobname.prb that stores labels of problems used in this + % document, so they don't get excluded on subsequent runs.) + \ExcludePreviousFile[3]{excluded} + + % To clear the used problems file (\jobname.prb) of the labels + % generated in the previous run, comment the above and uncomment + % below: + % \ClearUsedFile{excluded} + + % Load 1 problem randomly selected from the given file + % and store in database 'firstprinciples': +\loadrandomproblems[firstprinciples]{1}{prob-1stprncp} + + % Load 5 problems randomly selected from the given file + % and store in database 'easy': +\loadrandomproblems[easy]{5}{prob-easy} + + % Load 2 problems randomly selected from the given file + % and store in database 'implicit': +\loadrandomproblems[implicit]{2}{prob-implicit} + + % Load 2 problems randomly selected from the given file + % and store in database 'probspaces': +\loadrandomproblems[probspaces]{2}{prob-probspaces} + + % Load 1 problem randomly selected from the given file + % and store in database 'mchoice': +\loadrandomproblems[mchoice]{1}{prob-mchoice} + + % Load 1 problem randomly selected from the given file + % and store in database 'nosoln': +\loadrandomproblems[nosoln]{1}{prob-nosoln} + + +\begin{document} +\title{Sample Problem Sheet} +\author{Nicola Talbot} +\maketitle + +\begin{enumerate} + % Differentiation from first principles + \foreachproblem[firstprinciples]{\item \thisproblem} + +\item Differentiate the following functions: +\begin{enumerate} + \foreachproblem[easy]{\item \thisproblem} +\end{enumerate} + + % Implicit differentiation +\foreachproblem[implicit]{\item \thisproblem} + + % Finite probability spaces +\foreachproblem[probspaces]{\item \thisproblem} + + % Multiple choice question +\foreachproblem[mchoice]{\item \thisproblem} + + % select one essay style question that doesn't come with a solution + +\foreachproblem[nosoln]{\item \thisproblem} +\end{enumerate} +\end{document} +% \end{macrocode} +%\fi +%\iffalse +% \begin{macrocode} +% +% \end{macrocode} +%\fi +%\iffalse +% \begin{macrocode} +%<*sample.tex> +% \end{macrocode} +%\fi +%\iffalse +% \begin{macrocode} + % This file is public domain +\documentclass[a4paper]{article} + +\usepackage{probsoln} + % uncomment the following line to display the answers + % \showanswers % The following will generate a different set of % problems each year @@ -2941,6 +3585,33 @@ f'(x) & = & g'(x)\ln(g(x)) + \frac{g(x)}{g(x)}g'(x)\\ $y = \frac{\sin x}{x}$.}{% \[\frac{dy}{dx} = \frac{\cos x}{x} - \frac{\sin x}{x^2}\]} +\newproblem{diffeasy:exp4x}{% + $y = \exp(4x)$ +}% +{% + \[\frac{dy}{dx} = 4\exp(4x)\] +} + +\newproblem{diffeasy:exp3x+2}{% + $y = \exp(3x+2)$ +}% +{% + \[\frac{dy}{dx} = 3\exp(3x+2)\] +} + +\newproblem{diffeasy:cubic}{% + $y=x^3 + 4x^2 - x + 3$ +}% +{% + \[\frac{dy}{dx} = 3x^2 + 8x - 1\] +} + +\newproblem{diffeasy:quad}{% + $y=2x^3 + 6x -1$ +}% +{% + \[\frac{dy}{dx} = 6x + 6 = 6(x+1)\] +} % \end{macrocode} %\fi %\iffalse @@ -3119,6 +3790,15 @@ Differentiating with respect to $x$ gives: & = & \frac{-x}{\sqrt{1-x^2}}. \end{eqnarray*}} +\newproblem{imd:ellipse}{% +Find the gradient of the ellipse given by $4x^2 + 3y^2 = 25$.}{% +Differentiating with respect to $x$ gives: +\begin{eqnarray*} +8x + 6y\frac{dy}{dx} & = & 0\\ +\frac{dy}{dx} & = & \frac{-8x}{6y}\\ + & = & \frac{-4x}{\sqrt{25-4x^2}}. +\end{eqnarray*}} + \newproblem{imd:ysq:xcuov2mx}{% Find $\frac{dy}{dx}$, given \begin{displaymath} diff --git a/Master/texmf-dist/source/latex/probsoln/probsoln.ins b/Master/texmf-dist/source/latex/probsoln/probsoln.ins index 20afb0ffb88..261f5de04d8 100644 --- a/Master/texmf-dist/source/latex/probsoln/probsoln.ins +++ b/Master/texmf-dist/source/latex/probsoln/probsoln.ins @@ -1,10 +1,10 @@ -% probsoln.ins generated using makedtx version 0.94b 2011/12/10 17:17 +% probsoln.ins generated using makedtx version 0.94b 2013/3/13 15:28 \input docstrip \preamble probsoln.dtx - Copyright 2011 Nicola Talbot + Copyright 2013 Nicola Talbot This work may be distributed and/or modified under the conditions of the LaTeX Project Public License, either version 1.3 @@ -18,7 +18,7 @@ The Current Maintainer of this work is Nicola Talbot. - This work consists of the files probsoln.dtx and probsoln.ins and the derived files probsoln.sty, sample.tex, sample2.tex, sample3.tex, sample4.tex, sample5.tex, sample6.tex, sample7.tex, sample8.tex, prob-1stprncp.tex, prob-args.tex, prob-easy.tex, prob-easy2.tex, prob-implicit.tex, prob-mchoice.tex, prob-mixed.tex, prob-newdata.tex, prob-nosoln.tex, prob-probspaces.tex, prob-probspaces2.tex, prob-tabmchoice.tex, prob-verb.tex. + This work consists of the files probsoln.dtx and probsoln.ins and the derived files probsoln.sty, sample-exclude.tex, sample.tex, sample2.tex, sample3.tex, sample4.tex, sample5.tex, sample6.tex, sample7.tex, sample8.tex, prob-1stprncp.tex, prob-args.tex, prob-easy.tex, prob-easy2.tex, prob-implicit.tex, prob-mchoice.tex, prob-mixed.tex, prob-newdata.tex, prob-nosoln.tex, prob-probspaces.tex, prob-probspaces2.tex, prob-tabmchoice.tex, prob-verb.tex. \endpreamble @@ -26,6 +26,8 @@ \generate{\file{probsoln.sty}{\usepreamble\defaultpreamble \usepostamble\defaultpostamble\from{probsoln.dtx}{probsoln.sty,package}} +\file{sample-exclude.tex}{\usepreamble\defaultpreamble +\usepostamble\defaultpostamble\from{probsoln.dtx}{sample-exclude.tex,package}} \file{sample.tex}{\usepreamble\defaultpreamble \usepostamble\defaultpostamble\from{probsoln.dtx}{sample.tex,package}} \file{sample2.tex}{\usepreamble\defaultpreamble diff --git a/Master/texmf-dist/tex/latex/probsoln/probsoln.sty b/Master/texmf-dist/tex/latex/probsoln/probsoln.sty index 8144c5e1c22..86e685a1327 100644 --- a/Master/texmf-dist/tex/latex/probsoln/probsoln.sty +++ b/Master/texmf-dist/tex/latex/probsoln/probsoln.sty @@ -7,7 +7,7 @@ %% probsoln.dtx (with options: `probsoln.sty,package') %% %% probsoln.dtx -%% Copyright 2011 Nicola Talbot +%% Copyright 2013 Nicola Talbot %% %% This work may be distributed and/or modified under the %% conditions of the LaTeX Project Public License, either version 1.3 @@ -21,7 +21,7 @@ %% %% The Current Maintainer of this work is Nicola Talbot. %% -%% This work consists of the files probsoln.dtx and probsoln.ins and the derived files probsoln.sty, sample.tex, sample2.tex, sample3.tex, sample4.tex, sample5.tex, sample6.tex, sample7.tex, sample8.tex, prob-1stprncp.tex, prob-args.tex, prob-easy.tex, prob-easy2.tex, prob-implicit.tex, prob-mchoice.tex, prob-mixed.tex, prob-newdata.tex, prob-nosoln.tex, prob-probspaces.tex, prob-probspaces2.tex, prob-tabmchoice.tex, prob-verb.tex. +%% This work consists of the files probsoln.dtx and probsoln.ins and the derived files probsoln.sty, sample-exclude.tex, sample.tex, sample2.tex, sample3.tex, sample4.tex, sample5.tex, sample6.tex, sample7.tex, sample8.tex, prob-1stprncp.tex, prob-args.tex, prob-easy.tex, prob-easy2.tex, prob-implicit.tex, prob-mchoice.tex, prob-mixed.tex, prob-newdata.tex, prob-nosoln.tex, prob-probspaces.tex, prob-probspaces2.tex, prob-tabmchoice.tex, prob-verb.tex. %% %% \CharacterTable %% {Upper-case \A\B\C\D\E\F\G\H\I\J\K\L\M\N\O\P\Q\R\S\T\U\V\W\X\Y\Z @@ -47,9 +47,10 @@ %% Display the problems %% You may need to change \theenumi back here \NeedsTeXFormat{LaTeX2e} -\ProvidesPackage{probsoln}[2011/12/10 v3.02 (NLCT)] +\ProvidesPackage{probsoln}[2012/08/23 v3.04 (NLCT)] \RequirePackage{ifthen} \RequirePackage{amsmath} +\RequirePackage{etoolbox} \newif\ifshowanswers \showanswersfalse \let\showanswers\showanswerstrue @@ -72,16 +73,195 @@ \newcommand*{\ProbSolnFragileExt}{vrb} \newcommand*{\ProbSolnFragileFile}{\jobname} \newwrite\probsoln@write +\newcount\probsoln@startyear +\newcommand*{\SetStartYear}[1]{% + \probsoln@startyear=#1\relax + \renewcommand\SetStartMonth[1]{% + \PackageError{probsoln}{\string\SetStartMonth\space + can't be used after \string\SetStartYear}{}}% +} +\newcommand*{\GetStartYear}{\probsoln@startyear} +\newcount\probsoln@startmonth +\newcommand*{\SetStartMonth}[1]{% + \probsoln@startmonth=#1\relax + \probsoln@startyear=\year\relax + \ifnum\month<\probsoln@startmonth + \advance\probsoln@startyear by -1\relax + \fi +} +\SetStartMonth{9} +\newwrite\probsoln@prev +\newwrite\probsoln@used +\newcount\probsoln@prev@cutoff +\newcommand*{\@probsoln@usedfilename}{\jobname.prb} +\newcommand*{\SetUsedFileName}[1]{% + \renewcommand*{\@probsoln@usedfilename}{#1}% +} +\newcommand*{\ClearUsedFile}[1]{% + \probsoln@prev@cutoff=0\relax + \@probsoln@readprev{#1}% + \@for\@this@db:=\prob@databases\do{% + {% + \edef\@prev@list{\csname probsoln@prev@list@\@this@db\endcsname}% + \ifdefempty{\@prev@list}% + {}% + {% + \@for\@this@label:=\@prev@list\do{% + \ifcsundef{@used@problem@\@this@db @\@this@label}% + {% + \immediate\write\probsoln@prev{% + \string\previousproblem{\@this@label}{\@this@db}% + {\csname @prev@problem@\@this@db @\@this@label\endcsname}}% + }% + {}% + }% + }% + }% + }% + \immediate\closeout\probsoln@prev + \immediate\closeout\probsoln@used + \@disable@exclude@prev +} +\newcommand*{\ExcludePreviousFile}[2][3]{% + \probsoln@prev@cutoff=\probsoln@startyear\relax + \advance\probsoln@prev@cutoff by -#1\relax + \@probsoln@readprev{#2}% + \@write@prev + \def\ExcludePreviousFile[2][3]{\PackageError{probsoln}{Only one + instance of \string\ExcludePreviousFile\space allowed}{You've + already used this command. You are only allowed to use it once}}% + \def\ClearUsedFile[1]{% + \PackageError{probsoln}% + {\string\ClearUsedFile\space may not be used after + \string\ExcludePreviousFile}{}}% +} +\newcommand*{\@probsoln@readprev}[1]{% + \@enable@exclude@prev + \InputIfFileExists{#1}% + {\PackageInfo{probsoln}% + {Excluded problem file `#1' found}}% + {\PackageInfo{probsoln}% + {Excluded problem file `#1' not found. A new one will be + created}}% + \InputIfFileExists{\@probsoln@usedfilename}% + {\PackageInfo{probsoln}% + {Current problems file `\@probsoln@usedfilename' found}}% + {\PackageInfo{probsoln}% + {No current problem file `\@probsoln@usedfilename' found. A new one will be created}}% + \immediate\openout\probsoln@prev=#1 + \immediate\openout\probsoln@used=\@probsoln@usedfilename +} +\newcommand*{\probsoln@prev@list@default}{} +\newcommand*{\@write@prev}{% + \@for\@this@db:=\prob@databases\do{% + {% + \edef\@prev@list{\csname probsoln@prev@list@\@this@db\endcsname}% + \ifdefempty{\@prev@list}% + {}% + {% + \@for\@this@label:=\@prev@list\do{% + \immediate\write\probsoln@prev{% + \string\previousproblem{\@this@label}{\@this@db}% + {\csname @prev@problem@\@this@db @\@this@label\endcsname}}% + }% + }% + }% + }% +} +\newcommand*{\@enable@exclude@prev}{% + \renewcommand*{\@add@used@problem}[2]{% + \immediate\write\probsoln@used{\string\usedproblem{##1}{##2}{\number\probsoln@startyear}}% + \ifcsundef{@prev@problem@##2@##1}% + {% + \immediate\write\probsoln@prev{% + \string\previousproblem{##1}{##2}{\number\probsoln@startyear}}% + \expandafter\xdef\csname @prev@problem@##2@##1\endcsname{% + \number\probsoln@startyear}% + }% + {% + \expandafter\ifnum\csname @prev@problem@##2@##1\endcsname + <\probsoln@startyear + \immediate\write\probsoln@prev{% + \string\previousproblem{##1}{##2}{\number\probsoln@startyear}}% + \expandafter\xdef\csname @prev@problem@##2@##1\endcsname{% + \number\probsoln@startyear}% + \fi + }% + }% + \renewcommand*{\@fetch@excluded@list}[2]{% + \def##1{}% + \ifcsdef{probsoln@prev@list@##2}% + {% + \edef\@prev@list{\csname probsoln@prev@list@##2\endcsname}% + \@for\@this@label:=\@prev@list\do{% + \ifcsundef{@used@problem@##2@\@this@label}% + {% + \ifcsempty{##1}% + {\edef##1{\@this@label}}% + {\edef##1{##1,\@this@label}}% + }% + {}% + }% + }% + {}% + }% + \renewcommand*{\@add@newprevlist}[1]{% + \expandafter\gdef\csname probsoln@prev@list@##1\endcsname{}% + }% + \renewcommand*{\close@probsoln@prev}{% + \closeout\probsoln@prev + \closeout\probsoln@used + }% +} +\newcommand*{\@disable@exclude@prev}{% + \renewcommand*{\@add@used@problem}[2]{}% + \renewcommand*{\@fetch@excluded@list}[2]{\def##1{}}% + \renewcommand*{\@add@newprevlist}[1]{}% + \renewcommand*{\close@probsoln@prev}{}% +} +\newcommand*{\@add@used@problem}[2]{} +\newcommand*{\@fetch@excluded@list}[2]{% + \def#1{}% +} +\newcommand*{\@add@newprevlist}[1]{} +\newcommand*{\close@probsoln@prev}{} +\AtEndDocument{\close@probsoln@prev} +\newcommand*{\previousproblem}[3]{% + \ifnum#3>\probsoln@prev@cutoff + \ifcsundef{prob@db@#2}{\prob@newdb{#2}}{}% + \expandafter\gdef\csname @prev@problem@#2@#1\endcsname{#3}% + \edef\@prev@list{\csname probsoln@prev@list@#2\endcsname}% + \ifdefempty{\@prev@list}% + {% + \expandafter\xdef\csname probsoln@prev@list@#2\endcsname{#1}% + }% + {% + \expandafter\xdef\csname probsoln@prev@list@#2\endcsname{% + \@prev@list,#1}% + }% + \fi +} +\newcommand*{\usedproblem}[3]{% + \ifnum#3=\probsoln@startyear + \expandafter\def\csname @used@problem@#2@#1\endcsname{#3}% + \fi +} \newcommand*{\prob@db@default}{} \newcommand*{\prob@databases}{default} \newcommand*{\prob@db@default@solutions}{} \newcommand*{\prob@newdb}[1]{% -\@ifundefined{prob@db@#1}{% - \expandafter\gdef\csname prob@db@#1\endcsname{}% - \xdef\prob@databases{\prob@databases,#1}% - \expandafter\gdef\csname prob@db@#1@solutions\endcsname{}% - }{% - \PackageError{probsoln}{Data set `#1' is already defined}{}}} + \ifcsundef{prob@db@#1}% + {% + \expandafter\gdef\csname prob@db@#1\endcsname{}% + \xdef\prob@databases{\prob@databases,#1}% + \expandafter\gdef\csname prob@db@#1@solutions\endcsname{}% + \@add@newprevlist{#1}% + }% + {% + \PackageError{probsoln}{Data set `#1' is already defined}% + {Data set names must be unique}% + }% +} \newcommand*{\prob@currentdb}{default} \newcommand{\moveproblem}[3]{% \@moveproblem{#1}{#2}{#3}% @@ -101,12 +281,14 @@ }% } \newcommand*{\@moveproblem}[3]{% - \expandafter\ifx\csname prob@db@#3\endcsname\@empty + \ifcsempty{prob@db@#3}% + {% \expandafter\xdef\csname prob@db@#3\endcsname{#1}% - \else + }% + {% \expandafter\xdef\csname prob@db@#3\endcsname{% \csname prob@db@#3\endcsname,#1}% - \fi + }% \edef\do@movedata{% \noexpand\global\noexpand\let\expandafter\noexpand \csname prob@data@#3@#1\endcsname=% @@ -402,6 +584,7 @@ Please specify (e.g. \csname @prob@getargs@eg@\romannumeral#1\endcsname):}% \def\@prob@currentlabel{#2}% \def\prob@currentdb{#1}% \prob@showdraftlabel{#1}{#2}% + \@add@used@problem{#2}{#1}% \let\@useprob@next=\relax \@ifundefined{prob@data@#1@#2}% {% @@ -462,7 +645,8 @@ Please specify (e.g. \csname @prob@getargs@eg@\romannumeral#1\endcsname):}% \newif\iffirstpass \firstpasstrue \newcommand{\loadrandomproblems}[3][default]{% - \@loadrandomproblems{#1}{#2}{#3}{}% + \@fetch@excluded@list{\@excl@list}{#1}% + \@loadrandomproblems{#1}{#2}{#3}{\@excl@list}% } \newcommand{\loadrandomexcept}[4][default]{% \@loadrandomproblems{#1}{#2}{#3}{#4}% @@ -478,8 +662,9 @@ Please specify (e.g. \csname @prob@getargs@eg@\romannumeral#1\endcsname):}% \input{#3}% \@probselN=0\relax \@for\@thislabel:=\prob@selectedlabels\do{% - \expandafter\DTLifinlist\expandafter - {\@thislabel}{#4}{}% + \edef\@if@in@list{\noexpand\DTLifinlist{\@thislabel}{#4}}% + \@if@in@list + {}% {% \advance\@probselN by 1\relax \expandafter @@ -487,13 +672,32 @@ Please specify (e.g. \csname @prob@getargs@eg@\romannumeral#1\endcsname):}% \@thislabel}% }% }% - \shuffle{@prob@tmp@}{\@probselN}% - \ifnum\@probselN<#2\relax - \PackageWarning{probsoln}{You have requested - \number#2\space\space problem(s) but `#3' only contains - \number\@probselN\space problems. All problems will be selected}% + \edef\@do@excludedlist{#4}% + \ifdefempty{\@do@excludedlist}% + {}% + {\def\@do@excludedlist{(Excluded list: #4.) }}% + \ifnum\@probselN=0\relax + \PackageWarning{probsoln}{You have requested + \number#2\space\space problem(s) but there are no available + problems in `#3'. \@do@excludedlist No problems will be selected}% \else - \@probselN=#2\relax + \shuffle{@prob@tmp@}{\@probselN}% + \ifnum\@probselN<#2\relax + \ifnum\@probselN=1\relax + \PackageWarning{probsoln}{You have requested + \number#2\space\space problem(s) but there is only + 1 problem available in `#3'. \@do@excludedlist + Only 1 problem will be selected}% + \else + \PackageWarning{probsoln}{You have requested + \number#2\space\space problem(s) but there are only + \number\@probselN\space problems available in `#3'. + \@do@excludedlist + Only \number\@probselN\space problems will be selected}% + \fi + \else + \@probselN=#2\relax + \fi \fi \@probN=0\relax \def\prob@selectedlabels{}% @@ -652,31 +856,34 @@ Please specify (e.g. \csname @prob@getargs@eg@\romannumeral#1\endcsname):}% }% } \newcount\@ps@forrand +\newcount\@ps@forrand@level \newcommand{\doforrandN}[4]{% + \global\advance\@ps@forrand@level by 1\relax {% \@ps@forrand=0\relax \@for#2:=#3\do{% \advance\@ps@forrand by 1\relax \expandafter - \edef\csname @doforrandN@\romannumeral\@ps@forrand\endcsname{#2}% + \edef\csname @doforrandN@\number\@ps@forrand@level @\romannumeral\@ps@forrand\endcsname{#2}% }% \ifnum\@ps@forrand<#1\relax - \PackageError{probsoln}{Can't randomly select \number#1 item(s)}{You - have requested \number#1 item(s), but there - are only \number\@ps@forrand item(s) in the list}% + \PackageError{probsoln}{Can't randomly select \number#1\space item(s)}{You + have requested \number#1\space item(s), but there + are only \number\@ps@forrand\space item(s) in the list: #3}% \else - \shuffle{@doforrandN@}{\@ps@forrand}% + \shuffle{@doforrandN@\number\@ps@forrand@level @}{\@ps@forrand}% \ifnum#1>0\relax \@ps@forrand=0\relax \loop \advance\@ps@forrand by 1\relax - \edef#2{\csname @doforrandN@\romannumeral\@ps@forrand\endcsname}% + \edef#2{\csname @doforrandN@\number\@ps@forrand@level @\romannumeral\@ps@forrand\endcsname}% #4% \ifnum\@ps@forrand<#1\relax \repeat \fi \fi }% + \global\advance\@ps@forrand@level by -1\relax } \newcommand*{\newproblem}{\@ifstar\@snewproblem\@newproblem} \newcommand{\@snewproblem}[1][0]{% @@ -718,7 +925,7 @@ Please specify (e.g. \csname @prob@getargs@eg@\romannumeral#1\endcsname):}% \ifnum\@enumdepth>\thr@@ \@toodeep \else - \advance\@enumdepth\@ne\relax + \advance\@enumdepth by 1\relax \edef\@enumctr{enum\romannumeral\the\@enumdepth}% \let\@item\@textitem \def\@itemlabel{% @@ -730,7 +937,6 @@ Please specify (e.g. \csname @prob@getargs@eg@\romannumeral#1\endcsname):}% \ignorespaces }% {% - \global\advance\@enumdepth\m@ne\relax } \def\@textitem[#1]{#1\space\ignorespaces} \newcommand*{\correctitemformat}[1]{\fbox{#1}} -- cgit v1.2.3