summaryrefslogtreecommitdiff
path: root/Master/texmf-dist/source
diff options
context:
space:
mode:
authorKarl Berry <karl@freefriends.org>2012-01-14 23:23:39 +0000
committerKarl Berry <karl@freefriends.org>2012-01-14 23:23:39 +0000
commit99b7aeefd4f1e318e9ae379423a09f6ad116b468 (patch)
tree05e72540a09a2a9f842aa7914f80730f1b5d3787 /Master/texmf-dist/source
parent1398422d52caaf61193a5e8c21d1d2db8d41145f (diff)
probsoln 3.02 (14jan12)
git-svn-id: svn://tug.org/texlive/trunk@25106 c570f23f-e606-0410-a88d-b1316a301751
Diffstat (limited to 'Master/texmf-dist/source')
-rw-r--r--Master/texmf-dist/source/latex/probsoln/probsoln.dtx442
-rw-r--r--Master/texmf-dist/source/latex/probsoln/probsoln.ins8
2 files changed, 405 insertions, 45 deletions
diff --git a/Master/texmf-dist/source/latex/probsoln/probsoln.dtx b/Master/texmf-dist/source/latex/probsoln/probsoln.dtx
index 1baeb9789e3..9515bfe3a4a 100644
--- a/Master/texmf-dist/source/latex/probsoln/probsoln.dtx
+++ b/Master/texmf-dist/source/latex/probsoln/probsoln.dtx
@@ -9,7 +9,7 @@
% -doc "probsoln-manual.tex"
% -author "Nicola Talbot"
% probsoln
-% Created on 2011/8/22 22:10
+% Created on 2011/12/10 17:17
%\fi
%\iffalse
%<*package>
@@ -54,7 +54,7 @@
\RecordChanges
\PageIndex
-\CheckSum{1144}
+\CheckSum{1484}
\newcommand*{\dq}[1]{``#1''}
@@ -66,7 +66,7 @@
%\MakeShortVerb{"}
%\DeleteShortVerb{\|}
%
-% \title{probsoln v3.01:
+% \title{probsoln v3.02:
%creating problem sheets optionally with solutions}
% \author{Nicola L.C. Talbot\\[10pt]
%School of Computing Sciences\\
@@ -75,7 +75,7 @@
%NR4 7TJ. United Kingdom.\\
%\url{http://theoval.cmp.uea.ac.uk/~nlct/}}
%
-% \date{2011-08-22}
+% \date{2011-12-10}
% \maketitle
%\tableofcontents
%
@@ -108,6 +108,30 @@
%problem arguments (default).
%\end{description}
%
+%\section{Verbatim}\label{sec:verbatim}
+%
+%As from version 3.02, problems and solutions may contain verbatim
+%text, but you must use the \iterm{fragile}\texttt{fragile} (or
+%\texttt{fragile=true}) option for the associated environments.
+%
+%Alternatively, if most of your problems contain verbatim, you can
+%globally set this option using:
+%\begin{verbatim}
+%\setkeys{probsoln}{fragile}
+%\end{verbatim}
+%You can switch off this option using \texttt{fragile=false}.
+%
+%The \texttt{fragile} option writes information to a temporary file.
+%This defaults to "\jobname.vrb" but the name may be changed. The
+%extension (".vrb") is given by:
+%\begin{definition}[\DescribeMacro{\ProbSolnFragileExt}]
+%\cs{ProbSolnFragileExt}
+%\end{definition}
+%The base name (\cs{jobname}) is given by:
+%\begin{definition}[\DescribeMacro{\ProbSolnFragileFile}]
+%\cs{ProbSolnFragileFile}
+%\end{definition}
+%
%\section{Showing and Hiding Solutions}\label{sec:showanswers}
%
%In addition to the \pkgopt{answers} and \pkgopt{noanswers} package
@@ -135,8 +159,15 @@
%Assignment 1\ifshowanswers\space (Solution Sheet)\fi
%\end{verbatim}
%
-%For longer passages, you can use the environments \DescribeEnv{onlyproblem}\env{onlyproblem}
-%and \DescribeEnv{onlysolution}\env{onlysolution}. For example:
+%For longer passages, you can use the environments
+%\begin{definition}[\DescribeEnv{onlyproblem}]
+%\cs{begin}\marg{onlyproblem}\oarg{option}
+%\end{definition}
+%and
+%\begin{definition}[\DescribeEnv{onlysolution}]
+%\cs{begin}\marg{onlysolution}\oarg{option}
+%\end{definition}
+%For example:
%\begin{verbatim}
%\begin{onlyproblem}%
%What is the derivative of $f(x) = x^2$?
@@ -156,17 +187,19 @@
%Solution: $f'(x) = 2x$
%\end{onlysolution}
%\end{verbatim}
+%
%\begin{important}
-%You can't use verbatim text in the body of the
-%\envfmt{onlyproblem} or \envfmt{onlysolution} environments.
-%If you need verbatim-like text, then try packages such as
-%\sty{alltt}. Remember that you also can't use verbatim
-%text in command arguments.
+%If you want to include verbatim text in the body of
+%\env{onlyproblem} or \env{onlysolution}, you need to specify
+%\texttt{fragile} in the optional argument of the environment.
+%(See \sectionref{sec:verbatim} for further details.)
%\end{important}
%
%If you use \envfmt{onlysolution} within the \env{defproblem}
%environment, the problem will be tagged as having a solution
%and will be added to the list used by \ics{foreachsolution}.
+%The optional argument of \envfmt{onlysolution} (and \env{onlyproblem})
+%is inherited from the parent \env{defproblem} setting.
%
%\section{General Formatting Commands}\label{sec:formatting}
%
@@ -279,7 +312,7 @@
%appendix).
%
%\begin{definition}[\DescribeEnv{defproblem}]
-%\verb|\begin{defproblem}|\oarg{n}\oarg{default args}\marg{label}\newline
+%\verb|\begin{defproblem}|\oarg{n}\oarg{default args}\marg{label}\oarg{option}\newline
%\meta{definition}\newline
%\verb|\end{defproblem}|
%\end{definition}
@@ -291,6 +324,14 @@
%\sty{babel} packages make certain punctuation active. Check the
%relevant package documentation for details.)
%
+%\begin{important}
+%The final optional argument \meta{option} may be \texttt{fragile} to
+%indicate that the problem contains verbatim text. Any occurrences of
+%\env{onlyproblem} or \env{onlysolution} contained within
+%\envfmt{defproblem} are inherited from \envfmt{defproblem}. (See
+%\sectionref{sec:verbatim} for further details.)
+%\end{important}
+%
%If \env{defproblem} occurs in the document or is included via
%\ics{input} or \ics{include}, then the problem will be added to
%the default data set. If \envfmt{defproblem} occurs in an external
@@ -398,10 +439,9 @@
%\end{ttfamily}
%
%\begin{important}
-%Verbatim text must not be used in the contents of \env{defproblem}
-%or in any of the arguments to \cs{newproblem} or
-%\cs{newproblem*}. If you need verbatim-like text consider using
-%\cs{texttt} or the \sty{alltt} package.
+%Note that you can't use verbatim text with \cs{newproblem} or
+%\cs{newproblem*}. Use the \env{defproblem} environment instead with
+%the \texttt{fragile option}.
%\end{important}
%
%\section{Using a Problem}\label{sec:useproblem}
@@ -814,10 +854,10 @@
% \end{macrocode}
% Identify this package and version:
% \begin{macrocode}
-\ProvidesPackage{probsoln}[2011/08/22 v3.01 (NLCT)]
+\ProvidesPackage{probsoln}[2011/12/10 v3.02 (NLCT)]
% \end{macrocode}
% Required packages:
-%\changes{2011/08/22}{3.01}{substr package no longer required}
+%\changes{3.01}{2011/08/22}{substr package no longer required}
% \begin{macrocode}
\RequirePackage{ifthen}
\RequirePackage{amsmath}
@@ -903,6 +943,42 @@
% \begin{macrocode}
\ProcessOptions
% \end{macrocode}
+%\changes{3.02}{2011/12/10}{added xkeyval to required package list}
+% \begin{macrocode}
+\RequirePackage{xkeyval}
+% \end{macrocode}
+%\begin{macro}{\if@prob@fragile}
+%\changes{3.02}{2011/12/10}{new}
+%Need a conditional to determine whether \cs{long@collect@body}
+%needs to be aware of verbatim contents.
+% \begin{macrocode}
+\define@boolkey{probsoln}[@prob@]{fragile}[true]{}
+% \end{macrocode}
+%\end{macro}
+%\begin{macro}{\ProbSolnFragileExt}
+%\changes{3.02}{2011/12/10}{new}
+% The extension used for temporary files dealing with fragile
+% contents.
+% \begin{macrocode}
+\newcommand*{\ProbSolnFragileExt}{vrb}
+% \end{macrocode}
+%\end{macro}
+%\begin{macro}{\ProbSolnFragileFile}
+%\changes{3.02}{2011/12/10}{new}
+% The filename used for temporary files dealing with fragile
+% contents.
+% \begin{macrocode}
+\newcommand*{\ProbSolnFragileFile}{\jobname}
+% \end{macrocode}
+%\end{macro}
+%\begin{macro}{\probsoln@write}
+%\changes{3.02}{2011/12/10}{new}
+%File handle for temporary files.
+% \begin{macrocode}
+\newwrite\probsoln@write
+% \end{macrocode}
+%\end{macro}
+%
%\subsection{Databases}
% All the problems are stored in data bases. Each data base
% \meta{name} is represented as a macro \cs{prob@db@}\meta{name}
@@ -1044,7 +1120,7 @@
%
%\subsection{Defining New Problems}
%\begin{macro}{\prob@newproblem}
-%\changes{2011/08/22}{3.01}{added extra argument to supply defaults}
+%\changes{3.01}{2011/08/22}{added extra argument to supply defaults}
%\begin{definition}
%\cs{prob@newproblem}\marg{n}\marg{db
%name}\marg{label}\marg{definition}\marg{default args}
@@ -1180,6 +1256,11 @@ Please specify (e.g. \csname @prob@getargs@eg@\romannumeral#1\endcsname):}%
\edef\process@envbody{\the\@envbody\@nx\end{\@currenvir}}%
\@envbody\@emptytoks \def\begin@stack{b}%
\begingroup
+ \if@prob@fragile
+ \obeylines\obeyspaces
+ \@makeother\#
+ \@makeother\%
+ \fi
\@xp\let\csname\@currenvir\endcsname\long@collect@@body
\edef\process@envbody{\@xp\@nx\csname\@currenvir\endcsname}%
\process@envbody
@@ -1187,7 +1268,7 @@ Please specify (e.g. \csname @prob@getargs@eg@\romannumeral#1\endcsname):}%
% \end{macrocode}
%\end{macro}
%\begin{macro}{\long@addto@envbody}
-%\changes{2011/08/22}{3.01}{modified to allow for floats in the body of the
+%\changes{3.01}{2011/08/22}{modified to allow for floats in the body of the
%environment}
% \begin{macrocode}
\long\def\long@addto@envbody#1{%
@@ -1201,7 +1282,7 @@ Please specify (e.g. \csname @prob@getargs@eg@\romannumeral#1\endcsname):}%
% \begin{macrocode}
\long\def\long@collect@@body#1\end#2{%
% \end{macrocode}
-%\changes{2011/08/22}{3.01}{changed \cs{edef} to \cs{protected@edef}}
+%\changes{3.01}{2011/08/22}{changed \cs{edef} to \cs{protected@edef}}
% \begin{macrocode}
\protected@edef\begin@stack{%
\long@push@begins#1\begin\end \@xp\@gobble\begin@stack
@@ -1225,10 +1306,123 @@ Please specify (e.g. \csname @prob@getargs@eg@\romannumeral#1\endcsname):}%
% \end{macrocode}
%\end{macro}
%
+% Fragile contents are sanitized, written to file and read back in.
+% However, we don't want the new line character sanitized. Also,
+% the \env{verbatim} environment doesn't like a space after
+% \cs{begin} or \cs{end}, so these need to be replaced.
+%\begin{macro}{\@char@M}
+%\changes{3.02}{2011/12/10}{new}
+% First define a macro that contains the
+% newline marker:
+% \begin{macrocode}
+{\obeylines
+ \gdef\@char@M{^^M}%
+}
+\@onelevel@sanitize\@char@M
+% \end{macrocode}
+%\end{macro}
+%
+%\begin{macro}{\@beg@env@string}
+%\changes{3.02}{2011/12/10}{new}
+% Define a macro that contains the begin environment marker:
+% \begin{macrocode}
+\def\@beg@env@string{\begin}
+\@onelevel@sanitize\@beg@env@string
+% \end{macrocode}
+%\end{macro}
+%\begin{macro}{\@end@env@string}
+%\changes{3.02}{2011/12/10}{new}
+% Define a macro that contains the end environment marker:
+% \begin{macrocode}
+\def\@end@env@string{\end}
+\@onelevel@sanitize\@end@env@string
+% \end{macrocode}
+%\end{macro}
+%
+%\begin{macro}{\def@replace@markers}
+%\changes{3.02}{2011/12/10}{new}
+% Things start to get a bit complicated here. The substitution
+% macros need the markers as part of their definition. The easiest
+% way to do this is to define a command (using \cs{edef}) that defines the
+% substitution macros. The markers and replacements are the only
+% things to be expanded.
+% \begin{macrocode}
+\edef\def@replace@markers{%
+% \end{macrocode}
+% First define the command that replaces the newline marker:
+% \begin{macrocode}
+ \noexpand\def\noexpand\do@replace@charM##1\@char@M##2\noexpand\end@replace@marker{%
+ \noexpand\expandafter\noexpand\toks@\noexpand\expandafter{\noexpand\replace@text}%
+ \noexpand\ifx\noexpand\relax##2\noexpand\relax
+ \noexpand\edef\noexpand\replace@text{\noexpand\the\noexpand\toks@##1}%
+ \noexpand\let\noexpand\do@replacenext\noexpand\replace@mark@noop
+ \noexpand\else
+ \noexpand\edef\noexpand\replace@text{\noexpand\the\noexpand\toks@##1^^J}%
+ \noexpand\let\noexpand\do@replacenext\noexpand\do@replace@charM
+ \noexpand\fi
+ \noexpand\do@replacenext##2\noexpand\end@replace@marker
+ }%
+% \end{macrocode}
+% Next define the command that replaces the begin environment marker:
+% \begin{macrocode}
+ \noexpand\def\noexpand\doreplace@begverb##1\@beg@env@string##2\noexpand\end@replace@marker{%
+ \noexpand\expandafter\noexpand\toks@\noexpand\expandafter{\noexpand\replace@text}%
+ \noexpand\ifx\noexpand\relax##2\noexpand\relax
+ \noexpand\edef\noexpand\replace@text{\noexpand\the\noexpand\toks@##1}%
+ \noexpand\let\noexpand\do@replacenext\noexpand\replace@mark@noop
+ \noexpand\else
+ \noexpand\edef\noexpand\replace@text{\noexpand\the\noexpand\toks@
+ ##1\expandafter\@gobble\string\\begin}%
+ \noexpand\let\noexpand\do@replacenext\noexpand\doreplace@begverb
+ \noexpand\fi
+ \noexpand\do@replacenext##2\noexpand\end@replace@marker
+ }%
+% \end{macrocode}
+% Next define the command that replaces the end environment marker:
+% \begin{macrocode}
+ \noexpand\def\noexpand\doreplace@endverb##1\@end@env@string##2\noexpand\end@replace@marker{%
+ \noexpand\expandafter\noexpand\toks@\noexpand\expandafter{\noexpand\replace@text}%
+ \noexpand\ifx\noexpand\relax##2\noexpand\relax
+ \noexpand\edef\noexpand\replace@text{\noexpand\the\noexpand\toks@##1}%
+ \noexpand\let\noexpand\do@replacenext\noexpand\replace@mark@noop
+ \noexpand\else
+ \noexpand\edef\noexpand\replace@text{\noexpand\the\noexpand\toks@
+ ##1\expandafter\@gobble\string\\end}%
+ \noexpand\let\noexpand\do@replacenext\noexpand\doreplace@endverb
+ \noexpand\fi
+ \noexpand\do@replacenext##2\noexpand\end@replace@marker
+ }%
+% \end{macrocode}
+% Finally, define a higher-level command that calls all three of the above:
+% \begin{macrocode}
+ \noexpand\def\noexpand\replace@markers##1{%
+ \noexpand\def\noexpand\replace@text{}%
+ \noexpand\expandafter\noexpand\do@replace@charM##1\@char@M\relax\noexpand\end@replace@marker
+ \noexpand\let##1\noexpand\replace@text
+ \noexpand\def\noexpand\replace@text{}%
+ \noexpand\expandafter\noexpand\doreplace@begverb##1\@beg@env@string\relax\noexpand\end@replace@marker
+ \noexpand\let##1\noexpand\replace@text
+ \noexpand\def\noexpand\replace@text{}%
+ \noexpand\expandafter\noexpand\doreplace@endverb##1\@end@env@string\relax\noexpand\end@replace@marker
+ \noexpand\let##1\noexpand\replace@text
+ }
+}
+% \end{macrocode}
+% Define the substitution loop terminator:
+% \begin{macrocode}
+\def\replace@mark@noop#1\end@replace@marker{}
+% \end{macrocode}
+% Now define all the marker substitution macros:
+% \begin{macrocode}
+\def@replace@markers
+% \end{macrocode}
+%\end{macro}
+%
%\begin{environment}{defproblem}
-%\changes{2011/08/22}{3.01}{added second optional argument}
+%\changes{3.01}{2011/08/22}{added second optional argument}
+%\changes{3.02}{2011/12/11}{added key-val optional argument}
%\begin{definition}
-%"\begin{defproblem}"\oarg{n}\oarg{default args}\marg{label}
+%"\begin{defproblem}"\oarg{n}\oarg{default args}\marg{label}\oarg{key-val options}
%\end{definition}
% Define a new problem identified by \meta{label} with
% \meta{n} arguments to add to the current data base. Note that
@@ -1239,10 +1433,19 @@ Please specify (e.g. \csname @prob@getargs@eg@\romannumeral#1\endcsname):}%
\edef\@prob@currentargN{\number0#1}%
\@defproblem@beginenv
}{}
-
+% \end{macrocode}
+% Gather second optional argument and mandatory argument:
+% \begin{macrocode}
\newcommand*{\@defproblem@beginenv}[2][]{%
\def\@prob@currentdefaultargs{#1}%
\def\@prob@currentlabel{#2}%
+ \@defproblem@beginenv@
+}
+% \end{macrocode}
+% Get final optional argument and process
+% \begin{macrocode}
+\newcommand*{\@defproblem@beginenv@}[1][]{%
+ \setkeys{probsoln}{#1}%
\long@collect@body\prob@do@defproblem
}
% \end{macrocode}
@@ -1257,8 +1460,32 @@ Please specify (e.g. \csname @prob@getargs@eg@\romannumeral#1\endcsname):}%
% is given by \cs{prob@currentdb}.
% \begin{macrocode}
\newcommand{\prob@do@newproblem}[1]{%
- \prob@newproblem\@prob@currentargN\prob@currentdb
- \@prob@currentlabel{#1}{\@prob@currentdefaultargs}}
+ \if@prob@fragile
+ \probsoln@process@fragile{#1}%
+ \protected@edef\do@def@new@problem{%
+ \noexpand\prob@newproblem
+ {\@prob@currentargN}%
+ {\prob@currentdb}%
+ {\@prob@currentlabel}%
+ {%
+ \noexpand\probsoln@write@tmp{\@prob@tmp@problem}%
+ \noexpand\probsoln@read@tmp
+ }%
+ {\@prob@currentdefaultargs}%
+ }%
+ \else
+ \toks@{#1}%
+ \protected@edef\do@def@new@problem{%
+ \noexpand\prob@newproblem
+ {\@prob@currentargN}%
+ {\prob@currentdb}%
+ {\@prob@currentlabel}%
+ {\the\toks@}%
+ {\@prob@currentdefaultargs}%
+ }%
+ \fi
+ \do@def@new@problem
+}
% \end{macrocode}
%\end{macro}
%
@@ -1274,16 +1501,18 @@ Please specify (e.g. \csname @prob@getargs@eg@\romannumeral#1\endcsname):}%
% Define an environment that only displays its contents if the
% solutions should be displayed.
% \begin{macrocode}
-\newenvironment{onlysolution}{%
+\newenvironment{onlysolution}[1][]{%
+ \setkeys{probsoln}{#1}%
\long@collect@body\do@onlysolution
}{}
% \end{macrocode}
%\end{environment}
%\begin{macro}{\do@onlysolution}
+%\changes{3.02}{2011/12/10}{added \cs{probsoln@do@body}}
% \begin{macrocode}
\newcommand{\do@onlysolution}[1]{%
\ifshowanswers
- #1%
+ \probsoln@do@body{#1}%
\fi
% \end{macrocode}
% Add to the list of solutions
@@ -1302,7 +1531,7 @@ Please specify (e.g. \csname @prob@getargs@eg@\romannumeral#1\endcsname):}%
%\end{macro}
%
%\begin{macro}{\psn@add@unique@label}
-%\changes{2011/08/22}{3.01}{new}
+%\changes{3.01}{2011/08/22}{new}
%\begin{definition}
%\cs{psn@add@unique@label}\marg{list cs}\marg{label}
%\end{definition}
@@ -1325,7 +1554,7 @@ Please specify (e.g. \csname @prob@getargs@eg@\romannumeral#1\endcsname):}%
% This is defined in \sty{datatool}, but there's no sense loading
% the entire package just for this, so define if not already
% defined.
-%\changes{2011/08/22}{3.01}{new}
+%\changes{3.01}{2011/08/22}{new}
% \begin{macrocode}
\providecommand{\DTLifinlist}[4]{%
\def\@dtl@doifinlist##1,#1,##2\end@dtl@doifinlist{%
@@ -1348,19 +1577,75 @@ Please specify (e.g. \csname @prob@getargs@eg@\romannumeral#1\endcsname):}%
%\begin{environment}{onlyproblem}
% Define an environment that only displays its contents if the
% solutions should not be displayed.
+%\changes{3.02}{2011/12/10}{added optional argument.}
% \begin{macrocode}
-\newenvironment{onlyproblem}{%
+\newenvironment{onlyproblem}[1][]{%
+ \setkeys{probsoln}{#1}%
\long@collect@body\do@onlyproblem
}{}
% \end{macrocode}
%\end{environment}
%\begin{macro}{\do@onlyproblem}
+%\changes{3.02}{2011/12/10}{added \cs{probsoln@do@body}}
% \begin{macrocode}
\newcommand{\do@onlyproblem}[1]{%
-\ifshowanswers
-\else
- #1%
-\fi}
+ \ifshowanswers
+ \else
+ \probsoln@do@body{#1}%
+ \fi
+}
+% \end{macrocode}
+%\end{macro}
+%
+%\begin{macro}{\probsoln@do@body}
+% Either does argument or sanitizes, writes and reads.
+%\changes{3.02}{2011/12/10}{new}
+% \begin{macrocode}
+\newcommand{\probsoln@do@body}[1]{%
+ \if@prob@fragile
+ \probsoln@process@fragile{#1}%
+ \probsoln@write@tmp{\@prob@tmp@problem}%
+ \probsoln@read@tmp
+ \else
+ #1%
+ \fi
+}
+% \end{macrocode}
+%\end{macro}
+%
+%\begin{macro}{\probsoln@process@fragile}
+% Sanitizes and replaces markers. Result stored in
+% \cs{@prob@tmp@problem}
+%\changes{3.02}{2011/12/10}{new}
+% \begin{macrocode}
+\newcommand{\probsoln@process@fragile}[1]{%
+ \def\@prob@tmp@problem{#1}%
+ \@onelevel@sanitize\@prob@tmp@problem
+ \replace@markers\@prob@tmp@problem
+}
+% \end{macrocode}
+%\end{macro}
+%
+%\begin{macro}{\probsoln@write@tmp}
+%\changes{3.02}{2011/12/10}{new}
+% Writes argument to temporary file (including opening and closing
+% file.)
+% \begin{macrocode}
+\newcommand{\probsoln@write@tmp}[1]{%
+ \immediate\openout\probsoln@write=\ProbSolnFragileFile.\ProbSolnFragileExt
+ \immediate\write\probsoln@write{#1}%
+ \immediate\closeout\probsoln@write
+}
+% \end{macrocode}
+%\end{macro}
+%
+%\begin{macro}{\probsoln@read@tmp}
+%\changes{3.02}{2011/12/10}{new}
+% Inputs temporary file.
+% \begin{macrocode}
+\newcommand{\probsoln@read@tmp}{%
+ \input{\ProbSolnFragileFile.\ProbSolnFragileExt}%
+}
% \end{macrocode}
%\end{macro}
%
@@ -1374,7 +1659,7 @@ Please specify (e.g. \csname @prob@getargs@eg@\romannumeral#1\endcsname):}%
% \meta{db name} where \meta{arg1}\ldots\meta{argN} are the
% arguments to pass to the problem, if the problem was defined
% to take arguments.
-%\changes{2011/08/22}{3.01}{changed \cs{@next} to \cs{@useprob@next}}
+%\changes{3.01}{2011/08/22}{changed \cs{@next} to \cs{@useprob@next}}
% \begin{macrocode}
\newcommand{\useproblem}[2][default]{%
\def\@prob@currentlabel{#2}%
@@ -1415,7 +1700,7 @@ Please specify (e.g. \csname @prob@getargs@eg@\romannumeral#1\endcsname):}%
% Only define problem if the label is listed in
% \cs{prob@selectedlabels}. (The current label is
% given by \cs{@prob@currentlabel}.)
-%\changes{2011/08/22}{3.01}{replaced \cs{IFSubStringInString} with
+%\changes{3.01}{2011/08/22}{replaced \cs{IFSubStringInString} with
%\cs{DTLifinlist}}
% \begin{macrocode}
\newcommand{\prob@do@selectedproblem}[1]{%
@@ -1468,7 +1753,7 @@ Please specify (e.g. \csname @prob@getargs@eg@\romannumeral#1\endcsname):}%
%\end{definition}
% Loads only those problems whose labels are not listed in
% \meta{list}.
-%\changes{2011/08/22}{3.01}{new}
+%\changes{3.01}{2011/08/22}{new}
% \begin{macrocode}
\newcommand{\loadexceptproblems}[3][default]{%
\bgroup
@@ -1562,7 +1847,7 @@ Please specify (e.g. \csname @prob@getargs@eg@\romannumeral#1\endcsname):}%
\shuffle{@prob@tmp@}{\@probselN}%
\ifnum\@probselN<#2\relax
% \end{macrocode}
-%\changes{2011/08/22}{3.01}{changed error to warning}
+%\changes{3.01}{2011/08/22}{changed error to warning}
% \begin{macrocode}
\PackageWarning{probsoln}{You have requested
\number#2\space\space problem(s) but `#3' only contains
@@ -1888,7 +2173,7 @@ Please specify (e.g. \csname @prob@getargs@eg@\romannumeral#1\endcsname):}%
% These commands ensure that this version is compatible with
% versions prior to v3.0
%\begin{macro}{\newproblem}
-%\changes{2011/08/22}{3.01}{added second optional argument}
+%\changes{3.01}{2011/08/22}{added second optional argument}
% Defines a new problem.
% \begin{macrocode}
\newcommand*{\newproblem}{\@ifstar\@snewproblem\@newproblem}
@@ -1962,7 +2247,7 @@ Please specify (e.g. \csname @prob@getargs@eg@\romannumeral#1\endcsname):}%
% These commands are provided to format parts of the
% problems/solutions.
%\begin{environment}{solution}
-%\changes{2011/08/22}{3.01}{added space after solution tag}
+%\changes{3.01}{2011/08/22}{added space after solution tag}
% \begin{macrocode}
\@ifundefined{solution}{%
\newenvironment{solution}{\par\noindent\textbf{\solutionname:}\space
@@ -2395,6 +2680,35 @@ Differentiate the following functions:
%\fi
%\iffalse
% \begin{macrocode}
+%<*sample8.tex>
+% \end{macrocode}
+%\fi
+%\iffalse
+% \begin{macrocode}
+\documentclass{article}
+
+\usepackage{listings}
+\usepackage{probsoln}
+
+\setkeys{probsoln}{fragile}
+
+\loadallproblems{prob-verb}
+
+\showanswers
+\begin{document}
+\begin{enumerate}
+ \foreachproblem{\item \thisproblem}
+\end{enumerate}
+\end{document}
+% \end{macrocode}
+%\fi
+%\iffalse
+% \begin{macrocode}
+%</sample8.tex>
+% \end{macrocode}
+%\fi
+%\iffalse
+% \begin{macrocode}
%<*prob-1stprncp.tex>
% \end{macrocode}
%\fi
@@ -2955,8 +3269,8 @@ $P(a_2)=\frac{1}{4}$
\end{onlysolution}
\end{defproblem}
-\begin{defproblem}{digraph}\label{ex:digraph}
- \begin{onlyproblem}
+\begin{defproblem}{digraph}
+ \begin{onlyproblem}\label{ex:digraph}
Identify, if any, the sinks and sources of the digraph shown in Figure~\ref{fig:digraph}.
\begin{figure}[tbh]
@@ -3185,5 +3499,47 @@ What is $-1+2\times3$? &
%</prob-tabmchoice.tex>
% \end{macrocode}
%\fi
+%\iffalse
+% \begin{macrocode}
+%<*prob-verb.tex>
+% \end{macrocode}
+%\fi
+%\iffalse
+% \begin{macrocode}
+\begin{defproblem}{code-helloworld}
+This problem has a code fragment.
+\begin{onlyproblem}
+\lstset{language=Java}
+\begin{lstlisting}
+public class HelloWorld
+{
+ public static void main(String[] args)
+ {
+ System.out.println("Hello World!");
+ }
+}
+\end{lstlisting}
+\end{onlyproblem}
+\begin{onlysolution}
+\lstset{language=Java}
+\begin{lstlisting}
+public class HelloWorld
+{
+ public static void main(String[] args)
+ {
+ System.out.println("Hello "
+ + (args.length==0 ? "anon" : args[0])+"!");
+ }
+}
+\end{lstlisting}
+\end{onlysolution}
+\end{defproblem}
+% \end{macrocode}
+%\fi
+%\iffalse
+% \begin{macrocode}
+%</prob-verb.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 4b5315b74ca..20afb0ffb88 100644
--- a/Master/texmf-dist/source/latex/probsoln/probsoln.ins
+++ b/Master/texmf-dist/source/latex/probsoln/probsoln.ins
@@ -1,4 +1,4 @@
-% probsoln.ins generated using makedtx version 0.94b 2011/8/22 22:10
+% probsoln.ins generated using makedtx version 0.94b 2011/12/10 17:17
\input docstrip
\preamble
@@ -18,7 +18,7 @@
The Current Maintainer of this work is Nicola Talbot.
- This work consists of the files probsoln.dtx and probsoln.ins and the derived files probsoln.sty, sample.tex, sample2.tex, sample3.tex, sample4.tex, sample5.tex, sample6.tex, sample7.tex, prob-1stprncp.tex, prob-args.tex, prob-easy.tex, prob-easy2.tex, prob-implicit.tex, prob-mchoice.tex, prob-mixed.tex, prob-newdata.tex, prob-nosoln.tex, prob-probspaces.tex, prob-probspaces2.tex, prob-tabmchoice.tex.
+ This work consists of the files probsoln.dtx and probsoln.ins and the derived files probsoln.sty, sample.tex, sample2.tex, sample3.tex, sample4.tex, sample5.tex, sample6.tex, sample7.tex, sample8.tex, prob-1stprncp.tex, prob-args.tex, prob-easy.tex, prob-easy2.tex, prob-implicit.tex, prob-mchoice.tex, prob-mixed.tex, prob-newdata.tex, prob-nosoln.tex, prob-probspaces.tex, prob-probspaces2.tex, prob-tabmchoice.tex, prob-verb.tex.
\endpreamble
@@ -40,6 +40,8 @@
\usepostamble\defaultpostamble\from{probsoln.dtx}{sample6.tex,package}}
\file{sample7.tex}{\usepreamble\defaultpreamble
\usepostamble\defaultpostamble\from{probsoln.dtx}{sample7.tex,package}}
+\file{sample8.tex}{\usepreamble\defaultpreamble
+\usepostamble\defaultpostamble\from{probsoln.dtx}{sample8.tex,package}}
\file{prob-1stprncp.tex}{\usepreamble\defaultpreamble
\usepostamble\defaultpostamble\from{probsoln.dtx}{prob-1stprncp.tex,package}}
\file{prob-args.tex}{\usepreamble\defaultpreamble
@@ -64,6 +66,8 @@
\usepostamble\defaultpostamble\from{probsoln.dtx}{prob-probspaces2.tex,package}}
\file{prob-tabmchoice.tex}{\usepreamble\defaultpreamble
\usepostamble\defaultpostamble\from{probsoln.dtx}{prob-tabmchoice.tex,package}}
+\file{prob-verb.tex}{\usepreamble\defaultpreamble
+\usepostamble\defaultpostamble\from{probsoln.dtx}{prob-verb.tex,package}}
}
\endbatchfile