summaryrefslogtreecommitdiff
path: root/Master/texmf-dist/tex/latex/probsoln
diff options
context:
space:
mode:
authorKarl Berry <karl@freefriends.org>2007-07-28 00:29:08 +0000
committerKarl Berry <karl@freefriends.org>2007-07-28 00:29:08 +0000
commit59e589a13e8de3ebc58828416bdd1eb4269b7bd2 (patch)
tree78564d8ec87320790f651149217dcb4d9eec7ea4 /Master/texmf-dist/tex/latex/probsoln
parentaea330a2bc712291777bdb4bf73fe68b594227ff (diff)
probsoln 2.03 (18jul07)
git-svn-id: svn://tug.org/texlive/trunk@4672 c570f23f-e606-0410-a88d-b1316a301751
Diffstat (limited to 'Master/texmf-dist/tex/latex/probsoln')
-rw-r--r--Master/texmf-dist/tex/latex/probsoln/probsoln.sty48
1 files changed, 42 insertions, 6 deletions
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