summaryrefslogtreecommitdiff
path: root/Master/texmf-dist
diff options
context:
space:
mode:
authorKarl Berry <karl@freefriends.org>2007-08-24 18:34:51 +0000
committerKarl Berry <karl@freefriends.org>2007-08-24 18:34:51 +0000
commit5b3b0129bbe562139349fc1a231988ccccac589d (patch)
tree522b44f51609a92e84e25e0ed4b54062b071ce6c /Master/texmf-dist
parent049f485bdf6f9dbd4880051384aaf239d85ba83e (diff)
probsoln update (21aug07)
git-svn-id: svn://tug.org/texlive/trunk@4796 c570f23f-e606-0410-a88d-b1316a301751
Diffstat (limited to 'Master/texmf-dist')
-rw-r--r--Master/texmf-dist/doc/latex/probsoln/CHANGES2
-rw-r--r--Master/texmf-dist/doc/latex/probsoln/README4
-rw-r--r--Master/texmf-dist/doc/latex/probsoln/probsoln-manual.html752
-rw-r--r--Master/texmf-dist/doc/latex/probsoln/probsoln.pdfbin153769 -> 153651 bytes
-rw-r--r--Master/texmf-dist/source/latex/probsoln/probsoln.dtx136
-rw-r--r--Master/texmf-dist/source/latex/probsoln/probsoln.ins26
-rw-r--r--Master/texmf-dist/tex/latex/probsoln/probsoln.sty91
7 files changed, 916 insertions, 95 deletions
diff --git a/Master/texmf-dist/doc/latex/probsoln/CHANGES b/Master/texmf-dist/doc/latex/probsoln/CHANGES
index 6485349bb28..764317dda61 100644
--- a/Master/texmf-dist/doc/latex/probsoln/CHANGES
+++ b/Master/texmf-dist/doc/latex/probsoln/CHANGES
@@ -1,5 +1,7 @@
probsoln package versions:
+Version 2.04: fixed license text
+
Version 2.03: Added starred form of \newproblem for problems without
solutions. Checks to see if solution environment is already defined.
diff --git a/Master/texmf-dist/doc/latex/probsoln/README b/Master/texmf-dist/doc/latex/probsoln/README
index 431f3f5a08f..2edd170d254 100644
--- a/Master/texmf-dist/doc/latex/probsoln/README
+++ b/Master/texmf-dist/doc/latex/probsoln/README
@@ -1,6 +1,6 @@
-LaTeX Package : probsoln v 2.03
+LaTeX Package : probsoln v 2.04
-Last Modified : 20 June 2006
+Last Modified : 21 Aug 2007
Author : Nicola L.C. Talbot
diff --git a/Master/texmf-dist/doc/latex/probsoln/probsoln-manual.html b/Master/texmf-dist/doc/latex/probsoln/probsoln-manual.html
new file mode 100644
index 00000000000..0e24ce57ccd
--- /dev/null
+++ b/Master/texmf-dist/doc/latex/probsoln/probsoln-manual.html
@@ -0,0 +1,752 @@
+<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 3.2 Final//EN">
+
+<!--Converted with LaTeX2HTML 2002 (1.67)
+original version by: Nikos Drakos, CBLU, University of Leeds
+* revised and updated by: Marcus Hennecke, Ross Moore, Herb Swan
+* with significant contributions from:
+ Jens Lippmann, Marek Rouchal, Martin Wilck and others -->
+<HTML>
+<HEAD>
+<TITLE>probsoln.sty v2.04: LATEX2e Package to help create problem sheets</TITLE>
+<META NAME="description" CONTENT="probsoln.sty v2.04: LATEX2e Package to help create problem sheets">
+<META NAME="keywords" CONTENT="manual">
+<META NAME="resource-type" CONTENT="document">
+<META NAME="distribution" CONTENT="global">
+
+<META HTTP-EQUIV="Content-Type" CONTENT="text/html; charset=iso-8859-1">
+<META NAME="Generator" CONTENT="LaTeX2HTML v2002">
+<META HTTP-EQUIV="Content-Style-Type" CONTENT="text/css">
+
+
+</HEAD>
+
+<BODY >
+
+ <H1 ALIGN="CENTER">probsoln.sty v2.04: L<SUP><SMALL>A</SMALL></SUP>T<SMALL>E</SMALL>X2<SUB>e</SUB> Package to help create problem sheets</H1>
+<P ALIGN="CENTER"><STRONG>Nicola L.C. Talbot</STRONG></P>
+<P ALIGN="CENTER"><STRONG>21st August 2007</STRONG></P>
+ <BR>
+
+<H2><A NAME="SECTION00010000000000000000">
+Contents</A>
+</H2>
+<!--Table of Contents-->
+
+<UL>
+<LI><A NAME="tex2html18"
+ HREF="#SECTION00020000000000000000">Introduction</A>
+<LI><A NAME="tex2html19"
+ HREF="#SECTION00030000000000000000">Package Options</A>
+<LI><A NAME="tex2html20"
+ HREF="#SECTION00040000000000000000">Creating a New Problem</A>
+<LI><A NAME="tex2html21"
+ HREF="#SECTION00050000000000000000">Creating a Database</A>
+<LI><A NAME="tex2html22"
+ HREF="#SECTION00060000000000000000">Displaying a Problem</A>
+<LI><A NAME="tex2html23"
+ HREF="#SECTION00070000000000000000">Selecting All Problems</A>
+<LI><A NAME="tex2html24"
+ HREF="#SECTION00080000000000000000">Selecting Problems at Random</A>
+<LI><A NAME="tex2html25"
+ HREF="#SECTION00090000000000000000">Other Commands</A>
+<LI><A NAME="tex2html26"
+ HREF="#SECTION000100000000000000000">Troubleshooting</A>
+<UL>
+<LI><A NAME="tex2html27"
+ HREF="#SECTION000101000000000000000">Unexpected Output</A>
+<LI><A NAME="tex2html28"
+ HREF="#SECTION000102000000000000000">Error Messages</A>
+</UL>
+<BR>
+<LI><A NAME="tex2html29"
+ HREF="#SECTION000110000000000000000">Contact Details</A>
+<LI><A NAME="tex2html30"
+ HREF="#SECTION000120000000000000000">Index</A>
+</UL>
+<!--End of Table of Contents-->
+<P>
+
+<H1><A NAME="SECTION00020000000000000000">
+Introduction</A>
+</H1>
+The <TT>probsoln</TT> package is designed for teachers or
+lecturers who want to create problem sheets for their
+students. This package was designed with specifically
+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 L<SUP><SMALL>A</SMALL></SUP>T<SMALL>E</SMALL>X, and then select a number of problems to
+typeset. This means that once the database has been set up,
+each year you can easily create a new problem sheet that is
+sufficiently different from the previous year, thus
+preventing the temptation of current students seeking out
+the previous year's students, and checking out their
+answers. There is also an option that can be passed to the
+package to determine whether or not the solutions should be
+printed. In this way, one file can either produce the
+student's version or the teacher's version.
+
+<P>
+
+<H1><A NAME="SECTION00030000000000000000">
+Package Options</A>
+</H1>
+The following options may be passed to this package:
+<DIV ALIGN="CENTER">
+<TABLE CELLPADDING=3>
+<TR><TD ALIGN="LEFT"><TT></TD><TD ALIGN="LEFT">answers </TT></TD>
+<TD ALIGN="LEFT">Show the answers</TD>
+</TR>
+<TR><TD ALIGN="LEFT"><TT></TD><TD ALIGN="LEFT">noanswers </TT></TD>
+<TD ALIGN="LEFT">Don't show the answers (default)</TD>
+</TR>
+</TABLE>
+</DIV>
+
+<P>
+
+<H1><A NAME="SECTION00040000000000000000">
+Creating a New Problem</A>
+</H1>
+
+<A NAME="newproblem"></A><TT>newproblem</TT><A NAME="386"></A><code>[</code><I>nargs</I><code>]{</code><I>label</I><code>}{</code><I>problem</I><code>}{</code><I>solution</I><code>}</code>
+<BR>
+<BR>
+A new problem is defined using the command
+<TT>&#92;newproblem</TT><A NAME="389"></A>. This does not print anything,
+but merely stores the problem. As from version 2.03, there is also
+a starred version of this command for problems without a solution
+(for example, essay style questions):
+<BR>
+<BR>
+<A NAME="newproblem_"></A><TT>newproblem*</TT><A NAME="393"></A><code>[</code><I>nargs</I><code>]{</code><I>label</I><code>}{</code><I>problem</I><code>}</code>
+<BR>
+<BR>
+The argument <I>label</I> is
+a unique string that is assigned to this problem so that it
+can be used later. The argument <I>problem</I> is normal
+L<SUP><SMALL>A</SMALL></SUP>T<SMALL>E</SMALL>X code that should be used to typeset the problem.
+The argument <I>solution</I> is normal L<SUP><SMALL>A</SMALL></SUP>T<SMALL>E</SMALL>X code that
+should be used to typeset the solution, if required. For
+example, the following defines a problem with the label
+<A NAME="quaddiff"></A><TT>quaddiff</TT>:
+<PRE>
+ \newproblem{quaddiff}{%
+ %This is the problem
+ \begin{displaymath}
+ f(x) = x^2 + 3x + 4
+ \end{displaymath}
+ }{%
+ %This is the solution
+ \begin{displaymath}
+ f'(x) = 2x + 3
+ \end{displaymath}
+ }
+</PRE>
+The following is an essay question, so doesn't come with a solution:
+<PRE>
+\newproblem*{inheritance}{Describe what is meant by the term
+\emph{inheritance} in object-oriented programming. Use examples.}
+</PRE>
+
+<P>
+The optional argument <I>nargs</I> specifies the number of
+parameters this problem will take. By default this value is
+0, but any value from 1 to 9 may be used. Each parameter is
+referred to by <code>#1</code>, <code>#2</code>, ..., <code>#9</code>.
+For example, the following problem, labelled <A NAME="sindiff"></A><TT>sindiff</TT>,
+takes one parameter:
+<PRE>
+\newproblem[1]{sindiff}{%
+\(f(x) = \sin(#1x)\)
+}{%
+\(f'(x) = #1\cos(#1x)\)
+}
+</PRE>
+
+<P>
+The <A HREF="#quaddiff"><TT>quaddiff</TT></A> problem shown above can be made more
+generic by using parameters<A NAME="diff:quad"></A>:
+<PRE>
+\newcount\ctr
+\newproblem[3]{diff:quad}{%
+\(f(x) =
+\ifnum#1=0
+\else
+\ifnum#1=1\else#1\fi x^2
+\fi
+\ifnum#2=0
+\else
+\ifnum#2&gt;0 \ifnum#1=0 \else + \fi \fi
+\ifnum#2=1\else#2\fi x
+\fi
+\ifnum#3=0
+\else
+\ifnum#3&gt;0 \ifnum#2=0 \ifnum#1=0 \else + \fi \else + \fi\fi
+#3
+\fi\)
+}{%
+\(f'(x) =
+\ifnum#1=0
+\else
+\ctr=2
+\multiply\ctr by #1
+\the\ctr x
+\fi
+\ifnum#2=0
+\else
+\ifnum#2&gt;0 \ifnum#1=0 \else + \fi \fi
+#2
+\fi
+ % print 0 if both #1 and #2 are 0
+\ifnum#1=0 \ifnum#2=0 0 \fi\fi
+\)
+}
+</PRE>
+The three parameters correspond to the coefficients. Note
+that they must all be integers since T<SMALL>E</SMALL>X only performs
+integer arithmetic.
+
+<P>
+
+<H1><A NAME="SECTION00050000000000000000">
+Creating a Database</A>
+</H1>
+
+<P>
+To generate a database, simply create a <TT>.tex</TT> file
+where all the problems are defined using <A HREF="#newproblem"><TT>newproblem</TT><A NAME="407"></A></A> or
+<A HREF="#newproblem_"><TT>newproblem*</TT><A NAME="412"></A></A>,
+and either <TT>&#92;input</TT><A NAME="415"></A> it at the start of your document if
+you want to use <A HREF="#sec:useprob">specific problems</A>, or pass it to
+<A HREF="#sec:selran"><TT>&#92;selectrandomly</TT><A NAME="421"></A></A>. This package
+comes with some sample databases, along with some sample documents
+that use these databases.
+
+<P>
+
+<H1><A NAME="SECTION00060000000000000000"></A>
+<A NAME="sec:useprob"></A>
+<BR>
+Displaying a Problem
+</H1>
+
+<A NAME="useproblem"></A><TT>useproblem</TT><A NAME="425"></A><code>{</code><I>label</I><code>}</code>
+<BR>
+<BR>
+Once a problem has been defined using <A HREF="#newproblem"><TT>newproblem</TT><A NAME="430"></A></A>, it
+can be typeset using the command <TT>&#92;useproblem</TT><A NAME="433"></A>. If the
+problem was defined to take arguments, the arguments to the
+problem should come after the label. In the case of the
+<A HREF="#sindiff"><TT>sindiff</TT></A> example above, the command
+<code>\useproblem{sindiff}{2}</code> would produce the following:
+<BR>
+<BR> <I>f</I>(<I>x</I>) = sin(2<I>x</I>)
+
+<H4><A NAME="SECTION00060010000000000000">
+Solution:</A>
+</H4> <I>f'</I>(<I>x</I>) = 2cos(2<I>x</I>)
+<BR>
+<BR>
+whereas the command <code>\useproblem{diff:quad}{3}{0}{-2}</code> would produce:
+<BR>
+<BR> <I>f</I>(<I>x</I>) = 3<I>x</I><SUP>2</SUP> - 2
+
+<H4><A NAME="SECTION00060020000000000000">
+Solution:</A>
+</H4> <I>f'</I>(<I>x</I>) = 6<I>x</I>
+<BR>
+<BR>
+
+<P>
+Suppose all the above problems are defined in the file
+<TT>probs.tex</TT>, then the following code will create a
+problem sheet with four questions in it:
+<PRE>
+\documentclass{article}
+
+\usepackage{probsoln}
+\input{probs}
+
+\begin{document}
+Differentiate the following functions with respect to $x$:
+\begin{enumerate}
+\item \useproblem{quaddiff}
+\item \useproblem{sindiff}{4}
+\item \useproblem{diff:quad}{2}{3}{1}
+\item \useproblem{diff:quad}{0}{1}{2}
+\end{enumerate}
+\end{document}
+</PRE>
+The answer sheet can then be generated by passing the option
+<TT>answers</TT> to the <TT>probsoln</TT> package.
+
+<P>
+
+<H1><A NAME="SECTION00070000000000000000">
+Selecting All Problems</A>
+</H1>
+
+<P>
+To select all problems defined in a database, in the order in
+which they were defined, use the command:
+
+<A NAME="selectallproblems"></A><TT>selectallproblems</TT><A NAME="440"></A><code>{</code><I>filename</I><code>}</code>
+For example, suppose the problems are defined in the file
+<TT>easy.tex</TT>, then the following will create a problem sheet
+which uses all these problems:
+<PRE>
+\documentclass[a4paper]{article}
+
+\usepackage{probsoln}
+
+\begin{document}
+Differentiate the following functions:
+\begin{enumerate}
+\selectallproblems{easy}
+\end{enumerate}
+\end{document}
+</PRE>
+
+<P>
+
+<H1><A NAME="SECTION00080000000000000000"></A>
+<A NAME="sec:selran"></A>
+<BR>
+Selecting Problems at Random
+</H1>
+
+<A NAME="selectrandomly"></A><TT>selectrandomly</TT><A NAME="444"></A><code>{</code><I>filename</I><code>}{</code><I>n</I><code>}</code>
+<BR>
+<BR>
+The command <TT>&#92;selectrandomly</TT><A NAME="447"></A> will select <I>n</I>
+problems that are defined in the file <I>filename</I>. Each
+problem is proceeded by
+<A NAME="PSitem"></A><TT>PSitem</TT><A NAME="451"></A> which is
+defined to be <TT>&#92;item</TT><A NAME="454"></A>, so the command
+<TT>&#92;selectrandomly</TT><A NAME="457"></A> should occur within one of the
+list-like environments, such as <TT>enumerate</TT>.
+For example:
+<PRE>
+\begin{enumerate}
+\selectrandomly{easy.tex}{4}
+\end{enumerate}
+</PRE>
+will result in four numbered problems, selected at random
+from the file <TT>easy.tex</TT>. (The <TT>.tex</TT> extension
+may be omitted.) Each problem is followed by the command
+<A NAME="endPSNitem"></A><TT>endPSNitem</TT><A NAME="461"></A> which by default does nothing.
+
+<P>
+Multiple <TT>&#92;selectrandomly</TT><A NAME="464"></A> commands may be used, however a
+different file must be used each time. For
+example:
+<PRE>
+\begin{enumerate}
+\item Differentiate the following functions with respect to $x$:
+
+\begin{enumerate}
+\selectrandomly{samples/easy.tex}{3}
+\selectrandomly{samples/args.tex}{1}
+\end{enumerate}
+
+\selectrandomly{samples/implicit.tex}{1}
+\selectrandomly{samples/1stprncpl.tex}{1}
+
+\end{enumerate}
+</PRE>
+This will result in a total of 6 problems, numbered 1(a),
+1(b), 1(c), 1(d), 2 and 3.
+
+<P>
+If a randomly selected problem requires arguments, a message
+similar to the following will be displayed:
+<PRE>
+Problem diff:quad requires 3 argument(s), please specify (e.g. {5}{3}):
+</PRE>
+Enter the required arguments, where each argument is
+enclosed in braces ({ }).
+
+<P>
+
+<H1><A NAME="SECTION00090000000000000000">
+Other Commands</A>
+</H1>
+
+The command <A NAME="PSNrandseed"></A><TT>PSNrandseed</TT><A NAME="468"></A><code>{</code><I>n</I><code>}</code> specifies
+the seed for the random number generator. For example,
+if you are using <A HREF="#selectrandomly"><TT>selectrandomly</TT><A NAME="473"></A></A>,
+<code>\PSNrandseed{\year}</code> will produce a different set of
+problems each year, whereas <code>\PSNrandseed{\time}</code>
+will produce a different set of problems each time you
+L<SUP><SMALL>A</SMALL></SUP>T<SMALL>E</SMALL>X the problem sheet (as long as you leave at least a
+minute between runs.)
+
+<P>
+The command <A NAME="random"></A><TT>random</TT><A NAME="477"></A><code>{</code><I>counter</I><code>}{</code><I>a</I><code>}{</code><I>b</I><code>}</code>
+generates a random number from <I>a</I> to <I>b</I> and
+stores it in the L<SUP><SMALL>A</SMALL></SUP>T<SMALL>E</SMALL>X counter <I>counter</I>. For example,
+to select 2, 3 or 4 problems from the file
+<TT>implicit.tex</TT>:
+<PRE>
+\newcounter{numproblems}
+\begin{enumerate}
+\random{numproblems}{2}{4}
+\selectrandomly{implicit.tex}{\value{numproblems}}
+\end{enumerate}
+</PRE>
+(Note the use of <TT>&#92;value</TT><A NAME="480"></A>.)
+
+<P>
+This command can also be used to generate random values for
+problems that take arguments. Consider the problem <A HREF="#diff:quad"><TT>diff:quad</TT></A>
+defined earlier. Three counters can be defined to represent the
+three coefficients:
+<PRE>
+\newcounter{A}
+\newcounter{B}
+\newcounter{C}
+</PRE>
+Random values can now be assigned to these counters:
+<PRE>
+\random{A}{-5}{5}
+\random{B}{-5}{5}
+\random{C}{-5}{5}
+</PRE>
+Finally, the problem can be used (note the use of <TT>&#92;arabic</TT><A NAME="486"></A>):
+<PRE>
+\useproblem{diff:quad}{\arabic{A}}{\arabic{B}}{\arabic{C}}
+</PRE>
+
+<P>
+The command
+<A NAME="doforrandN"></A><TT>doforrandN</TT><A NAME="490"></A><code>{</code><I>n</I><code>}{</code><I>cmd</I><code>}{</code><I>list</I><code>}{</code><I>text</I><code>}</code> will apply
+<I>text</I> for a random selection of <I>n</I> items in the
+comma separated <I>list</I>. In each iteration the list
+item is denoted by <I>cmd</I>. For example, suppose you
+have three files called <TT>file1.tex</TT>,
+<TT>file2.tex</TT> and <TT>file3.tex</TT>, and you want to
+select 1 problem from two of the three files, then you can
+do:
+<PRE>
+\doforrandN{2}{\file}{file1,file2,file3}{\selectrandomly{\file}{1}}
+</PRE>
+Note that it is also possible to do
+<PRE>
+\newcounter{numproblems}
+\random{numproblems}{1}{3}
+\selectrandomly{file\arabic{numproblems}}{1}
+\random{numproblems}{1}{3}
+\selectrandomly{file\arabic{numproblems}}{1}
+</PRE>
+however there is a possibility that the same file may be
+selected twice which will cause an error.
+
+<P>
+The command <A NAME="showanswers"></A><TT>showanswers</TT><A NAME="494"></A> will show the solutions from
+that point on. May be localised by placing within a group.
+
+<P>
+The command <A NAME="hideanswers"></A><TT>hideanswers</TT><A NAME="498"></A> will hide the solutions from
+that point on. May be localised by placing within a group.
+
+<P>
+The solution is placed inside the <TT>solution</TT>
+environment. By default this environment simply does
+<code>\par\noindent\textbf{\solutionname:} </code> at the start, where
+<A NAME="solutionname"></A><TT>solutionname</TT><A NAME="503"></A>
+has the value: Solution. See the file <TT>sample3.tex</TT>, which
+comes with this package, for an illustration of how to
+customise the way in which the randomly selected problems are
+displayed. This sample file randomly selects multiple choice
+problems stored in the file <TT>tabmchoice.tex</TT>, and displays them
+in a longtable <TT>environment</TT>. As from version 2.03, the package
+will not define this environment if another package or class file has
+already defined it.
+
+<P>
+The boolean variable <TT>showanswers</TT> is defined to be
+true if the answers are shown and false otherwise. You can
+therefore do something like:
+<PRE>
+\ifthenelse{\boolean{showanswers}}{\textbf{Solution Sheet}}{}
+</PRE>
+and <B>Solution Sheet</B> will be printed only if the
+answers are displayed. (For more information on
+<TT>&#92;ifthenelse</TT><A NAME="507"></A> and <TT>&#92;boolean</TT><A NAME="510"></A> see the
+documentation for the <TT>ifthen</TT> package by
+David Carlisle.)
+
+<P>
+The <TT>showanswers</TT> switch can also be used within the definition
+of a problem, if you want the question to appear differently if the
+solution is displayed. For example:
+<PRE>
+\newproblem{mc:prod}{%
+Which of the following is the derivative of $x\sin(x)$?
+(Circle the correct answer.)
+\ifthenelse{\boolean{showanswers}}{}%
+{\begin{description}
+\item[A] $\sin(x)$
+\item[B] $x\cos(x)$
+\item[C] $\sin(x) + x\cos(x)$
+\end{description}
+}}{%
+\begin{description}
+\item[A] $\sin(x)$
+\item[B] $x\cos(x)$
+\item[\textcircled{C}] $\sin(x) + x\cos(x)$ (product rule).
+\end{description}
+}
+</PRE>
+If the solutions are not displayed, the question will appear
+as
+<DL>
+<DT></DT>
+<DD>Which of the following is the derivative of
+<I>x</I>sin(<I>x</I>)?
+(Circle the correct answer.)
+<DL>
+<DT><STRONG>A</STRONG></DT>
+<DD>sin(<I>x</I>)
+</DD>
+<DT><STRONG>B</STRONG></DT>
+<DD><I>x</I>cos(<I>x</I>)
+</DD>
+<DT><STRONG>C</STRONG></DT>
+<DD>sin(<I>x</I>)+<I>x</I>cos(<I>x</I>)
+</DD>
+</DL>
+</DD>
+</DL>
+otherwise it will appear as:
+<DL>
+<DT></DT>
+<DD>Which of the following is the derivative of
+<I>x</I>sin(<I>x</I>)?
+(Circle the correct answer.)
+<DL>
+<DT><STRONG>A</STRONG></DT>
+<DD>sin(<I>x</I>)
+</DD>
+<DT><STRONG>B</STRONG></DT>
+<DD><I>x</I>cos(<I>x</I>)
+</DD>
+<DT><STRONG><FONT SIZE="+2">&#169;</FONT></STRONG></DT>
+<DD>sin(<I>x</I>) + <I>x</I>cos(<I>x</I>) (product rule)
+</DD>
+</DL>
+</DD>
+</DL>
+
+<P>
+
+<H1><A NAME="SECTION000100000000000000000">
+Troubleshooting</A>
+</H1>
+
+<H2><A NAME="SECTION000101000000000000000">
+Unexpected Output</A>
+</H2>
+
+<UL>
+<LI>I have lots of blank space before the first problem when
+using <A HREF="#selectrandomly"><TT>selectrandomly</TT><A NAME="515"></A></A>.
+
+<P>
+This is probably because you have lots of extraneous white space
+in your database. <A HREF="#selectrandomly"><TT>selectrandomly</TT><A NAME="520"></A></A> will input the entire
+file, so any extra space will be included. Try commenting out the
+extra space using %.
+</LI>
+</UL>
+
+<P>
+
+<H2><A NAME="SECTION000102000000000000000">
+Error Messages</A>
+</H2>
+
+<UL>
+<LI><TT>! Package probsoln Error: Label ... already used.
+</TT>
+
+<P>
+Each label identifier used in <A HREF="#newproblem"><TT>newproblem</TT><A NAME="525"></A></A> must be
+unique. Check to make sure you haven't used the same label
+more than once. Also check to make sure you haven't
+<TT>&#92;input</TT><A NAME="528"></A>ed or randomly selected from the same file more
+than once. (Or <TT>&#92;input</TT><A NAME="531"></A>ed and randomly selected from
+the same file.)
+
+<P>
+</LI>
+<LI><TT>! Package probsoln Error: Label ... undefined.
+</TT>
+
+<P>
+You need to define a problem before you can use it. Check to
+make sure you haven't mis-spelt it, and check to make sure you
+have <TT>&#92;input</TT><A NAME="534"></A>ed the file in which it is defined.
+
+<P>
+</LI>
+<LI><TT>! Package probsoln Error: Requested number too large.
+</TT>
+
+<P>
+You have asked for more problems than are defined within the
+specified file. All problems in that file will be selected.
+
+<P>
+</LI>
+<LI><TT>! Package probsoln Error: Can't randomly select <I>n</I>
+item(s)
+</TT>
+
+<P>
+You have asked to randomly select <I>n</I> items from a list
+that has less than <I>n</I> elements. For example, the
+following will generate this error:
+<PRE>
+\doforrandN{10}{\file}{file1,file2,file3}{%
+\selectrandomly{\file}{1}}
+</PRE>
+In this case the list, <TT>file1,file2,file3</TT> has only 3
+elements, but the user has asked for 10 elements. If you type
+`h' at the L<SUP><SMALL>A</SMALL></SUP>T<SMALL>E</SMALL>X prompt it will tell you how many items it thinks
+there are in the list. Remember that each item must be separated by a
+comma.
+
+<P>
+</LI>
+<LI><TT>! LaTeX Error: Lonely <TT>&#92;item</TT><A NAME="537"></A>-perhaps missing list
+environment.
+</TT>
+
+<P>
+Each problem selected using <A HREF="#selectrandomly"><TT>selectrandomly</TT><A NAME="542"></A></A> is
+proceeded by <A HREF="#PSNitem"><TT>PSNitem</TT><A NAME="547"></A></A> which by default is defined
+as <TT>&#92;item</TT><A NAME="550"></A>, and should therefore be
+placed in one of the list environments, such as
+<TT>enumerate</TT>. Alternatively, redefine <A HREF="#PSNitem"><TT>PSNitem</TT><A NAME="555"></A></A>.
+
+<P>
+</LI>
+<LI>I get an error when I put a command definition in my database
+when using <TT>&#92;selectrandomly</TT><A NAME="558"></A>.
+
+<P>
+<A HREF="#selectrandomly"><TT>selectrandomly</TT><A NAME="563"></A></A> inputs the database twice, so any
+command definition will be read twice, causing an error. You
+can use the switch <TT>&#92;iffirstpass</TT><A NAME="566"></A> to prevent the error. For
+example:
+<PRE>
+\iffirstpass
+\newcommand{\mycmd}{}
+\fi
+</PRE>
+It is generally not a good idea to put anything other than
+<A HREF="#newproblem"><TT>newproblem</TT><A NAME="571"></A></A> commands within the database.
+
+<P>
+</LI>
+</UL>
+
+<P>
+
+<H1><A NAME="SECTION000110000000000000000">
+Contact Details</A>
+</H1>
+Dr Nicola Talbot
+<BR>
+School of Computing Sciences
+<BR>
+University of East Anglia
+<BR>
+Norwich. NR4 7TJ
+<BR><TT><A NAME="tex2html1"
+ HREF="http://theoval.cmp.uea.ac.uk/~nlct/">http://theoval.cmp.uea.ac.uk/~nlct/</A></TT>
+<P>
+<BR>
+
+<H2><A NAME="SECTION000120000000000000000">
+Index</A>
+</H2><DL COMPACT>
+<DT><STRONG><TT>&#92;arabic</TT></STRONG>
+<DD><A HREF="#486">Other Commands</A>
+<DT><STRONG><TT>&#92;boolean</TT></STRONG>
+<DD><A HREF="#510">Other Commands</A>
+<DT><STRONG><TT>&#92;doforrandN</TT></STRONG>
+<DD><A HREF="#490">Other Commands</A>
+<DT><STRONG><TT>&#92;endPSNitem</TT></STRONG>
+<DD><A HREF="#461">Selecting Problems at Random</A>
+<DT><STRONG><TT>&#92;hideanswers</TT></STRONG>
+<DD><A HREF="#498">Other Commands</A>
+<DT><STRONG><TT>&#92;iffirstpass</TT></STRONG>
+<DD><A HREF="#566">Error Messages</A>
+<DT><STRONG><TT>&#92;ifthenelse</TT></STRONG>
+<DD><A HREF="#507">Other Commands</A>
+<DT><STRONG><TT>&#92;input</TT></STRONG>
+<DD><A HREF="#415">Creating a Database</A>
+ | <A HREF="#528">Error Messages</A>
+ | <A HREF="#531">Error Messages</A>
+ | <A HREF="#534">Error Messages</A>
+<DT><STRONG><TT>&#92;item</TT></STRONG>
+<DD><A HREF="#454">Selecting Problems at Random</A>
+ | <A HREF="#537">Error Messages</A>
+ | <A HREF="#550">Error Messages</A>
+<DT><STRONG><TT>&#92;newproblem</TT></STRONG>
+<DD><A HREF="#386">Creating a New Problem</A>
+ | <A HREF="#389">Creating a New Problem</A>
+ | <A HREF="#407">Creating a Database</A>
+ | <A HREF="#430">Displaying a Problem</A>
+ | <A HREF="#525">Error Messages</A>
+ | <A HREF="#571">Error Messages</A>
+<DT><STRONG><TT>&#92;newproblem*</TT></STRONG>
+<DD><A HREF="#393">Creating a New Problem</A>
+ | <A HREF="#412">Creating a Database</A>
+<DT><STRONG><TT>&#92;PSitem</TT></STRONG>
+<DD><A HREF="#451">Selecting Problems at Random</A>
+<DT><STRONG><TT>&#92;PSNitem</TT></STRONG>
+<DD><A HREF="#547">Error Messages</A>
+ | <A HREF="#555">Error Messages</A>
+<DT><STRONG><TT>&#92;PSNrandseed</TT></STRONG>
+<DD><A HREF="#468">Other Commands</A>
+<DT><STRONG><TT>&#92;random</TT></STRONG>
+<DD><A HREF="#477">Other Commands</A>
+<DT><STRONG><TT>&#92;selectallproblems</TT></STRONG>
+<DD><A HREF="#440">Selecting All Problems</A>
+<DT><STRONG><TT>&#92;selectrandomly</TT></STRONG>
+<DD><A HREF="#418">Creating a Database</A>
+ | <A HREF="#421">Creating a Database</A>
+ | <A HREF="#444">Selecting Problems at Random</A>
+ | <A HREF="#447">Selecting Problems at Random</A>
+ | <A HREF="#457">Selecting Problems at Random</A>
+ | <A HREF="#464">Selecting Problems at Random</A>
+ | <A HREF="#473">Other Commands</A>
+ | <A HREF="#515">Unexpected Output</A>
+ | <A HREF="#520">Unexpected Output</A>
+ | <A HREF="#542">Error Messages</A>
+ | <A HREF="#563">Error Messages</A>
+ | <A HREF="#558">Error Messages</A>
+<DT><STRONG><TT>&#92;showanswers</TT></STRONG>
+<DD><A HREF="#494">Other Commands</A>
+<DT><STRONG><TT>&#92;solutionname</TT></STRONG>
+<DD><A HREF="#503">Other Commands</A>
+<DT><STRONG><TT>&#92;useproblem</TT></STRONG>
+<DD><A HREF="#425">Displaying a Problem</A>
+ | <A HREF="#433">Displaying a Problem</A>
+<DT><STRONG><TT>&#92;value</TT></STRONG>
+<DD><A HREF="#480">Other Commands</A>
+
+</DL>
+<BR><HR>
+<ADDRESS>
+<A href=http://theoval.cmp.uea.ac.uk/~nlct/>Nicola L. C. Talbot</A>.
+<A HREF=http://www.cmp.uea.ac.uk/>School of Computing Sciences</A>.
+<A HREF=http://www.uea.ac.uk/>University of East Anglia.</A>
+Last Modified: 2007-08-21
+</ADDRESS>
+</BODY>
+</HTML>
diff --git a/Master/texmf-dist/doc/latex/probsoln/probsoln.pdf b/Master/texmf-dist/doc/latex/probsoln/probsoln.pdf
index 6230fab1c62..958fa8996a8 100644
--- a/Master/texmf-dist/doc/latex/probsoln/probsoln.pdf
+++ b/Master/texmf-dist/doc/latex/probsoln/probsoln.pdf
Binary files differ
diff --git a/Master/texmf-dist/source/latex/probsoln/probsoln.dtx b/Master/texmf-dist/source/latex/probsoln/probsoln.dtx
index d555fc87f5e..b15dc024005 100644
--- a/Master/texmf-dist/source/latex/probsoln/probsoln.dtx
+++ b/Master/texmf-dist/source/latex/probsoln/probsoln.dtx
@@ -1,12 +1,12 @@
%\iffalse
-% probsoln.dtx generated using makedtx version 0.91b (c) Nicola Talbot
+% probsoln.dtx generated using makedtx version 0.94b (c) Nicola Talbot
% Command line args:
% -src "(.+)\.(sty)=>\1.\2"
% -doc "manual.tex"
% -author "Nicola Talbot"
% -dir "source"
% probsoln
-% Created on 2007/7/18 20:23
+% Created on 2007/8/21 16:58
%\fi
%\iffalse
%<*package>
@@ -47,7 +47,7 @@
\newcommand{\cmdlink}[1]{\hyperlink{#1}{\cmdname{#1}}}
\newcommand{\problabel}[2]{\hypertarget{#1}{\texttt{#2}}}
\newcommand{\probref}[1]{\hyperlink{#1}{\texttt{#1}}}
-\newcommand{\cmdname}[1]{\texttt{\symbol{92}#1}}
+\newcommand{\cmdname}[1]{\cs{#1}}
%hyperindex conflicts with doc
%(end up with |usage|hyperpage in indexentry)
\renewcommand{\usage}[1]{\textit{\hyperpage{#1}}}
@@ -56,9 +56,10 @@
\makeatletter
\def\index@prologue{\section*{Index}}
\makeatother
+\CheckSum{499}
+\OnlyDescription
-\OnlyDescription
\PageIndex
\begin{document}
@@ -66,11 +67,9 @@
\end{document}
%</driver>
%\fi
-%
-%
-% \title{probsoln.sty v2.03: \LaTeXe\ Package to help create problem sheets}
+% \title{probsoln.sty v2.04: \LaTeXe\ Package to help create problem sheets}
% \author{Nicola L.C. Talbot}
-% \date{20th June 2006}
+% \date{21st August 2007}
% \maketitle
% \tableofcontents
%
@@ -563,16 +562,24 @@
% required. And specify the package provided.
% \begin{macrocode}
\NeedsTeXFormat{LaTeX2e}
-\ProvidesPackage{probsoln}[2006/06/20 v2.03 Problems and their Solutions Package (NLCT)]
+\ProvidesPackage{probsoln}[2007/08/21 v2.04 Problems and their Solutions Package (NLCT)]
\RequirePackage{ifthen}
% \end{macrocode}
% Define newif to determine whether or not to show the answers.
% (Changed to |\provideboolean| 21 Mar 2004.)
% \begin{macrocode}
\provideboolean{showanswers}
-\newcommand{\showanswers}{\showanswerstrue}
-\newcommand{\hideanswers}{\showanswersfalse}
% \end{macrocode}
+%\begin{macro}{\showanswers}
+% \begin{macrocode}
+\let\showanswers=\showanswerstrue
+% \end{macrocode}
+%\end{macro}
+%\begin{macro}{\hideanswers}
+% \begin{macrocode}
+\let\hideanswers=\showanswersfalse
+% \end{macrocode}
+%\end{macro}
% Now define the package options
% \begin{macrocode}
\DeclareOption{answers}{\showanswerstrue}
@@ -586,12 +593,15 @@
\newif\iffirstpass
\newif\ifselected
% \end{macrocode}
+%\begin{macro}{\newproblem}
% Define the command that creates a new problem. As from version
% 2.03 this command now has a starred version for problems without
% solutions.
% \begin{macrocode}
\newcommand{\newproblem}{\@ifstar\@snewproblem\@newproblem}
% \end{macrocode}
+%\end{macro}
+%\begin{macro}{\@newproblem}
% The unstarred version.
% \begin{macrocode}
\newcommand{\@newproblem}[4][0]{%
@@ -634,6 +644,8 @@
\fi
}
% \end{macrocode}
+%\end{macro}
+%\begin{macro}{\@snewproblem}
% The starred version (new to version 2.03). Note that there is one
% less argument, because the problem doesn't have a solution.
% \begin{macrocode}
@@ -674,15 +686,18 @@
\fi
}
% \end{macrocode}
+%\end{macro}
+%\begin{macro}{\useproblem}
% Define the command that uses a problem
% \begin{macrocode}
-\newcommand{\useproblem}[1]{%
+\newcommand*{\useproblem}[1]{%
\@ifundefined{@prob@#1}{%
\PackageError{probsoln}{Label #1 undefined}%
-{Can't find problem defined with label identifier '#1'}%
+{Can't find problem defined with label identifier `#1'}%
}{\csname @prob@#1\endcsname}%
}
% \end{macrocode}
+%\end{macro}
% Now deal with the stuff for random selection.
% First define some registers for later use.
% \begin{macrocode}
@@ -691,21 +706,24 @@
\newcount\@ps@randtmp
\r@ndcur=1\relax
% \end{macrocode}
+%\begin{macro}{\PSNrandseed}
% Set the random generator seed
% \begin{macrocode}
-\newcommand{\PSNrandseed}[1]{%
+\newcommand*{\PSNrandseed}[1]{%
\ifnum#1=0\relax
-\PackageWarning{probsoln}{Can't have 0 as random seed, changing to 1}%
-\r@ndcur=1\relax
+ \PackageWarning{probsoln}{Can't have 0 as random seed, changing to 1}%
+ \r@ndcur=1\relax
\else
-\r@ndcur=#1\relax
+ \r@ndcur=#1\relax
\fi
-\PackageInfo{probsoln}{Random Seed = \the\r@ndcur}%
+\PackageInfo{probsoln}{Random Seed = \number\r@ndcur}%
}
% \end{macrocode}
+%\end{macro}
+%\begin{macro}{\PSNrand}
% Generate a random integer.
% \begin{macrocode}
-\newcommand{\PSNrand}{%
+\newcommand*{\PSNrand}{%
\@ps@randtmp=\r@ndcur
\multiply\@ps@randtmp by 16807\relax
\r@ndcur=\@ps@randtmp
@@ -716,41 +734,51 @@
\ifnum\r@ndcur=0\relax\r@ndcur=1\fi
}
% \end{macrocode}
-% |\PSNrandom{|\meta{count}|}{|\meta{n}|}| stores a random number
+%\end{macro}
+%\begin{macro}{\PSNrandom}
+% \cs{PSNrandom}\marg{count}\marg{n} stores a random number
% from 1 to \meta{n}
% in the TeX count register \meta{count}
% \begin{macrocode}
\newcommand{\PSNrandom}[2]{%
+% \end{macrocode}
% generate new random number.
+% \begin{macrocode}
\PSNrand
#1=\r@ndcur
\@ps@randtmp=\r@ndcur
-% now (#1 mod #2) + 1
+% \end{macrocode}
+% now set \meta{count} to (\meta{count} mod \meta{n}) + 1
+% \begin{macrocode}
\divide\@ps@randtmp by #2\relax
\multiply\@ps@randtmp by #2\relax
\advance#1 by -\@ps@randtmp
\advance#1 by 1\relax
}
% \end{macrocode}
-% |\random{|\meta{counter}|}{|\meta{a}|}{|\meta{b}|}|:
+%\end{macro}
+%\begin{macro}{\random}
+% \cs{random}\marg{counter}\marg{a}\marg{b}:
% Generate a random number in the range $[a,b]$, and store this
% number in the \LaTeX\ counter \meta{counter}.
% \begin{macrocode}
\newcommand{\random}[3]{%
\ifnum#2=1\relax
-\PSNrandom{\value{#1}}{#3}%
+ \PSNrandom{\value{#1}}{#3}%
\else
-\@rndselctr=#3%
-\advance\@rndselctr by -#2\relax
-\advance\@rndselctr by 1\relax
-\PSNrandom{\value{#1}}{\@rndselctr}%
-\addtocounter{#1}{#2}%
-\addtocounter{#1}{-1}%
+ \@rndselctr=#3%
+ \advance\@rndselctr by -#2\relax
+ \advance\@rndselctr by 1\relax
+ \PSNrandom{\value{#1}}{\@rndselctr}%
+ \addtocounter{#1}{#2}%
+ \addtocounter{#1}{-1}%
\fi
}
% \end{macrocode}
+%\end{macro}
+%\begin{macro}{\selectallproblems}
% Define command to use all problems from a given file.
-% Syntax: |\selectallproblems{|\meta{filename}|}|.
+% Syntax: \cs{selectallproblems}\marg{filename}.
% \begin{macrocode}
\newcommand*{\selectallproblems}[1]{%
\global\@probN=0\relax
@@ -768,22 +796,25 @@
\global\advance\@rndselctr by 1\relax
}}
% \end{macrocode}
+%\end{macro}
+%\begin{macro}{\selectrandomly}
% Now define command to randomly select \meta{n} problems from
% a given file.
-% Syntax: |\selectrandomly{|\meta{filename}|}{|\meta{n}|}|.
+% Syntax: \cs{selectrandomly}\marg{filename}\meta{n}.
% \begin{macrocode}
-\newcommand{\selectrandomly}[2]{%
+\newcommand*{\selectrandomly}[2]{%
\global\@probselN=#2\relax
\global\@probN=0\relax
\selectrandomtrue
\firstpasstrue
\input{#1}%
\ifnum\@probselN>\@probN
-\PackageError{probsoln}{Requested number too large}%
-{You have asked for \the\@probselN \space problems, but there are only
-\the\@probN \space problems defined in the file #1. I will only select \the\@probN \space
-problems.}%
-\global\@probselN=\@probN
+ \PackageError{probsoln}{Requested number too large}%
+ {You have asked for \the\@probselN \space problems,
+ but there are only \the\@probN \space problems defined in the
+ file #1. I will only select \the\@probN \space
+ problems.}%
+ \global\@probselN=\@probN
\fi
\shuffle{@problabel}{\@probN}%
\firstpassfalse
@@ -798,26 +829,32 @@ problems.}%
}%
}
% \end{macrocode}
+%\end{macro}
+%\begin{macro}{\PSNitem}
% What to do at start and end of each randomly selected item:
% (I may turn this into a normal environment at a later date. At the
% moment, I have kept \verb|\PSNitem| for compatibility with earlier
% versions.)
% \begin{macrocode}
-\newcommand{\PSNitem}{\item}
+\newcommand*{\PSNitem}{\item}
\@ifundefined{endPSNitem}{\def\endPSNitem{}}{%
\PackageError{probsoln}{\string\endPSitem\ already defined}{}}
% \end{macrocode}
+%\end{macro}
+%\begin{macro}{\solutionname}
% How to display each solution
% \begin{macrocode}
-\providecommand{\solutionname}{Solution}
+\providecommand*{\solutionname}{Solution}
\@ifundefined{solution}{%
\newenvironment{solution}{\par\noindent\textbf{\solutionname:} }{}}{%
}
% \end{macrocode}
+%\end{macro}
+%\begin{macro}{\checkselected}
% Check to see if label has been selected
% \begin{macrocode}
\newcount\@ckselctr
-\newcommand{\checkselected}[1]{%
+\newcommand*{\checkselected}[1]{%
\selectedfalse
\@ckselctr=1\relax
\whiledo{\@ckselctr < \@probselN \TE@or \@ckselctr = \@probselN}{%
@@ -827,6 +864,8 @@ problems.}%
}%
}
% \end{macrocode}
+%\end{macro}
+%\begin{macro}{\shuffle}
% Shuffle contents of pseudo-array. For example, suppose you have
% the following definitions: |\def\fooi{A}|, |\def\fooii{B}| and
% |\def\fooiii{C}|, then |\shuffle{foo}{3}| will shuffle the
@@ -840,18 +879,20 @@ problems.}%
\PSNrandom{\@shfA}{#2}\PSNrandom{\@shfB}{#2}%
\ifnum\@shfA=\@shfB
\else
-\edef\@@tmpA{\csname#1\romannumeral\@shfA\endcsname}%
-\let\@tmpA=\@@tmpA
-\edef\@@tmpB{\csname#1\romannumeral\@shfB\endcsname}%
-\let\@tmpB=\@@tmpB
-\expandafter\xdef\csname#1\romannumeral\@shfA\endcsname{\@tmpB}%
-\expandafter\xdef\csname#1\romannumeral\@shfB\endcsname{\@tmpA}%
+ \edef\@@tmpA{\csname#1\romannumeral\@shfA\endcsname}%
+ \let\@tmpA=\@@tmpA
+ \edef\@@tmpB{\csname#1\romannumeral\@shfB\endcsname}%
+ \let\@tmpB=\@@tmpB
+ \expandafter\xdef\csname#1\romannumeral\@shfA\endcsname{\@tmpB}%
+ \expandafter\xdef\csname#1\romannumeral\@shfB\endcsname{\@tmpA}%
\fi
\advance\@shfctr by 1\relax
}%
}
% \end{macrocode}
-% Syntax: |\doforrandN{|\meta{n}|}{|\meta{cmd}|}{|\meta{list}|}{|\meta{text}|}|.
+%\end{macro}
+%\begin{macro}{\doforrandN}
+% Syntax: \cs{doforrandN}\marg{n}\marg{cmd}\marg{list}\marg{text}.
% A bit like |\@for| but only for a random subset of the given list.
% For example,
%\begin{verbatim}
@@ -885,6 +926,7 @@ are only \number\@ps@forrand item(s) in the list}%
\fi
}}
% \end{macrocode}
+%\end{macro}
%\iffalse
% \begin{macrocode}
%</probsoln.sty>
diff --git a/Master/texmf-dist/source/latex/probsoln/probsoln.ins b/Master/texmf-dist/source/latex/probsoln/probsoln.ins
index 68fbc99f748..d38d1a5f179 100644
--- a/Master/texmf-dist/source/latex/probsoln/probsoln.ins
+++ b/Master/texmf-dist/source/latex/probsoln/probsoln.ins
@@ -1,13 +1,25 @@
-% probsoln.ins generated using makedtx version 0.91b 2007/7/18 20:23
+% probsoln.ins generated using makedtx version 0.94b 2007/8/21 16:58
\input docstrip
\preamble
-Copyright (C) 2007 Nicola Talbot, all rights reserved.
-If you modify this file, you must change its name first.
-You are NOT ALLOWED to distribute this file alone. You are NOT
-ALLOWED to take money for the distribution or use of either this
-file or a changed version, except for a nominal charge for copying
-etc.
+
+ probsoln.dtx
+ Copyright 2007 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 file probsoln.sty.
+
\endpreamble
\askforoverwritefalse
diff --git a/Master/texmf-dist/tex/latex/probsoln/probsoln.sty b/Master/texmf-dist/tex/latex/probsoln/probsoln.sty
index 7c6589c6395..768917f9a96 100644
--- a/Master/texmf-dist/tex/latex/probsoln/probsoln.sty
+++ b/Master/texmf-dist/tex/latex/probsoln/probsoln.sty
@@ -5,12 +5,24 @@
%% The original source files were:
%%
%% probsoln.dtx (with options: `probsoln.sty,package')
-%% Copyright (C) 2007 Nicola Talbot, all rights reserved.
-%% If you modify this file, you must change its name first.
-%% You are NOT ALLOWED to distribute this file alone. You are NOT
-%% ALLOWED to take money for the distribution or use of either this
-%% file or a changed version, except for a nominal charge for copying
-%% etc.
+%%
+%% probsoln.dtx
+%% Copyright 2007 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 file probsoln.sty.
+%%
%% \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
@@ -27,11 +39,11 @@
%% Grave accent \` Left brace \{ Vertical bar \|
%% Right brace \} Tilde \~}
\NeedsTeXFormat{LaTeX2e}
-\ProvidesPackage{probsoln}[2006/06/20 v2.03 Problems and their Solutions Package (NLCT)]
+\ProvidesPackage{probsoln}[2007/08/21 v2.04 Problems and their Solutions Package (NLCT)]
\RequirePackage{ifthen}
\provideboolean{showanswers}
-\newcommand{\showanswers}{\showanswerstrue}
-\newcommand{\hideanswers}{\showanswersfalse}
+\let\showanswers=\showanswerstrue
+\let\hideanswers=\showanswersfalse
\DeclareOption{answers}{\showanswerstrue}
\DeclareOption{noanswers}{\showanswersfalse}
\ExecuteOptions{noanswers}
@@ -109,26 +121,26 @@
}
\fi
}
-\newcommand{\useproblem}[1]{%
+\newcommand*{\useproblem}[1]{%
\@ifundefined{@prob@#1}{%
\PackageError{probsoln}{Label #1 undefined}%
-{Can't find problem defined with label identifier '#1'}%
+{Can't find problem defined with label identifier `#1'}%
}{\csname @prob@#1\endcsname}%
}
\newcount\@probN \newcount\@probselN \newcount\@rndselctr
\newcount\r@ndcur
\newcount\@ps@randtmp
\r@ndcur=1\relax
-\newcommand{\PSNrandseed}[1]{%
+\newcommand*{\PSNrandseed}[1]{%
\ifnum#1=0\relax
-\PackageWarning{probsoln}{Can't have 0 as random seed, changing to 1}%
-\r@ndcur=1\relax
+ \PackageWarning{probsoln}{Can't have 0 as random seed, changing to 1}%
+ \r@ndcur=1\relax
\else
-\r@ndcur=#1\relax
+ \r@ndcur=#1\relax
\fi
-\PackageInfo{probsoln}{Random Seed = \the\r@ndcur}%
+\PackageInfo{probsoln}{Random Seed = \number\r@ndcur}%
}
-\newcommand{\PSNrand}{%
+\newcommand*{\PSNrand}{%
\@ps@randtmp=\r@ndcur
\multiply\@ps@randtmp by 16807\relax
\r@ndcur=\@ps@randtmp
@@ -149,14 +161,14 @@
}
\newcommand{\random}[3]{%
\ifnum#2=1\relax
-\PSNrandom{\value{#1}}{#3}%
+ \PSNrandom{\value{#1}}{#3}%
\else
-\@rndselctr=#3%
-\advance\@rndselctr by -#2\relax
-\advance\@rndselctr by 1\relax
-\PSNrandom{\value{#1}}{\@rndselctr}%
-\addtocounter{#1}{#2}%
-\addtocounter{#1}{-1}%
+ \@rndselctr=#3%
+ \advance\@rndselctr by -#2\relax
+ \advance\@rndselctr by 1\relax
+ \PSNrandom{\value{#1}}{\@rndselctr}%
+ \addtocounter{#1}{#2}%
+ \addtocounter{#1}{-1}%
\fi
}
\newcommand*{\selectallproblems}[1]{%
@@ -174,18 +186,19 @@
\PSNitem \expandafter\useproblem\@probargs \endPSNitem
\global\advance\@rndselctr by 1\relax
}}
-\newcommand{\selectrandomly}[2]{%
+\newcommand*{\selectrandomly}[2]{%
\global\@probselN=#2\relax
\global\@probN=0\relax
\selectrandomtrue
\firstpasstrue
\input{#1}%
\ifnum\@probselN>\@probN
-\PackageError{probsoln}{Requested number too large}%
-{You have asked for \the\@probselN \space problems, but there are only
-\the\@probN \space problems defined in the file #1. I will only select \the\@probN \space
-problems.}%
-\global\@probselN=\@probN
+ \PackageError{probsoln}{Requested number too large}%
+ {You have asked for \the\@probselN \space problems,
+ but there are only \the\@probN \space problems defined in the
+ file #1. I will only select \the\@probN \space
+ problems.}%
+ \global\@probselN=\@probN
\fi
\shuffle{@problabel}{\@probN}%
\firstpassfalse
@@ -199,15 +212,15 @@ problems.}%
\global\advance\@rndselctr by 1\relax
}%
}
-\newcommand{\PSNitem}{\item}
+\newcommand*{\PSNitem}{\item}
\@ifundefined{endPSNitem}{\def\endPSNitem{}}{%
\PackageError{probsoln}{\string\endPSitem\ already defined}{}}
-\providecommand{\solutionname}{Solution}
+\providecommand*{\solutionname}{Solution}
\@ifundefined{solution}{%
\newenvironment{solution}{\par\noindent\textbf{\solutionname:} }{}}{%
}
\newcount\@ckselctr
-\newcommand{\checkselected}[1]{%
+\newcommand*{\checkselected}[1]{%
\selectedfalse
\@ckselctr=1\relax
\whiledo{\@ckselctr < \@probselN \TE@or \@ckselctr = \@probselN}{%
@@ -223,12 +236,12 @@ problems.}%
\PSNrandom{\@shfA}{#2}\PSNrandom{\@shfB}{#2}%
\ifnum\@shfA=\@shfB
\else
-\edef\@@tmpA{\csname#1\romannumeral\@shfA\endcsname}%
-\let\@tmpA=\@@tmpA
-\edef\@@tmpB{\csname#1\romannumeral\@shfB\endcsname}%
-\let\@tmpB=\@@tmpB
-\expandafter\xdef\csname#1\romannumeral\@shfA\endcsname{\@tmpB}%
-\expandafter\xdef\csname#1\romannumeral\@shfB\endcsname{\@tmpA}%
+ \edef\@@tmpA{\csname#1\romannumeral\@shfA\endcsname}%
+ \let\@tmpA=\@@tmpA
+ \edef\@@tmpB{\csname#1\romannumeral\@shfB\endcsname}%
+ \let\@tmpB=\@@tmpB
+ \expandafter\xdef\csname#1\romannumeral\@shfA\endcsname{\@tmpB}%
+ \expandafter\xdef\csname#1\romannumeral\@shfB\endcsname{\@tmpA}%
\fi
\advance\@shfctr by 1\relax
}%