diff options
author | Karl Berry <karl@freefriends.org> | 2012-01-14 23:23:39 +0000 |
---|---|---|
committer | Karl Berry <karl@freefriends.org> | 2012-01-14 23:23:39 +0000 |
commit | 99b7aeefd4f1e318e9ae379423a09f6ad116b468 (patch) | |
tree | 05e72540a09a2a9f842aa7914f80730f1b5d3787 /Master | |
parent | 1398422d52caaf61193a5e8c21d1d2db8d41145f (diff) |
probsoln 3.02 (14jan12)
git-svn-id: svn://tug.org/texlive/trunk@25106 c570f23f-e606-0410-a88d-b1316a301751
Diffstat (limited to 'Master')
21 files changed, 1305 insertions, 605 deletions
diff --git a/Master/texmf-dist/doc/latex/probsoln/CHANGES b/Master/texmf-dist/doc/latex/probsoln/CHANGES index 831d13648ec..353a6ee6db8 100644 --- a/Master/texmf-dist/doc/latex/probsoln/CHANGES +++ b/Master/texmf-dist/doc/latex/probsoln/CHANGES @@ -1,5 +1,12 @@ probsoln package versions: +version 3.02: + + * Added xkeyval to required package list + + * defproblem, onlyproblem and onlysolutions may now contain + verbatim if fragile option set + version 3.01: * Problems may now contain floats in their definition diff --git a/Master/texmf-dist/doc/latex/probsoln/README b/Master/texmf-dist/doc/latex/probsoln/README index 7eb0964cf5b..d3a2a30d676 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.01 +LaTeX Package : probsoln v3.02 -Last Modified : 2011-08-22 +Last Modified : 2011-12-10 Author : Nicola L.C. Talbot @@ -23,6 +23,7 @@ Required packages: ifthen amsmath +xkeyval To extract the code do: diff --git a/Master/texmf-dist/doc/latex/probsoln/probsoln-manual.html b/Master/texmf-dist/doc/latex/probsoln/probsoln-manual.html index 6f33dd7f12c..5f2552db5b0 100644 --- a/Master/texmf-dist/doc/latex/probsoln/probsoln-manual.html +++ b/Master/texmf-dist/doc/latex/probsoln/probsoln-manual.html @@ -5,13 +5,13 @@ <!--http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd--> <html xmlns="http://www.w3.org/1999/xhtml" > -<head><title>probsoln v3.01: creating problem sheets optionally with solutions</title> +<head><title>probsoln v3.02: creating problem sheets optionally with solutions</title> <meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" /> <meta name="generator" content="TeX4ht (http://www.cse.ohio-state.edu/~gurari/TeX4ht/)" /> <meta name="originator" content="TeX4ht (http://www.cse.ohio-state.edu/~gurari/TeX4ht/)" /> <!-- xhtml,fn-in,css-in --> <meta name="src" content="probsoln-manual.tex" /> -<meta name="date" content="2011-08-22 22:11:00" /> +<meta name="date" content="2011-12-13 15:58:00" /> <style type="text/css"> <!-- @@ -245,7 +245,7 @@ div.important { background-color:red; } -<h2 class="titleHead">probsoln v3.01: creating problem sheets optionally +<h2 class="titleHead">probsoln v3.02: creating problem sheets optionally with solutions</h2> <div class="author" ><span class="ec-lmr-12">Nicola L.C. Talbot</span> @@ -261,7 +261,7 @@ class="ec-lmr-12">NR4 7TJ. United Kingdom.</span> href="http://theoval.cmp.uea.ac.uk/~nlct/" class="url" ><span class="ec-lmtt-12">http://theoval.cmp.uea.ac.uk/~nlct/</span></a></div><br /> <div class="date" ><span -class="ec-lmr-12">2011-08-22</span></div> +class="ec-lmr-12">2011-12-10</span></div> </div> <h3 class="likesectionHead"><a id="x1-1000"></a>Contents</h3> @@ -271,23 +271,25 @@ href="#x1-20001" id="QQ2-1-2">Introduction</a></span> <br /> <span class="sectionToc" >2 <a href="#x1-30002" id="QQ2-1-3">Package Options</a></span> <br /> <span class="sectionToc" >3 <a -href="#x1-40003" id="QQ2-1-4">Showing and Hiding Solutions</a></span> +href="#x1-40003" id="QQ2-1-4">Verbatim</a></span> <br /> <span class="sectionToc" >4 <a -href="#x1-50004" id="QQ2-1-5">General Formatting Commands</a></span> +href="#x1-50004" id="QQ2-1-5">Showing and Hiding Solutions</a></span> <br /> <span class="sectionToc" >5 <a -href="#x1-60005" id="QQ2-1-6">Defining a Problem</a></span> +href="#x1-60005" id="QQ2-1-6">General Formatting Commands</a></span> <br /> <span class="sectionToc" >6 <a -href="#x1-70006" id="QQ2-1-7">Using a Problem</a></span> +href="#x1-70006" id="QQ2-1-7">Defining a Problem</a></span> <br /> <span class="sectionToc" >7 <a -href="#x1-80007" id="QQ2-1-8">Loading Problems From External Files</a></span> +href="#x1-80007" id="QQ2-1-8">Using a Problem</a></span> <br /> <span class="sectionToc" >8 <a -href="#x1-90008" id="QQ2-1-9">Iterating Through Datasets</a></span> +href="#x1-90008" id="QQ2-1-9">Loading Problems From External Files</a></span> <br /> <span class="sectionToc" >9 <a -href="#x1-100009" id="QQ2-1-10">Random Number Generator</a></span> +href="#x1-100009" id="QQ2-1-10">Iterating Through Datasets</a></span> <br /> <span class="sectionToc" >10 <a -href="#x1-1100010" id="QQ2-1-11">Compatibility With Versions Prior to 3.0</a></span> +href="#x1-1100010" id="QQ2-1-11">Random Number Generator</a></span> +<br /> <span class="sectionToc" >11 <a +href="#x1-1200011" id="QQ2-1-12">Compatibility With Versions Prior to 3.0</a></span> <br /> <span class="sectionToc" ><a -href="#Q1-1-12">Index</a></span> +href="#Q1-1-13">Index</a></span> </div> <!--l. 40--><p class="noindent" > </p> @@ -298,11 +300,11 @@ class="ec-lmss-10">probsoln </span>package is designed for teachers or lecturers 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 <span class="LATEX">L<span class="A">A</span><span class="TEX">T<span -class="E">E</span>X</span></span>, and then select a number of problems to typeset. This means +by <span class="LATEX">L<span class="A">A</span><span class="TEX">T<span +class="E">E</span>X</span></span>, 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, @@ -355,75 +357,133 @@ class="ec-lmtt-10">\thisproblem</span><a </p> <!--l. 69--><p class="noindent" ><a href="#top">Top</a></p><h3 class="sectionHead"><span class="titlemark">3 </span> <a - id="x1-40003"></a>Showing and Hiding Solutions</h3> -<!--l. 71--><p class="noindent" >In addition to the <span + id="x1-40003"></a>Verbatim</h3> +<!--l. 71--><p class="noindent" >As from version 3.02, problems and solutions may contain verbatim text, but you must +use the <a + id="dx1-4001"></a><span +class="ec-lmtt-10">fragile </span>(or <span +class="ec-lmtt-10">fragile=true</span>) option for the associated environments. +</p><!--l. 75--><p class="indent" > Alternatively, if most of your problems contain verbatim, you can globally set this +option using: + + + +</p> + <div class="verbatim" id="verbatim-1"> +\setkeys{probsoln}{fragile} +</div> +<!--l. 79--><p class="nopar" > You can switch off this option using <span +class="ec-lmtt-10">fragile=false</span>. +</p><!--l. 82--><p class="indent" > The <span +class="ec-lmtt-10">fragile </span>option writes information to a temporary file. This defaults to +<span class="obeylines-h"><span class="verb"><span +class="ec-lmtt-10">\jobname.vrb</span></span></span> but the name may be changed. The extension (<span class="obeylines-h"><span class="verb"><span +class="ec-lmtt-10">.vrb</span></span></span>) is given +by: +</p><!--l. 85--><p class="indent" > <hr><div title="Definition"><span class="marginpar"><span +class="ec-lmtt-9">\ProbSolnFragileExt</span><span +class="ec-lmtt-9"> </span></span><a + id="dx1-4002"></a> <span +class="ec-lmtt-10">\ProbSolnFragileExt </span></div><hr> +</p><!--l. 87--><p class="noindent" > +The base name (<span +class="ec-lmtt-10">\jobname</span>) is given by: +</p><!--l. 89--><p class="indent" > <hr><div title="Definition"><span class="marginpar"><span +class="ec-lmtt-9">\ProbSolnFragileFile</span><span +class="ec-lmtt-9"> </span></span><a + id="dx1-4003"></a> <span +class="ec-lmtt-10">\ProbSolnFragileFile </span></div><hr> +</p><!--l. 91--><p class="noindent" > +</p><!--l. 93--><p class="noindent" > +</p> +<!--l. 93--><p class="noindent" ><a +href="#top">Top</a></p><h3 class="sectionHead"><span class="titlemark">4 </span> <a + id="x1-50004"></a>Showing and Hiding Solutions</h3> +<!--l. 95--><p class="noindent" >In addition to the <span class="ec-lmss-10">answers</span><a - id="dx1-4001"></a> and <span + id="dx1-5001"></a> and <span class="ec-lmss-10">noanswers</span><a - id="dx1-4002"></a> package options, it is also possible to show or + id="dx1-5002"></a> package options, it is also possible to show or suppress the solutions using -</p><!--l. 74--><p class="indent" > <hr><div title="Definition"><span class="marginpar"><span +</p><!--l. 98--><p class="indent" > <hr><div title="Definition"><span class="marginpar"><span class="ec-lmtt-9">\showanswers</span><span class="ec-lmtt-9"> </span></span><a - id="dx1-4003"></a> <span + id="dx1-5003"></a> <span class="ec-lmtt-10">\showanswers </span></div><hr> -</p><!--l. 76--><p class="noindent" > +</p><!--l. 100--><p class="noindent" > and -</p><!--l. 78--><p class="indent" > <hr><div title="Definition"><span class="marginpar"><span +</p><!--l. 102--><p class="indent" > <hr><div title="Definition"><span class="marginpar"><span class="ec-lmtt-9">\hideanswers</span><span class="ec-lmtt-9"> </span></span><a - id="dx1-4004"></a> <span + id="dx1-5004"></a> <span class="ec-lmtt-10">\hideanswers </span></div><hr> -</p><!--l. 80--><p class="noindent" > +</p><!--l. 104--><p class="noindent" > respectively. -</p><!--l. 83--><p class="indent" > The boolean variable <span +</p><!--l. 107--><p class="indent" > The boolean variable <span class="ec-lmss-10">showanswers</span><a - id="dx1-4005"></a> determines whether the answers should be + id="dx1-5005"></a> determines whether the answers should be displayed. You can use this value with the <span class="ec-lmss-10">ifthen</span><a - id="dx1-4006"></a> package to specify different text + id="dx1-5006"></a> package to specify different text depending on whether the solutions should be displayed. For example: </p> - <div class="verbatim" id="verbatim-1"> + <div class="verbatim" id="verbatim-2"> Assignment 1\ifthenelse{\boolean{showanswers}}{ (Solution Sheet)}{} </div> -<!--l. 89--><p class="nopar" > Alternatively you can use <span +<!--l. 113--><p class="nopar" > Alternatively you can use <span class="ec-lmtt-10">\ifshowanswers</span><a - id="dx1-4007"></a>…<span + id="dx1-5007"></a>…<span class="ec-lmtt-10">\else</span>…<span class="ec-lmtt-10">\fi</span>: </p> - <div class="verbatim" id="verbatim-2"> + <div class="verbatim" id="verbatim-3"> Assignment 1\ifshowanswers\space (Solution Sheet)\fi </div> -<!--l. 94--><p class="nopar" > -</p><!--l. 96--><p class="indent" > For longer passages, you can use the environments <span class="marginpar"><span +<!--l. 118--><p class="nopar" > +</p><!--l. 120--><p class="indent" > For longer passages, you can use the environments +</p><!--l. 121--><p class="indent" > <hr><div title="Definition"><span class="marginpar"><span class="ec-lmtt-9">onlyproblem</span><span class="ec-lmtt-9"> </span></span><a - id="dx1-4008"></a><a - id="dx1-4009"></a><span -class="ec-lmss-10">onlyproblem</span><a - id="dx1-4010"></a><a - id="dx1-4011"></a> and -<span class="marginpar"><span + id="dx1-5008"></a><a + id="dx1-5009"></a> <span +class="ec-lmtt-10">\begin{</span><span +class="lmsy-10">⟨</span><span +class="ec-lmri-10">onlyproblem</span><span +class="lmsy-10">⟩</span><span +class="ec-lmtt-10">}[</span><span +class="lmsy-10">⟨</span><span +class="ec-lmri-10">option</span><span +class="lmsy-10">⟩</span><span +class="ec-lmtt-10">] </span></div><hr> +</p><!--l. 123--><p class="noindent" > +and +</p><!--l. 125--><p class="indent" > <hr><div title="Definition"><span class="marginpar"><span class="ec-lmtt-9">onlysolution</span><span class="ec-lmtt-9"> </span></span><a - id="dx1-4012"></a><a - id="dx1-4013"></a><span -class="ec-lmss-10">onlysolution</span><a - id="dx1-4014"></a><a - id="dx1-4015"></a>. For example: + id="dx1-5010"></a><a + id="dx1-5011"></a> <span +class="ec-lmtt-10">\begin{</span><span +class="lmsy-10">⟨</span><span +class="ec-lmri-10">onlysolution</span><span +class="lmsy-10">⟩</span><span +class="ec-lmtt-10">}[</span><span +class="lmsy-10">⟨</span><span +class="ec-lmri-10">option</span><span +class="lmsy-10">⟩</span><span +class="ec-lmtt-10">] </span></div><hr> +</p><!--l. 127--><p class="noindent" > +For example: </p> - <div class="verbatim" id="verbatim-3"> + <div class="verbatim" id="verbatim-4"> \begin{onlyproblem}%  <br />What is the derivative of $f(x) = x^2$?  <br />\end{onlyproblem}% @@ -431,62 +491,76 @@ class="ec-lmss-10">onlysolution</span><a  <br />$f’(x) = 2x$  <br />\end{onlysolution} </div> -<!--l. 105--><p class="nopar" > The above will only display the question if <span +<!--l. 136--><p class="nopar" > The above will only display the question if <span class="ec-lmss-10">showanswers</span><a - id="dx1-4016"></a> is false and will only display + id="dx1-5012"></a> is false and will only display the solution if <span class="ec-lmss-10">showanswers</span><a - id="dx1-4017"></a> is true. If you want the question to appear in the answer + id="dx1-5013"></a> 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 <span class="ec-lmss-10">onlyproblem</span><a - id="dx1-4018"></a><a - id="dx1-4019"></a> + id="dx1-5014"></a><a + id="dx1-5015"></a> environment: </p> - <div class="verbatim" id="verbatim-4"> + <div class="verbatim" id="verbatim-5"> What is the derivative of $f(x) = x^2$?  <br />\begin{onlysolution}%  <br />Solution: $f’(x) = 2x$  <br />\end{onlysolution} </div> -<!--l. 116--><p class="nopar" > -</p><!--l. 117--><p class="indent" > <div class="important" title="Important Note"> You can’t use verbatim text in the body of the <span -class="ec-lmss-10">onlyproblem </span>or <span -class="ec-lmss-10">onlysolution</span> -environments. If you need verbatim-like text, then try packages such as <span -class="ec-lmss-10">alltt</span><a - id="dx1-4020"></a>. Remember -that you also can’t use verbatim text in command arguments. </div> -</p><!--l. 123--><p class="noindent" > -</p><!--l. 125--><p class="indent" > If you use <span +<!--l. 147--><p class="nopar" > +</p><!--l. 149--><p class="indent" > <div class="important" title="Important Note"> If you want to include verbatim text in the body of <span +class="ec-lmss-10">onlyproblem</span><a + id="dx1-5016"></a><a + id="dx1-5017"></a> or <span +class="ec-lmss-10">onlysolution</span><a + id="dx1-5018"></a><a + id="dx1-5019"></a>, you +need to specify <span +class="ec-lmtt-10">fragile </span>in the optional argument of the environment. (See <a +href="#x1-40003">§3 </a><a +href="#x1-40003">Verbatim<!--tex4ht:ref: sec:verbatim --></a> +for further details.) </div> +</p><!--l. 154--><p class="noindent" > +</p><!--l. 156--><p class="indent" > If you use <span class="ec-lmss-10">onlysolution </span>within the <span class="ec-lmss-10">defproblem</span><a - id="dx1-4021"></a><a - id="dx1-4022"></a> environment, the problem will be + id="dx1-5020"></a><a + id="dx1-5021"></a> environment, the problem will be tagged as having a solution and will be added to the list used by <span class="ec-lmtt-10">\foreachsolution</span><a - id="dx1-4023"></a>. -</p><!--l. 129--><p class="noindent" > + id="dx1-5022"></a>. +The optional argument of <span +class="ec-lmss-10">onlysolution </span>(and <span +class="ec-lmss-10">onlyproblem</span><a + id="dx1-5023"></a><a + id="dx1-5024"></a>) is inherited from the parent +<span +class="ec-lmss-10">defproblem</span><a + id="dx1-5025"></a><a + id="dx1-5026"></a> setting. +</p><!--l. 162--><p class="noindent" > </p> -<!--l. 129--><p class="noindent" ><a -href="#top">Top</a></p><h3 class="sectionHead"><span class="titlemark">4 </span> <a - id="x1-50004"></a>General Formatting Commands</h3> -<!--l. 131--><p class="noindent" >The commands and environments described in this section are provided to assist +<!--l. 162--><p class="noindent" ><a +href="#top">Top</a></p><h3 class="sectionHead"><span class="titlemark">5 </span> <a + id="x1-60005"></a>General Formatting Commands</h3> +<!--l. 164--><p class="noindent" >The commands and environments described in this section are provided to assist formatting problems and their solutions. -</p><!--l. 133--><p class="indent" > <hr><div title="Definition"><span class="marginpar"><span +</p><!--l. 166--><p class="indent" > <hr><div title="Definition"><span class="marginpar"><span class="ec-lmtt-9">solution</span><span class="ec-lmtt-9"> </span></span><a - id="dx1-5001"></a><a - id="dx1-5002"></a> <span class="obeylines-h"><span class="verb"><span + id="dx1-6001"></a><a + id="dx1-6002"></a> <span class="obeylines-h"><span class="verb"><span class="ec-lmtt-10">\begin{solution}</span></span></span><span class="lmsy-10">⟨</span><span class="ec-lmri-10">text</span><span class="lmsy-10">⟩</span><span class="obeylines-h"><span class="verb"><span class="ec-lmtt-10">\end{solution}</span></span></span> </div><hr> -</p><!--l. 135--><p class="noindent" > +</p><!--l. 168--><p class="noindent" > By default, this is equivalent to <spacer type=vertical size=10><span class="obeylines-h"> <br /><span class="verb"><span class="ec-lmtt-10">\par\noindent\textbf{\solutionname}:</span><span @@ -498,40 +572,40 @@ class="lmsy-10">⟩</span> where <span class="marginpar"><span class="ec-lmtt-9">\solutionname</span><span class="ec-lmtt-9"> </span></span><a - id="dx1-5003"></a><span + id="dx1-6003"></a><span class="ec-lmtt-10">\solutionname </span>defaults to “Solution”. Note that you must place the <span class="ec-lmss-10">solution</span><a - id="dx1-5004"></a><a - id="dx1-5005"></a> environment inside the <span + id="dx1-6004"></a><a + id="dx1-6005"></a> environment inside the <span class="ec-lmss-10">onlysolution </span>environment or between <span class="ec-lmtt-10">\ifshowanswers</span><a - id="dx1-5006"></a>…<span + id="dx1-6006"></a>…<span class="ec-lmtt-10">\fi </span>to ensure that it is suppressed when the solutions are not wanted. (See <a -href="#x1-40003">§3 </a><a -href="#x1-40003">Showing and Hiding Solutions<!--tex4ht:ref: sec:showanswers --></a>.) -</p><!--l. 148--><p class="indent" > Note that the <span +href="#x1-50004">§4 </a><a +href="#x1-50004">Showing and Hiding Solutions<!--tex4ht:ref: sec:showanswers --></a>.) +</p><!--l. 181--><p class="indent" > Note that the <span class="ec-lmss-10">probsoln </span>package will only define the <span class="ec-lmss-10">solution</span><a - id="dx1-5007"></a><a - id="dx1-5008"></a> environment if it is not + id="dx1-6007"></a><a + id="dx1-6008"></a> environment if it is not already defined. -</p><!--l. 151--><p class="indent" > <hr><div title="Definition"><span class="marginpar"><span +</p><!--l. 184--><p class="indent" > <hr><div title="Definition"><span class="marginpar"><span class="ec-lmtt-9">textenum</span><span class="ec-lmtt-9"> </span></span><a - id="dx1-5009"></a><a - id="dx1-5010"></a> <span class="obeylines-h"><span class="verb"><span + id="dx1-6009"></a><a + id="dx1-6010"></a> <span class="obeylines-h"><span class="verb"><span class="ec-lmtt-10">\begin{textenum}</span></span></span><span class="ec-lmtt-10">…</span><span class="obeylines-h"><span class="verb"><span class="ec-lmtt-10">\end{textenum}</span></span></span> </div><hr> -</p><!--l. 153--><p class="noindent" > +</p><!--l. 186--><p class="noindent" > The <span class="ec-lmss-10">textenum </span>environment is like the <span class="ec-lmss-10">enumerate</span><a - id="dx1-5011"></a><a - id="dx1-5012"></a> environment but is in-line. It uses + id="dx1-6011"></a><a + id="dx1-6012"></a> environment but is in-line. It uses the same counter that the <span class="ec-lmss-10">enumerate </span>environment would use at that level so the question can be compact but the answer can use <span @@ -541,7 +615,7 @@ example: </p> - <div class="verbatim" id="verbatim-5"> + <div class="verbatim" id="verbatim-6"> \begin{onlyproblem}%  <br />  Differentiate the following:  <br />  \begin{textenum} @@ -565,10 +639,10 @@ example:  <br />  \end{enumerate}  <br />\end{onlysolution} </div> -<!--l. 182--><p class="nopar" > In this example, the items in the question are brief, so an <span +<!--l. 215--><p class="nopar" > In this example, the items in the question are brief, so an <span class="ec-lmss-10">enumerate</span><a - id="dx1-5013"></a><a - id="dx1-5014"></a> environment + id="dx1-6013"></a><a + id="dx1-6014"></a> environment would result in a lot of unnecessary white space, but the answers require more space, so an <span class="ec-lmss-10">enumerate </span>environment is more appropriate. Since the <span @@ -579,34 +653,34 @@ consistent labelling. Note that there are other packages available on CTAN that you can use to create in-line lists. Check the <a href="http://www.tex.ac.uk/tex-archive/help/Catalogue/bytopic.html#enumeration" >TeX Catalogue</a> for further details. -</p><!--l. 194--><p class="indent" > <span class="marginpar"><span +</p><!--l. 227--><p class="indent" > <span class="marginpar"><span class="ec-lmtt-9">\correctitem</span><span class="ec-lmtt-9"> </span></span><a - id="dx1-5015"></a><span class="marginpar"><span + id="dx1-6015"></a><span class="marginpar"><span class="ec-lmtt-9">\incorrectitem</span><span class="ec-lmtt-9"> </span></span><a - id="dx1-5016"></a> -</p><!--l. 196--><p class="indent" > <hr><div title="Definition"><span + id="dx1-6016"></a> +</p><!--l. 229--><p class="indent" > <hr><div title="Definition"><span class="ec-lmtt-10">\correctitem</span><br class="newline" /><span class="ec-lmtt-10">\incorrectitem </span></div><hr> -</p><!--l. 198--><p class="noindent" > +</p><!--l. 231--><p class="noindent" > You can use the commands <span class="ec-lmtt-10">\correctitem </span>and <span class="ec-lmtt-10">\incorrectitem </span>in place of <span class="ec-lmtt-10">\item</span><a - id="dx1-5017"></a>. If the solutions are suppressed, these commands behave in the same way + id="dx1-6017"></a>. If the solutions are suppressed, these commands behave in the same way as <span class="ec-lmtt-10">\item</span>, otherwise they format the item label using one of the commands: <span class="marginpar"><span class="ec-lmtt-9">\correctitemformat</span><span class="ec-lmtt-9"> </span></span><a - id="dx1-5018"></a><span class="marginpar"><span + id="dx1-6018"></a><span class="marginpar"><span class="ec-lmtt-9">\incorrectitemformat</span><span class="ec-lmtt-9"> </span></span><a - id="dx1-5019"></a> -</p><!--l. 205--><p class="indent" > <hr><div title="Definition"><span + id="dx1-6019"></a> +</p><!--l. 238--><p class="indent" > <hr><div title="Definition"><span class="ec-lmtt-10">\correctitemformat{</span><span class="lmsy-10">⟨</span><span class="ec-lmri-10">label</span><span @@ -618,13 +692,13 @@ class="lmsy-10">⟨</span><span class="ec-lmri-10">label</span><span class="lmsy-10">⟩</span><span class="ec-lmtt-10">} </span></div><hr> -</p><!--l. 207--><p class="noindent" > +</p><!--l. 240--><p class="noindent" > For example: </p> - <div class="verbatim" id="verbatim-6"> + <div class="verbatim" id="verbatim-7"> Under which of the following functions does $S=\{a_1,a_2\}$  <br />become a probability space?  <br />\begin{enumerate} @@ -634,14 +708,14 @@ Under which of the following functions   <br />\incorrectitem $P(a_1)=\frac{5}{4}$, $P(a_2)=-\frac{1}{4}$  <br />\end{enumerate} </div> -<!--l. 218--><p class="nopar" > The default definition of <span +<!--l. 251--><p class="nopar" > The default definition of <span class="ec-lmtt-10">\correctitemformat </span>puts a frame around the label. -</p><!--l. 222--><p class="noindent" > +</p><!--l. 255--><p class="noindent" > </p> -<!--l. 222--><p class="noindent" ><a -href="#top">Top</a></p><h3 class="sectionHead"><span class="titlemark">5 </span> <a - id="x1-60005"></a>Defining a Problem</h3> -<!--l. 224--><p class="noindent" >It is possible to construct a problem sheet with solutions using the commands described +<!--l. 255--><p class="noindent" ><a +href="#top">Top</a></p><h3 class="sectionHead"><span class="titlemark">6 </span> <a + id="x1-70006"></a>Defining a Problem</h3> +<!--l. 257--><p class="noindent" >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 <span @@ -651,25 +725,25 @@ 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 <span class="ec-lmss-10">onlyproblem</span><a - id="dx1-6001"></a><a - id="dx1-6002"></a>, <span + id="dx1-7001"></a><a + id="dx1-7002"></a>, <span class="ec-lmss-10">onlysolution</span><a - id="dx1-6003"></a><a - id="dx1-6004"></a> or the <span + id="dx1-7003"></a><a + id="dx1-7004"></a> or the <span class="ec-lmss-10">showanswers</span><a - id="dx1-6005"></a> + id="dx1-7005"></a> boolean variable in conjunction with <span class="ec-lmtt-10">\showanswers</span><a - id="dx1-6006"></a> and <span + id="dx1-7006"></a> and <span class="ec-lmtt-10">\hideanswers</span><a - id="dx1-6007"></a>, you can + id="dx1-7007"></a>, you can print the solutions in a different location to the questions (for example in an appendix). -</p><!--l. 239--><p class="indent" > <hr><div title="Definition"><span class="marginpar"><span +</p><!--l. 272--><p class="indent" > <hr><div title="Definition"><span class="marginpar"><span class="ec-lmtt-9">defproblem</span><span class="ec-lmtt-9"> </span></span><a - id="dx1-6008"></a><a - id="dx1-6009"></a> <span class="obeylines-h"><span class="verb"><span + id="dx1-7008"></a><a + id="dx1-7009"></a> <span class="obeylines-h"><span class="verb"><span class="ec-lmtt-10">\begin{defproblem}</span></span></span><span class="ec-lmtt-10">[</span><span class="lmsy-10">⟨</span><span @@ -683,14 +757,18 @@ class="ec-lmtt-10">]{</span><span class="lmsy-10">⟨</span><span class="ec-lmri-10">label</span><span class="lmsy-10">⟩</span><span -class="ec-lmtt-10">}</span><br +class="ec-lmtt-10">}[</span><span +class="lmsy-10">⟨</span><span +class="ec-lmri-10">option</span><span +class="lmsy-10">⟩</span><span +class="ec-lmtt-10">]</span><br class="newline" /><span class="lmsy-10">⟨</span><span class="ec-lmri-10">definition</span><span class="lmsy-10">⟩</span><br class="newline" /><span class="obeylines-h"><span class="verb"><span class="ec-lmtt-10">\end{defproblem}</span></span></span> </div><hr> -</p><!--l. 243--><p class="noindent" > +</p><!--l. 276--><p class="noindent" > This defines the problem whose label is given by <span class="lmsy-10">⟨</span><span class="ec-lmri-10">label</span><span @@ -699,46 +777,65 @@ given data set and should not contain active characters or a comma. (Active char include the special characters such as $ and &, but some packages may make other symbols active, such as the colon (:) character. For example, the <span class="ec-lmss-10">ngerman</span><a - id="dx1-6010"></a> and <span + id="dx1-7010"></a> and <span class="ec-lmss-10">babel</span><a - id="dx1-6011"></a> + id="dx1-7011"></a> packages make certain punctuation active. Check the relevant package documentation for details.) -</p><!--l. 252--><p class="indent" > If <span +</p><!--l. 285--><p class="indent" > <div class="important" title="Important Note"> The final optional argument <span +class="lmsy-10">⟨</span><span +class="ec-lmri-10">option</span><span +class="lmsy-10">⟩ </span>may be <span +class="ec-lmtt-10">fragile </span>to indicate that the problem +contains verbatim text. Any occurrences of <span +class="ec-lmss-10">onlyproblem</span><a + id="dx1-7012"></a><a + id="dx1-7013"></a> or <span +class="ec-lmss-10">onlysolution</span><a + id="dx1-7014"></a><a + id="dx1-7015"></a> contained within +<span +class="ec-lmss-10">defproblem </span>are inherited from <span +class="ec-lmss-10">defproblem</span>. (See <a +href="#x1-40003">§3 </a><a +href="#x1-40003">Verbatim<!--tex4ht:ref: sec:verbatim --></a> for further details.) +</div> +</p><!--l. 291--><p class="noindent" > +</p><!--l. 293--><p class="indent" > If <span class="ec-lmss-10">defproblem</span><a - id="dx1-6012"></a><a - id="dx1-6013"></a> occurs in the document or is included via <span + id="dx1-7016"></a><a + id="dx1-7017"></a> occurs in the document or is included via <span class="ec-lmtt-10">\input</span><a - id="dx1-6014"></a> or <span + id="dx1-7018"></a> or <span class="ec-lmtt-10">\include</span><a - id="dx1-6015"></a>, then + id="dx1-7019"></a>, then the problem will be added to the default data set. If <span class="ec-lmss-10">defproblem </span>occurs in an external file that is loaded using one of the commands defined in <a -href="#x1-80007">§7 </a><a -href="#x1-80007">Loading Problems +href="#x1-90008">§8 </a><a +href="#x1-90008">Loading Problems + + + From External Files<!--tex4ht:ref: sec:load --></a> then the problem will be added to the specified data set. -</p><!--l. 259--><p class="indent" > The contents of the <span +</p><!--l. 300--><p class="indent" > The contents of the <span class="ec-lmss-10">defproblem</span><a - id="dx1-6016"></a><a - id="dx1-6017"></a> environment should be the text that defines the + id="dx1-7020"></a><a + id="dx1-7021"></a> environment should be the text that defines the problem. This may include any of the commands defined in <a -href="#x1-40003">§3 </a><a -href="#x1-40003">Showing and Hiding -Solutions<!--tex4ht:ref: sec:showanswers --></a> and <a href="#x1-50004">§4 </a><a -href="#x1-50004">General Formatting Commands<!--tex4ht:ref: sec:formatting --></a>. -</p><!--l. 264--><p class="indent" > The problem may optionally take <span +href="#x1-50004">Showing and Hiding +Solutions<!--tex4ht:ref: sec:showanswers --></a> and <a +href="#x1-60005">§5 </a><a +href="#x1-60005">General Formatting Commands<!--tex4ht:ref: sec:formatting --></a>. +</p><!--l. 305--><p class="indent" > The problem may optionally take <span class="lmsy-10">⟨</span><span class="ec-lmri-10">n</span><span class="lmsy-10">⟩ </span>arguments (where <span class="lmsy-10">⟨</span><span class="ec-lmri-10">n</span><span class="lmsy-10">⟩ </span>is from 0 to 9). The - - - arguments can be referenced in the definition via <span class="ec-lmtt-10">#1</span>,…,<span class="ec-lmtt-10">#9</span>. If <span @@ -751,7 +848,7 @@ argument: </p> - <div class="verbatim" id="verbatim-7"> + <div class="verbatim" id="verbatim-8"> \begin{defproblem}[1]{diffsin}  <br />Differentiate $f(x)=\sin(#1x)$.  <br />\begin{onlysolution}% @@ -761,27 +858,27 @@ argument:  <br />\end{onlysolution}  <br />\end{defproblem} </div> -<!--l. 279--><p class="nopar" > -</p><!--l. 281--><p class="indent" > The second optional argument <span +<!--l. 320--><p class="nopar" > +</p><!--l. 322--><p class="indent" > The second optional argument <span class="lmsy-10">⟨</span><span class="ec-lmri-10">default args</span><span class="lmsy-10">⟩ </span>supplies default problem arguments that will automatically be used within <span class="ec-lmtt-10">\thisproblem</span><a - id="dx1-6018"></a> when used in <span + id="dx1-7022"></a> when used in <span class="ec-lmtt-10">\foreachproblem</span><a - id="dx1-6019"></a> + id="dx1-7023"></a> in conjunction with the package option <span class="ec-lmss-10">usedefaultargs</span><a - id="dx1-6020"></a>. (See <a -href="#x1-90008">§8 </a><a -href="#x1-90008">Iterating Through + id="dx1-7024"></a>. (See <a +href="#x1-100009">§9 </a><a +href="#x1-100009">Iterating Through Datasets<!--tex4ht:ref: sec:foreach --></a>.) For example: </p> - <div class="verbatim" id="verbatim-8"> + <div class="verbatim" id="verbatim-9"> \begin{defproblem}[1][{2}]{diffsin}  <br />Differentiate $f(x)=\sin(#1x)$.  <br />\begin{onlysolution}% @@ -791,11 +888,11 @@ Datasets<!--tex4ht:ref: sec:foreach --></a>.) For example:  <br />\end{onlysolution}  <br />\end{defproblem} </div> -<!--l. 295--><p class="nopar" > -</p><!--l. 297--><p class="indent" > <hr><div title="Definition"><span class="marginpar"><span +<!--l. 336--><p class="nopar" > +</p><!--l. 338--><p class="indent" > <hr><div title="Definition"><span class="marginpar"><span class="ec-lmtt-9">\newproblem</span><span class="ec-lmtt-9"> </span></span><a - id="dx1-6021"></a> <span + id="dx1-7025"></a> <span class="ec-lmtt-10">\newproblem[</span><span class="lmsy-10">⟨</span><span class="ec-lmri-10">n</span><span @@ -818,7 +915,7 @@ class="ec-lmri-10">solution</span><span class="lmsy-10">⟩</span><span class="ec-lmtt-10">}</span> </div><hr> -</p><!--l. 299--><p class="noindent" > +</p><!--l. 340--><p class="noindent" > This is a shortcut command for: <span class="obeylines-h"> <span class="ec-lmtt-10">\begin{defproblem}[</span><span @@ -854,12 +951,12 @@ class="ec-lmtt-10">\end{solution}%</span> class="ec-lmtt-10">\end{onlysolution}%</span> <br /><span class="ec-lmtt-10">\end{defproblem}</span></span> -</p><!--l. 311--><p class="indent" > For example: +</p><!--l. 352--><p class="indent" > For example: </p> - <div class="verbatim" id="verbatim-9"> + <div class="verbatim" id="verbatim-10"> \newproblem[1]{diffsin}{%  <br />  \(f(x) = \sin(#1x)\)  <br />}% @@ -867,12 +964,12 @@ class="ec-lmtt-10">\end{defproblem}</span></span>  <br />  \(f’(x) = #1\cos(#1x)\)  <br />} </div> -<!--l. 319--><p class="nopar" > is equivalent to +<!--l. 360--><p class="nopar" > is equivalent to </p> - <div class="verbatim" id="verbatim-10"> + <div class="verbatim" id="verbatim-11"> \begin{defproblem}[1]{diffcos}%  <br />  \(f(x) = \cos(#1x)\)  <br />\begin{onlysolution}% @@ -882,22 +979,22 @@ class="ec-lmtt-10">\end{defproblem}</span></span>  <br />\end{onlysolution}%  <br />\end{defproblem} </div> -<!--l. 330--><p class="nopar" > (In this example, the argument will need to be a positive number to avoid a double +<!--l. 371--><p class="nopar" > (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 <span class="ec-lmss-10">fp</span><a - id="dx1-6022"></a> or <span + id="dx1-7026"></a> or <span class="ec-lmss-10">pgfmath</span><a - id="dx1-6023"></a> packages.) -</p><!--l. 336--><p class="indent" > Alternatively, if you want to supply default arguments to use when iterating through + id="dx1-7027"></a> packages.) +</p><!--l. 377--><p class="indent" > Alternatively, if you want to supply default arguments to use when iterating through problems with <span class="ec-lmtt-10">\foreachproblem</span><a - id="dx1-6024"></a>: + id="dx1-7028"></a>: </p> - <div class="verbatim" id="verbatim-11"> + <div class="verbatim" id="verbatim-12"> \newproblem[1][{3}]{diffsin}{%  <br />  \(f(x) = \sin(#1x)\)  <br />}% @@ -905,11 +1002,11 @@ class="ec-lmtt-10">\foreachproblem</span><a  <br />  \(f’(x) = #1\cos(#1x)\)  <br />} </div> -<!--l. 345--><p class="nopar" > -</p><!--l. 348--><p class="indent" > <hr><div title="Definition"><span class="marginpar"><span +<!--l. 386--><p class="nopar" > +</p><!--l. 389--><p class="indent" > <hr><div title="Definition"><span class="marginpar"><span class="ec-lmtt-9">\newproblem*</span><span class="ec-lmtt-9"> </span></span><a - id="dx1-6025"></a> <span + id="dx1-7029"></a> <span class="ec-lmtt-10">\newproblem*[</span><span class="lmsy-10">⟨</span><span class="ec-lmri-10">n</span><span @@ -928,7 +1025,7 @@ class="ec-lmri-10">definition</span><span class="lmsy-10">⟩</span><span class="ec-lmtt-10">}</span> </div><hr> -</p><!--l. 350--><p class="noindent" > +</p><!--l. 391--><p class="noindent" > This is a shortcut for: <span class="obeylines-h"> <span class="ec-lmtt-10">\begin{defproblem}[</span><span @@ -951,36 +1048,33 @@ class="lmsy-10">⟩</span><span class="ec-lmtt-10">%</span> <br /><span class="ec-lmtt-10">\end{defproblem}</span></span> -</p><!--l. 358--><p class="indent" > <div class="important" title="Important Note"> Verbatim text must not be used in the contents of <span -class="ec-lmss-10">defproblem</span><a - id="dx1-6026"></a><a - id="dx1-6027"></a> or in any of the -arguments to <span +</p><!--l. 399--><p class="indent" > <div class="important" title="Important Note"> Note that you can’t use verbatim text with <span class="ec-lmtt-10">\newproblem </span>or <span -class="ec-lmtt-10">\newproblem*</span>. If you need verbatim-like text consider -using <span -class="ec-lmtt-10">\texttt </span>or the <span -class="ec-lmss-10">alltt</span><a - id="dx1-6028"></a> package. </div> -</p><!--l. 363--><p class="noindent" > -</p><!--l. 365--><p class="noindent" > +class="ec-lmtt-10">\newproblem*</span>. Use the +<span +class="ec-lmss-10">defproblem</span><a + id="dx1-7030"></a><a + id="dx1-7031"></a> environment instead with the <span +class="ec-lmtt-10">fragile option</span>. </div> +</p><!--l. 403--><p class="noindent" > +</p><!--l. 405--><p class="noindent" > </p> -<!--l. 365--><p class="noindent" ><a -href="#top">Top</a></p><h3 class="sectionHead"><span class="titlemark">6 </span> <a - id="x1-70006"></a>Using a Problem</h3> -<!--l. 367--><p class="noindent" >Once you have defined a problem using <span +<!--l. 405--><p class="noindent" ><a +href="#top">Top</a></p><h3 class="sectionHead"><span class="titlemark">7 </span> <a + id="x1-80007"></a>Using a Problem</h3> +<!--l. 407--><p class="noindent" >Once you have defined a problem using <span class="ec-lmss-10">defproblem</span><a - id="dx1-7001"></a><a - id="dx1-7002"></a> or <span + id="dx1-8001"></a><a + id="dx1-8002"></a> or <span class="ec-lmtt-10">\newproblem</span><a - id="dx1-7003"></a> (see <a -href="#x1-60005">§5 </a><a -href="#x1-60005">Defining a + id="dx1-8003"></a> (see <a +href="#x1-70006">§6 </a><a +href="#x1-70006">Defining a Problem<!--tex4ht:ref: sec:defproblem --></a>), you can later display the problem using: -</p><!--l. 370--><p class="indent" > <hr><div title="Definition"><span class="marginpar"><span +</p><!--l. 410--><p class="indent" > <hr><div title="Definition"><span class="marginpar"><span class="ec-lmtt-9">\useproblem</span><span class="ec-lmtt-9"> </span></span><a - id="dx1-7004"></a> <span + id="dx1-8004"></a> <span class="ec-lmtt-10">\useproblem[</span><span class="lmsy-10">⟨</span><span class="ec-lmri-10">data set</span><span @@ -1001,7 +1095,7 @@ class="ec-lmri-10">arg</span><sub><span class="lmmi-8x-x-95">N</span></sub><span class="lmsy-10">⟩</span><span class="ec-lmtt-10">} </span></div><hr> -</p><!--l. 373--><p class="noindent" > +</p><!--l. 413--><p class="noindent" > where <span class="lmsy-10">⟨</span><span class="ec-lmri-10">data set</span><span @@ -1022,22 +1116,22 @@ class="lmsy-10">⟩ </span>are the arguments to pass to the problem, if the arguments (where <span class="lmmi-10">N </span>is the number of arguments specified when the problem was defined). -</p><!--l. 382--><p class="indent" > For example, in the previous section the problem <span +</p><!--l. 422--><p class="indent" > For example, in the previous section the problem <span class="ec-lmtt-10">diffcos </span>was defined to have one argument, so it can be used as follows: </p> - <div class="verbatim" id="verbatim-12"> + <div class="verbatim" id="verbatim-13"> \useproblem{diffcos}{3} </div> -<!--l. 386--><p class="nopar" > This will be equivalent to: +<!--l. 426--><p class="nopar" > This will be equivalent to: </p> - <div class="verbatim" id="verbatim-13"> + <div class="verbatim" id="verbatim-14"> \(f(x) = \cos(3x)\)  <br />\begin{onlysolution}%  <br />\begin{solution}% @@ -1045,29 +1139,29 @@ argument, so it can be used as follows:  <br />\end{solution}%  <br />\end{onlysolution}% </div> -<!--l. 395--><p class="nopar" > -</p><!--l. 397--><p class="noindent" > +<!--l. 435--><p class="nopar" > +</p><!--l. 437--><p class="noindent" > </p> -<!--l. 397--><p class="noindent" ><a -href="#top">Top</a></p><h3 class="sectionHead"><span class="titlemark">7 </span> <a - id="x1-80007"></a>Loading Problems From External Files</h3> -<!--l. 399--><p class="noindent" >You can store all your problem definitions (see <a -href="#x1-60005">§5 </a><a -href="#x1-60005">Defining a Problem<!--tex4ht:ref: sec:defproblem --></a>) in an external +<!--l. 437--><p class="noindent" ><a +href="#top">Top</a></p><h3 class="sectionHead"><span class="titlemark">8 </span> <a + id="x1-90008"></a>Loading Problems From External Files</h3> +<!--l. 439--><p class="noindent" >You can store all your problem definitions (see <a +href="#x1-70006">§6 </a><a +href="#x1-70006">Defining a Problem<!--tex4ht:ref: sec:defproblem --></a>) in an external file. These problems can all be appended to the default data set by including the file via <span class="ec-lmtt-10">\input</span><a - id="dx1-8001"></a> or they can be appended to other data sets using one of the commands + id="dx1-9001"></a> 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 <a -href="#x1-90008">§8 </a><a -href="#x1-90008">Iterating Through Datasets<!--tex4ht:ref: sec:foreach --></a>. +href="#x1-100009">§9 </a><a +href="#x1-100009">Iterating Through Datasets<!--tex4ht:ref: sec:foreach --></a>. Note that the commands below will create a new data set, if the named data set doesn’t exist. -</p><!--l. 410--><p class="indent" > <hr><div title="Definition"><span class="marginpar"><span +</p><!--l. 450--><p class="indent" > <hr><div title="Definition"><span class="marginpar"><span class="ec-lmtt-9">\loadallproblems</span><span class="ec-lmtt-9"> </span></span><a - id="dx1-8002"></a> <span + id="dx1-9002"></a> <span class="ec-lmtt-10">\loadallproblems[</span><span class="lmsy-10">⟨</span><span class="ec-lmri-10">data set</span><span @@ -1077,7 +1171,7 @@ class="lmsy-10">⟨</span><span class="ec-lmri-10">filename</span><span class="lmsy-10">⟩</span><span class="ec-lmtt-10">} </span></div><hr> -</p><!--l. 412--><p class="noindent" > +</p><!--l. 452--><p class="noindent" > This will load all problems defined in <span class="lmsy-10">⟨</span><span class="ec-lmri-10">filename</span><span @@ -1091,10 +1185,10 @@ class="lmsy-10">⟨</span><span class="ec-lmri-10">data set</span><span class="lmsy-10">⟩ </span>doesn’t exist, it will be created. -</p><!--l. 419--><p class="indent" > <hr><div title="Definition"><span class="marginpar"><span +</p><!--l. 459--><p class="indent" > <hr><div title="Definition"><span class="marginpar"><span class="ec-lmtt-9">\loadselectedproblems</span><span class="ec-lmtt-9"> </span></span><a - id="dx1-8003"></a> <span + id="dx1-9003"></a> <span class="ec-lmtt-10">\loadselectedproblems[</span><span class="lmsy-10">⟨</span><span class="ec-lmri-10">data set</span><span @@ -1109,7 +1203,7 @@ class="ec-lmri-10">filename</span><span class="lmsy-10">⟩</span><span class="ec-lmtt-10">}</span> </div><hr> -</p><!--l. 421--><p class="noindent" > +</p><!--l. 461--><p class="noindent" > This is like <span class="ec-lmtt-10">\loadallproblems</span>, but only those problems whose label is listed in the comma-separated list <span @@ -1122,17 +1216,17 @@ class="ec-lmtt-10">derivatives.tex</span>, then </p> - <div class="verbatim" id="verbatim-14"> + <div class="verbatim" id="verbatim-15"> \loadselectedproblems{diffsin,diffcos}{derivatives} </div> -<!--l. 428--><p class="nopar" > will only load the problems whose labels are <span +<!--l. 468--><p class="nopar" > will only load the problems whose labels are <span class="ec-lmtt-10">diffsin </span>and <span class="ec-lmtt-10">diffcos</span>, respectively. All the other problems in the file will remain undefined. -</p><!--l. 433--><p class="indent" > <hr><div title="Definition"><span class="marginpar"><span +</p><!--l. 473--><p class="indent" > <hr><div title="Definition"><span class="marginpar"><span class="ec-lmtt-9">\loadexceptproblems</span><span class="ec-lmtt-9"> </span></span><a - id="dx1-8004"></a> <span + id="dx1-9004"></a> <span class="ec-lmtt-10">\loadexceptproblems[</span><span class="lmsy-10">⟨</span><span class="ec-lmri-10">data set</span><span @@ -1147,17 +1241,17 @@ class="ec-lmri-10">filename</span><span class="lmsy-10">⟩</span><span class="ec-lmtt-10">}</span> </div><hr> -</p><!--l. 435--><p class="noindent" > +</p><!--l. 475--><p class="noindent" > This is the reverse of <span class="ec-lmtt-10">\loadselectedproblems</span>. This loads all problems except those whose labels are listed in <span class="lmsy-10">⟨</span><span class="ec-lmri-10">exception list</span><span class="lmsy-10">⟩</span>. -</p><!--l. 440--><p class="indent" > <hr><div title="Definition"><span class="marginpar"><span +</p><!--l. 480--><p class="indent" > <hr><div title="Definition"><span class="marginpar"><span class="ec-lmtt-9">\loadrandomproblems</span><span class="ec-lmtt-9"> </span></span><a - id="dx1-8005"></a> <span + id="dx1-9005"></a> <span class="ec-lmtt-10">\loadrandomproblems[</span><span class="lmsy-10">⟨</span><span class="ec-lmri-10">data set</span><span @@ -1172,7 +1266,7 @@ class="ec-lmri-10">filename</span><span class="lmsy-10">⟩</span><span class="ec-lmtt-10">}</span> </div><hr> -</p><!--l. 442--><p class="noindent" > +</p><!--l. 482--><p class="noindent" > This randomly loads <span class="lmsy-10">⟨</span><span class="ec-lmri-10">n</span><span @@ -1193,10 +1287,10 @@ class="lmsy-10">⟩ </span>problems defined in class="lmsy-10">⟨</span><span class="ec-lmri-10">filename</span><span class="lmsy-10">⟩</span>. -</p><!--l. 450--><p class="indent" > <hr><div title="Definition"><span class="marginpar"><span +</p><!--l. 490--><p class="indent" > <hr><div title="Definition"><span class="marginpar"><span class="ec-lmtt-9">\loadrandomexcept</span><span class="ec-lmtt-9"> </span></span><a - id="dx1-8006"></a> <span + id="dx1-9006"></a> <span class="ec-lmtt-10">\loadrandomexcept[</span><span class="lmsy-10">⟨</span><span class="ec-lmri-10">data set</span><span @@ -1216,60 +1310,60 @@ class="ec-lmri-10">exception</span> class="ec-lmri-10">list</span><span class="lmsy-10">⟩</span><span class="ec-lmtt-10">} </span></div><hr> -</p><!--l. 453--><p class="noindent" > +</p><!--l. 493--><p class="noindent" > This is similar to <span class="ec-lmtt-10">\loadrandomproblems </span>except that it won’t load those problems whose labels are listed in <span class="lmsy-10">⟨</span><span class="ec-lmri-10">exception list</span><span class="lmsy-10">⟩</span>. -</p><!--l. 457--><p class="indent" > Note that the random number generator has been modified in version 3.01 in order +</p><!--l. 497--><p class="indent" > 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 -</p><!--l. 461--><p class="indent" > <hr><div title="Definition"><span class="marginpar"><span +</p><!--l. 501--><p class="indent" > <hr><div title="Definition"><span class="marginpar"><span class="ec-lmtt-9">\PSNuseoldrandom</span><span class="ec-lmtt-9"> </span></span><a - id="dx1-8007"></a> <span + id="dx1-9007"></a> <span class="ec-lmtt-10">\PSNuseoldrandom </span></div><hr> -</p><!--l. 463--><p class="noindent" > -</p><!--l. 465--><p class="indent" > <div class="important" title="Important Note"> It is generally not a good idea to place anything in <span +</p><!--l. 503--><p class="noindent" > +</p><!--l. 505--><p class="indent" > <div class="important" title="Important Note"> It is generally not a good idea to place anything in <span class="lmsy-10">⟨</span><span class="ec-lmri-10">filename</span><span class="lmsy-10">⟩ </span>that is not inside the body of <span class="ec-lmss-10">defproblem</span><a - id="dx1-8008"></a><a - id="dx1-8009"></a> or in the arguments to <span + id="dx1-9008"></a><a + id="dx1-9009"></a> or in the arguments to <span class="ec-lmtt-10">\newproblem</span><a - id="dx1-8010"></a> or <span + id="dx1-9010"></a> or <span class="ec-lmtt-10">\newproblem*</span><a - id="dx1-8011"></a>. All + id="dx1-9011"></a>. 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, <span class="ec-lmtt-10">\loadrandomproblems </span>has to load each file twice, which means that anything outside a problem definition will be parsed twice. </div> -</p><!--l. 474--><p class="noindent" > -</p><!--l. 476--><p class="noindent" > +</p><!--l. 514--><p class="noindent" > +</p><!--l. 516--><p class="noindent" > </p> -<!--l. 476--><p class="noindent" ><a -href="#top">Top</a></p><h3 class="sectionHead"><span class="titlemark">8 </span> <a - id="x1-90008"></a>Iterating Through Datasets</h3> -<!--l. 478--><p class="noindent" >Once you have defined all your problems for a given data set, you can use an individual +<!--l. 516--><p class="noindent" ><a +href="#top">Top</a></p><h3 class="sectionHead"><span class="titlemark">9 </span> <a + id="x1-100009"></a>Iterating Through Datasets</h3> +<!--l. 518--><p class="noindent" >Once you have defined all your problems for a given data set, you can use an individual problem with <span class="ec-lmtt-10">\useproblem</span><a - id="dx1-9001"></a> (see <a -href="#x1-70006">§6 </a><a -href="#x1-70006">Using a Problem<!--tex4ht:ref: sec:useproblem --></a>) but it is more likely that you will + id="dx1-10001"></a> (see <a +href="#x1-80007">§7 </a><a +href="#x1-80007">Using a Problem<!--tex4ht:ref: sec:useproblem --></a>) 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. -</p><!--l. 484--><p class="indent" > <hr><div title="Definition"><span class="marginpar"><span +</p><!--l. 524--><p class="indent" > <hr><div title="Definition"><span class="marginpar"><span class="ec-lmtt-9">\foreachproblem</span><span class="ec-lmtt-9"> </span></span><a - id="dx1-9002"></a> <span + id="dx1-10002"></a> <span class="ec-lmtt-10">\foreachproblem[</span><span class="lmsy-10">⟨</span><span class="ec-lmri-10">data set</span><span @@ -1279,7 +1373,7 @@ class="lmsy-10">⟨</span><span class="ec-lmri-10">body</span><span class="lmsy-10">⟩</span><span class="ec-lmtt-10">} </span></div><hr> -</p><!--l. 486--><p class="noindent" > +</p><!--l. 526--><p class="noindent" > This does <span class="lmsy-10">⟨</span><span class="ec-lmri-10">body</span><span @@ -1291,23 +1385,23 @@ default data set is used. Within <span class="lmsy-10">⟨</span><span class="ec-lmri-10">body</span><span class="lmsy-10">⟩ </span>you can use -</p><!--l. 490--><p class="indent" > <hr><div title="Definition"><span class="marginpar"><span +</p><!--l. 530--><p class="indent" > <hr><div title="Definition"><span class="marginpar"><span class="ec-lmtt-9">\thisproblem</span><span class="ec-lmtt-9"> </span></span><a - id="dx1-9003"></a> <span + id="dx1-10003"></a> <span class="ec-lmtt-10">\thisproblem </span></div><hr> -</p><!--l. 492--><p class="noindent" > +</p><!--l. 532--><p class="noindent" > to use the current problem and -</p><!--l. 494--><p class="indent" > <hr><div title="Definition"><span class="marginpar"><span +</p><!--l. 534--><p class="indent" > <hr><div title="Definition"><span class="marginpar"><span class="ec-lmtt-9">\thisproblemlabel</span><span class="ec-lmtt-9"> </span></span><a - id="dx1-9004"></a> <span + id="dx1-10004"></a> <span class="ec-lmtt-10">\thisproblemlabel </span></div><hr> -</p><!--l. 496--><p class="noindent" > +</p><!--l. 536--><p class="noindent" > to access the current label. If the problem requires arguments, and no default arguments were supplied in the problem definition or the package option <span class="ec-lmss-10">usedefaultargs</span><a - id="dx1-9005"></a> + id="dx1-10005"></a> was not used, then you will be prompted for arguments, so if you want to use this approach you will need to use <span class="LATEX">L<span class="A">A</span><span class="TEX">T<span class="E">E</span>X</span></span> in interactive mode. If you do provide @@ -1317,22 +1411,22 @@ class="ec-lmtt-10">\thisproblem</span>, so you only need to use <span class="ec-lmtt-10">\thisproblem </span>without having to specify <span class="ec-lmtt-10">\useproblem</span><a - id="dx1-9006"></a>. -</p><!--l. 508--><p class="indent" > For example, to iterate through all problems in the default data set: + id="dx1-10006"></a>. +</p><!--l. 548--><p class="indent" > For example, to iterate through all problems in the default data set: </p> - <div class="verbatim" id="verbatim-15"> + <div class="verbatim" id="verbatim-16"> \begin{enumerate}  <br />\foreachproblem{\item\thisproblem}  <br />\end{enumerate} </div> -<!--l. 514--><p class="nopar" > -</p><!--l. 516--><p class="indent" > <hr><div title="Definition"><span class="marginpar"><span +<!--l. 554--><p class="nopar" > +</p><!--l. 556--><p class="indent" > <hr><div title="Definition"><span class="marginpar"><span class="ec-lmtt-9">\foreachsolution</span><span class="ec-lmtt-9"> </span></span><a - id="dx1-9007"></a> <span + id="dx1-10007"></a> <span class="ec-lmtt-10">\foreachsolution[</span><span class="lmsy-10">⟨</span><span class="ec-lmri-10">data set</span><span @@ -1342,26 +1436,26 @@ class="lmsy-10">⟨</span><span class="ec-lmri-10">body</span><span class="lmsy-10">⟩</span><span class="ec-lmtt-10">} </span></div><hr> -</p><!--l. 518--><p class="noindent" > +</p><!--l. 558--><p class="noindent" > This is equivalent to <span class="ec-lmtt-10">\foreachsolution</span>, but only iterates through problems that contain the <span class="ec-lmss-10">onlysolution</span><a - id="dx1-9008"></a><a - id="dx1-9009"></a> environment. Note that you still need to use <span + id="dx1-10008"></a><a + id="dx1-10009"></a> environment. Note that you still need to use <span class="ec-lmtt-10">\showanswers</span><a - id="dx1-9010"></a> or + id="dx1-10010"></a> or the <span class="ec-lmss-10">answers</span><a - id="dx1-9011"></a> package option for the contents of the <span + id="dx1-10011"></a> package option for the contents of the <span class="ec-lmss-10">onlysolution</span><a - id="dx1-9012"></a><a - id="dx1-9013"></a> environment to + id="dx1-10012"></a><a + id="dx1-10013"></a> environment to appear. -</p><!--l. 525--><p class="indent" > <hr><div title="Definition"><span class="marginpar"><span +</p><!--l. 565--><p class="indent" > <hr><div title="Definition"><span class="marginpar"><span class="ec-lmtt-9">\foreachdataset</span><span class="ec-lmtt-9"> </span></span><a - id="dx1-9014"></a> <span + id="dx1-10014"></a> <span class="ec-lmtt-10">\foreachdataset{</span><span class="lmsy-10">⟨</span><span class="ec-lmri-10">cmd</span><span @@ -1371,7 +1465,7 @@ class="lmsy-10">⟨</span><span class="ec-lmri-10">body</span><span class="lmsy-10">⟩</span><span class="ec-lmtt-10">} </span></div><hr> -</p><!--l. 527--><p class="noindent" > +</p><!--l. 567--><p class="noindent" > This does <span class="lmsy-10">⟨</span><span class="ec-lmri-10">body</span><span @@ -1388,28 +1482,28 @@ sets: </p> - <div class="verbatim" id="verbatim-16"> + <div class="verbatim" id="verbatim-17"> \begin{enumerate}  <br />\foreachdataset{\thisdataset}{%  <br />\foreachproblem[\thisdataset]{\item\thisproblem}}  <br />\end{enumerate} </div> -<!--l. 536--><p class="nopar" > -</p><!--l. 538--><p class="indent" > Suppose I have two external files called <span +<!--l. 576--><p class="nopar" > +</p><!--l. 578--><p class="indent" > Suppose I have two external files called <span class="ec-lmtt-10">derivatives.tex </span>and <span class="ec-lmtt-10">probspaces.tex</span> which define problems using both <span class="ec-lmss-10">onlyproblem</span><a - id="dx1-9015"></a><a - id="dx1-9016"></a> and <span + id="dx1-10015"></a><a + id="dx1-10016"></a> and <span class="ec-lmss-10">onlysolution</span><a - id="dx1-9017"></a><a - id="dx1-9018"></a> for example: + id="dx1-10017"></a><a + id="dx1-10018"></a> for example: </p> - <div class="verbatim" id="verbatim-17"> + <div class="verbatim" id="verbatim-18"> \begin{defproblem}{cosxsqsinx}%  <br />\begin{onlyproblem}%  <br />$y = \cos(x^2)\sin x$.% @@ -1419,22 +1513,22 @@ class="ec-lmss-10">onlysolution</span><a  <br />\end{onlysolution}%  <br />\end{defproblem} </div> -<!--l. 551--><p class="nopar" > I can write a document that creates two data sets, one for the derivative problems and +<!--l. 591--><p class="nopar" > 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 <span class="ec-lmtt-10">\hideanswers</span><a - id="dx1-9019"></a> and iterate + id="dx1-10019"></a> and iterate through the require data set to produce the problems. Later, I can use <span class="ec-lmtt-10">\showanswers</span><a - id="dx1-9020"></a> + id="dx1-10020"></a> 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 <span class="ec-lmss-10">enumerate</span><a - id="dx1-9021"></a><a - id="dx1-9022"></a> environment, + id="dx1-10021"></a><a + id="dx1-10022"></a> environment, and redefined <span class="ec-lmtt-10">\theenumi</span><a - id="dx1-9023"></a> to label the questions according to the chapter. The + id="dx1-10023"></a> 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. @@ -1442,7 +1536,7 @@ questions. </p> - <div class="verbatim" id="verbatim-18"> + <div class="verbatim" id="verbatim-19"> \documentclass{report}  <br />\usepackage{probsoln}  <br />\begin{document} @@ -1477,38 +1571,38 @@ questions.  <br />\end{itemize}  <br />\end{document} </div> -<!--l. 604--><p class="nopar" > -</p><!--l. 606--><p class="noindent" > +<!--l. 644--><p class="nopar" > +</p><!--l. 646--><p class="noindent" > </p> -<!--l. 606--><p class="noindent" ><a -href="#top">Top</a></p><h3 class="sectionHead"><span class="titlemark">9 </span> <a - id="x1-100009"></a>Random Number Generator</h3> -<!--l. 608--><p class="noindent" >This package provides a pseudo-random number generator that is used by +<!--l. 646--><p class="noindent" ><a +href="#top">Top</a></p><h3 class="sectionHead"><span class="titlemark">10 </span> <a + id="x1-1100010"></a>Random Number Generator</h3> +<!--l. 648--><p class="noindent" >This package provides a pseudo-random number generator that is used by <span class="ec-lmtt-10">\loadrandomproblems</span><a - id="dx1-10001"></a>. As noted earlier the random number generator has been + id="dx1-11001"></a>. 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 -</p><!--l. 613--><p class="indent" > <hr><div title="Definition"><span class="marginpar"><span +</p><!--l. 653--><p class="indent" > <hr><div title="Definition"><span class="marginpar"><span class="ec-lmtt-9">\PSNuseoldrandom</span><span class="ec-lmtt-9"> </span></span><a - id="dx1-10002"></a> <span + id="dx1-11002"></a> <span class="ec-lmtt-10">\PSNuseoldrandom </span></div><hr> -</p><!--l. 615--><p class="noindent" > -</p><!--l. 617--><p class="indent" > <hr><div title="Definition"><span class="marginpar"><span +</p><!--l. 655--><p class="noindent" > +</p><!--l. 657--><p class="indent" > <hr><div title="Definition"><span class="marginpar"><span class="ec-lmtt-9">\PSNrandseed</span><span class="ec-lmtt-9"> </span></span><a - id="dx1-10003"></a> <span + id="dx1-11003"></a> <span class="ec-lmtt-10">\PSNrandseed{</span><span class="lmsy-10">⟨</span><span class="ec-lmri-10">n</span><span class="lmsy-10">⟩</span><span class="ec-lmtt-10">} </span></div><hr> -</p><!--l. 619--><p class="noindent" > +</p><!--l. 659--><p class="noindent" > This sets the seed to <span class="lmsy-10">⟨</span><span class="ec-lmri-10">n</span><span @@ -1517,36 +1611,36 @@ generate a different set of random numbers every time you <span class="LATEX">L< class="E">E</span>X</span></span> your document,<span class="footnote-mark"><a href="#fn1x0" id="fn1x0-bk"><sup class="textsuperscript">1</sup></a></span><a - id="x1-10004f1"></a> + id="x1-11004f1"></a> put the following in your preamble: </p> - <div class="verbatim" id="verbatim-19"> + <div class="verbatim" id="verbatim-20"> \PSNrandseed{\time} </div> -<!--l. 627--><p class="nopar" > or to generate a different set of random numbers every year you <span class="LATEX">L<span class="A">A</span><span class="TEX">T<span +<!--l. 667--><p class="nopar" > or to generate a different set of random numbers every year you <span class="LATEX">L<span class="A">A</span><span class="TEX">T<span class="E">E</span>X</span></span> your document: </p> - <div class="verbatim" id="verbatim-20"> + <div class="verbatim" id="verbatim-21"> \PSNrandseed{\year} </div> -<!--l. 632--><p class="nopar" > -</p><!--l. 634--><p class="indent" > <hr><div title="Definition"><span class="marginpar"><span +<!--l. 672--><p class="nopar" > +</p><!--l. 674--><p class="indent" > <hr><div title="Definition"><span class="marginpar"><span class="ec-lmtt-9">\PSNgetrandseed</span><span class="ec-lmtt-9"> </span></span><a - id="dx1-10005"></a> <span + id="dx1-11005"></a> <span class="ec-lmtt-10">\PSNgetrandseed{</span><span class="lmsy-10">⟨</span><span class="ec-lmri-10">register</span><span class="lmsy-10">⟩</span><span class="ec-lmtt-10">} </span></div><hr> -</p><!--l. 636--><p class="noindent" > +</p><!--l. 676--><p class="noindent" > This stores the current seed in the count register specified by <span class="lmsy-10">⟨</span><span class="ec-lmri-10">register</span><span @@ -1556,15 +1650,15 @@ example: </p> - <div class="verbatim" id="verbatim-21"> + <div class="verbatim" id="verbatim-22"> \newcount\myseed  <br />\PSNgetrandseed{\myseed} </div> -<!--l. 643--><p class="nopar" > -</p><!--l. 645--><p class="indent" > <hr><div title="Definition"><span class="marginpar"><span +<!--l. 683--><p class="nopar" > +</p><!--l. 685--><p class="indent" > <hr><div title="Definition"><span class="marginpar"><span class="ec-lmtt-9">\PSNrandom</span><span class="ec-lmtt-9"> </span></span><a - id="dx1-10006"></a> <span + id="dx1-11006"></a> <span class="ec-lmtt-10">\PSNrandom{</span><span class="lmsy-10">⟨</span><span class="ec-lmri-10">register</span><span @@ -1574,7 +1668,7 @@ class="lmsy-10">⟨</span><span class="ec-lmri-10">n</span><span class="lmsy-10">⟩</span><span class="ec-lmtt-10">} </span></div><hr> -</p><!--l. 647--><p class="noindent" > +</p><!--l. 687--><p class="noindent" > Generates a random integer from 1 to <span class="lmsy-10">⟨</span><span class="ec-lmri-10">n</span><span @@ -1589,15 +1683,15 @@ class="ec-lmtt-10">\myreg</span>: </p> - <div class="verbatim" id="verbatim-22"> + <div class="verbatim" id="verbatim-23"> \newcount\myreg  <br />\PSNrandom{\myreg}{10} </div> -<!--l. 655--><p class="nopar" > -</p><!--l. 657--><p class="indent" > <hr><div title="Definition"><span class="marginpar"><span +<!--l. 695--><p class="nopar" > +</p><!--l. 697--><p class="indent" > <hr><div title="Definition"><span class="marginpar"><span class="ec-lmtt-9">\random</span><span class="ec-lmtt-9"> </span></span><a - id="dx1-10007"></a> <span + id="dx1-11007"></a> <span class="ec-lmtt-10">\random{</span><span class="lmsy-10">⟨</span><span class="ec-lmri-10">counter</span><span @@ -1611,7 +1705,7 @@ class="lmsy-10">⟨</span><span class="ec-lmri-10">max</span><span class="lmsy-10">⟩</span><span class="ec-lmtt-10">} </span></div><hr> -</p><!--l. 659--><p class="noindent" > +</p><!--l. 699--><p class="noindent" > Generates a random integer from <span class="lmsy-10">⟨</span><span class="ec-lmri-10">min</span><span @@ -1626,15 +1720,15 @@ class="ec-lmtt-10">myrand</span>. </p> - <div class="verbatim" id="verbatim-23"> + <div class="verbatim" id="verbatim-24"> \newcounter{myrand}  <br />\random{myrand}{3}{8} </div> -<!--l. 667--><p class="nopar" > -</p><!--l. 669--><p class="indent" > <hr><div title="Definition"><span class="marginpar"><span +<!--l. 707--><p class="nopar" > +</p><!--l. 709--><p class="indent" > <hr><div title="Definition"><span class="marginpar"><span class="ec-lmtt-9">\doforrandN</span><span class="ec-lmtt-9"> </span></span><a - id="dx1-10008"></a> <span + id="dx1-11008"></a> <span class="ec-lmtt-10">\doforrandN{</span><span class="lmsy-10">⟨</span><span class="ec-lmri-10">n</span><span @@ -1652,7 +1746,7 @@ class="lmsy-10">⟨</span><span class="ec-lmri-10">text</span><span class="lmsy-10">⟩</span><span class="ec-lmtt-10">} </span></div><hr> -</p><!--l. 671--><p class="noindent" > +</p><!--l. 711--><p class="noindent" > Randomly selects <span class="lmsy-10">⟨</span><span class="ec-lmri-10">n</span><span @@ -1677,41 +1771,41 @@ one problem): </p> - <div class="verbatim" id="verbatim-24"> + <div class="verbatim" id="verbatim-25"> \doforrandN{2}{\thisfile}{file1,file2,file3}{%  <br />\loadrandomproblems{1}{\thisfile}} </div> -<!--l. 682--><p class="nopar" > -</p><!--l. 684--><p class="noindent" > +<!--l. 722--><p class="nopar" > +</p><!--l. 724--><p class="noindent" > </p> -<!--l. 684--><p class="noindent" ><a -href="#top">Top</a></p><h3 class="sectionHead"><span class="titlemark">10 </span> <a - id="x1-1100010"></a>Compatibility With Versions Prior to 3.0</h3> -<!--l. 686--><p class="noindent" >Version 3.0 of the <span +<!--l. 724--><p class="noindent" ><a +href="#top">Top</a></p><h3 class="sectionHead"><span class="titlemark">11 </span> <a + id="x1-1200011"></a>Compatibility With Versions Prior to 3.0</h3> +<!--l. 726--><p class="noindent" >Version 3.0 of the <span class="ec-lmss-10">probsoln</span><a - id="dx1-11001"></a> package completely changed the structure of the package, + id="dx1-12001"></a> 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 <span class="ec-lmtt-10">\newproblem</span><a - id="dx1-11002"></a> and <span + id="dx1-12002"></a> and <span class="ec-lmtt-10">\newproblem*</span><a - id="dx1-11003"></a>. However, since the external files had to be + id="dx1-12003"></a>. 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. -</p><!--l. 698--><p class="indent" > The other likely difference is where the random generator is used in a group. This +</p><!--l. 738--><p class="indent" > The other likely difference is where the random generator is used in a group. This includes commands such as <span class="ec-lmtt-10">\selectrandomly</span><a - id="dx1-11004"></a>. For example, if your document + id="dx1-12004"></a>. For example, if your document contained something like: </p> - <div class="verbatim" id="verbatim-25"> + <div class="verbatim" id="verbatim-26"> \begin{enumerate}  <br />\selectrandomly{file1}{8}  <br />\item Solve the following: @@ -1721,7 +1815,7 @@ contained something like:  <br />\selectrandomly{file3}{2}  <br />\end{enumerate} </div> -<!--l. 713--><p class="nopar" > Then using versions prior to v3.0 will produce a different set of random numbers since +<!--l. 753--><p class="nopar" > Then using versions prior to v3.0 will produce a different set of random numbers since the second <span class="ec-lmtt-10">\selectrandomly </span>is in a different level of grouping. If you want to ensure that the document produces exactly the same random set with the @@ -1732,7 +1826,7 @@ becomes: </p> - <div class="verbatim" id="verbatim-26"> + <div class="verbatim" id="verbatim-27"> \begin{enumerate}  <br />\selectrandomly{file1}{8}  <br />\item Solve the following: @@ -1745,11 +1839,11 @@ becomes:  <br />\selectrandomly{file3}{2}  <br />\end{enumerate} </div> -<!--l. 735--><p class="nopar" > -</p><!--l. 737--><p class="indent" > <hr><div title="Definition"><span class="marginpar"><span +<!--l. 775--><p class="nopar" > +</p><!--l. 777--><p class="indent" > <hr><div title="Definition"><span class="marginpar"><span class="ec-lmtt-9">\selectrandomly</span><span class="ec-lmtt-9"> </span></span><a - id="dx1-11005"></a> <span + id="dx1-12005"></a> <span class="ec-lmtt-10">\selectrandomly{</span><span class="lmsy-10">⟨</span><span class="ec-lmri-10">filename</span><span @@ -1759,7 +1853,7 @@ class="lmsy-10">⟨</span><span class="ec-lmri-10">n</span><span class="lmsy-10">⟩</span><span class="ec-lmtt-10">} </span></div><hr> -</p><!--l. 739--><p class="noindent" > +</p><!--l. 779--><p class="noindent" > This is now equivalent to: <span class="obeylines-h"> <span class="ec-lmtt-10">{\loadrandomproblems[</span><span @@ -1781,16 +1875,16 @@ class="lmsy-10">⟨</span><span class="ec-lmri-10">filename</span><span class="lmsy-10">⟩</span><span class="ec-lmtt-10">]{\PSNitem\thisproblem\endPSNitem}</span></span> -</p><!--l. 746--><p class="indent" > <hr><div title="Definition"><span class="marginpar"><span +</p><!--l. 786--><p class="indent" > <hr><div title="Definition"><span class="marginpar"><span class="ec-lmtt-9">\selectallproblems</span><span class="ec-lmtt-9"> </span></span><a - id="dx1-11006"></a> <span + id="dx1-12006"></a> <span class="ec-lmtt-10">\selectallproblems{</span><span class="lmsy-10">⟨</span><span class="ec-lmri-10">filename</span><span class="lmsy-10">⟩</span><span class="ec-lmtt-10">} </span></div><hr> -</p><!--l. 748--><p class="noindent" > +</p><!--l. 788--><p class="noindent" > This is now equivalent to: <span class="obeylines-h"> <span class="ec-lmtt-10">{\loadallproblems[</span><span @@ -1808,347 +1902,359 @@ class="lmsy-10">⟨</span><span class="ec-lmri-10">filename</span><span class="lmsy-10">⟩</span><span class="ec-lmtt-10">]{\PSNitem\thisproblem\endPSNitem}</span></span> -</p><!--l. 755--><p class="indent" > Note that in both the above cases, a new data set is created with the same name as +</p><!--l. 795--><p class="indent" > Note that in both the above cases, a new data set is created with the same name as the file name. -</p><!--l. 758--><p class="indent" > <a +</p><!--l. 798--><p class="indent" > <a id="likesection.1"></a><a - id="Q1-1-12"></a> + id="Q1-1-13"></a> </p> <!--l. 2--><p class="noindent" ><a href="#top">Top</a></p><h3 class="likesectionHead"><a - id="x1-1200010"></a>Index</h3> + id="x1-1300011"></a>Index</h3> <!--l. 4--><p class="noindent" > <span -class="ec-lmbx-10">A</span> +class="ec-lmbx-10">B</span> </p> <div class="theindex"><span class="index-item"><span -class="ec-lmss-10">alltt </span>package  <a -href="probsoln-manual.html#dx1-4020" >1</a>, <a -href="probsoln-manual.html#dx1-6028" >2</a> <br /></span> -<p class="theindex"> <span -class="ec-lmbx-10">B</span> -<span class="index-item"><span class="ec-lmss-10">babel </span>package  <a -href="probsoln-manual.html#dx1-6011" >3</a> <br /></span> -</p><p class="theindex"> <span +href="probsoln-manual.html#dx1-7011" >1</a> <br /></span> +<p class="theindex"> <span class="ec-lmbx-10">C</span> <span class="index-item"><span class="obeylines-h"><span class="verb"><span class="ec-lmtt-10">\correctitem</span></span></span>  <a -href="probsoln-manual.html#dx1-5015" ><span -class="ec-lmri-10">4</span></a> <br /></span> +href="probsoln-manual.html#dx1-6015" ><span +class="ec-lmri-10">2</span></a> <br /></span> <span class="index-item"><span class="obeylines-h"><span class="verb"><span class="ec-lmtt-10">\correctitemformat</span></span></span>  <a -href="probsoln-manual.html#dx1-5018" ><span -class="ec-lmri-10">5</span></a> <br /></span> +href="probsoln-manual.html#dx1-6018" ><span +class="ec-lmri-10">3</span></a> <br /></span> </p><p class="theindex"> <span class="ec-lmbx-10">D</span> <span class="index-item"><span class="ec-lmtt-10">defproblem </span>(environment)  <a -href="probsoln-manual.html#dx1-4021" ><span class="underline">6</span></a>, <a -href="probsoln-manual.html#dx1-6008" ><span -class="ec-lmri-10">7</span></a>, <a -href="probsoln-manual.html#dx1-6012" ><span class="underline">8</span></a>, <a -href="probsoln-manual.html#dx1-6016" ><span class="underline">9</span></a>, <a -href="probsoln-manual.html#dx1-6026" ><span class="underline">10</span></a>, <a -href="probsoln-manual.html#dx1-7001" ><span class="underline">11</span></a>, <a -href="probsoln-manual.html#dx1-8008" ><span class="underline">12</span></a> <br /></span> +href="probsoln-manual.html#dx1-5020" ><span class="underline">4</span></a>, <a +href="probsoln-manual.html#dx1-5025" ><span class="underline">5</span></a>, <a +href="probsoln-manual.html#dx1-7008" ><span +class="ec-lmri-10">6</span></a>, <a +href="probsoln-manual.html#dx1-7016" ><span class="underline">7</span></a>, <a +href="probsoln-manual.html#dx1-7020" ><span class="underline">8</span></a>, <a +href="probsoln-manual.html#dx1-7030" ><span class="underline">9</span></a>, <a +href="probsoln-manual.html#dx1-8001" ><span class="underline">10</span></a>, <a +href="probsoln-manual.html#dx1-9008" ><span class="underline">11</span></a> <br /></span> <span class="index-item"><span class="obeylines-h"><span class="verb"><span class="ec-lmtt-10">\doforrandN</span></span></span>  <a -href="probsoln-manual.html#dx1-10008" ><span -class="ec-lmri-10">13</span></a> <br /></span> +href="probsoln-manual.html#dx1-11008" ><span +class="ec-lmri-10">12</span></a> <br /></span> </p><p class="theindex"> <span class="ec-lmbx-10">E</span> <span class="index-item"><span class="ec-lmtt-10">enumerate </span>(environment)  <a -href="probsoln-manual.html#dx1-5011" ><span class="underline">14</span></a>, <a -href="probsoln-manual.html#dx1-5013" ><span class="underline">15</span></a>, <a -href="probsoln-manual.html#dx1-9021" ><span class="underline">16</span></a> <br /></span> +href="probsoln-manual.html#dx1-6011" ><span class="underline">13</span></a>, <a +href="probsoln-manual.html#dx1-6013" ><span class="underline">14</span></a>, <a +href="probsoln-manual.html#dx1-10021" ><span class="underline">15</span></a> <br /></span> <span class="index-item">environments:<br /></span> <span class="index-subitem">    <span class="ec-lmtt-10">defproblem</span>  <a -href="probsoln-manual.html#dx1-4022" ><span class="underline">17</span></a>, <a -href="probsoln-manual.html#dx1-6009" ><span +href="probsoln-manual.html#dx1-5021" ><span class="underline">16</span></a>, <a +href="probsoln-manual.html#dx1-5026" ><span class="underline">17</span></a>, <a +href="probsoln-manual.html#dx1-7009" ><span class="ec-lmri-10">18</span></a>, <a -href="probsoln-manual.html#dx1-6013" ><span class="underline">19</span></a>, <a -href="probsoln-manual.html#dx1-6017" ><span class="underline">20</span></a>, <a -href="probsoln-manual.html#dx1-6027" ><span class="underline">21</span></a>, <a -href="probsoln-manual.html#dx1-7002" ><span class="underline">22</span></a>, <a -href="probsoln-manual.html#dx1-8009" ><span class="underline">23</span></a> <br /></span> +href="probsoln-manual.html#dx1-7017" ><span class="underline">19</span></a>, <a +href="probsoln-manual.html#dx1-7021" ><span class="underline">20</span></a>, <a +href="probsoln-manual.html#dx1-7031" ><span class="underline">21</span></a>, <a +href="probsoln-manual.html#dx1-8002" ><span class="underline">22</span></a>, <a +href="probsoln-manual.html#dx1-9009" ><span class="underline">23</span></a> <br /></span> <span class="index-subitem">    <span class="ec-lmtt-10">enumerate</span>  <a -href="probsoln-manual.html#dx1-5012" ><span class="underline">24</span></a>, <a -href="probsoln-manual.html#dx1-5014" ><span class="underline">25</span></a>, <a -href="probsoln-manual.html#dx1-9022" ><span class="underline">26</span></a> <br /></span> +href="probsoln-manual.html#dx1-6012" ><span class="underline">24</span></a>, <a +href="probsoln-manual.html#dx1-6014" ><span class="underline">25</span></a>, <a +href="probsoln-manual.html#dx1-10022" ><span class="underline">26</span></a> <br /></span> <span class="index-subitem">    <span class="ec-lmtt-10">onlyproblem</span>  <a -href="probsoln-manual.html#dx1-4009" ><span +href="probsoln-manual.html#dx1-5009" ><span class="ec-lmri-10">27</span></a>, <a -href="probsoln-manual.html#dx1-4011" ><span class="underline">28</span></a>, <a -href="probsoln-manual.html#dx1-4019" ><span class="underline">29</span></a>, <a -href="probsoln-manual.html#dx1-6002" ><span class="underline">30</span></a>, <a -href="probsoln-manual.html#dx1-9016" ><span class="underline">31</span></a> <br /></span> +href="probsoln-manual.html#dx1-5015" ><span class="underline">28</span></a>, <a +href="probsoln-manual.html#dx1-5017" ><span class="underline">29</span></a>, <a +href="probsoln-manual.html#dx1-5024" ><span class="underline">30</span></a>, <a +href="probsoln-manual.html#dx1-7002" ><span class="underline">31</span></a>, <a +href="probsoln-manual.html#dx1-7013" ><span class="underline">32</span></a>, <a +href="probsoln-manual.html#dx1-10016" ><span class="underline">33</span></a> <br /></span> <span class="index-subitem">    <span class="ec-lmtt-10">onlysolution</span>  <a -href="probsoln-manual.html#dx1-4013" ><span -class="ec-lmri-10">32</span></a>, <a -href="probsoln-manual.html#dx1-4015" ><span class="underline">33</span></a>, <a -href="probsoln-manual.html#dx1-6004" ><span class="underline">34</span></a>, <a -href="probsoln-manual.html#dx1-9009" ><span class="underline">35</span></a>, <a -href="probsoln-manual.html#dx1-9013" ><span class="underline">36</span></a>, <a -href="probsoln-manual.html#dx1-9018" ><span class="underline">37</span></a> <br /></span> +href="probsoln-manual.html#dx1-5011" ><span +class="ec-lmri-10">34</span></a>, <a +href="probsoln-manual.html#dx1-5019" ><span class="underline">35</span></a>, <a +href="probsoln-manual.html#dx1-7004" ><span class="underline">36</span></a>, <a +href="probsoln-manual.html#dx1-7015" ><span class="underline">37</span></a>, <a +href="probsoln-manual.html#dx1-10009" ><span class="underline">38</span></a>, <a +href="probsoln-manual.html#dx1-10013" ><span class="underline">39</span></a>, <a +href="probsoln-manual.html#dx1-10018" ><span class="underline">40</span></a> <br /></span> <span class="index-subitem">    <span class="ec-lmtt-10">solution</span>  <a -href="probsoln-manual.html#dx1-5002" ><span -class="ec-lmri-10">38</span></a>, <a -href="probsoln-manual.html#dx1-5005" ><span class="underline">39</span></a>, <a -href="probsoln-manual.html#dx1-5008" ><span class="underline">40</span></a> <br /></span> +href="probsoln-manual.html#dx1-6002" ><span +class="ec-lmri-10">41</span></a>, <a +href="probsoln-manual.html#dx1-6005" ><span class="underline">42</span></a>, <a +href="probsoln-manual.html#dx1-6008" ><span class="underline">43</span></a> <br /></span> <span class="index-subitem">    <span class="ec-lmtt-10">textenum</span>  <a -href="probsoln-manual.html#dx1-5010" ><span -class="ec-lmri-10">41</span></a> <br /></span> +href="probsoln-manual.html#dx1-6010" ><span +class="ec-lmri-10">44</span></a> <br /></span> </p><p class="theindex"> <span class="ec-lmbx-10">F</span> <span class="index-item"><span class="obeylines-h"><span class="verb"><span class="ec-lmtt-10">\foreachdataset</span></span></span>  <a -href="probsoln-manual.html#dx1-9014" ><span -class="ec-lmri-10">42</span></a> <br /></span> +href="probsoln-manual.html#dx1-10014" ><span +class="ec-lmri-10">45</span></a> <br /></span> <span class="index-item"><span class="obeylines-h"><span class="verb"><span class="ec-lmtt-10">\foreachproblem</span></span></span>  <a -href="probsoln-manual.html#dx1-6019" ><span class="underline">43</span></a>, <a -href="probsoln-manual.html#dx1-6024" ><span class="underline">44</span></a>, <a -href="probsoln-manual.html#dx1-9002" ><span -class="ec-lmri-10">45</span></a> <br /></span> +href="probsoln-manual.html#dx1-7023" ><span class="underline">46</span></a>, <a +href="probsoln-manual.html#dx1-7028" ><span class="underline">47</span></a>, <a +href="probsoln-manual.html#dx1-10002" ><span +class="ec-lmri-10">48</span></a> <br /></span> <span class="index-item"><span class="obeylines-h"><span class="verb"><span class="ec-lmtt-10">\foreachsolution</span></span></span>  <a -href="probsoln-manual.html#dx1-4023" ><span class="underline">46</span></a>, <a -href="probsoln-manual.html#dx1-9007" ><span -class="ec-lmri-10">47</span></a> <br /></span> +href="probsoln-manual.html#dx1-5022" ><span class="underline">49</span></a>, <a +href="probsoln-manual.html#dx1-10007" ><span +class="ec-lmri-10">50</span></a> <br /></span> <span class="index-item"><span class="ec-lmss-10">fp </span>package  <a -href="probsoln-manual.html#dx1-6022" >48</a> <br /></span> +href="probsoln-manual.html#dx1-7026" >51</a> <br /></span> +<span class="index-item">fragile  <a +href="probsoln-manual.html#dx1-4001" ><span class="underline">52</span></a> <br /></span> </p><p class="theindex"> <span class="ec-lmbx-10">H</span> <span class="index-item"><span class="obeylines-h"><span class="verb"><span class="ec-lmtt-10">\hideanswers</span></span></span>  <a -href="probsoln-manual.html#dx1-4004" ><span -class="ec-lmri-10">49</span></a>, <a -href="probsoln-manual.html#dx1-6007" ><span class="underline">50</span></a>, <a -href="probsoln-manual.html#dx1-9019" ><span class="underline">51</span></a> <br /></span> +href="probsoln-manual.html#dx1-5004" ><span +class="ec-lmri-10">53</span></a>, <a +href="probsoln-manual.html#dx1-7007" ><span class="underline">54</span></a>, <a +href="probsoln-manual.html#dx1-10019" ><span class="underline">55</span></a> <br /></span> </p><p class="theindex"> <span class="ec-lmbx-10">I</span> <span class="index-item"><span class="obeylines-h"><span class="verb"><span class="ec-lmtt-10">\ifshowanswers</span></span></span>  <a -href="probsoln-manual.html#dx1-4007" ><span class="underline">52</span></a>, <a -href="probsoln-manual.html#dx1-5006" ><span class="underline">53</span></a> <br /></span> - - - +href="probsoln-manual.html#dx1-5007" ><span class="underline">56</span></a>, <a +href="probsoln-manual.html#dx1-6006" ><span class="underline">57</span></a> <br /></span> <span class="index-item"><span class="ec-lmss-10">ifthen </span>package  <a -href="probsoln-manual.html#dx1-4006" >54</a> <br /></span> +href="probsoln-manual.html#dx1-5006" >58</a> <br /></span> <span class="index-item"><span class="obeylines-h"><span class="verb"><span class="ec-lmtt-10">\include</span></span></span>  <a -href="probsoln-manual.html#dx1-6015" ><span class="underline">55</span></a> <br /></span> +href="probsoln-manual.html#dx1-7019" ><span class="underline">59</span></a> <br /></span> <span class="index-item"><span class="obeylines-h"><span class="verb"><span class="ec-lmtt-10">\incorrectitem</span></span></span>  <a -href="probsoln-manual.html#dx1-5016" ><span -class="ec-lmri-10">56</span></a> <br /></span> +href="probsoln-manual.html#dx1-6016" ><span +class="ec-lmri-10">60</span></a> <br /></span> + + + <span class="index-item"><span class="obeylines-h"><span class="verb"><span class="ec-lmtt-10">\incorrectitemformat</span></span></span>  <a -href="probsoln-manual.html#dx1-5019" ><span -class="ec-lmri-10">57</span></a> <br /></span> +href="probsoln-manual.html#dx1-6019" ><span +class="ec-lmri-10">61</span></a> <br /></span> <span class="index-item"><span class="obeylines-h"><span class="verb"><span class="ec-lmtt-10">\input</span></span></span>  <a -href="probsoln-manual.html#dx1-6014" ><span class="underline">58</span></a>, <a -href="probsoln-manual.html#dx1-8001" ><span class="underline">59</span></a> <br /></span> +href="probsoln-manual.html#dx1-7018" ><span class="underline">62</span></a>, <a +href="probsoln-manual.html#dx1-9001" ><span class="underline">63</span></a> <br /></span> <span class="index-item"><span class="obeylines-h"><span class="verb"><span class="ec-lmtt-10">\item</span></span></span>  <a -href="probsoln-manual.html#dx1-5017" ><span class="underline">60</span></a> <br /></span> +href="probsoln-manual.html#dx1-6017" ><span class="underline">64</span></a> <br /></span> </p><p class="theindex"> <span class="ec-lmbx-10">L</span> <span class="index-item"><span class="obeylines-h"><span class="verb"><span class="ec-lmtt-10">\loadallproblems</span></span></span>  <a -href="probsoln-manual.html#dx1-8002" ><span -class="ec-lmri-10">61</span></a> <br /></span> +href="probsoln-manual.html#dx1-9002" ><span +class="ec-lmri-10">65</span></a> <br /></span> <span class="index-item"><span class="obeylines-h"><span class="verb"><span class="ec-lmtt-10">\loadexceptproblems</span></span></span>  <a -href="probsoln-manual.html#dx1-8004" ><span -class="ec-lmri-10">62</span></a> <br /></span> +href="probsoln-manual.html#dx1-9004" ><span +class="ec-lmri-10">66</span></a> <br /></span> <span class="index-item"><span class="obeylines-h"><span class="verb"><span class="ec-lmtt-10">\loadrandomexcept</span></span></span>  <a -href="probsoln-manual.html#dx1-8006" ><span -class="ec-lmri-10">63</span></a> <br /></span> +href="probsoln-manual.html#dx1-9006" ><span +class="ec-lmri-10">67</span></a> <br /></span> <span class="index-item"><span class="obeylines-h"><span class="verb"><span class="ec-lmtt-10">\loadrandomproblems</span></span></span>  <a -href="probsoln-manual.html#dx1-8005" ><span -class="ec-lmri-10">64</span></a>, <a -href="probsoln-manual.html#dx1-10001" ><span class="underline">65</span></a> <br /></span> +href="probsoln-manual.html#dx1-9005" ><span +class="ec-lmri-10">68</span></a>, <a +href="probsoln-manual.html#dx1-11001" ><span class="underline">69</span></a> <br /></span> <span class="index-item"><span class="obeylines-h"><span class="verb"><span class="ec-lmtt-10">\loadselectedproblems</span></span></span>  <a -href="probsoln-manual.html#dx1-8003" ><span -class="ec-lmri-10">66</span></a> <br /></span> +href="probsoln-manual.html#dx1-9003" ><span +class="ec-lmri-10">70</span></a> <br /></span> </p><p class="theindex"> <span class="ec-lmbx-10">N</span> <span class="index-item"><span class="obeylines-h"><span class="verb"><span class="ec-lmtt-10">\newproblem</span></span></span>  <a -href="probsoln-manual.html#dx1-6021" ><span -class="ec-lmri-10">67</span></a>, <a -href="probsoln-manual.html#dx1-7003" ><span class="underline">68</span></a>, <a -href="probsoln-manual.html#dx1-8010" ><span class="underline">69</span></a>, <a -href="probsoln-manual.html#dx1-11002" ><span class="underline">70</span></a> <br /></span> +href="probsoln-manual.html#dx1-7025" ><span +class="ec-lmri-10">71</span></a>, <a +href="probsoln-manual.html#dx1-8003" ><span class="underline">72</span></a>, <a +href="probsoln-manual.html#dx1-9010" ><span class="underline">73</span></a>, <a +href="probsoln-manual.html#dx1-12002" ><span class="underline">74</span></a> <br /></span> <span class="index-item"><span class="obeylines-h"><span class="verb"><span class="ec-lmtt-10">\newproblem*</span></span></span>  <a -href="probsoln-manual.html#dx1-6025" ><span -class="ec-lmri-10">71</span></a>, <a -href="probsoln-manual.html#dx1-8011" ><span class="underline">72</span></a>, <a -href="probsoln-manual.html#dx1-11003" ><span class="underline">73</span></a> <br /></span> +href="probsoln-manual.html#dx1-7029" ><span +class="ec-lmri-10">75</span></a>, <a +href="probsoln-manual.html#dx1-9011" ><span class="underline">76</span></a>, <a +href="probsoln-manual.html#dx1-12003" ><span class="underline">77</span></a> <br /></span> <span class="index-item"><span class="ec-lmss-10">ngerman </span>package  <a -href="probsoln-manual.html#dx1-6010" >74</a> <br /></span> +href="probsoln-manual.html#dx1-7010" >78</a> <br /></span> </p><p class="theindex"> <span class="ec-lmbx-10">O</span> <span class="index-item"><span class="ec-lmtt-10">onlyproblem </span>(environment)  <a -href="probsoln-manual.html#dx1-4008" ><span -class="ec-lmri-10">75</span></a>, <a -href="probsoln-manual.html#dx1-4010" ><span class="underline">76</span></a>, <a -href="probsoln-manual.html#dx1-4018" ><span class="underline">77</span></a>, <a -href="probsoln-manual.html#dx1-6001" ><span class="underline">78</span></a>, <a -href="probsoln-manual.html#dx1-9015" ><span class="underline">79</span></a> <br /></span> +href="probsoln-manual.html#dx1-5008" ><span +class="ec-lmri-10">79</span></a>, <a +href="probsoln-manual.html#dx1-5014" ><span class="underline">80</span></a>, <a +href="probsoln-manual.html#dx1-5016" ><span class="underline">81</span></a>, <a +href="probsoln-manual.html#dx1-5023" ><span class="underline">82</span></a>, <a +href="probsoln-manual.html#dx1-7001" ><span class="underline">83</span></a>, <a +href="probsoln-manual.html#dx1-7012" ><span class="underline">84</span></a>, <a +href="probsoln-manual.html#dx1-10015" ><span class="underline">85</span></a> <br /></span> <span class="index-item"><span class="ec-lmtt-10">onlysolution </span>(environment)  <a -href="probsoln-manual.html#dx1-4012" ><span -class="ec-lmri-10">80</span></a>, <a -href="probsoln-manual.html#dx1-4014" ><span class="underline">81</span></a>, <a -href="probsoln-manual.html#dx1-6003" ><span class="underline">82</span></a>, <a -href="probsoln-manual.html#dx1-9008" ><span class="underline">83</span></a>, <a -href="probsoln-manual.html#dx1-9012" ><span class="underline">84</span></a>, <a -href="probsoln-manual.html#dx1-9017" ><span class="underline">85</span></a> <br /></span> +href="probsoln-manual.html#dx1-5010" ><span +class="ec-lmri-10">86</span></a>, <a +href="probsoln-manual.html#dx1-5018" ><span class="underline">87</span></a>, <a +href="probsoln-manual.html#dx1-7003" ><span class="underline">88</span></a>, <a +href="probsoln-manual.html#dx1-7014" ><span class="underline">89</span></a>, <a +href="probsoln-manual.html#dx1-10008" ><span class="underline">90</span></a>, <a +href="probsoln-manual.html#dx1-10012" ><span class="underline">91</span></a>, <a +href="probsoln-manual.html#dx1-10017" ><span class="underline">92</span></a> <br /></span> </p><p class="theindex"> <span class="ec-lmbx-10">P</span> <span class="index-item">package options:<br /></span> <span class="index-subitem">    <span class="ec-lmss-10">answers</span>  <a -href="probsoln-manual.html#dx1-3001" ><span class="underline">86</span></a>, <a -href="probsoln-manual.html#dx1-4001" ><span class="underline">87</span></a>, <a -href="probsoln-manual.html#dx1-9011" ><span class="underline">88</span></a> <br /></span> +href="probsoln-manual.html#dx1-3001" ><span class="underline">93</span></a>, <a +href="probsoln-manual.html#dx1-5001" ><span class="underline">94</span></a>, <a +href="probsoln-manual.html#dx1-10011" ><span class="underline">95</span></a> <br /></span> <span class="index-subitem">    <span class="ec-lmss-10">draft</span>  <a -href="probsoln-manual.html#dx1-3003" ><span class="underline">89</span></a> <br /></span> +href="probsoln-manual.html#dx1-3003" ><span class="underline">96</span></a> <br /></span> <span class="index-subitem">    <span class="ec-lmss-10">final</span>  <a -href="probsoln-manual.html#dx1-3004" ><span class="underline">90</span></a> <br /></span> +href="probsoln-manual.html#dx1-3004" ><span class="underline">97</span></a> <br /></span> <span class="index-subitem">    <span class="ec-lmss-10">noanswers</span>  <a -href="probsoln-manual.html#dx1-3002" ><span class="underline">91</span></a>, <a -href="probsoln-manual.html#dx1-4002" ><span class="underline">92</span></a> <br /></span> +href="probsoln-manual.html#dx1-3002" ><span class="underline">98</span></a>, <a +href="probsoln-manual.html#dx1-5002" ><span class="underline">99</span></a> <br /></span> <span class="index-subitem">    <span class="ec-lmss-10">nousedefaultargs</span>  <a -href="probsoln-manual.html#dx1-3007" ><span class="underline">93</span></a> <br /></span> +href="probsoln-manual.html#dx1-3007" ><span class="underline">100</span></a> <br /></span> <span class="index-subitem">    <span class="ec-lmss-10">usedefaultargs</span>  <a -href="probsoln-manual.html#dx1-3005" ><span class="underline">94</span></a>, <a -href="probsoln-manual.html#dx1-6020" ><span class="underline">95</span></a>, <a -href="probsoln-manual.html#dx1-9005" ><span class="underline">96</span></a> <br /></span> +href="probsoln-manual.html#dx1-3005" ><span class="underline">101</span></a>, <a +href="probsoln-manual.html#dx1-7024" ><span class="underline">102</span></a>, <a +href="probsoln-manual.html#dx1-10005" ><span class="underline">103</span></a> <br /></span> <span class="index-item"><span class="ec-lmss-10">pgfmath </span>package  <a -href="probsoln-manual.html#dx1-6023" >97</a> <br /></span> +href="probsoln-manual.html#dx1-7027" >104</a> <br /></span> <span class="index-item"><span class="ec-lmss-10">probsoln </span>package  <a -href="probsoln-manual.html#dx1-11001" >98</a> <br /></span> +href="probsoln-manual.html#dx1-12001" >105</a> <br /></span> +<span class="index-item"><span class="obeylines-h"><span class="verb"><span +class="ec-lmtt-10">\ProbSolnFragileExt</span></span></span>  <a +href="probsoln-manual.html#dx1-4002" ><span +class="ec-lmri-10">106</span></a> <br /></span> +<span class="index-item"><span class="obeylines-h"><span class="verb"><span +class="ec-lmtt-10">\ProbSolnFragileFile</span></span></span>  <a +href="probsoln-manual.html#dx1-4003" ><span +class="ec-lmri-10">107</span></a> <br /></span> <span class="index-item"><span class="obeylines-h"><span class="verb"><span class="ec-lmtt-10">\PSNgetrandseed</span></span></span>  <a -href="probsoln-manual.html#dx1-10005" ><span -class="ec-lmri-10">99</span></a> <br /></span> +href="probsoln-manual.html#dx1-11005" ><span +class="ec-lmri-10">108</span></a> <br /></span> <span class="index-item"><span class="obeylines-h"><span class="verb"><span class="ec-lmtt-10">\PSNrandom</span></span></span>  <a -href="probsoln-manual.html#dx1-10006" ><span -class="ec-lmri-10">100</span></a> <br /></span> +href="probsoln-manual.html#dx1-11006" ><span +class="ec-lmri-10">109</span></a> <br /></span> <span class="index-item"><span class="obeylines-h"><span class="verb"><span class="ec-lmtt-10">\PSNrandseed</span></span></span>  <a -href="probsoln-manual.html#dx1-10003" ><span -class="ec-lmri-10">101</span></a> <br /></span> +href="probsoln-manual.html#dx1-11003" ><span +class="ec-lmri-10">110</span></a> <br /></span> <span class="index-item"><span class="obeylines-h"><span class="verb"><span class="ec-lmtt-10">\PSNuseoldrandom</span></span></span>  <a -href="probsoln-manual.html#dx1-8007" ><span -class="ec-lmri-10">102</span></a>, <a -href="probsoln-manual.html#dx1-10002" ><span -class="ec-lmri-10">103</span></a> <br /></span> +href="probsoln-manual.html#dx1-9007" ><span +class="ec-lmri-10">111</span></a>, <a +href="probsoln-manual.html#dx1-11002" ><span +class="ec-lmri-10">112</span></a> <br /></span> </p><p class="theindex"> <span class="ec-lmbx-10">R</span> <span class="index-item"><span class="obeylines-h"><span class="verb"><span class="ec-lmtt-10">\random</span></span></span>  <a -href="probsoln-manual.html#dx1-10007" ><span -class="ec-lmri-10">104</span></a> <br /></span> +href="probsoln-manual.html#dx1-11007" ><span +class="ec-lmri-10">113</span></a> <br /></span> </p><p class="theindex"> <span class="ec-lmbx-10">S</span> <span class="index-item"><span class="obeylines-h"><span class="verb"><span class="ec-lmtt-10">\selectallproblems</span></span></span>  <a -href="probsoln-manual.html#dx1-11006" ><span -class="ec-lmri-10">105</span></a> <br /></span> +href="probsoln-manual.html#dx1-12006" ><span +class="ec-lmri-10">114</span></a> <br /></span> <span class="index-item"><span class="obeylines-h"><span class="verb"><span class="ec-lmtt-10">\selectrandomly</span></span></span>  <a -href="probsoln-manual.html#dx1-11004" ><span class="underline">106</span></a>, <a -href="probsoln-manual.html#dx1-11005" ><span -class="ec-lmri-10">107</span></a> <br /></span> +href="probsoln-manual.html#dx1-12004" ><span class="underline">115</span></a>, <a +href="probsoln-manual.html#dx1-12005" ><span +class="ec-lmri-10">116</span></a> <br /></span> +<span class="index-item"><span class="obeylines-h"><span class="verb"><span +class="ec-lmtt-10">\showanswers</span></span></span>  <a +href="probsoln-manual.html#dx1-5003" ><span +class="ec-lmri-10">117</span></a>, <a +href="probsoln-manual.html#dx1-7006" ><span class="underline">118</span></a>, <a +href="probsoln-manual.html#dx1-10010" ><span class="underline">119</span></a>, <a +href="probsoln-manual.html#dx1-10020" ><span class="underline">120</span></a> <br /></span> -<span class="index-item"><span class="obeylines-h"><span class="verb"><span -class="ec-lmtt-10">\showanswers</span></span></span>  <a -href="probsoln-manual.html#dx1-4003" ><span -class="ec-lmri-10">108</span></a>, <a -href="probsoln-manual.html#dx1-6006" ><span class="underline">109</span></a>, <a -href="probsoln-manual.html#dx1-9010" ><span class="underline">110</span></a>, <a -href="probsoln-manual.html#dx1-9020" ><span class="underline">111</span></a> <br /></span> <span class="index-item"><span class="ec-lmss-10">showanswers </span>boolean variable  <a -href="probsoln-manual.html#dx1-4005" >112</a>, <a -href="probsoln-manual.html#dx1-4016" >113</a>, <a -href="probsoln-manual.html#dx1-4017" >114</a>, <a -href="probsoln-manual.html#dx1-6005" >115</a> <br /></span> +href="probsoln-manual.html#dx1-5005" >121</a>, <a +href="probsoln-manual.html#dx1-5012" >122</a>, <a +href="probsoln-manual.html#dx1-5013" >123</a>, <a +href="probsoln-manual.html#dx1-7005" >124</a> <br /></span> <span class="index-item"><span class="ec-lmtt-10">solution </span>(environment)  <a -href="probsoln-manual.html#dx1-5001" ><span -class="ec-lmri-10">116</span></a>, <a -href="probsoln-manual.html#dx1-5004" ><span class="underline">117</span></a>, <a -href="probsoln-manual.html#dx1-5007" ><span class="underline">118</span></a> <br /></span> +href="probsoln-manual.html#dx1-6001" ><span +class="ec-lmri-10">125</span></a>, <a +href="probsoln-manual.html#dx1-6004" ><span class="underline">126</span></a>, <a +href="probsoln-manual.html#dx1-6007" ><span class="underline">127</span></a> <br /></span> <span class="index-item"><span class="obeylines-h"><span class="verb"><span class="ec-lmtt-10">\solutionname</span></span></span>  <a -href="probsoln-manual.html#dx1-5003" ><span -class="ec-lmri-10">119</span></a> <br /></span> +href="probsoln-manual.html#dx1-6003" ><span +class="ec-lmri-10">128</span></a> <br /></span> </p><p class="theindex"> <span class="ec-lmbx-10">T</span> <span class="index-item"><span class="ec-lmtt-10">textenum </span>(environment)  <a -href="probsoln-manual.html#dx1-5009" ><span -class="ec-lmri-10">120</span></a> <br /></span> +href="probsoln-manual.html#dx1-6009" ><span +class="ec-lmri-10">129</span></a> <br /></span> <span class="index-item"><span class="obeylines-h"><span class="verb"><span class="ec-lmtt-10">\theenumi</span></span></span>  <a -href="probsoln-manual.html#dx1-9023" ><span class="underline">121</span></a> <br /></span> +href="probsoln-manual.html#dx1-10023" ><span class="underline">130</span></a> <br /></span> <span class="index-item"><span class="obeylines-h"><span class="verb"><span class="ec-lmtt-10">\thisproblem</span></span></span>  <a -href="probsoln-manual.html#dx1-3006" ><span class="underline">122</span></a>, <a -href="probsoln-manual.html#dx1-3008" ><span class="underline">123</span></a>, <a -href="probsoln-manual.html#dx1-6018" ><span class="underline">124</span></a>, <a -href="probsoln-manual.html#dx1-9003" ><span -class="ec-lmri-10">125</span></a> <br /></span> +href="probsoln-manual.html#dx1-3006" ><span class="underline">131</span></a>, <a +href="probsoln-manual.html#dx1-3008" ><span class="underline">132</span></a>, <a +href="probsoln-manual.html#dx1-7022" ><span class="underline">133</span></a>, <a +href="probsoln-manual.html#dx1-10003" ><span +class="ec-lmri-10">134</span></a> <br /></span> <span class="index-item"><span class="obeylines-h"><span class="verb"><span class="ec-lmtt-10">\thisproblemlabel</span></span></span>  <a -href="probsoln-manual.html#dx1-9004" ><span -class="ec-lmri-10">126</span></a> <br /></span> +href="probsoln-manual.html#dx1-10004" ><span +class="ec-lmri-10">135</span></a> <br /></span> </p><p class="theindex"> <span class="ec-lmbx-10">U</span> <span class="index-item"><span class="obeylines-h"><span class="verb"><span class="ec-lmtt-10">\useproblem</span></span></span>  <a -href="probsoln-manual.html#dx1-7004" ><span -class="ec-lmri-10">127</span></a>, <a -href="probsoln-manual.html#dx1-9001" ><span class="underline">128</span></a>, <a -href="probsoln-manual.html#dx1-9006" ><span class="underline">129</span></a> <br /></span> +href="probsoln-manual.html#dx1-8004" ><span +class="ec-lmri-10">136</span></a>, <a +href="probsoln-manual.html#dx1-10001" ><span class="underline">137</span></a>, <a +href="probsoln-manual.html#dx1-10006" ><span class="underline">138</span></a> <br /></span> </p></div> - <div class="footnotes"><!--l. 623--><p class="indent" > <span class="footnote-mark"><a + <div class="footnotes"><!--l. 663--><p class="indent" > <span class="footnote-mark"><a href="#fn1x0-bk" id="fn1x0"><sup class="textsuperscript">1</sup></a></span><span class="ec-lmr-8">assuming you leave at least a minute between runs.</span></p> </div> diff --git a/Master/texmf-dist/doc/latex/probsoln/probsoln-manual.tex b/Master/texmf-dist/doc/latex/probsoln/probsoln-manual.tex index c7454082cc1..83f12ca68e6 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{1144} +\CheckSum{1484} \newcommand*{\dq}[1]{``#1''} @@ -24,7 +24,7 @@ \MakeShortVerb{"} \DeleteShortVerb{\|} - \title{probsoln v3.01: + \title{probsoln v3.02: 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-08-22} + \date{2011-12-10} \maketitle \tableofcontents @@ -66,6 +66,30 @@ default arguments supplied in the problem definition. problem arguments (default). \end{description} +\section{Verbatim}\label{sec:verbatim} + +As from version 3.02, problems and solutions may contain verbatim +text, but you must use the \iterm{fragile}\texttt{fragile} (or +\texttt{fragile=true}) option for the associated environments. + +Alternatively, if most of your problems contain verbatim, you can +globally set this option using: +\begin{verbatim} +\setkeys{probsoln}{fragile} +\end{verbatim} +You can switch off this option using \texttt{fragile=false}. + +The \texttt{fragile} option writes information to a temporary file. +This defaults to "\jobname.vrb" but the name may be changed. The +extension (".vrb") is given by: +\begin{definition}[\DescribeMacro{\ProbSolnFragileExt}] +\cs{ProbSolnFragileExt} +\end{definition} +The base name (\cs{jobname}) is given by: +\begin{definition}[\DescribeMacro{\ProbSolnFragileFile}] +\cs{ProbSolnFragileFile} +\end{definition} + \section{Showing and Hiding Solutions}\label{sec:showanswers} In addition to the \pkgopt{answers} and \pkgopt{noanswers} package @@ -93,8 +117,15 @@ Alternatively you can use \ics{ifshowanswers}\ldots\cs{else}\ldots Assignment 1\ifshowanswers\space (Solution Sheet)\fi \end{verbatim} -For longer passages, you can use the environments \DescribeEnv{onlyproblem}\env{onlyproblem} -and \DescribeEnv{onlysolution}\env{onlysolution}. For example: +For longer passages, you can use the environments +\begin{definition}[\DescribeEnv{onlyproblem}] +\cs{begin}\marg{onlyproblem}\oarg{option} +\end{definition} +and +\begin{definition}[\DescribeEnv{onlysolution}] +\cs{begin}\marg{onlysolution}\oarg{option} +\end{definition} +For example: \begin{verbatim} \begin{onlyproblem}% What is the derivative of $f(x) = x^2$? @@ -114,17 +145,19 @@ What is the derivative of $f(x) = x^2$? Solution: $f'(x) = 2x$ \end{onlysolution} \end{verbatim} + \begin{important} -You can't use verbatim text in the body of the -\envfmt{onlyproblem} or \envfmt{onlysolution} environments. -If you need verbatim-like text, then try packages such as -\sty{alltt}. Remember that you also can't use verbatim -text in command arguments. +If you want to include verbatim text in the body of +\env{onlyproblem} or \env{onlysolution}, you need to specify +\texttt{fragile} in the optional argument of the environment. +(See \sectionref{sec:verbatim} for further details.) \end{important} If you use \envfmt{onlysolution} within the \env{defproblem} environment, the problem will be tagged as having a solution and will be added to the list used by \ics{foreachsolution}. +The optional argument of \envfmt{onlysolution} (and \env{onlyproblem}) +is inherited from the parent \env{defproblem} setting. \section{General Formatting Commands}\label{sec:formatting} @@ -237,7 +270,7 @@ in a different location to the questions (for example in an appendix). \begin{definition}[\DescribeEnv{defproblem}] -\verb|\begin{defproblem}|\oarg{n}\oarg{default args}\marg{label}\newline +\verb|\begin{defproblem}|\oarg{n}\oarg{default args}\marg{label}\oarg{option}\newline \meta{definition}\newline \verb|\end{defproblem}| \end{definition} @@ -249,6 +282,14 @@ such as the colon (:) character. For example, the \sty{ngerman} and \sty{babel} packages make certain punctuation active. Check the relevant package documentation for details.) +\begin{important} +The final optional argument \meta{option} may be \texttt{fragile} to +indicate that the problem contains verbatim text. Any occurrences of +\env{onlyproblem} or \env{onlysolution} contained within +\envfmt{defproblem} are inherited from \envfmt{defproblem}. (See +\sectionref{sec:verbatim} for further details.) +\end{important} + If \env{defproblem} occurs in the document or is included via \ics{input} or \ics{include}, then the problem will be added to the default data set. If \envfmt{defproblem} occurs in an external @@ -356,10 +397,9 @@ This is a shortcut for: \end{ttfamily} \begin{important} -Verbatim text must not be used in the contents of \env{defproblem} -or in any of the arguments to \cs{newproblem} or -\cs{newproblem*}. If you need verbatim-like text consider using -\cs{texttt} or the \sty{alltt} package. +Note that you can't use verbatim text with \cs{newproblem} or +\cs{newproblem*}. Use the \env{defproblem} environment instead with +the \texttt{fragile option}. \end{important} \section{Using a Problem}\label{sec:useproblem} diff --git a/Master/texmf-dist/doc/latex/probsoln/probsoln.pdf b/Master/texmf-dist/doc/latex/probsoln/probsoln.pdf Binary files differindex 86b7d6baf6a..50eb3513ddf 100644 --- a/Master/texmf-dist/doc/latex/probsoln/probsoln.pdf +++ b/Master/texmf-dist/doc/latex/probsoln/probsoln.pdf diff --git a/Master/texmf-dist/doc/latex/probsoln/samples/sample.pdf b/Master/texmf-dist/doc/latex/probsoln/samples/sample.pdf Binary files differindex bd16cbf85ad..b5b7adf2538 100644 --- a/Master/texmf-dist/doc/latex/probsoln/samples/sample.pdf +++ b/Master/texmf-dist/doc/latex/probsoln/samples/sample.pdf diff --git a/Master/texmf-dist/doc/latex/probsoln/samples/sample.tex b/Master/texmf-dist/doc/latex/probsoln/samples/sample.tex index 6627c165ae4..8b927bd5588 100644 --- a/Master/texmf-dist/doc/latex/probsoln/samples/sample.tex +++ b/Master/texmf-dist/doc/latex/probsoln/samples/sample.tex @@ -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, 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. +%% 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. %% %% \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/sample2.pdf b/Master/texmf-dist/doc/latex/probsoln/samples/sample2.pdf Binary files differindex dc760dd57ad..545b648d531 100644 --- a/Master/texmf-dist/doc/latex/probsoln/samples/sample2.pdf +++ b/Master/texmf-dist/doc/latex/probsoln/samples/sample2.pdf diff --git a/Master/texmf-dist/doc/latex/probsoln/samples/sample2.tex b/Master/texmf-dist/doc/latex/probsoln/samples/sample2.tex index 8054e753e8d..57580107254 100644 --- a/Master/texmf-dist/doc/latex/probsoln/samples/sample2.tex +++ b/Master/texmf-dist/doc/latex/probsoln/samples/sample2.tex @@ -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, 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. +%% 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. %% %% \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 Binary files differindex 91812c4451a..2a4bdd77839 100644 --- a/Master/texmf-dist/doc/latex/probsoln/samples/sample3.pdf +++ b/Master/texmf-dist/doc/latex/probsoln/samples/sample3.pdf diff --git a/Master/texmf-dist/doc/latex/probsoln/samples/sample3.tex b/Master/texmf-dist/doc/latex/probsoln/samples/sample3.tex index f5020372ce4..e10158ae4db 100644 --- a/Master/texmf-dist/doc/latex/probsoln/samples/sample3.tex +++ b/Master/texmf-dist/doc/latex/probsoln/samples/sample3.tex @@ -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, 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. +%% 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. %% %% \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 Binary files differindex c454080cde7..3abaeb7843e 100644 --- a/Master/texmf-dist/doc/latex/probsoln/samples/sample4.pdf +++ b/Master/texmf-dist/doc/latex/probsoln/samples/sample4.pdf diff --git a/Master/texmf-dist/doc/latex/probsoln/samples/sample4.tex b/Master/texmf-dist/doc/latex/probsoln/samples/sample4.tex index 46456dc0590..8d0355a2f2b 100644 --- a/Master/texmf-dist/doc/latex/probsoln/samples/sample4.tex +++ b/Master/texmf-dist/doc/latex/probsoln/samples/sample4.tex @@ -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, 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. +%% 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. %% %% \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 Binary files differindex 0b18bf6d483..e8b50cfa542 100644 --- a/Master/texmf-dist/doc/latex/probsoln/samples/sample5.pdf +++ b/Master/texmf-dist/doc/latex/probsoln/samples/sample5.pdf diff --git a/Master/texmf-dist/doc/latex/probsoln/samples/sample5.tex b/Master/texmf-dist/doc/latex/probsoln/samples/sample5.tex index 5ad29c56fb0..fd31bef8d66 100644 --- a/Master/texmf-dist/doc/latex/probsoln/samples/sample5.tex +++ b/Master/texmf-dist/doc/latex/probsoln/samples/sample5.tex @@ -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, 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. +%% 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. %% %% \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 6719c02088f..1edcbaad89b 100644 --- a/Master/texmf-dist/doc/latex/probsoln/samples/sample6.tex +++ b/Master/texmf-dist/doc/latex/probsoln/samples/sample6.tex @@ -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, 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. +%% 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. %% %% \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 8bf5b5ecc67..5b1997c8f39 100644 --- a/Master/texmf-dist/doc/latex/probsoln/samples/sample7.tex +++ b/Master/texmf-dist/doc/latex/probsoln/samples/sample7.tex @@ -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, 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. +%% 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. %% %% \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 new file mode 100644 index 00000000000..d52549da9eb --- /dev/null +++ b/Master/texmf-dist/doc/latex/probsoln/samples/sample8.tex @@ -0,0 +1,66 @@ +%% +%% This is file `sample8.tex', +%% generated with the docstrip utility. +%% +%% The original source files were: +%% +%% probsoln.dtx (with options: `sample8.tex,package') +%% +%% probsoln.dtx +%% Copyright 2011 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.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 +\documentclass{article} + +\usepackage{listings} +\usepackage{probsoln} + +\setkeys{probsoln}{fragile} + +\loadallproblems{prob-verb} + +\showanswers +\begin{document} +\begin{enumerate} + \foreachproblem{\item \thisproblem} +\end{enumerate} +\end{document} +\endinput +%% +%% End of file `sample8.tex'. diff --git a/Master/texmf-dist/source/latex/probsoln/probsoln.dtx b/Master/texmf-dist/source/latex/probsoln/probsoln.dtx index 1baeb9789e3..9515bfe3a4a 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/8/22 22:10 +% Created on 2011/12/10 17:17 %\fi %\iffalse %<*package> @@ -54,7 +54,7 @@ \RecordChanges \PageIndex -\CheckSum{1144} +\CheckSum{1484} \newcommand*{\dq}[1]{``#1''} @@ -66,7 +66,7 @@ %\MakeShortVerb{"} %\DeleteShortVerb{\|} % -% \title{probsoln v3.01: +% \title{probsoln v3.02: %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-08-22} +% \date{2011-12-10} % \maketitle %\tableofcontents % @@ -108,6 +108,30 @@ %problem arguments (default). %\end{description} % +%\section{Verbatim}\label{sec:verbatim} +% +%As from version 3.02, problems and solutions may contain verbatim +%text, but you must use the \iterm{fragile}\texttt{fragile} (or +%\texttt{fragile=true}) option for the associated environments. +% +%Alternatively, if most of your problems contain verbatim, you can +%globally set this option using: +%\begin{verbatim} +%\setkeys{probsoln}{fragile} +%\end{verbatim} +%You can switch off this option using \texttt{fragile=false}. +% +%The \texttt{fragile} option writes information to a temporary file. +%This defaults to "\jobname.vrb" but the name may be changed. The +%extension (".vrb") is given by: +%\begin{definition}[\DescribeMacro{\ProbSolnFragileExt}] +%\cs{ProbSolnFragileExt} +%\end{definition} +%The base name (\cs{jobname}) is given by: +%\begin{definition}[\DescribeMacro{\ProbSolnFragileFile}] +%\cs{ProbSolnFragileFile} +%\end{definition} +% %\section{Showing and Hiding Solutions}\label{sec:showanswers} % %In addition to the \pkgopt{answers} and \pkgopt{noanswers} package @@ -135,8 +159,15 @@ %Assignment 1\ifshowanswers\space (Solution Sheet)\fi %\end{verbatim} % -%For longer passages, you can use the environments \DescribeEnv{onlyproblem}\env{onlyproblem} -%and \DescribeEnv{onlysolution}\env{onlysolution}. For example: +%For longer passages, you can use the environments +%\begin{definition}[\DescribeEnv{onlyproblem}] +%\cs{begin}\marg{onlyproblem}\oarg{option} +%\end{definition} +%and +%\begin{definition}[\DescribeEnv{onlysolution}] +%\cs{begin}\marg{onlysolution}\oarg{option} +%\end{definition} +%For example: %\begin{verbatim} %\begin{onlyproblem}% %What is the derivative of $f(x) = x^2$? @@ -156,17 +187,19 @@ %Solution: $f'(x) = 2x$ %\end{onlysolution} %\end{verbatim} +% %\begin{important} -%You can't use verbatim text in the body of the -%\envfmt{onlyproblem} or \envfmt{onlysolution} environments. -%If you need verbatim-like text, then try packages such as -%\sty{alltt}. Remember that you also can't use verbatim -%text in command arguments. +%If you want to include verbatim text in the body of +%\env{onlyproblem} or \env{onlysolution}, you need to specify +%\texttt{fragile} in the optional argument of the environment. +%(See \sectionref{sec:verbatim} for further details.) %\end{important} % %If you use \envfmt{onlysolution} within the \env{defproblem} %environment, the problem will be tagged as having a solution %and will be added to the list used by \ics{foreachsolution}. +%The optional argument of \envfmt{onlysolution} (and \env{onlyproblem}) +%is inherited from the parent \env{defproblem} setting. % %\section{General Formatting Commands}\label{sec:formatting} % @@ -279,7 +312,7 @@ %appendix). % %\begin{definition}[\DescribeEnv{defproblem}] -%\verb|\begin{defproblem}|\oarg{n}\oarg{default args}\marg{label}\newline +%\verb|\begin{defproblem}|\oarg{n}\oarg{default args}\marg{label}\oarg{option}\newline %\meta{definition}\newline %\verb|\end{defproblem}| %\end{definition} @@ -291,6 +324,14 @@ %\sty{babel} packages make certain punctuation active. Check the %relevant package documentation for details.) % +%\begin{important} +%The final optional argument \meta{option} may be \texttt{fragile} to +%indicate that the problem contains verbatim text. Any occurrences of +%\env{onlyproblem} or \env{onlysolution} contained within +%\envfmt{defproblem} are inherited from \envfmt{defproblem}. (See +%\sectionref{sec:verbatim} for further details.) +%\end{important} +% %If \env{defproblem} occurs in the document or is included via %\ics{input} or \ics{include}, then the problem will be added to %the default data set. If \envfmt{defproblem} occurs in an external @@ -398,10 +439,9 @@ %\end{ttfamily} % %\begin{important} -%Verbatim text must not be used in the contents of \env{defproblem} -%or in any of the arguments to \cs{newproblem} or -%\cs{newproblem*}. If you need verbatim-like text consider using -%\cs{texttt} or the \sty{alltt} package. +%Note that you can't use verbatim text with \cs{newproblem} or +%\cs{newproblem*}. Use the \env{defproblem} environment instead with +%the \texttt{fragile option}. %\end{important} % %\section{Using a Problem}\label{sec:useproblem} @@ -814,10 +854,10 @@ % \end{macrocode} % Identify this package and version: % \begin{macrocode} -\ProvidesPackage{probsoln}[2011/08/22 v3.01 (NLCT)] +\ProvidesPackage{probsoln}[2011/12/10 v3.02 (NLCT)] % \end{macrocode} % Required packages: -%\changes{2011/08/22}{3.01}{substr package no longer required} +%\changes{3.01}{2011/08/22}{substr package no longer required} % \begin{macrocode} \RequirePackage{ifthen} \RequirePackage{amsmath} @@ -903,6 +943,42 @@ % \begin{macrocode} \ProcessOptions % \end{macrocode} +%\changes{3.02}{2011/12/10}{added xkeyval to required package list} +% \begin{macrocode} +\RequirePackage{xkeyval} +% \end{macrocode} +%\begin{macro}{\if@prob@fragile} +%\changes{3.02}{2011/12/10}{new} +%Need a conditional to determine whether \cs{long@collect@body} +%needs to be aware of verbatim contents. +% \begin{macrocode} +\define@boolkey{probsoln}[@prob@]{fragile}[true]{} +% \end{macrocode} +%\end{macro} +%\begin{macro}{\ProbSolnFragileExt} +%\changes{3.02}{2011/12/10}{new} +% The extension used for temporary files dealing with fragile +% contents. +% \begin{macrocode} +\newcommand*{\ProbSolnFragileExt}{vrb} +% \end{macrocode} +%\end{macro} +%\begin{macro}{\ProbSolnFragileFile} +%\changes{3.02}{2011/12/10}{new} +% The filename used for temporary files dealing with fragile +% contents. +% \begin{macrocode} +\newcommand*{\ProbSolnFragileFile}{\jobname} +% \end{macrocode} +%\end{macro} +%\begin{macro}{\probsoln@write} +%\changes{3.02}{2011/12/10}{new} +%File handle for temporary files. +% \begin{macrocode} +\newwrite\probsoln@write +% \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} @@ -1044,7 +1120,7 @@ % %\subsection{Defining New Problems} %\begin{macro}{\prob@newproblem} -%\changes{2011/08/22}{3.01}{added extra argument to supply defaults} +%\changes{3.01}{2011/08/22}{added extra argument to supply defaults} %\begin{definition} %\cs{prob@newproblem}\marg{n}\marg{db %name}\marg{label}\marg{definition}\marg{default args} @@ -1180,6 +1256,11 @@ Please specify (e.g. \csname @prob@getargs@eg@\romannumeral#1\endcsname):}% \edef\process@envbody{\the\@envbody\@nx\end{\@currenvir}}% \@envbody\@emptytoks \def\begin@stack{b}% \begingroup + \if@prob@fragile + \obeylines\obeyspaces + \@makeother\# + \@makeother\% + \fi \@xp\let\csname\@currenvir\endcsname\long@collect@@body \edef\process@envbody{\@xp\@nx\csname\@currenvir\endcsname}% \process@envbody @@ -1187,7 +1268,7 @@ Please specify (e.g. \csname @prob@getargs@eg@\romannumeral#1\endcsname):}% % \end{macrocode} %\end{macro} %\begin{macro}{\long@addto@envbody} -%\changes{2011/08/22}{3.01}{modified to allow for floats in the body of the +%\changes{3.01}{2011/08/22}{modified to allow for floats in the body of the %environment} % \begin{macrocode} \long\def\long@addto@envbody#1{% @@ -1201,7 +1282,7 @@ Please specify (e.g. \csname @prob@getargs@eg@\romannumeral#1\endcsname):}% % \begin{macrocode} \long\def\long@collect@@body#1\end#2{% % \end{macrocode} -%\changes{2011/08/22}{3.01}{changed \cs{edef} to \cs{protected@edef}} +%\changes{3.01}{2011/08/22}{changed \cs{edef} to \cs{protected@edef}} % \begin{macrocode} \protected@edef\begin@stack{% \long@push@begins#1\begin\end \@xp\@gobble\begin@stack @@ -1225,10 +1306,123 @@ Please specify (e.g. \csname @prob@getargs@eg@\romannumeral#1\endcsname):}% % \end{macrocode} %\end{macro} % +% Fragile contents are sanitized, written to file and read back in. +% However, we don't want the new line character sanitized. Also, +% the \env{verbatim} environment doesn't like a space after +% \cs{begin} or \cs{end}, so these need to be replaced. +%\begin{macro}{\@char@M} +%\changes{3.02}{2011/12/10}{new} +% First define a macro that contains the +% newline marker: +% \begin{macrocode} +{\obeylines + \gdef\@char@M{^^M}% +} +\@onelevel@sanitize\@char@M +% \end{macrocode} +%\end{macro} +% +%\begin{macro}{\@beg@env@string} +%\changes{3.02}{2011/12/10}{new} +% Define a macro that contains the begin environment marker: +% \begin{macrocode} +\def\@beg@env@string{\begin} +\@onelevel@sanitize\@beg@env@string +% \end{macrocode} +%\end{macro} +%\begin{macro}{\@end@env@string} +%\changes{3.02}{2011/12/10}{new} +% Define a macro that contains the end environment marker: +% \begin{macrocode} +\def\@end@env@string{\end} +\@onelevel@sanitize\@end@env@string +% \end{macrocode} +%\end{macro} +% +%\begin{macro}{\def@replace@markers} +%\changes{3.02}{2011/12/10}{new} +% Things start to get a bit complicated here. The substitution +% macros need the markers as part of their definition. The easiest +% way to do this is to define a command (using \cs{edef}) that defines the +% substitution macros. The markers and replacements are the only +% things to be expanded. +% \begin{macrocode} +\edef\def@replace@markers{% +% \end{macrocode} +% First define the command that replaces the newline marker: +% \begin{macrocode} + \noexpand\def\noexpand\do@replace@charM##1\@char@M##2\noexpand\end@replace@marker{% + \noexpand\expandafter\noexpand\toks@\noexpand\expandafter{\noexpand\replace@text}% + \noexpand\ifx\noexpand\relax##2\noexpand\relax + \noexpand\edef\noexpand\replace@text{\noexpand\the\noexpand\toks@##1}% + \noexpand\let\noexpand\do@replacenext\noexpand\replace@mark@noop + \noexpand\else + \noexpand\edef\noexpand\replace@text{\noexpand\the\noexpand\toks@##1^^J}% + \noexpand\let\noexpand\do@replacenext\noexpand\do@replace@charM + \noexpand\fi + \noexpand\do@replacenext##2\noexpand\end@replace@marker + }% +% \end{macrocode} +% Next define the command that replaces the begin environment marker: +% \begin{macrocode} + \noexpand\def\noexpand\doreplace@begverb##1\@beg@env@string##2\noexpand\end@replace@marker{% + \noexpand\expandafter\noexpand\toks@\noexpand\expandafter{\noexpand\replace@text}% + \noexpand\ifx\noexpand\relax##2\noexpand\relax + \noexpand\edef\noexpand\replace@text{\noexpand\the\noexpand\toks@##1}% + \noexpand\let\noexpand\do@replacenext\noexpand\replace@mark@noop + \noexpand\else + \noexpand\edef\noexpand\replace@text{\noexpand\the\noexpand\toks@ + ##1\expandafter\@gobble\string\\begin}% + \noexpand\let\noexpand\do@replacenext\noexpand\doreplace@begverb + \noexpand\fi + \noexpand\do@replacenext##2\noexpand\end@replace@marker + }% +% \end{macrocode} +% Next define the command that replaces the end environment marker: +% \begin{macrocode} + \noexpand\def\noexpand\doreplace@endverb##1\@end@env@string##2\noexpand\end@replace@marker{% + \noexpand\expandafter\noexpand\toks@\noexpand\expandafter{\noexpand\replace@text}% + \noexpand\ifx\noexpand\relax##2\noexpand\relax + \noexpand\edef\noexpand\replace@text{\noexpand\the\noexpand\toks@##1}% + \noexpand\let\noexpand\do@replacenext\noexpand\replace@mark@noop + \noexpand\else + \noexpand\edef\noexpand\replace@text{\noexpand\the\noexpand\toks@ + ##1\expandafter\@gobble\string\\end}% + \noexpand\let\noexpand\do@replacenext\noexpand\doreplace@endverb + \noexpand\fi + \noexpand\do@replacenext##2\noexpand\end@replace@marker + }% +% \end{macrocode} +% Finally, define a higher-level command that calls all three of the above: +% \begin{macrocode} + \noexpand\def\noexpand\replace@markers##1{% + \noexpand\def\noexpand\replace@text{}% + \noexpand\expandafter\noexpand\do@replace@charM##1\@char@M\relax\noexpand\end@replace@marker + \noexpand\let##1\noexpand\replace@text + \noexpand\def\noexpand\replace@text{}% + \noexpand\expandafter\noexpand\doreplace@begverb##1\@beg@env@string\relax\noexpand\end@replace@marker + \noexpand\let##1\noexpand\replace@text + \noexpand\def\noexpand\replace@text{}% + \noexpand\expandafter\noexpand\doreplace@endverb##1\@end@env@string\relax\noexpand\end@replace@marker + \noexpand\let##1\noexpand\replace@text + } +} +% \end{macrocode} +% Define the substitution loop terminator: +% \begin{macrocode} +\def\replace@mark@noop#1\end@replace@marker{} +% \end{macrocode} +% Now define all the marker substitution macros: +% \begin{macrocode} +\def@replace@markers +% \end{macrocode} +%\end{macro} +% %\begin{environment}{defproblem} -%\changes{2011/08/22}{3.01}{added second optional argument} +%\changes{3.01}{2011/08/22}{added second optional argument} +%\changes{3.02}{2011/12/11}{added key-val optional argument} %\begin{definition} -%"\begin{defproblem}"\oarg{n}\oarg{default args}\marg{label} +%"\begin{defproblem}"\oarg{n}\oarg{default args}\marg{label}\oarg{key-val options} %\end{definition} % Define a new problem identified by \meta{label} with % \meta{n} arguments to add to the current data base. Note that @@ -1239,10 +1433,19 @@ Please specify (e.g. \csname @prob@getargs@eg@\romannumeral#1\endcsname):}% \edef\@prob@currentargN{\number0#1}% \@defproblem@beginenv }{} - +% \end{macrocode} +% Gather second optional argument and mandatory argument: +% \begin{macrocode} \newcommand*{\@defproblem@beginenv}[2][]{% \def\@prob@currentdefaultargs{#1}% \def\@prob@currentlabel{#2}% + \@defproblem@beginenv@ +} +% \end{macrocode} +% Get final optional argument and process +% \begin{macrocode} +\newcommand*{\@defproblem@beginenv@}[1][]{% + \setkeys{probsoln}{#1}% \long@collect@body\prob@do@defproblem } % \end{macrocode} @@ -1257,8 +1460,32 @@ Please specify (e.g. \csname @prob@getargs@eg@\romannumeral#1\endcsname):}% % is given by \cs{prob@currentdb}. % \begin{macrocode} \newcommand{\prob@do@newproblem}[1]{% - \prob@newproblem\@prob@currentargN\prob@currentdb - \@prob@currentlabel{#1}{\@prob@currentdefaultargs}} + \if@prob@fragile + \probsoln@process@fragile{#1}% + \protected@edef\do@def@new@problem{% + \noexpand\prob@newproblem + {\@prob@currentargN}% + {\prob@currentdb}% + {\@prob@currentlabel}% + {% + \noexpand\probsoln@write@tmp{\@prob@tmp@problem}% + \noexpand\probsoln@read@tmp + }% + {\@prob@currentdefaultargs}% + }% + \else + \toks@{#1}% + \protected@edef\do@def@new@problem{% + \noexpand\prob@newproblem + {\@prob@currentargN}% + {\prob@currentdb}% + {\@prob@currentlabel}% + {\the\toks@}% + {\@prob@currentdefaultargs}% + }% + \fi + \do@def@new@problem +} % \end{macrocode} %\end{macro} % @@ -1274,16 +1501,18 @@ Please specify (e.g. \csname @prob@getargs@eg@\romannumeral#1\endcsname):}% % Define an environment that only displays its contents if the % solutions should be displayed. % \begin{macrocode} -\newenvironment{onlysolution}{% +\newenvironment{onlysolution}[1][]{% + \setkeys{probsoln}{#1}% \long@collect@body\do@onlysolution }{} % \end{macrocode} %\end{environment} %\begin{macro}{\do@onlysolution} +%\changes{3.02}{2011/12/10}{added \cs{probsoln@do@body}} % \begin{macrocode} \newcommand{\do@onlysolution}[1]{% \ifshowanswers - #1% + \probsoln@do@body{#1}% \fi % \end{macrocode} % Add to the list of solutions @@ -1302,7 +1531,7 @@ Please specify (e.g. \csname @prob@getargs@eg@\romannumeral#1\endcsname):}% %\end{macro} % %\begin{macro}{\psn@add@unique@label} -%\changes{2011/08/22}{3.01}{new} +%\changes{3.01}{2011/08/22}{new} %\begin{definition} %\cs{psn@add@unique@label}\marg{list cs}\marg{label} %\end{definition} @@ -1325,7 +1554,7 @@ Please specify (e.g. \csname @prob@getargs@eg@\romannumeral#1\endcsname):}% % This is defined in \sty{datatool}, but there's no sense loading % the entire package just for this, so define if not already % defined. -%\changes{2011/08/22}{3.01}{new} +%\changes{3.01}{2011/08/22}{new} % \begin{macrocode} \providecommand{\DTLifinlist}[4]{% \def\@dtl@doifinlist##1,#1,##2\end@dtl@doifinlist{% @@ -1348,19 +1577,75 @@ Please specify (e.g. \csname @prob@getargs@eg@\romannumeral#1\endcsname):}% %\begin{environment}{onlyproblem} % Define an environment that only displays its contents if the % solutions should not be displayed. +%\changes{3.02}{2011/12/10}{added optional argument.} % \begin{macrocode} -\newenvironment{onlyproblem}{% +\newenvironment{onlyproblem}[1][]{% + \setkeys{probsoln}{#1}% \long@collect@body\do@onlyproblem }{} % \end{macrocode} %\end{environment} %\begin{macro}{\do@onlyproblem} +%\changes{3.02}{2011/12/10}{added \cs{probsoln@do@body}} % \begin{macrocode} \newcommand{\do@onlyproblem}[1]{% -\ifshowanswers -\else - #1% -\fi} + \ifshowanswers + \else + \probsoln@do@body{#1}% + \fi +} +% \end{macrocode} +%\end{macro} +% +%\begin{macro}{\probsoln@do@body} +% Either does argument or sanitizes, writes and reads. +%\changes{3.02}{2011/12/10}{new} +% \begin{macrocode} +\newcommand{\probsoln@do@body}[1]{% + \if@prob@fragile + \probsoln@process@fragile{#1}% + \probsoln@write@tmp{\@prob@tmp@problem}% + \probsoln@read@tmp + \else + #1% + \fi +} +% \end{macrocode} +%\end{macro} +% +%\begin{macro}{\probsoln@process@fragile} +% Sanitizes and replaces markers. Result stored in +% \cs{@prob@tmp@problem} +%\changes{3.02}{2011/12/10}{new} +% \begin{macrocode} +\newcommand{\probsoln@process@fragile}[1]{% + \def\@prob@tmp@problem{#1}% + \@onelevel@sanitize\@prob@tmp@problem + \replace@markers\@prob@tmp@problem +} +% \end{macrocode} +%\end{macro} +% +%\begin{macro}{\probsoln@write@tmp} +%\changes{3.02}{2011/12/10}{new} +% Writes argument to temporary file (including opening and closing +% file.) +% \begin{macrocode} +\newcommand{\probsoln@write@tmp}[1]{% + \immediate\openout\probsoln@write=\ProbSolnFragileFile.\ProbSolnFragileExt + \immediate\write\probsoln@write{#1}% + \immediate\closeout\probsoln@write +} +% \end{macrocode} +%\end{macro} +% +%\begin{macro}{\probsoln@read@tmp} +%\changes{3.02}{2011/12/10}{new} +% Inputs temporary file. +% \begin{macrocode} +\newcommand{\probsoln@read@tmp}{% + \input{\ProbSolnFragileFile.\ProbSolnFragileExt}% +} % \end{macrocode} %\end{macro} % @@ -1374,7 +1659,7 @@ Please specify (e.g. \csname @prob@getargs@eg@\romannumeral#1\endcsname):}% % \meta{db name} where \meta{arg1}\ldots\meta{argN} are the % arguments to pass to the problem, if the problem was defined % to take arguments. -%\changes{2011/08/22}{3.01}{changed \cs{@next} to \cs{@useprob@next}} +%\changes{3.01}{2011/08/22}{changed \cs{@next} to \cs{@useprob@next}} % \begin{macrocode} \newcommand{\useproblem}[2][default]{% \def\@prob@currentlabel{#2}% @@ -1415,7 +1700,7 @@ Please specify (e.g. \csname @prob@getargs@eg@\romannumeral#1\endcsname):}% % Only define problem if the label is listed in % \cs{prob@selectedlabels}. (The current label is % given by \cs{@prob@currentlabel}.) -%\changes{2011/08/22}{3.01}{replaced \cs{IFSubStringInString} with +%\changes{3.01}{2011/08/22}{replaced \cs{IFSubStringInString} with %\cs{DTLifinlist}} % \begin{macrocode} \newcommand{\prob@do@selectedproblem}[1]{% @@ -1468,7 +1753,7 @@ Please specify (e.g. \csname @prob@getargs@eg@\romannumeral#1\endcsname):}% %\end{definition} % Loads only those problems whose labels are not listed in % \meta{list}. -%\changes{2011/08/22}{3.01}{new} +%\changes{3.01}{2011/08/22}{new} % \begin{macrocode} \newcommand{\loadexceptproblems}[3][default]{% \bgroup @@ -1562,7 +1847,7 @@ Please specify (e.g. \csname @prob@getargs@eg@\romannumeral#1\endcsname):}% \shuffle{@prob@tmp@}{\@probselN}% \ifnum\@probselN<#2\relax % \end{macrocode} -%\changes{2011/08/22}{3.01}{changed error to warning} +%\changes{3.01}{2011/08/22}{changed error to warning} % \begin{macrocode} \PackageWarning{probsoln}{You have requested \number#2\space\space problem(s) but `#3' only contains @@ -1888,7 +2173,7 @@ Please specify (e.g. \csname @prob@getargs@eg@\romannumeral#1\endcsname):}% % These commands ensure that this version is compatible with % versions prior to v3.0 %\begin{macro}{\newproblem} -%\changes{2011/08/22}{3.01}{added second optional argument} +%\changes{3.01}{2011/08/22}{added second optional argument} % Defines a new problem. % \begin{macrocode} \newcommand*{\newproblem}{\@ifstar\@snewproblem\@newproblem} @@ -1962,7 +2247,7 @@ Please specify (e.g. \csname @prob@getargs@eg@\romannumeral#1\endcsname):}% % These commands are provided to format parts of the % problems/solutions. %\begin{environment}{solution} -%\changes{2011/08/22}{3.01}{added space after solution tag} +%\changes{3.01}{2011/08/22}{added space after solution tag} % \begin{macrocode} \@ifundefined{solution}{% \newenvironment{solution}{\par\noindent\textbf{\solutionname:}\space @@ -2395,6 +2680,35 @@ Differentiate the following functions: %\fi %\iffalse % \begin{macrocode} +%<*sample8.tex> +% \end{macrocode} +%\fi +%\iffalse +% \begin{macrocode} +\documentclass{article} + +\usepackage{listings} +\usepackage{probsoln} + +\setkeys{probsoln}{fragile} + +\loadallproblems{prob-verb} + +\showanswers +\begin{document} +\begin{enumerate} + \foreachproblem{\item \thisproblem} +\end{enumerate} +\end{document} +% \end{macrocode} +%\fi +%\iffalse +% \begin{macrocode} +%</sample8.tex> +% \end{macrocode} +%\fi +%\iffalse +% \begin{macrocode} %<*prob-1stprncp.tex> % \end{macrocode} %\fi @@ -2955,8 +3269,8 @@ $P(a_2)=\frac{1}{4}$ \end{onlysolution} \end{defproblem} -\begin{defproblem}{digraph}\label{ex:digraph} - \begin{onlyproblem} +\begin{defproblem}{digraph} + \begin{onlyproblem}\label{ex:digraph} Identify, if any, the sinks and sources of the digraph shown in Figure~\ref{fig:digraph}. \begin{figure}[tbh] @@ -3185,5 +3499,47 @@ What is $-1+2\times3$? & %</prob-tabmchoice.tex> % \end{macrocode} %\fi +%\iffalse +% \begin{macrocode} +%<*prob-verb.tex> +% \end{macrocode} +%\fi +%\iffalse +% \begin{macrocode} +\begin{defproblem}{code-helloworld} +This problem has a code fragment. +\begin{onlyproblem} +\lstset{language=Java} +\begin{lstlisting} +public class HelloWorld +{ + public static void main(String[] args) + { + System.out.println("Hello World!"); + } +} +\end{lstlisting} +\end{onlyproblem} +\begin{onlysolution} +\lstset{language=Java} +\begin{lstlisting} +public class HelloWorld +{ + public static void main(String[] args) + { + System.out.println("Hello " + + (args.length==0 ? "anon" : args[0])+"!"); + } +} +\end{lstlisting} +\end{onlysolution} +\end{defproblem} +% \end{macrocode} +%\fi +%\iffalse +% \begin{macrocode} +%</prob-verb.tex> +% \end{macrocode} +%\fi %\Finale \endinput diff --git a/Master/texmf-dist/source/latex/probsoln/probsoln.ins b/Master/texmf-dist/source/latex/probsoln/probsoln.ins index 4b5315b74ca..20afb0ffb88 100644 --- a/Master/texmf-dist/source/latex/probsoln/probsoln.ins +++ b/Master/texmf-dist/source/latex/probsoln/probsoln.ins @@ -1,4 +1,4 @@ -% probsoln.ins generated using makedtx version 0.94b 2011/8/22 22:10 +% probsoln.ins generated using makedtx version 0.94b 2011/12/10 17:17 \input docstrip \preamble @@ -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, 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. + 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. \endpreamble @@ -40,6 +40,8 @@ \usepostamble\defaultpostamble\from{probsoln.dtx}{sample6.tex,package}} \file{sample7.tex}{\usepreamble\defaultpreamble \usepostamble\defaultpostamble\from{probsoln.dtx}{sample7.tex,package}} +\file{sample8.tex}{\usepreamble\defaultpreamble +\usepostamble\defaultpostamble\from{probsoln.dtx}{sample8.tex,package}} \file{prob-1stprncp.tex}{\usepreamble\defaultpreamble \usepostamble\defaultpostamble\from{probsoln.dtx}{prob-1stprncp.tex,package}} \file{prob-args.tex}{\usepreamble\defaultpreamble @@ -64,6 +66,8 @@ \usepostamble\defaultpostamble\from{probsoln.dtx}{prob-probspaces2.tex,package}} \file{prob-tabmchoice.tex}{\usepreamble\defaultpreamble \usepostamble\defaultpostamble\from{probsoln.dtx}{prob-tabmchoice.tex,package}} +\file{prob-verb.tex}{\usepreamble\defaultpreamble +\usepostamble\defaultpostamble\from{probsoln.dtx}{prob-verb.tex,package}} } \endbatchfile diff --git a/Master/texmf-dist/tex/latex/probsoln/probsoln.sty b/Master/texmf-dist/tex/latex/probsoln/probsoln.sty index 365b1075773..8144c5e1c22 100644 --- a/Master/texmf-dist/tex/latex/probsoln/probsoln.sty +++ b/Master/texmf-dist/tex/latex/probsoln/probsoln.sty @@ -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, 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. +%% 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. %% %% \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,7 +47,7 @@ %% Display the problems %% You may need to change \theenumi back here \NeedsTeXFormat{LaTeX2e} -\ProvidesPackage{probsoln}[2011/08/22 v3.01 (NLCT)] +\ProvidesPackage{probsoln}[2011/12/10 v3.02 (NLCT)] \RequirePackage{ifthen} \RequirePackage{amsmath} \newif\ifshowanswers @@ -67,6 +67,11 @@ \DeclareOption{final}{% \renewcommand*{\prob@showdraftlabel}[2]{}} \ProcessOptions +\RequirePackage{xkeyval} +\define@boolkey{probsoln}[@prob@]{fragile}[true]{} +\newcommand*{\ProbSolnFragileExt}{vrb} +\newcommand*{\ProbSolnFragileFile}{\jobname} +\newwrite\probsoln@write \newcommand*{\prob@db@default}{} \newcommand*{\prob@databases}{default} \newcommand*{\prob@db@default@solutions}{} @@ -191,6 +196,11 @@ Please specify (e.g. \csname @prob@getargs@eg@\romannumeral#1\endcsname):}% \edef\process@envbody{\the\@envbody\@nx\end{\@currenvir}}% \@envbody\@emptytoks \def\begin@stack{b}% \begingroup + \if@prob@fragile + \obeylines\obeyspaces + \@makeother\# + \@makeother\% + \fi \@xp\let\csname\@currenvir\endcsname\long@collect@@body \edef\process@envbody{\@xp\@nx\csname\@currenvir\endcsname}% \process@envbody @@ -216,26 +226,112 @@ Please specify (e.g. \csname @prob@getargs@eg@\romannumeral#1\endcsname):}% \long\def\long@push@begins#1\begin#2{% \ifx\end#2\else b\@xp\long@push@begins\fi } +{\obeylines + \gdef\@char@M{^^M}% +} +\@onelevel@sanitize\@char@M +\def\@beg@env@string{\begin} +\@onelevel@sanitize\@beg@env@string +\def\@end@env@string{\end} +\@onelevel@sanitize\@end@env@string +\edef\def@replace@markers{% + \noexpand\def\noexpand\do@replace@charM##1\@char@M##2\noexpand\end@replace@marker{% + \noexpand\expandafter\noexpand\toks@\noexpand\expandafter{\noexpand\replace@text}% + \noexpand\ifx\noexpand\relax##2\noexpand\relax + \noexpand\edef\noexpand\replace@text{\noexpand\the\noexpand\toks@##1}% + \noexpand\let\noexpand\do@replacenext\noexpand\replace@mark@noop + \noexpand\else + \noexpand\edef\noexpand\replace@text{\noexpand\the\noexpand\toks@##1^^J}% + \noexpand\let\noexpand\do@replacenext\noexpand\do@replace@charM + \noexpand\fi + \noexpand\do@replacenext##2\noexpand\end@replace@marker + }% + \noexpand\def\noexpand\doreplace@begverb##1\@beg@env@string##2\noexpand\end@replace@marker{% + \noexpand\expandafter\noexpand\toks@\noexpand\expandafter{\noexpand\replace@text}% + \noexpand\ifx\noexpand\relax##2\noexpand\relax + \noexpand\edef\noexpand\replace@text{\noexpand\the\noexpand\toks@##1}% + \noexpand\let\noexpand\do@replacenext\noexpand\replace@mark@noop + \noexpand\else + \noexpand\edef\noexpand\replace@text{\noexpand\the\noexpand\toks@ + ##1\expandafter\@gobble\string\\begin}% + \noexpand\let\noexpand\do@replacenext\noexpand\doreplace@begverb + \noexpand\fi + \noexpand\do@replacenext##2\noexpand\end@replace@marker + }% + \noexpand\def\noexpand\doreplace@endverb##1\@end@env@string##2\noexpand\end@replace@marker{% + \noexpand\expandafter\noexpand\toks@\noexpand\expandafter{\noexpand\replace@text}% + \noexpand\ifx\noexpand\relax##2\noexpand\relax + \noexpand\edef\noexpand\replace@text{\noexpand\the\noexpand\toks@##1}% + \noexpand\let\noexpand\do@replacenext\noexpand\replace@mark@noop + \noexpand\else + \noexpand\edef\noexpand\replace@text{\noexpand\the\noexpand\toks@ + ##1\expandafter\@gobble\string\\end}% + \noexpand\let\noexpand\do@replacenext\noexpand\doreplace@endverb + \noexpand\fi + \noexpand\do@replacenext##2\noexpand\end@replace@marker + }% + \noexpand\def\noexpand\replace@markers##1{% + \noexpand\def\noexpand\replace@text{}% + \noexpand\expandafter\noexpand\do@replace@charM##1\@char@M\relax\noexpand\end@replace@marker + \noexpand\let##1\noexpand\replace@text + \noexpand\def\noexpand\replace@text{}% + \noexpand\expandafter\noexpand\doreplace@begverb##1\@beg@env@string\relax\noexpand\end@replace@marker + \noexpand\let##1\noexpand\replace@text + \noexpand\def\noexpand\replace@text{}% + \noexpand\expandafter\noexpand\doreplace@endverb##1\@end@env@string\relax\noexpand\end@replace@marker + \noexpand\let##1\noexpand\replace@text + } +} +\def\replace@mark@noop#1\end@replace@marker{} +\def@replace@markers \newenvironment{defproblem}[1][0]{% \edef\@prob@currentargN{\number0#1}% \@defproblem@beginenv }{} - \newcommand*{\@defproblem@beginenv}[2][]{% \def\@prob@currentdefaultargs{#1}% \def\@prob@currentlabel{#2}% + \@defproblem@beginenv@ +} +\newcommand*{\@defproblem@beginenv@}[1][]{% + \setkeys{probsoln}{#1}% \long@collect@body\prob@do@defproblem } \newcommand{\prob@do@newproblem}[1]{% - \prob@newproblem\@prob@currentargN\prob@currentdb - \@prob@currentlabel{#1}{\@prob@currentdefaultargs}} + \if@prob@fragile + \probsoln@process@fragile{#1}% + \protected@edef\do@def@new@problem{% + \noexpand\prob@newproblem + {\@prob@currentargN}% + {\prob@currentdb}% + {\@prob@currentlabel}% + {% + \noexpand\probsoln@write@tmp{\@prob@tmp@problem}% + \noexpand\probsoln@read@tmp + }% + {\@prob@currentdefaultargs}% + }% + \else + \toks@{#1}% + \protected@edef\do@def@new@problem{% + \noexpand\prob@newproblem + {\@prob@currentargN}% + {\prob@currentdb}% + {\@prob@currentlabel}% + {\the\toks@}% + {\@prob@currentdefaultargs}% + }% + \fi + \do@def@new@problem +} \let\prob@do@defproblem=\prob@do@newproblem -\newenvironment{onlysolution}{% +\newenvironment{onlysolution}[1][]{% + \setkeys{probsoln}{#1}% \long@collect@body\do@onlysolution }{} \newcommand{\do@onlysolution}[1]{% \ifshowanswers - #1% + \probsoln@do@body{#1}% \fi \@ifundefined{@prob@currentlabel} {}% @@ -270,14 +366,38 @@ Please specify (e.g. \csname @prob@getargs@eg@\romannumeral#1\endcsname):}% #3% \fi } -\newenvironment{onlyproblem}{% +\newenvironment{onlyproblem}[1][]{% + \setkeys{probsoln}{#1}% \long@collect@body\do@onlyproblem }{} \newcommand{\do@onlyproblem}[1]{% -\ifshowanswers -\else - #1% -\fi} + \ifshowanswers + \else + \probsoln@do@body{#1}% + \fi +} +\newcommand{\probsoln@do@body}[1]{% + \if@prob@fragile + \probsoln@process@fragile{#1}% + \probsoln@write@tmp{\@prob@tmp@problem}% + \probsoln@read@tmp + \else + #1% + \fi +} +\newcommand{\probsoln@process@fragile}[1]{% + \def\@prob@tmp@problem{#1}% + \@onelevel@sanitize\@prob@tmp@problem + \replace@markers\@prob@tmp@problem +} +\newcommand{\probsoln@write@tmp}[1]{% + \immediate\openout\probsoln@write=\ProbSolnFragileFile.\ProbSolnFragileExt + \immediate\write\probsoln@write{#1}% + \immediate\closeout\probsoln@write +} +\newcommand{\probsoln@read@tmp}{% + \input{\ProbSolnFragileFile.\ProbSolnFragileExt}% +} \newcommand{\useproblem}[2][default]{% \def\@prob@currentlabel{#2}% \def\prob@currentdb{#1}% |