From 5b3b0129bbe562139349fc1a231988ccccac589d Mon Sep 17 00:00:00 2001 From: Karl Berry Date: Fri, 24 Aug 2007 18:34:51 +0000 Subject: probsoln update (21aug07) git-svn-id: svn://tug.org/texlive/trunk@4796 c570f23f-e606-0410-a88d-b1316a301751 --- Master/texmf-dist/doc/latex/probsoln/CHANGES | 2 + Master/texmf-dist/doc/latex/probsoln/README | 4 +- .../doc/latex/probsoln/probsoln-manual.html | 752 +++++++++++++++++++++ Master/texmf-dist/doc/latex/probsoln/probsoln.pdf | Bin 153769 -> 153651 bytes 4 files changed, 756 insertions(+), 2 deletions(-) create mode 100644 Master/texmf-dist/doc/latex/probsoln/probsoln-manual.html (limited to 'Master/texmf-dist/doc') 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 @@ + + + + + +probsoln.sty v2.04: LATEX2e Package to help create problem sheets + + + + + + + + + + + + + + +

probsoln.sty v2.04: LATEX2e Package to help create problem sheets

+

Nicola L.C. Talbot

+

21st August 2007

+
+ +

+Contents +

+ + + + +

+ +

+Introduction +

+The probsoln 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 LATEX, and then select a number of problems to +typeset. This means that once the database has been set up, +each year you can easily create a new problem sheet that is +sufficiently different from the previous year, thus +preventing the temptation of current students seeking out +the previous year's students, and checking out their +answers. There is also an option that can be passed to the +package to determine whether or not the solutions should be +printed. In this way, one file can either produce the +student's version or the teacher's version. + +

+ +

+Package Options +

+The following options may be passed to this package: +
+ + + + + + + +
answers Show the answers
noanswers Don't show the answers (default)
+
+ +

+ +

+Creating a New Problem +

+ +newproblem[nargs]{label}{problem}{solution} +
+
+A new problem is defined using the command +\newproblem. 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): +
+
+newproblem*[nargs]{label}{problem} +
+
+The argument label is +a unique string that is assigned to this problem so that it +can be used later. The argument problem is normal +LATEX code that should be used to typeset the problem. +The argument solution is normal LATEX code that +should be used to typeset the solution, if required. For +example, the following defines a problem with the label +quaddiff: +
+ \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}
+ }
+
+The following is an essay question, so doesn't come with a solution: +
+\newproblem*{inheritance}{Describe what is meant by the term 
+\emph{inheritance} in object-oriented programming. Use examples.}
+
+ +

+The optional argument nargs 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 #1, #2, ..., #9. +For example, the following problem, labelled sindiff, +takes one parameter: +

+\newproblem[1]{sindiff}{%
+\(f(x) = \sin(#1x)\)
+}{%
+\(f'(x) = #1\cos(#1x)\)
+}
+
+ +

+The quaddiff problem shown above can be made more +generic by using parameters: +

+\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>0 \ifnum#1=0 \else + \fi \fi
+\ifnum#2=1\else#2\fi x 
+\fi
+\ifnum#3=0
+\else
+\ifnum#3>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>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 
+\)
+}
+
+The three parameters correspond to the coefficients. Note +that they must all be integers since TEX only performs +integer arithmetic. + +

+ +

+Creating a Database +

+ +

+To generate a database, simply create a .tex file +where all the problems are defined using newproblem or +newproblem*, +and either \input it at the start of your document if +you want to use specific problems, or pass it to +\selectrandomly. This package +comes with some sample databases, along with some sample documents +that use these databases. + +

+ +

+ +
+Displaying a Problem +

+ +useproblem{label} +
+
+Once a problem has been defined using newproblem, it +can be typeset using the command \useproblem. If the +problem was defined to take arguments, the arguments to the +problem should come after the label. In the case of the +sindiff example above, the command +\useproblem{sindiff}{2} would produce the following: +
+
f(x) = sin(2x) + +

+Solution: +

f'(x) = 2cos(2x) +
+
+whereas the command \useproblem{diff:quad}{3}{0}{-2} would produce: +
+
f(x) = 3x2 - 2 + +

+Solution: +

f'(x) = 6x +
+
+ +

+Suppose all the above problems are defined in the file +probs.tex, then the following code will create a +problem sheet with four questions in it: +

+\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}
+
+The answer sheet can then be generated by passing the option +answers to the probsoln package. + +

+ +

+Selecting All Problems +

+ +

+To select all problems defined in a database, in the order in +which they were defined, use the command: + +selectallproblems{filename} +For example, suppose the problems are defined in the file +easy.tex, then the following will create a problem sheet +which uses all these problems: +

+\documentclass[a4paper]{article}
+
+\usepackage{probsoln}
+
+\begin{document}
+Differentiate the following functions:
+\begin{enumerate}
+\selectallproblems{easy}
+\end{enumerate}
+\end{document}
+
+ +

+ +

+ +
+Selecting Problems at Random +

+ +selectrandomly{filename}{n} +
+
+The command \selectrandomly will select n +problems that are defined in the file filename. Each +problem is proceeded by +PSitem which is +defined to be \item, so the command +\selectrandomly should occur within one of the +list-like environments, such as enumerate. +For example: +
+\begin{enumerate}
+\selectrandomly{easy.tex}{4}
+\end{enumerate}
+
+will result in four numbered problems, selected at random +from the file easy.tex. (The .tex extension +may be omitted.) Each problem is followed by the command +endPSNitem which by default does nothing. + +

+Multiple \selectrandomly commands may be used, however a +different file must be used each time. For +example: +

+\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}
+
+This will result in a total of 6 problems, numbered 1(a), +1(b), 1(c), 1(d), 2 and 3. + +

+If a randomly selected problem requires arguments, a message +similar to the following will be displayed: +

+Problem diff:quad requires 3 argument(s), please specify (e.g. {5}{3}):
+
+Enter the required arguments, where each argument is +enclosed in braces ({ }). + +

+ +

+Other Commands +

+ +The command PSNrandseed{n} specifies +the seed for the random number generator. For example, +if you are using selectrandomly, +\PSNrandseed{\year} will produce a different set of +problems each year, whereas \PSNrandseed{\time} +will produce a different set of problems each time you +LATEX the problem sheet (as long as you leave at least a +minute between runs.) + +

+The command random{counter}{a}{b} +generates a random number from a to b and +stores it in the LATEX counter counter. For example, +to select 2, 3 or 4 problems from the file +implicit.tex: +

+\newcounter{numproblems}
+\begin{enumerate}
+\random{numproblems}{2}{4}
+\selectrandomly{implicit.tex}{\value{numproblems}}
+\end{enumerate}
+
+(Note the use of \value.) + +

+This command can also be used to generate random values for +problems that take arguments. Consider the problem diff:quad +defined earlier. Three counters can be defined to represent the +three coefficients: +

+\newcounter{A}
+\newcounter{B}
+\newcounter{C}
+
+Random values can now be assigned to these counters: +
+\random{A}{-5}{5}
+\random{B}{-5}{5}
+\random{C}{-5}{5}
+
+Finally, the problem can be used (note the use of \arabic): +
+\useproblem{diff:quad}{\arabic{A}}{\arabic{B}}{\arabic{C}}
+
+ +

+The command +doforrandN{n}{cmd}{list}{text} will apply +text for a random selection of n items in the +comma separated list. In each iteration the list +item is denoted by cmd. For example, suppose you +have three files called file1.tex, +file2.tex and file3.tex, and you want to +select 1 problem from two of the three files, then you can +do: +

+\doforrandN{2}{\file}{file1,file2,file3}{\selectrandomly{\file}{1}}
+
+Note that it is also possible to do +
+\newcounter{numproblems}
+\random{numproblems}{1}{3}
+\selectrandomly{file\arabic{numproblems}}{1}
+\random{numproblems}{1}{3}
+\selectrandomly{file\arabic{numproblems}}{1}
+
+however there is a possibility that the same file may be +selected twice which will cause an error. + +

+The command showanswers will show the solutions from +that point on. May be localised by placing within a group. + +

+The command hideanswers will hide the solutions from +that point on. May be localised by placing within a group. + +

+The solution is placed inside the solution +environment. By default this environment simply does +\par\noindent\textbf{\solutionname:} at the start, where +solutionname +has the value: Solution. See the file sample3.tex, 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 tabmchoice.tex, and displays them +in a longtable environment. As from version 2.03, the package +will not define this environment if another package or class file has +already defined it. + +

+The boolean variable showanswers is defined to be +true if the answers are shown and false otherwise. You can +therefore do something like: +

+\ifthenelse{\boolean{showanswers}}{\textbf{Solution Sheet}}{}
+
+and Solution Sheet will be printed only if the +answers are displayed. (For more information on +\ifthenelse and \boolean see the +documentation for the ifthen package by +David Carlisle.) + +

+The showanswers 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: +

+\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}
+}
+
+If the solutions are not displayed, the question will appear +as +
+
+
Which of the following is the derivative of +xsin(x)? +(Circle the correct answer.) +
+
A
+
sin(x) +
+
B
+
xcos(x) +
+
C
+
sin(x)+xcos(x) +
+
+
+
+otherwise it will appear as: +
+
+
Which of the following is the derivative of +xsin(x)? +(Circle the correct answer.) +
+
A
+
sin(x) +
+
B
+
xcos(x) +
+
©
+
sin(x) + xcos(x) (product rule) +
+
+
+
+ +

+ +

+Troubleshooting +

+ +

+Unexpected Output +

+ + + +

+ +

+Error Messages +

+ + + +

+ +

+Contact Details +

+Dr Nicola Talbot +
+School of Computing Sciences +
+University of East Anglia +
+Norwich. NR4 7TJ +
http://theoval.cmp.uea.ac.uk/~nlct/ +

+
+ +

+Index +

+
\arabic +
Other Commands +
\boolean +
Other Commands +
\doforrandN +
Other Commands +
\endPSNitem +
Selecting Problems at Random +
\hideanswers +
Other Commands +
\iffirstpass +
Error Messages +
\ifthenelse +
Other Commands +
\input +
Creating a Database + | Error Messages + | Error Messages + | Error Messages +
\item +
Selecting Problems at Random + | Error Messages + | Error Messages +
\newproblem +
Creating a New Problem + | Creating a New Problem + | Creating a Database + | Displaying a Problem + | Error Messages + | Error Messages +
\newproblem* +
Creating a New Problem + | Creating a Database +
\PSitem +
Selecting Problems at Random +
\PSNitem +
Error Messages + | Error Messages +
\PSNrandseed +
Other Commands +
\random +
Other Commands +
\selectallproblems +
Selecting All Problems +
\selectrandomly +
Creating a Database + | Creating a Database + | Selecting Problems at Random + | Selecting Problems at Random + | Selecting Problems at Random + | Selecting Problems at Random + | Other Commands + | Unexpected Output + | Unexpected Output + | Error Messages + | Error Messages + | Error Messages +
\showanswers +
Other Commands +
\solutionname +
Other Commands +
\useproblem +
Displaying a Problem + | Displaying a Problem +
\value +
Other Commands + +
+

+
+Nicola L. C. Talbot. +School of Computing Sciences. +University of East Anglia. +Last Modified: 2007-08-21 +
+ + diff --git a/Master/texmf-dist/doc/latex/probsoln/probsoln.pdf b/Master/texmf-dist/doc/latex/probsoln/probsoln.pdf index 6230fab1c62..958fa8996a8 100644 Binary files a/Master/texmf-dist/doc/latex/probsoln/probsoln.pdf and b/Master/texmf-dist/doc/latex/probsoln/probsoln.pdf differ -- cgit v1.2.3