summaryrefslogtreecommitdiff
path: root/Master/texmf-dist/tex/latex/probsoln/probsoln.sty
diff options
context:
space:
mode:
Diffstat (limited to 'Master/texmf-dist/tex/latex/probsoln/probsoln.sty')
-rw-r--r--Master/texmf-dist/tex/latex/probsoln/probsoln.sty91
1 files changed, 52 insertions, 39 deletions
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
}%