diff options
author | Karl Berry <karl@freefriends.org> | 2007-07-28 00:29:08 +0000 |
---|---|---|
committer | Karl Berry <karl@freefriends.org> | 2007-07-28 00:29:08 +0000 |
commit | 59e589a13e8de3ebc58828416bdd1eb4269b7bd2 (patch) | |
tree | 78564d8ec87320790f651149217dcb4d9eec7ea4 | |
parent | aea330a2bc712291777bdb4bf73fe68b594227ff (diff) |
probsoln 2.03 (18jul07)
git-svn-id: svn://tug.org/texlive/trunk@4672 c570f23f-e606-0410-a88d-b1316a301751
19 files changed, 186 insertions, 1569 deletions
diff --git a/Build/cdbuild/ctan2tds.pl b/Build/cdbuild/ctan2tds.pl index 7430e045cde..0be0cbe1b34 100755 --- a/Build/cdbuild/ctan2tds.pl +++ b/Build/cdbuild/ctan2tds.pl @@ -243,6 +243,7 @@ chdir $startdir || die "chdir($startdir) failed: $!"; 'pl-qx', "&MAKEplqx", 'poster', "print \"skipping poster, nonfree license\"", 'powerdot', '&MAKEflatten', + 'probsoln', '&MAKEflatten', 'prosper', '&MAKEflatten', 'ps4pdf', "print \"skipping ps4pdf, obsolete\"", 'psfragx', "&MAKEflatten", diff --git a/Master/texmf-dist/doc/latex/probsoln/1stprncp.tex b/Master/texmf-dist/doc/latex/probsoln/1stprncp.tex index d7ccacdcda3..f857392a6ef 100644 --- a/Master/texmf-dist/doc/latex/probsoln/1stprncp.tex +++ b/Master/texmf-dist/doc/latex/probsoln/1stprncp.tex @@ -1,31 +1,4 @@ -%% -%% This is file `1stprncp.tex', -%% generated with the docstrip utility. -%% -%% The original source files were: -%% -%% probsoln.dtx (with options: `1stprncp.tex,package') -%% Copyright (C) 2006 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. -%% \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 \~} +% These all involve differentiating from 1st principles \newproblem{dfp:xcube}{% Differentiate $f(x) = x^3$ with respect to $x$ by first principles.}{% @@ -71,7 +44,7 @@ Differentiate from first principles $f(x) = c$ where $c$ is a constant.}{% \end{eqnarray*}} \newproblem{dfp:cosx}{% -Given +Given \begin{eqnarray*} \lim_{x \rightarrow 0} \frac{\cos x - 1}{x} & = & 0\\ \lim_{x \rightarrow 0} \frac{\sin x}{x} & = & 1 @@ -82,10 +55,7 @@ differentiate from first principles $f(x) = \cos x$.}{% & = & \lim_{\Delta x \rightarrow 0} \frac{\cos(x + \Delta x) - \cos(x)}{\Delta x}\\ & = & \lim_{\Delta x \rightarrow 0} \frac{\cos x\cos\Delta x - \sin x\sin\Delta x - \cos x}{\Delta x}\\ & = & \lim_{\Delta x \rightarrow 0} \frac{\cos x(\cos\Delta x - 1) - \sin x\sin\Delta x}{\Delta x}\\ - & = & \cos x\lim_{\Delta x \rightarrow 0}\frac{\cos\Delta x - 1}{\Delta x} + & = & \cos x\lim_{\Delta x \rightarrow 0}\frac{\cos\Delta x - 1}{\Delta x} - \sin x\lim_{\Delta x \rightarrow 0}\frac{\sin\Delta x}{\Delta x}\\ & = & -1 \qquad\mbox{(using given results)} \end{eqnarray*}} -\endinput -%% -%% End of file `1stprncp.tex'. diff --git a/Master/texmf-dist/doc/latex/probsoln/CHANGES b/Master/texmf-dist/doc/latex/probsoln/CHANGES index 288adf8bb83..6485349bb28 100644 --- a/Master/texmf-dist/doc/latex/probsoln/CHANGES +++ b/Master/texmf-dist/doc/latex/probsoln/CHANGES @@ -1,5 +1,8 @@ probsoln package versions: +Version 2.03: Added starred form of \newproblem for problems without +solutions. Checks to see if solution environment is already defined. + Version 2.02: Added \selectallproblems which selects all the problems in a given database, in the order in which they were defined. diff --git a/Master/texmf-dist/doc/latex/probsoln/README b/Master/texmf-dist/doc/latex/probsoln/README index 77653261977..431f3f5a08f 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.02 +LaTeX Package : probsoln v 2.03 -Last Modified : 2 Mar 2006 +Last Modified : 20 June 2006 Author : Nicola L.C. Talbot diff --git a/Master/texmf-dist/doc/latex/probsoln/args.tex b/Master/texmf-dist/doc/latex/probsoln/args.tex index af1ee73778b..e3bd7de75ec 100644 --- a/Master/texmf-dist/doc/latex/probsoln/args.tex +++ b/Master/texmf-dist/doc/latex/probsoln/args.tex @@ -1,43 +1,18 @@ -%% -%% This is file `args.tex', -%% generated with the docstrip utility. -%% -%% The original source files were: -%% -%% probsoln.dtx (with options: `args.tex,package') -%% Copyright (C) 2006 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. -%% \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 \~} +% These problems require arguments +% Arguments: #1->a_2, #2->a_1 and #3->a_0 +% (Arguments must be integers) \newcount\ctr \newproblem[3]{diff:quad}{% -\(f(x) = +\(f(x) = \ifnum#1=0 \else -\ifnum#1=1\else#1\fi x^2 +\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 +\ifnum#2=1\else#2\fi x \fi \ifnum#3=0 \else @@ -45,19 +20,20 @@ #3 \fi\) }{% -\(f'(x) = +\(f'(x) = \ifnum#1=0 \else \ctr=2 \multiply\ctr by #1 -\the\ctr x +\the\ctr x \fi \ifnum#2=0 \else \ifnum#2>0 \ifnum#1=0 \else + \fi \fi #2 \fi -\ifnum#1=0 \ifnum#2=0 0 \fi\fi +% print 0 if both #1 and #2 are 0 +\ifnum#1=0 \ifnum#2=0 0 \fi\fi \) } @@ -67,6 +43,3 @@ \(f'(x) = #1\cos(#1x)\) } -\endinput -%% -%% End of file `args.tex'. diff --git a/Master/texmf-dist/doc/latex/probsoln/easy.tex b/Master/texmf-dist/doc/latex/probsoln/easy.tex index dd2d1ba160b..3106fcfdb9a 100644 --- a/Master/texmf-dist/doc/latex/probsoln/easy.tex +++ b/Master/texmf-dist/doc/latex/probsoln/easy.tex @@ -1,31 +1,4 @@ -%% -%% This is file `easy.tex', -%% generated with the docstrip utility. -%% -%% The original source files were: -%% -%% probsoln.dtx (with options: `easy.tex,package') -%% Copyright (C) 2006 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. -%% \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 \~} +% These are all easy differentiation problems \newproblem{diffeasy:gpowh}{% \(f(x) = g(x)^{h(x)}.\)}{% @@ -110,6 +83,3 @@ f'(x) & = & g'(x)\ln(g(x)) + \frac{g(x)}{g(x)}g'(x)\\ $y = \frac{\sin x}{x}$.}{% \[\frac{dy}{dx} = \frac{\cos x}{x} - \frac{\sin x}{x^2}\]} -\endinput -%% -%% End of file `easy.tex'. diff --git a/Master/texmf-dist/doc/latex/probsoln/implicit.tex b/Master/texmf-dist/doc/latex/probsoln/implicit.tex index f6b706871cd..00453df3045 100644 --- a/Master/texmf-dist/doc/latex/probsoln/implicit.tex +++ b/Master/texmf-dist/doc/latex/probsoln/implicit.tex @@ -1,31 +1,4 @@ -%% -%% This is file `implicit.tex', -%% generated with the docstrip utility. -%% -%% The original source files were: -%% -%% probsoln.dtx (with options: `implicit.tex,package') -%% Copyright (C) 2006 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. -%% \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 \~} +% These are all implicit differentiation problems \newproblem{imd:circ}{% Find the gradient of the unit circle ($x^2 + y^2 = 1$).}{% @@ -66,6 +39,3 @@ xe^{xy}\frac{dy}{dx} - \frac{dy}{dx} & = & 2 - ye^{xy} \\ \frac{dy}{dx}(xe^{xy}-1) & = & 2 - ye^{xy}\\ \frac{dy}{dx} & = & \frac{2-ye^{xy}}{xe^{xy}-1} \end{eqnarray*}} -\endinput -%% -%% End of file `implicit.tex'. diff --git a/Master/texmf-dist/doc/latex/probsoln/manual.html b/Master/texmf-dist/doc/latex/probsoln/manual.html deleted file mode 100644 index 8ba716bf93d..00000000000 --- a/Master/texmf-dist/doc/latex/probsoln/manual.html +++ /dev/null @@ -1,742 +0,0 @@ -<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 3.2 Final//EN"> - -<!--Converted with LaTeX2HTML 2002-2-1 (1.70) -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.02: LATEX2e Package to help create problem sheets</TITLE> -<META NAME="description" CONTENT="probsoln.sty v2.02: LATEX2e Package to help create problem sheets"> -<META NAME="keywords" CONTENT="manual"> -<META NAME="resource-type" CONTENT="document"> -<META NAME="distribution" CONTENT="global"> - -<META NAME="Generator" CONTENT="LaTeX2HTML v2002-2-1"> -<META HTTP-EQUIV="Content-Style-Type" CONTENT="text/css"> - - -</HEAD> - -<BODY > -<A NAME="tex2html1" - HREF="http://theoval.cmp.uea.ac.uk/~nlct/">Dr Nicola Talbot</A> -| -<A NAME="tex2html2" - HREF="http://www.cmp.uea.ac.uk/">School of Computing Sciences</A> -| -<A NAME="tex2html3" - HREF="http://www.uea.ac.uk/">University of East Anglia</A> - -<P> - - <H1 ALIGN="CENTER">probsoln.sty v2.02: L<SUP><SMALL>A</SMALL></SUP>T<SMALL>E</SMALL>X2<SUB>e</SUB> Package to help create problem sheets</H1> -<DIV> - -<P ALIGN="CENTER"><STRONG>Nicola L.C. Talbot</STRONG></P> -<P ALIGN="CENTER"><STRONG>2nd March 2006</STRONG></P> -</DIV> - <BR> - -<H2><A NAME="SECTION00010000000000000000"> -Contents</A> -</H2> -<!--Table of Contents--> - -<UL> -<LI><A NAME="tex2html21" - HREF="manual.html#SECTION00020000000000000000">Introduction</A> -<LI><A NAME="tex2html22" - HREF="manual.html#SECTION00030000000000000000">Package Options</A> -<LI><A NAME="tex2html23" - HREF="manual.html#SECTION00040000000000000000">Creating a New Problem</A> -<LI><A NAME="tex2html24" - HREF="manual.html#SECTION00050000000000000000">Creating a Database</A> -<LI><A NAME="tex2html25" - HREF="manual.html#SECTION00060000000000000000">Displaying a Problem</A> -<LI><A NAME="tex2html26" - HREF="manual.html#SECTION00070000000000000000">Selecting All Problems</A> -<LI><A NAME="tex2html27" - HREF="manual.html#SECTION00080000000000000000">Selecting Problems at Random</A> -<LI><A NAME="tex2html28" - HREF="manual.html#SECTION00090000000000000000">Other Commands</A> -<LI><A NAME="tex2html29" - HREF="manual.html#SECTION000100000000000000000">Troubleshooting</A> -<UL> -<LI><A NAME="tex2html30" - HREF="manual.html#SECTION000101000000000000000">Unexpected Output</A> -<LI><A NAME="tex2html31" - HREF="manual.html#SECTION000102000000000000000">Error Messages</A> -</UL> -<BR> -<LI><A NAME="tex2html32" - HREF="manual.html#SECTION000110000000000000000">Contact Details</A> -<LI><A NAME="tex2html33" - HREF="manual.html#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="393"></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>\newproblem</TT><A NAME="397"></A>. This does not print anything, -but merely stores the problem. 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> - -<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>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 -\) -} -</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="412"></A></A>, -and either <TT>\input</TT><A NAME="416"></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>\selectrandomly</TT><A NAME="424"></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="429"></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="435"></A></A>, it -can be typeset using the command <TT>\useproblem</TT><A NAME="439"></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="447"></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="452"></A><code>{</code><I>filename</I><code>}{</code><I>n</I><code>}</code> -<BR> -<BR> -The command <TT>\selectrandomly</TT><A NAME="456"></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="461"></A> which is -defined to be <TT>\item</TT><A NAME="465"></A>, so the command -<TT>\selectrandomly</TT><A NAME="469"></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="474"></A> which by default does nothing. - -<P> -Multiple <TT>\selectrandomly</TT><A NAME="478"></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="483"></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="489"></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="494"></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>\value</TT><A NAME="498"></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>\arabic</TT><A NAME="505"></A>): -<PRE> -\useproblem{diff:quad}{\arabic{A}}{\arabic{B}}{\arabic{C}} -</PRE> - -<P> -The command -<A NAME="doforrandN"></A><TT>\doforrandN</TT><A NAME="510"></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="515"></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="520"></A> will hide the solutions from -that point on. May be localised by placing within a group. - -<P> -The solution is placed inside the solution<TT>solution</TT> -environment. By default this environment simply does -<code>\paragraph{\solutionname:}</code> at the start, where -<A NAME="solutionname"></A><TT>\solutionname</TT><A NAME="526"></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>. - -<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>\ifthenelse</TT><A NAME="531"></A> and <TT>\boolean</TT><A NAME="535"></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">©</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="541"></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="547"></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="553"></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>\input</TT><A NAME="557"></A>ed or randomly selected from the same file more -than once. (Or <TT>\input</TT><A NAME="561"></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>\input</TT><A NAME="565"></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>\item</TT><A NAME="569"></A>-perhaps missing list -environment. -</TT> - -<P> -Each problem selected using <A HREF="#selectrandomly"><TT>\selectrandomly</TT><A NAME="575"></A></A> is -proceeded by <A HREF="#PSNitem"><TT>\PSNitem</TT><A NAME="581"></A></A> which by default is defined -as <TT>\item</TT><A NAME="585"></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="591"></A></A>. - -<P> -</LI> -<LI>I get an error when I put a command definition in my database -when using <TT>\selectrandomly</TT><A NAME="595"></A>. - -<P> -<A HREF="#selectrandomly"><TT>\selectrandomly</TT><A NAME="601"></A></A> inputs the database twice, so any -command definition will be read twice, causing an error. You -can use the switch <TT>\iffirstpass</TT><A NAME="605"></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="611"></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="tex2html4" - 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>\arabic</TT></STRONG> -<DD><A HREF="manual.html#505">Other Commands</A> -<DT><STRONG><TT>\boolean</TT></STRONG> -<DD><A HREF="manual.html#535">Other Commands</A> -<DT><STRONG><TT>\doforrandN</TT></STRONG> -<DD><A HREF="manual.html#510">Other Commands</A> -<DT><STRONG><TT>\endPSNitem</TT></STRONG> -<DD><A HREF="manual.html#474">Selecting Problems at Random</A> -<DT><STRONG><TT>\hideanswers</TT></STRONG> -<DD><A HREF="manual.html#520">Other Commands</A> -<DT><STRONG><TT>\iffirstpass</TT></STRONG> -<DD><A HREF="manual.html#605">Error Messages</A> -<DT><STRONG><TT>\ifthenelse</TT></STRONG> -<DD><A HREF="manual.html#531">Other Commands</A> -<DT><STRONG><TT>\input</TT></STRONG> -<DD><A HREF="manual.html#416">Creating a Database</A> - | <A HREF="manual.html#557">Error Messages</A> - | <A HREF="manual.html#561">Error Messages</A> - | <A HREF="manual.html#565">Error Messages</A> -<DT><STRONG><TT>\item</TT></STRONG> -<DD><A HREF="manual.html#465">Selecting Problems at Random</A> - | <A HREF="manual.html#569">Error Messages</A> - | <A HREF="manual.html#585">Error Messages</A> -<DT><STRONG><TT>\newproblem</TT></STRONG> -<DD><A HREF="manual.html#393">Creating a New Problem</A> - | <A HREF="manual.html#397">Creating a New Problem</A> - | <A HREF="manual.html#412">Creating a Database</A> - | <A HREF="manual.html#435">Displaying a Problem</A> - | <A HREF="manual.html#553">Error Messages</A> - | <A HREF="manual.html#611">Error Messages</A> -<DT><STRONG><TT>\PSitem</TT></STRONG> -<DD><A HREF="manual.html#461">Selecting Problems at Random</A> -<DT><STRONG><TT>\PSNitem</TT></STRONG> -<DD><A HREF="manual.html#581">Error Messages</A> - | <A HREF="manual.html#591">Error Messages</A> -<DT><STRONG><TT>\PSNrandseed</TT></STRONG> -<DD><A HREF="manual.html#483">Other Commands</A> -<DT><STRONG><TT>\random</TT></STRONG> -<DD><A HREF="manual.html#494">Other Commands</A> -<DT><STRONG><TT>\selectallproblems</TT></STRONG> -<DD><A HREF="manual.html#447">Selecting All Problems</A> -<DT><STRONG><TT>\selectrandomly</TT></STRONG> -<DD><A HREF="manual.html#420">Creating a Database</A> - | <A HREF="manual.html#424">Creating a Database</A> - | <A HREF="manual.html#452">Selecting Problems at Random</A> - | <A HREF="manual.html#456">Selecting Problems at Random</A> - | <A HREF="manual.html#469">Selecting Problems at Random</A> - | <A HREF="manual.html#478">Selecting Problems at Random</A> - | <A HREF="manual.html#489">Other Commands</A> - | <A HREF="manual.html#541">Unexpected Output</A> - | <A HREF="manual.html#547">Unexpected Output</A> - | <A HREF="manual.html#575">Error Messages</A> - | <A HREF="manual.html#601">Error Messages</A> - | <A HREF="manual.html#595">Error Messages</A> -<DT><STRONG><TT>\showanswers</TT></STRONG> -<DD><A HREF="manual.html#515">Other Commands</A> -<DT><STRONG><TT>\solutionname</TT></STRONG> -<DD><A HREF="manual.html#526">Other Commands</A> -<DT><STRONG><TT>\useproblem</TT></STRONG> -<DD><A HREF="manual.html#429">Displaying a Problem</A> - | <A HREF="manual.html#439">Displaying a Problem</A> -<DT><STRONG><TT>\value</TT></STRONG> -<DD><A HREF="manual.html#498">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: 2006-03-02 -</ADDRESS> -</BODY> -</HTML> diff --git a/Master/texmf-dist/doc/latex/probsoln/mchoice.tex b/Master/texmf-dist/doc/latex/probsoln/mchoice.tex index 5f266bb3cd3..7add557a680 100644 --- a/Master/texmf-dist/doc/latex/probsoln/mchoice.tex +++ b/Master/texmf-dist/doc/latex/probsoln/mchoice.tex @@ -1,31 +1,3 @@ -%% -%% This is file `mchoice.tex', -%% generated with the docstrip utility. -%% -%% The original source files were: -%% -%% probsoln.dtx (with options: `mchoice.tex,package') -%% Copyright (C) 2006 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. -%% \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 \~} \newproblem{mc:prod}{% Which of the following is the derivative of $x\sin(x)$? (Circle the correct answer.) @@ -60,6 +32,3 @@ Which of the following is the derivative of $\frac{\sin(x)}{x}$? (quotient rule) \end{description} } -\endinput -%% -%% End of file `mchoice.tex'. diff --git a/Master/texmf-dist/doc/latex/probsoln/nosoln.tex b/Master/texmf-dist/doc/latex/probsoln/nosoln.tex new file mode 100644 index 00000000000..322701f965c --- /dev/null +++ b/Master/texmf-dist/doc/latex/probsoln/nosoln.tex @@ -0,0 +1,7 @@ +% these problems don't have solutions + +\newproblem*{oop}{Describe what is meant by object-oriented +programming.} + +\newproblem*{inheritance}{Describe what is meant by the term +\emph{inheritance} in object-oriented programming. Use examples.} diff --git a/Master/texmf-dist/doc/latex/probsoln/probsoln.pdf b/Master/texmf-dist/doc/latex/probsoln/probsoln.pdf Binary files differindex cab2b84791a..6230fab1c62 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/sample.tex b/Master/texmf-dist/doc/latex/probsoln/sample.tex index a21dd8e7042..472bd51276c 100644 --- a/Master/texmf-dist/doc/latex/probsoln/sample.tex +++ b/Master/texmf-dist/doc/latex/probsoln/sample.tex @@ -1,36 +1,11 @@ -%% -%% This is file `sample.tex', -%% generated with the docstrip utility. -%% -%% The original source files were: -%% -%% probsoln.dtx (with options: `sample.tex,package') -%% Copyright (C) 2006 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. -%% \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 \~} \documentclass[a4paper]{article} \usepackage{probsoln} +%uncomment the following line to display the answers \showanswers +% The following will generate a different set of +% problems in subsequent years \PSNrandseed{\year} \begin{document} @@ -39,6 +14,7 @@ \maketitle \begin{enumerate} +% Differentiation from first principles \selectrandomly{1stprncp}{1} \item Differentiate the following functions: @@ -46,11 +22,14 @@ \selectrandomly{easy}{5} \end{enumerate} +% Implicit differentiation \selectrandomly{implicit}{2} +% Multiple choice question \selectrandomly{mchoice}{1} + +% select one essay style question that doesn't come with a solution + +\selectrandomly{nosoln}{1} \end{enumerate} \end{document} -\endinput -%% -%% End of file `sample.tex'. diff --git a/Master/texmf-dist/doc/latex/probsoln/sample2.tex b/Master/texmf-dist/doc/latex/probsoln/sample2.tex index 2e1ea5b467a..abc7c0d7bd3 100644 --- a/Master/texmf-dist/doc/latex/probsoln/sample2.tex +++ b/Master/texmf-dist/doc/latex/probsoln/sample2.tex @@ -1,37 +1,16 @@ -%% -%% This is file `sample2.tex', -%% generated with the docstrip utility. -%% -%% The original source files were: -%% -%% probsoln.dtx (with options: `sample2.tex,package') -%% Copyright (C) 2006 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. -%% \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 \~} \documentclass[a4paper]{article} \usepackage{probsoln} +%uncomment the following line to display the answers \showanswers +% The following will generate a different set of +% problems in subsequent years +%\PSNrandseed{\year} +% The following will generate a different set of +% problems on every run (where each run is at +% least a minute apart from the previous one) \PSNrandseed{\time} \begin{document} @@ -42,8 +21,10 @@ \begin{enumerate} \newcounter{numproblems} +% store a random number from 1 to 3 in the counter numproblems \random{numproblems}{1}{3} +% selects 1,2 or 3 problems from 1 of the given files: \doforrandN{1}{\file}{1stprncp,implicit}{\selectrandomly{\file}{\value{numproblems}}} \item Differentiate the following functions: @@ -58,11 +39,9 @@ \item \useproblem{diff:quad}{\arabic{A}}{\arabic{B}}{\arabic{C}} \random{A}{-5}{5} +% make sure its not 0 \whiledo{\value{A}=0}{\random{A}{-5}{5}} \item \useproblem{diff:sin}{\arabic{A}} \end{enumerate} \end{enumerate} \end{document} -\endinput -%% -%% End of file `sample2.tex'. diff --git a/Master/texmf-dist/doc/latex/probsoln/sample3.tex b/Master/texmf-dist/doc/latex/probsoln/sample3.tex index ced57a52c51..0a605526fcf 100644 --- a/Master/texmf-dist/doc/latex/probsoln/sample3.tex +++ b/Master/texmf-dist/doc/latex/probsoln/sample3.tex @@ -1,36 +1,9 @@ -%% -%% This is file `sample3.tex', -%% generated with the docstrip utility. -%% -%% The original source files were: -%% -%% probsoln.dtx (with options: `sample3.tex,package') -%% Copyright (C) 2006 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. -%% \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 \~} \documentclass[a4paper]{article} \usepackage{longtable} \usepackage{probsoln} +%\showanswers \newcounter{problem} \renewcommand{\PSNitem}{\refstepcounter{problem}% @@ -44,11 +17,8 @@ \begin{document} \begin{longtable}{lrrrl} -\bfseries Question & \bfseries A & \bfseries B & +\bfseries Question & \bfseries A & \bfseries B & \bfseries C & \ifshowanswers \bfseries Reason\fi\\ \selectrandomly{tabmchoice}{2} \end{longtable} \end{document} -\endinput -%% -%% End of file `sample3.tex'. diff --git a/Master/texmf-dist/doc/latex/probsoln/sample4.tex b/Master/texmf-dist/doc/latex/probsoln/sample4.tex index 27019aa0a09..798214cfbd1 100644 --- a/Master/texmf-dist/doc/latex/probsoln/sample4.tex +++ b/Master/texmf-dist/doc/latex/probsoln/sample4.tex @@ -1,35 +1,10 @@ -%% -%% This is file `sample4.tex', -%% generated with the docstrip utility. -%% -%% The original source files were: -%% -%% probsoln.dtx (with options: `sample4.tex,package') -%% Copyright (C) 2006 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. -%% \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 \~} \documentclass[a4paper]{article} \usepackage{probsoln} +% Sample file illustrating use of \selectallproblems +% All problems defined in specified file will be used +% in order of definition \showanswers @@ -39,6 +14,3 @@ Differentiate the following functions: \selectallproblems{easy} \end{enumerate} \end{document} -\endinput -%% -%% End of file `sample4.tex'. diff --git a/Master/texmf-dist/doc/latex/probsoln/tabmchoice.tex b/Master/texmf-dist/doc/latex/probsoln/tabmchoice.tex index 80600c17632..055affdb944 100644 --- a/Master/texmf-dist/doc/latex/probsoln/tabmchoice.tex +++ b/Master/texmf-dist/doc/latex/probsoln/tabmchoice.tex @@ -1,43 +1,16 @@ -%% -%% This is file `tabmchoice.tex', -%% generated with the docstrip utility. -%% -%% The original source files were: -%% -%% probsoln.dtx (with options: `tabmchoice.tex,package') -%% Copyright (C) 2006 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. -%% \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 \~} +% These problems are designed to be placed in a +% tabular environment +% \newproblem{tab:1}{% What is $(3+2)\times5$? & 25 \ifshowanswers\selected\else\notselected\fi & 13 \notselected & 10 \notselected & }{Brackets come first}% +% \newproblem{tab:2}{% What is $-1+2\times3$? & 3 \notselected & -7 \notselected & 5 \ifshowanswers\selected\else\notselected\fi & }{Multiplication comes first}% -\endinput -%% -%% End of file `tabmchoice.tex'. diff --git a/Master/texmf-dist/source/latex/probsoln/probsoln.dtx b/Master/texmf-dist/source/latex/probsoln/probsoln.dtx index 0912f634e65..d555fc87f5e 100644 --- a/Master/texmf-dist/source/latex/probsoln/probsoln.dtx +++ b/Master/texmf-dist/source/latex/probsoln/probsoln.dtx @@ -1,13 +1,12 @@ %\iffalse -% probsoln.dtx generated using makedtx version 0.9b (c) Nicola Talbot +% probsoln.dtx generated using makedtx version 0.91b (c) Nicola Talbot % Command line args: % -src "(.+)\.(sty)=>\1.\2" -% -src "(.*\.tex)\Z=>\1" % -doc "manual.tex" % -author "Nicola Talbot" % -dir "source" % probsoln -% Created on 2006/3/2 11:26 +% Created on 2007/7/18 20:23 %\fi %\iffalse %<*package> @@ -30,7 +29,7 @@ %\fi % \iffalse % Doc-Source file to use with LaTeX2e -% Copyright (C) 2006 Nicola Talbot, all rights reserved. +% Copyright (C) 2007 Nicola Talbot, all rights reserved. % \fi % \iffalse %<*driver> @@ -69,9 +68,9 @@ %\fi % % -% \title{probsoln.sty v2.02: \LaTeXe\ Package to help create problem sheets} +% \title{probsoln.sty v2.03: \LaTeXe\ Package to help create problem sheets} % \author{Nicola L.C. Talbot} -% \date{2nd March 2006} +% \date{20th June 2006} % \maketitle % \tableofcontents % @@ -107,7 +106,12 @@ %\cmddef{newproblem}\verb|[|\meta{nargs}\verb/]{/\meta{label}\verb!}{!\meta{problem}\verb+}{+\meta{solution}\verb=}=\\[10pt] %A new problem is defined using the command %\cmdname{newproblem}. This does not print anything, -%but merely stores the problem. The argument \meta{label} is +%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):\\[10pt] +%\DescribeMacro{\newproblem*} +%\cmddef{newproblem*}\verb|[|\meta{nargs}\verb/]{/\meta{label}\verb!}{!\meta{problem}\verb+}+\\[10pt] +%The argument \meta{label} is %a unique string that is assigned to this problem so that it %can be used later. The argument \meta{problem} is normal %\LaTeX\ code that should be used to typeset the problem. @@ -128,6 +132,11 @@ % \end{displaymath} % } %\end{verbatim} +%The following is an essay question, so doesn't come with a solution: +%\begin{verbatim} +%\newproblem*{inheritance}{Describe what is meant by the term +%\emph{inheritance} in object-oriented programming. Use examples.} +%\end{verbatim} % %The optional argument \meta{nargs} specifies the number of %parameters this problem will take. By default this value is @@ -188,7 +197,8 @@ %\section{Creating a Database} % %To generate a database, simply create a \texttt{.tex} file -%where all the problems are defined using \cmdlink{newproblem}, +%where all the problems are defined using \cmdlink{newproblem} or +%\cmdlink{newproblem*}, %and either \cmdname{input} it at the start of your document if %you want to use specific problems (see Section~\ref{sec:useprob}), or pass it to %\cmdname{selectrandomly} (see Section~\ref{sec:selran}). This package @@ -382,14 +392,16 @@ % %The solution is placed inside the \DescribeEnv{solution}\env{solution} %environment. By default this environment simply does -%\verb|\paragraph{\solutionname:}| at the start, where +%\verb|\par\noindent\textbf{\solutionname:} | at the start, where %\DescribeMacro{\solutionname}\cmddef{solutionname} %has the value: Solution. See the file \texttt{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 \texttt{tabmchoice.tex}, and displays them -%in a longtable \env{environment}. +%in a longtable \env{environment}. As from version 2.03, the package +%will not define this environment if another package or class file has +%already defined it. % %\DescribeMacro{showanswers} %The boolean variable \texttt{showanswers} is defined to be @@ -436,7 +448,7 @@ %otherwise it will appear as: %\begin{description} %\item Which of the following is the derivative of -%$x\sin(x)$?(Circle the correct answer.) +%$x\sin(x)$? (Circle the correct answer.) %\begin{description} %\item[A] $\sin(x)$\item[B] $x\cos(x)$\item[\textcircled{C}] $\sin(x) + x\cos(x)$ (product rule)\end{description} %\end{description} @@ -542,14 +554,16 @@ %\StopEventually{\PrintIndex} % %\section{The Code} +%\iffalse % \begin{macrocode} %<*probsoln.sty> % \end{macrocode} +%\fi % At the start of the package, specify that the \LaTeXe\ format is % required. And specify the package provided. % \begin{macrocode} \NeedsTeXFormat{LaTeX2e} -\ProvidesPackage{probsoln}[2006/03/02 v2.02 Problems and their Solutions Package (NLCT)] +\ProvidesPackage{probsoln}[2006/06/20 v2.03 Problems and their Solutions Package (NLCT)] \RequirePackage{ifthen} % \end{macrocode} % Define newif to determine whether or not to show the answers. @@ -572,10 +586,15 @@ \newif\iffirstpass \newif\ifselected % \end{macrocode} -% Define the command that creates a new problem +% 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{\solutionname}{Solution} -\newcommand{\newproblem}[4][0]{% +\newcommand{\newproblem}{\@ifstar\@snewproblem\@newproblem} +% \end{macrocode} +% The unstarred version. +% \begin{macrocode} +\newcommand{\@newproblem}[4][0]{% \ifselectrandom \iffirstpass % on the first pass, just store the label, and increment \@probN @@ -596,7 +615,7 @@ \read-1to\@tmp \expandafter\xdef\csname @prob@#2@arg\endcsname{\@tmp}% \expandafter\global\expandafter\newcommand\csname @prob@#2\endcsname[#1]{% -#3 \ifshowanswers\solution #4\fi}% +#3 \ifshowanswers\begin{solution}#4\end{solution}\fi}% \fi }{% \PackageError{probsoln}{Label #2 already used}% @@ -615,6 +634,46 @@ \fi } % \end{macrocode} +% 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} +\newcommand{\@snewproblem}[3][0]{% +\ifselectrandom +\iffirstpass +% on the first pass, just store the label, and increment \@probN +\global\advance\@probN by 1 +\expandafter\gdef\csname @problabel\romannumeral\@probN\endcsname{#2}% +\else +% check to see if this problem has been selected +\checkselected{#2}% +\ifselected +\@ifundefined{@prob@#2}{% +\ifnum#1=0 +% this problem has no arguments +\expandafter\gdef\csname @prob@#2\endcsname{#3}% +\expandafter\gdef\csname @prob@#2@arg\endcsname{\relax}% +\else +\message{Problem #2 requires #1 argument(s), please specify (e.g. {5}{3}):}% +\read-1to\@tmp +\expandafter\xdef\csname @prob@#2@arg\endcsname{\@tmp}% +\expandafter\global\expandafter\newcommand\csname @prob@#2\endcsname[#1]{#3}% +\fi +}{% +\PackageError{probsoln}{Label #2 already used}% +{Each problem must have a unique label identifier}% +}% +\fi +\fi +\else +\@ifundefined{@prob@#2}{% +\expandafter\global\expandafter\newcommand\csname @prob@#2\endcsname[#1]{#3}% +}{% +\PackageError{probsoln}{Label #2 already used}% +{Each problem must have a unique label identifier}% +} +\fi +} +% \end{macrocode} % Define the command that uses a problem % \begin{macrocode} \newcommand{\useproblem}[1]{% @@ -740,6 +799,9 @@ problems.}% } % \end{macrocode} % 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} \@ifundefined{endPSNitem}{\def\endPSNitem{}}{% @@ -747,7 +809,10 @@ problems.}% % \end{macrocode} % How to display each solution % \begin{macrocode} -\newenvironment{solution}{\paragraph{\solutionname:}}{} +\providecommand{\solutionname}{Solution} +\@ifundefined{solution}{% +\newenvironment{solution}{\par\noindent\textbf{\solutionname:} }{}}{% +} % \end{macrocode} % Check to see if label has been selected % \begin{macrocode} @@ -820,468 +885,10 @@ are only \number\@ps@forrand item(s) in the list}% \fi }} % \end{macrocode} +%\iffalse % \begin{macrocode} %</probsoln.sty> % \end{macrocode} -% \begin{macrocode} -%<*1stprncp.tex> -% \end{macrocode} -% These all involve differentiating from 1st principles - -\newproblem{dfp:xcube}{% -Differentiate $f(x) = x^3$ with respect to $x$ by first principles.}{% -\begin{eqnarray*} -\frac{dy}{dx} & = & \lim_{\Delta x\rightarrow 0}\frac{f(x+\Delta x) - f(x)}{\Delta x}\\ - & = & \lim_{\Delta x\rightarrow 0}\frac{(x+\Delta x)^3-x^3}{\Delta x}\\ - & = & \lim_{\Delta x\rightarrow 0}\frac{(x+\Delta x)(x^2+2x\Delta x+(\Delta x)^2)-x^3}{\Delta x}\\ - & = & \lim_{\Delta x\rightarrow 0}\frac{x^3+3x^2\Delta x+3x(\Delta x)^2+(\Delta x)^3-x^3}{\Delta x}\\ - & = & \lim_{\Delta x\rightarrow 0}\frac{3x^2\Delta x+3x(\Delta x)^2+(\Delta x)^3}{\Delta x}\\ - & = & \lim_{\Delta x\rightarrow 0}3x^2+3x\Delta x + (\Delta x)^2\\ - & = & 3x^2 -\end{eqnarray*}} - -\newproblem{dfp:Ioverxsq}{% -Differentiate $\displaystyle f(x) = \frac{1}{x^2}$ with respect to $x$ by first principles.}{% -\begin{eqnarray*} -\frac{df}{dx} & = & \lim_{\Delta x\rightarrow 0}\frac{\frac{1}{(x+\Delta x)^2}-\frac{1}{x^2}}{\Delta x}\\ - & = & \lim_{\Delta x\rightarrow 0}\frac{\frac{x^2-(x+\Delta x)^2}{x^2(x+\Delta x)^2}}{\Delta x}\\ - & = & \lim_{\Delta x\rightarrow 0}\frac{x^2-(x^2+2x\Delta x+(\Delta x)^2)}{x^2\Delta x(x+\Delta x)^2}\\ - & = & \lim_{\Delta x\rightarrow 0}\frac{-2x\Delta x-(\Delta x)^2}{x^2\Delta x(x+\Delta x)^2}\\ - & = & \lim_{\Delta x\rightarrow 0}\frac{-2x-\Delta x}{x^2(x+\Delta x)^2}\\ - & = & \frac{-2x}{x^2x^2}\\ - & = & -\frac{2}{x^3} -\end{eqnarray*}} - -\newproblem{dfp:sqrtx}{% -Differentiate from first principles $f(x) = \surd x$}{% -\begin{eqnarray*} -\frac{df}{dx} & = & \lim_{\Delta x\rightarrow 0}\frac{\sqrt{x+\Delta x}-\surd x}{\Delta x}\\ - & = & \lim_{\Delta x\rightarrow 0}\frac{(\sqrt{x+\Delta x}-\surd x)(\sqrt{x+\delta x}+\surd x)}{\Delta x(\sqrt{x+\Delta x}+\surd x)}\\ - & = & \lim_{\Delta x\rightarrow 0}\frac{x+\Delta x - x}{\Delta x(\sqrt{x+\Delta x}+\surd x)}\\ - & = & \lim_{\Delta x\rightarrow 0}\frac{\Delta x}{\Delta x(\sqrt{x+\Delta x}+\Delta x)}\\ - & = & \lim_{\Delta x\rightarrow 0}\frac{1}{\sqrt{x+\Delta x}+\surd x}\\ - & = & \frac{1}{2\surd x} -\end{eqnarray*}} - -\newproblem{dfp:cons}{% -Differentiate from first principles $f(x) = c$ where $c$ is a constant.}{% -\begin{eqnarray*} -\frac{df}{dx} & = & \lim_{\Delta x\rightarrow 0}\frac{c-c}{\Delta x}\\ - & = & \lim_{\Delta x\rightarrow 0}0\\ - & = & 0 -\end{eqnarray*}} - -\newproblem{dfp:cosx}{% -Given -\begin{eqnarray*} -\lim_{x \rightarrow 0} \frac{\cos x - 1}{x} & = & 0\\ -\lim_{x \rightarrow 0} \frac{\sin x}{x} & = & 1 -\end{eqnarray*} -differentiate from first principles $f(x) = \cos x$.}{% -\begin{eqnarray*} -\frac{df}{dx} & = & \lim_{\Delta x \rightarrow 0}\frac{f(x + \Delta x) - f(x)}{\Delta x}\\ - & = & \lim_{\Delta x \rightarrow 0} \frac{\cos(x + \Delta x) - \cos(x)}{\Delta x}\\ - & = & \lim_{\Delta x \rightarrow 0} \frac{\cos x\cos\Delta x - \sin x\sin\Delta x - \cos x}{\Delta x}\\ - & = & \lim_{\Delta x \rightarrow 0} \frac{\cos x(\cos\Delta x - 1) - \sin x\sin\Delta x}{\Delta x}\\ - & = & \cos x\lim_{\Delta x \rightarrow 0}\frac{\cos\Delta x - 1}{\Delta x} - - \sin x\lim_{\Delta x \rightarrow 0}\frac{\sin\Delta x}{\Delta x}\\ - & = & -1 \qquad\mbox{(using given results)} -\end{eqnarray*}} -% \begin{macrocode} -%</1stprncp.tex> -% \end{macrocode} -% \begin{macrocode} -%<*args.tex> -% \end{macrocode} -% These problems require arguments - -% Arguments: #1->a_2, #2->a_1 and #3->a_0 -% (Arguments must be integers) -\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 -\) -} - -\newproblem[1]{diff:sin}{% -\(f(x) = \sin(#1x)\) -}{% -\(f'(x) = #1\cos(#1x)\) -} - -% \begin{macrocode} -%</args.tex> -% \end{macrocode} -% \begin{macrocode} -%<*easy.tex> -% \end{macrocode} -% These are all easy differentiation problems - -\newproblem{diffeasy:gpowh}{% -\(f(x) = g(x)^{h(x)}.\)}{% -\begin{eqnarray*} -f(x) & = & e^{\ln g(x)^{h(x)}}\\ - & = & e^{h(x)\ln g(x)}\\ -f'(x) & = & e^{h(x)\ln g(x)}(h'(x)\ln g(x) + h(x)\frac{g'(x)}{g(x)})\\ - & = & g(x)^{h(x)}(h'(x)\ln g(x) + \frac{h(x)g'(x)}{g(x)}) -\end{eqnarray*}} - -\newproblem{diffeasy:arcsin}{% -\(y = \arcsin(x)\)}{% -\[\sin(y) = x\] -diff. w.r.t. $x$: -\begin{eqnarray*} -\cos y \frac{dy}{dx} & = & 1\\ -\frac{dy}{dx} & = & \frac{1}{\cos y}\\ - & = & \frac{1}{\sqrt{1 - \sin^2y}}\\ - & = & \frac{1}{\sqrt{1-x^2}}. -\end{eqnarray*}} - -\newproblem{diffeasy:arccos}{% -$y = \arccos x$.}{% -\(\cos y = x\) -diff. w.r.t. $x$: -\begin{eqnarray*} --\sin y \frac{dy}{dx} & = & 1\\ -\frac{dy}{dx} & = & \frac{-1}{\sin y}\\ - & = & \frac{-1}{\sqrt{1-\cos^2y}}\\ - & = & \frac{-1}{\sqrt{1-x^2}} -\end{eqnarray*}} - -\newproblem{diffeasy:tan}{% -\(y = \tan x\)}{% -\begin{eqnarray*} -y & = & \tan x\\ - & = & \frac{\sin x}{\cos x}\\ -\frac{dy}{dx} & = & \frac{\cos x}{\cos x} + \sin x\times\frac{-1}{\cos^2x}\times -\sin x\\ - & = & 1 + \tan^2x\\ - & = & \sec^2x. -\end{eqnarray*}} - -\newproblem{diffeasy:arctan}{% -\(y = \arctan x = \tan^{-1}x\)}{% -\[\tan y = x\] -diff w.r.t. $x$: -\begin{eqnarray*} -\sec^2y\frac{dy}{dx} & = & 1\\ -\frac{dy}{dx} & = & \frac{1}{\sec^2y}\\ - & = & \frac{1}{1+\tan^2y}\\ - & = & \frac{1}{1+x^2} -\end{eqnarray*}} - -\newproblem{diffeasy:cot}{% -\(y = (\tan x)^{-1} = \cot x\)}{% -\begin{eqnarray*} -\frac{dy}{dx} & = & -(\tan x)^{-2}\sec^2x\\ - & = & -\frac{\cos^2x}{\sin^2x}\cdot\frac{1}{\cos^2x}\\ - & = & \frac{-1}{\sin^2x}\\ - & = & -\csc^2x. -\end{eqnarray*}} - -\newproblem{diffeasy:cosxsqsinx}{% -$y = \cos(x^2)\sin x$.}{% -\[\frac{dy}{dx} = -\sin(x^2)2x\sin x + \cos(x^2)\cos x\]} - -\newproblem{diffeasy:xlnx}{% -$y = (x+1)\ln(x+1)$.}{% -\begin{eqnarray*} -\frac{dy}{dx} & = & \ln(x+1) + \frac{x+1}{x+1}\\ - & = & 1 + \ln(x+1). -\end{eqnarray*}} - -\newproblem{diffeasy:glng}{% -$f(x) = g(x)\ln(g(x))$.}{% -\begin{eqnarray*} -f'(x) & = & g'(x)\ln(g(x)) + \frac{g(x)}{g(x)}g'(x)\\ - & = & g'(x)(1+\ln(g(x))). -\end{eqnarray*}} - -\newproblem{diffeasy:sinx/x}{% -$y = \frac{\sin x}{x}$.}{% -\[\frac{dy}{dx} = \frac{\cos x}{x} - \frac{\sin x}{x^2}\]} - -% \begin{macrocode} -%</easy.tex> -% \end{macrocode} -% \begin{macrocode} -%<*implicit.tex> -% \end{macrocode} -% These are all implicit differentiation problems - -\newproblem{imd:circ}{% -Find the gradient of the unit circle ($x^2 + y^2 = 1$).}{% -Differentiating with respect to $x$ gives: -\begin{eqnarray*} -2x + 2y\frac{dy}{dx} & = & 0\\ -\frac{dy}{dx} & = & \frac{-2x}{2y}\\ - & = & \frac{-x}{\sqrt{1-x^2}}. -\end{eqnarray*}} - -\newproblem{imd:ysq:xcuov2mx}{% -Find $\frac{dy}{dx}$, given -\begin{displaymath} -y^2 = \frac{x^3}{2-x} -\end{displaymath}}{% -Differentiating both sides w.r.t.\ $x$: -\begin{eqnarray*} -2y\frac{dy}{dx} & = & \frac{(2-x)3x^2 - x^3(-1)}{(2-x)^2}\\ - & = & \frac{3x^2(2-x) + x^3}{(2-x)^2}\\ - & = & \frac{6x^2 - 3x^3 + x^3}{(2-x)^2}\\ - & = & \frac{6x^2-2x^3}{(2-x)^2}\\ - & = & 2x^2\frac{3-x}{(2-x)^2} -\end{eqnarray*} -Therefore -\begin{displaymath} -y\frac{dy}{dx} = x^2\frac{3-x}{(2-x)^2} -\end{displaymath}} - -\newproblem{imd:exy:IIxay}{% -Differentiate w.r.t.\ $x$: -\begin{displaymath} -e^{xy} = 2x + y -\end{displaymath}}{% -Differentiating both sides w.r.t.\ $x$: -\begin{eqnarray*} -e^{xy}(1y + x\frac{dy}{dx}) & = & 2 + \frac{dy}{dx}\\ -xe^{xy}\frac{dy}{dx} - \frac{dy}{dx} & = & 2 - ye^{xy} \\ -\frac{dy}{dx}(xe^{xy}-1) & = & 2 - ye^{xy}\\ -\frac{dy}{dx} & = & \frac{2-ye^{xy}}{xe^{xy}-1} -\end{eqnarray*}} -% \begin{macrocode} -%</implicit.tex> -% \end{macrocode} -% \begin{macrocode} -%<*mchoice.tex> -% \end{macrocode} -\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} -} - -\newproblem{mc:quot}{% -Which of the following is the derivative of $\frac{\sin(x)}{x}$? -(Circle the correct answer.) -\ifthenelse{\boolean{showanswers}}{}% -{\begin{description} -\item[A] $\sin(x)$ -\item[B] $\cos(x)$ -\item[C] $\frac{\cos(x)x-\sin(x)}{x^2}$ -\end{description} -}}{% -\begin{description} -\item[A] $\sin(x)$ -\item[B] $\cos(x)$ -\item[\textcircled{C}] $\frac{\cos(x)x-\sin(x)}{x^2}$ -(quotient rule) -\end{description} -} -% \begin{macrocode} -%</mchoice.tex> -% \end{macrocode} -% \begin{macrocode} -%<*sample.tex> -% \end{macrocode} -\documentclass[a4paper]{article} - -\usepackage{probsoln} -%uncomment the following line to display the answers -\showanswers - -% The following will generate a different set of -% problems in subsequent years -\PSNrandseed{\year} - -\begin{document} -\title{Sample Problem Sheet} -\author{Nicola Talbot} -\maketitle - -\begin{enumerate} -% Differentiation from first principles -\selectrandomly{1stprncp}{1} - -\item Differentiate the following functions: -\begin{enumerate} -\selectrandomly{easy}{5} -\end{enumerate} - -% Implicit differentiation -\selectrandomly{implicit}{2} - -% Multiple choice question -\selectrandomly{mchoice}{1} -\end{enumerate} -\end{document} -% \begin{macrocode} -%</sample.tex> -% \end{macrocode} -% \begin{macrocode} -%<*sample2.tex> -% \end{macrocode} -\documentclass[a4paper]{article} - -\usepackage{probsoln} -%uncomment the following line to display the answers -\showanswers - -% The following will generate a different set of -% problems in subsequent years -%\PSNrandseed{\year} - -% The following will generate a different set of -% problems on every run (where each run is at -% least a minute apart from the previous one) -\PSNrandseed{\time} - -\begin{document} -\title{Sample Problem Sheet} -\author{Nicola Talbot} -\maketitle - -\begin{enumerate} - -\newcounter{numproblems} -% store a random number from 1 to 3 in the counter numproblems -\random{numproblems}{1}{3} - -% selects 1,2 or 3 problems from 1 of the given files: -\doforrandN{1}{\file}{1stprncp,implicit}{\selectrandomly{\file}{\value{numproblems}}} - -\item Differentiate the following functions: -\input{args}% load database -\begin{enumerate} -\newcounter{A} -\newcounter{B} -\newcounter{C} -\random{A}{-4}{5} -\random{B}{-3}{3} -\random{C}{-1}{10} -\item \useproblem{diff:quad}{\arabic{A}}{\arabic{B}}{\arabic{C}} - -\random{A}{-5}{5} -% make sure its not 0 -\whiledo{\value{A}=0}{\random{A}{-5}{5}} -\item \useproblem{diff:sin}{\arabic{A}} -\end{enumerate} -\end{enumerate} -\end{document} -% \begin{macrocode} -%</sample2.tex> -% \end{macrocode} -% \begin{macrocode} -%<*sample3.tex> -% \end{macrocode} -\documentclass[a4paper]{article} - -\usepackage{longtable} -\usepackage{probsoln} - -%\showanswers - -\newcounter{problem} -\renewcommand{\PSNitem}{\refstepcounter{problem}% -\theproblem. } -\renewcommand{\endPSNitem}{\\} - -\renewenvironment{solution}{}{} - -\newcommand{\selected}{\fbox{$\times$}} -\newcommand{\notselected}{\fbox{\phantom{$\times$}}} - -\begin{document} -\begin{longtable}{lrrrl} -\bfseries Question & \bfseries A & \bfseries B & -\bfseries C & \ifshowanswers \bfseries Reason\fi\\ -\selectrandomly{tabmchoice}{2} -\end{longtable} -\end{document} -% \begin{macrocode} -%</sample3.tex> -% \end{macrocode} -% \begin{macrocode} -%<*sample4.tex> -% \end{macrocode} -\documentclass[a4paper]{article} - -\usepackage{probsoln} - -% Sample file illustrating use of \selectallproblems -% All problems defined in specified file will be used -% in order of definition - -\showanswers - -\begin{document} -Differentiate the following functions: -\begin{enumerate} -\selectallproblems{easy} -\end{enumerate} -\end{document} -% \begin{macrocode} -%</sample4.tex> -% \end{macrocode} -% \begin{macrocode} -%<*tabmchoice.tex> -% \end{macrocode} -% These problems are designed to be placed in a -% tabular environment -% -\newproblem{tab:1}{% -What is $(3+2)\times5$? & -25 \ifshowanswers\selected\else\notselected\fi & -13 \notselected & -10 \notselected & -}{Brackets come first}% -% -\newproblem{tab:2}{% -What is $-1+2\times3$? & -3 \notselected & --7 \notselected & -5 \ifshowanswers\selected\else\notselected\fi & -}{Multiplication comes first}% -% \begin{macrocode} -%</tabmchoice.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 cc868fab642..68fbc99f748 100644 --- a/Master/texmf-dist/source/latex/probsoln/probsoln.ins +++ b/Master/texmf-dist/source/latex/probsoln/probsoln.ins @@ -1,8 +1,8 @@ -% probsoln.ins generated using /nlctltpc/home/nlct/bin/makedtx version 0.9b 2006/3/2 11:26 +% probsoln.ins generated using makedtx version 0.91b 2007/7/18 20:23 \input docstrip \preamble -Copyright (C) 2006 Nicola Talbot, all rights reserved. +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 @@ -12,28 +12,8 @@ etc. \askforoverwritefalse -\generate{\file{sample2.tex}{\usepreamble\defaultpreamble -\usepostamble\defaultpostamble\from{probsoln.dtx}{sample2.tex,package}} -\file{1stprncp.tex}{\usepreamble\defaultpreamble -\usepostamble\defaultpostamble\from{probsoln.dtx}{1stprncp.tex,package}} -\file{probsoln.sty}{\usepreamble\defaultpreamble +\generate{\file{probsoln.sty}{\usepreamble\defaultpreamble \usepostamble\defaultpostamble\from{probsoln.dtx}{probsoln.sty,package}} -\file{mchoice.tex}{\usepreamble\defaultpreamble -\usepostamble\defaultpostamble\from{probsoln.dtx}{mchoice.tex,package}} -\file{tabmchoice.tex}{\usepreamble\defaultpreamble -\usepostamble\defaultpostamble\from{probsoln.dtx}{tabmchoice.tex,package}} -\file{easy.tex}{\usepreamble\defaultpreamble -\usepostamble\defaultpostamble\from{probsoln.dtx}{easy.tex,package}} -\file{args.tex}{\usepreamble\defaultpreamble -\usepostamble\defaultpostamble\from{probsoln.dtx}{args.tex,package}} -\file{sample4.tex}{\usepreamble\defaultpreamble -\usepostamble\defaultpostamble\from{probsoln.dtx}{sample4.tex,package}} -\file{sample.tex}{\usepreamble\defaultpreamble -\usepostamble\defaultpostamble\from{probsoln.dtx}{sample.tex,package}} -\file{sample3.tex}{\usepreamble\defaultpreamble -\usepostamble\defaultpostamble\from{probsoln.dtx}{sample3.tex,package}} -\file{implicit.tex}{\usepreamble\defaultpreamble -\usepostamble\defaultpostamble\from{probsoln.dtx}{implicit.tex,package}} } \endbatchfile diff --git a/Master/texmf-dist/tex/latex/probsoln/probsoln.sty b/Master/texmf-dist/tex/latex/probsoln/probsoln.sty index 6666c3a9398..7c6589c6395 100644 --- a/Master/texmf-dist/tex/latex/probsoln/probsoln.sty +++ b/Master/texmf-dist/tex/latex/probsoln/probsoln.sty @@ -5,7 +5,7 @@ %% The original source files were: %% %% probsoln.dtx (with options: `probsoln.sty,package') -%% Copyright (C) 2006 Nicola Talbot, all rights reserved. +%% 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 @@ -27,7 +27,7 @@ %% Grave accent \` Left brace \{ Vertical bar \| %% Right brace \} Tilde \~} \NeedsTeXFormat{LaTeX2e} -\ProvidesPackage{probsoln}[2006/03/02 v2.02 Problems and their Solutions Package (NLCT)] +\ProvidesPackage{probsoln}[2006/06/20 v2.03 Problems and their Solutions Package (NLCT)] \RequirePackage{ifthen} \provideboolean{showanswers} \newcommand{\showanswers}{\showanswerstrue} @@ -39,8 +39,8 @@ \newif\ifselectrandom \selectrandomfalse \newif\iffirstpass \newif\ifselected -\newcommand{\solutionname}{Solution} -\newcommand{\newproblem}[4][0]{% +\newcommand{\newproblem}{\@ifstar\@snewproblem\@newproblem} +\newcommand{\@newproblem}[4][0]{% \ifselectrandom \iffirstpass \global\advance\@probN by 1 @@ -58,7 +58,7 @@ \read-1to\@tmp \expandafter\xdef\csname @prob@#2@arg\endcsname{\@tmp}% \expandafter\global\expandafter\newcommand\csname @prob@#2\endcsname[#1]{% -#3 \ifshowanswers\solution #4\fi}% +#3 \ifshowanswers\begin{solution}#4\end{solution}\fi}% \fi }{% \PackageError{probsoln}{Label #2 already used}% @@ -76,6 +76,39 @@ } \fi } +\newcommand{\@snewproblem}[3][0]{% +\ifselectrandom +\iffirstpass +\global\advance\@probN by 1 +\expandafter\gdef\csname @problabel\romannumeral\@probN\endcsname{#2}% +\else +\checkselected{#2}% +\ifselected +\@ifundefined{@prob@#2}{% +\ifnum#1=0 +\expandafter\gdef\csname @prob@#2\endcsname{#3}% +\expandafter\gdef\csname @prob@#2@arg\endcsname{\relax}% +\else +\message{Problem #2 requires #1 argument(s), please specify (e.g. {5}{3}):}% +\read-1to\@tmp +\expandafter\xdef\csname @prob@#2@arg\endcsname{\@tmp}% +\expandafter\global\expandafter\newcommand\csname @prob@#2\endcsname[#1]{#3}% +\fi +}{% +\PackageError{probsoln}{Label #2 already used}% +{Each problem must have a unique label identifier}% +}% +\fi +\fi +\else +\@ifundefined{@prob@#2}{% +\expandafter\global\expandafter\newcommand\csname @prob@#2\endcsname[#1]{#3}% +}{% +\PackageError{probsoln}{Label #2 already used}% +{Each problem must have a unique label identifier}% +} +\fi +} \newcommand{\useproblem}[1]{% \@ifundefined{@prob@#1}{% \PackageError{probsoln}{Label #1 undefined}% @@ -169,7 +202,10 @@ problems.}% \newcommand{\PSNitem}{\item} \@ifundefined{endPSNitem}{\def\endPSNitem{}}{% \PackageError{probsoln}{\string\endPSitem\ already defined}{}} -\newenvironment{solution}{\paragraph{\solutionname:}}{} +\providecommand{\solutionname}{Solution} +\@ifundefined{solution}{% +\newenvironment{solution}{\par\noindent\textbf{\solutionname:} }{}}{% +} \newcount\@ckselctr \newcommand{\checkselected}[1]{% \selectedfalse |