summaryrefslogtreecommitdiff
path: root/macros/latex/contrib/eqexam/eqexam.dtx
diff options
context:
space:
mode:
authorNorbert Preining <norbert@preining.info>2021-03-02 03:04:42 +0000
committerNorbert Preining <norbert@preining.info>2021-03-02 03:04:42 +0000
commit4763ec8ceefaf2b038d591b8c15d88d081aec6c9 (patch)
tree113e7c21358dd01318b8e7a1e3f3228ec33bc563 /macros/latex/contrib/eqexam/eqexam.dtx
parent3a1a102e980610859d9f1b197733d6ce6a541c62 (diff)
CTAN sync 202103020304
Diffstat (limited to 'macros/latex/contrib/eqexam/eqexam.dtx')
-rw-r--r--macros/latex/contrib/eqexam/eqexam.dtx252
1 files changed, 152 insertions, 100 deletions
diff --git a/macros/latex/contrib/eqexam/eqexam.dtx b/macros/latex/contrib/eqexam/eqexam.dtx
index b9cc28503f..fd5e1e31f8 100644
--- a/macros/latex/contrib/eqexam/eqexam.dtx
+++ b/macros/latex/contrib/eqexam/eqexam.dtx
@@ -16,8 +16,8 @@
%</copyright>
%<package>\NeedsTeXFormat{LaTeX2e}
%<package>\ProvidesPackage{eqexam}
-%<package> [2021/01/20 v5.1.13 An Exam Construction Package (dps)]
-%<package>\def\eqexamdefReq{2021/01/20}
+%<package> [2021/02/26 v5.2 An Exam Construction Package (dps)]
+%<package>\def\eqexamdefReq{2021/02/21}
%<*driver>
\documentclass{ltxdoc}
\GlossaryPrologue{\section{{Change History}}}%
@@ -26,6 +26,7 @@
\value{GlossaryColumns}=2
\usepackage{makeidx}
\usepackage[colorlinks,hyperindex=false]{hyperref}
+\usepackage{fancyvrb}
\gdef\darg#1{\texttt{\char123\relax#1\char125\relax}}
\let\env\texttt
\let\opt\texttt
@@ -171,12 +172,13 @@
% option. It is normally \texttt{true}, but if set to \texttt{false}, the
% \cs{AddToShipoutPicture} is not generated at the beginning of the
% document. Here is the code taken from below:
-%\begin{verbatim}
-% \ifeqfortextbook\ifeqwritetomargins
-% \AtBeginDocument{\chkmarginboxwidth
-% \AddToShipoutPicture{\eqe@tb@shipout}}
-% \fi\fi
-%\end{verbatim}
+%\begin{Verbatim}[xleftmargin=\parindent,fontsize=\small,
+%commandchars={!()},codes={\catcode`\%=9}]
+%\ifeqfortextbook\ifeqwritetomargins
+%!quad\AtBeginDocument{\chkmarginboxwidth
+%!quad\AddToShipoutPicture{\eqe@tb@shipout}}
+%\fi\fi
+%\end{Verbatim}
% Using this option, the check for the margin width is not done,
% and writing to the margins is turned off.
% (\cs{marginpar} still works)
@@ -700,19 +702,20 @@
%
% Here is an example of usage for defining your own custom options, must be based on
% current options, this code would be in the file \texttt{eqecus.opt}.
-%\begin{verbatim}
+%\begin{Verbatim}[xleftmargin=\parindent,fontsize=\small,
+%commandchars={!()},codes={\catcode`\%=9}]
%\DeclareOptionX{atbdbopts}
-%{%
-% \ExecuteOptionsX{online}
-% \ExecuteOptionsX{forcolorpaper}
-% \ExecuteOptionsX{nosolutions}
-% \ExecuteOptionsX{nopoints}
-% \ExecuteOptionsX{nototals}
-% \ExecuteOptionsX{nospacetowork}
-% \ExecuteOptionsX{obeylocalversions}
-% \ExecuteOptionsX{myconfig}
+%{!%
+%!quad\ExecuteOptionsX{online}
+%!quad\ExecuteOptionsX{forcolorpaper}
+%!quad\ExecuteOptionsX{nosolutions}
+%!quad\ExecuteOptionsX{nopoints}
+%!quad\ExecuteOptionsX{nototals}
+%!quad\ExecuteOptionsX{nospacetowork}
+%!quad\ExecuteOptionsX{obeylocalversions}
+%!quad\ExecuteOptionsX{myconfig}
%}
-%\end{verbatim}
+%\end{Verbatim}
% The following config files are input prior to \cs{ProcessOptionsX}, and can,
% therefore, contain declaration of options. \texttt{web.cfg} usually only
% specifies the default driver. \texttt{eqecus.opt} is used by \textsf{@EASE},
@@ -1363,7 +1366,8 @@
% \begin{macro}{\Exam}
% \begin{macro}{\sExam}
% Convenience macros for titling the exam. Usage:
-%\begin{verbatim}
+%\begin{Verbatim}[xleftmargin=\parindent,fontsize=\small,
+%commandchars={!()},codes={\catcode`\%=9}]
%\VersionAtext{Test~\nExam--Version A}
%\VersionBtext{Test~\nExam--Version B}
%\shortVersionAtext{T\nExam A}
@@ -1374,7 +1378,7 @@
%\subject[C3]{Calculus III}
%\title[\sExam]{\Exam}
%\author{Dr.\ D. P. Story}
-%\end{verbatim}
+%\end{Verbatim}
% These next two definitions are overwritten by the two
% commands \cs{longTitleText} and \cs{shortTitleText}.
% \begin{macrocode}
@@ -1428,18 +1432,19 @@
% Next we state the long and short titles for our document,
% one for each of our declare number of versions given earlier.
% For example, we can use the value \cs{nExam} in out titles. Usage:
-%\begin{verbatim}
-% \longTitleText
-% {Test~\nExam--Version A}
-% {Test~\nExam--Version B}
-% {Test~\nExam--Make Up}
-% \endlongTitleText
-% \shortTitleText
-% {T\nExam A}
-% {T\nExam B}
-% {T\nExam MU}
-% \endshortTitleText
-%\end{verbatim}
+%\begin{Verbatim}[xleftmargin=\parindent,fontsize=\small,
+%commandchars={!()},codes={\catcode`\%=9}]%
+%!quad\longTitleText
+%!qquad{Test~\nExam--Version A}
+%!qquad{Test~\nExam--Version B}
+%!qquad{Test~\nExam--Make Up}
+%!quad\endlongTitleText
+%!quad\shortTitleText
+%!qquad{T\nExam A}
+%!qquad{T\nExam B}
+%!qquad{T\nExam MU}
+%!quad\endshortTitleText
+%\end{Verbatim}
% I've added markers that delimit the end of the arguments. In this
% way, the end of the list of titles can be detected, even though
% the number of titles is not the same as what is declared by the
@@ -1572,17 +1577,19 @@
% For example, assuming |\numVersions{3}| appeared earlier, the
% command |\forVersion{a}| (or |\forVersion{A}|) defines $3$ text commands \cs{vA}, \cs{vB} and
% \cs{vC}, each taking one argument, the text you want to display:
-%\begin{verbatim}
-% Name the \vA{place}\vB{date}\vC{year} of the signing of the Declaration
-% of independence.
-%\end{verbatim}
+%\begin{Verbatim}[xleftmargin=\parindent,fontsize=\small,
+%commandchars={!()},codes={\catcode`\%=9}]
+% Name the \vA{place}\vB{date}\vC{year} of the signing of the
+% Declaration of independence.
+%\end{Verbatim}
% Since we said |forVersion{a}| only the \cs{vA} text
% is displayed, the others are gobbled up, etc. But wait, the \cs{forVersion}
% does more than that! It also creates a series of comment environments
% |\begin{verA}/\end{verA}|, |\begin{verB}/\end{verB}|, |\begin{verC}/\end{verC}|, etc.,
% where only the version for which this compile applies will be typeset,
% the others are commented out.
-%\begin{verbatim}
+%\begin{Verbatim}[xleftmargin=\parindent,fontsize=\small,
+%commandchars={!()},codes={\catcode`\%=9}]
%\numVersions{3}
%\forVersion{b}
%...
@@ -1591,16 +1598,16 @@
% Solve the equation for $\vA{x}\vB{y}\vC{z}$:
%\[
%\begin{verA}
-% 2x + 4 = 7
+% 2x + 4 = 7
%\end{verA}
%\begin{verB}
-% 5y + 2 = 4
+% 5y + 2 = 4
%\end{verB}
%\begin{verC}
-% 3z - 2 = 2
+% 3z - 2 = 2
%\end{verC}
%\]
-%\end{verbatim}
+%\end{Verbatim}
% \changes{1.6b}{2006/04/03}
% {
% Changed the alphabet environments \texttt{A}, \texttt{B}, etc.\ due to a
@@ -1729,9 +1736,10 @@
% then you can locally change the version between problems.
% If the first argument is empty, the first variation is chosen.
% The syntax is
-%\begin{verbatim}
+%\begin{Verbatim}[xleftmargin=\parindent,fontsize=\small,
+%commandchars={!()},codes={\catcode`\%=9}]
%\selectVersion{2}{3}
-%\end{verbatim}
+%\end{Verbatim}
%This command says that the next problem has 3 variations, and here we select the second one.
%\changes{1.6a}{2006/01/22}
% {%
@@ -2086,9 +2094,10 @@
\EmailSubject{}
% \end{macrocode}
% In this case \textsf{eqAttach.asp} inserts the standard one.
-%\begin{verbatim}
+%\begin{Verbatim}[xleftmargin=\parindent,fontsize=\small,
+%commandchars={!()},codes={\catcode`\%=9}]
%Exam Results: \webtitle of \websubject
-%\end{verbatim}
+%\end{Verbatim}
% The email would read like ``\texttt{Exam Results:~Test 1 of Calculus I}'', for example.
%
% \DescribeMacro{\ServerRetnMsg} Unless submitted in \texttt{silent} mode, the \textsf{eqAttach.asp}
@@ -2696,10 +2705,11 @@
% This is the user-interface to acquiring the first and last page
% numbers of the exam with name \texttt{\#1}. These can be used
% in comparisons, e.g.
-%\begin{verbatim}
-% \rfooteqe{\ifnum\value{page}<\numLastPageOfExam{<myTest>}%
-% \textbf{Test Continues}\fi}
-%\end{verbatim}
+%\begin{Verbatim}[xleftmargin=\parindent,fontsize=\small,
+%commandchars={!()},codes={\catcode`\%=9}]
+%\rfooteqe{\ifnum\value{page}<\numLastPageOfExam{!ameta(myTest)}%
+%!quad\textbf{Test Continues}\fi}
+%\end{Verbatim}
% \begin{macrocode}
\newcommand{\numLastPageOfExam}[1]{\eqe@numRefii{#1PageEnd}}
\newcommand{\numFirstPageOfExam}[1]{\eqe@numRefii{#1PageBegin}}
@@ -2917,9 +2927,10 @@
% \begin{macro}{\placeCoverPageLogo}
% A simple command to insert a logo on the cover page. The logo can be used to cover the
% score in the next page, if the instructor places the score under the logo. Example of usage
-%\begin{verbatim}
-% \placeCoverPageLogo{5in}{-1.5in}{\includegraphics{nwfsc_logo}}
-%\end{verbatim}
+%\begin{Verbatim}[xleftmargin=\parindent,fontsize=\small,
+%commandchars={!()},codes={\catcode`\%=9}]
+%\placeCoverPageLogo{5in}{-1.5in}{\includegraphics{nwfsc_logo}}
+%\end{Verbatim}
% Working from the upper left corner, the first parameter is the amount to move to logo
% to the right, the second parameter is the amount to move the logo vertically. The
% Third parameter is the content; perhaps an \cs{includegraphics} command.
@@ -3229,11 +3240,12 @@
% \cs{autocaleparts}. \textbf{Should not be redefined}.
%\begin{flushleft}
%Parameters
-%\begin{verbatim}
+%\begin{Verbatim}[xleftmargin=15pt,fontsize=\small,
+%commandchars={!()},codes={\catcode`\%=9}]
%#1 = total points for this problem
%#2 = 0 if total points, otherwise, #2 is the number of points each
% problem.
-%\end{verbatim}
+%\end{Verbatim}
%\end{flushleft}
% \begin{macrocode}
\def\@marktotalvalue{\global\let\eqe@innermarkpts\relax
@@ -3269,21 +3281,23 @@
% This macro places the problem value in the left margin, can be redefined, if you dare.
%\begin{flushleft}
% Parameters
-%\begin{verbatim}
+%\begin{Verbatim}[xleftmargin=15pt,fontsize=\small,
+%commandchars={!()},codes={\catcode`\%=9}]
%#1 = total points for this problem
%#2 = 0 if total points, otherwise, #2 is the number of points each
-% problem.
-%\end{verbatim}
+% problem.
+%\end{Verbatim}
%\end{flushleft}
% Currently, this macro is not used so I'll make it into verbatim text.
-%\begin{verbatim}
+%\begin{Verbatim}[xleftmargin=\parindent,fontsize=\small,
+%commandchars={!()},codes={\catcode`\%=9}]
\newcommand{\eqleftmarginbox}[2]{\makebox[0pt][r]{%
- \setlength\tabcolsep{0pt}%
- \raisebox{-.5\height}[0pt][0pt]{%
- \marginboxdesign{\marginpointsboxtext{#1}{#2}}%
- }\hspace*{\marginparsep}\hspace*{\eqemargin}}%
+ \setlength\tabcolsep{0pt}%
+ \raisebox{-.5\height}[0pt][0pt]{%
+ \marginboxdesign{\marginpointsboxtext{#1}{#2}}%
+ }\hspace*{\marginparsep}\hspace*{\eqemargin}}%
}
-%\end{verbatim}
+%\end{Verbatim}
% \end{macro}
% \paragraph*{Formatting the points}
% \begin{macro}{\ptsLabel}
@@ -3482,9 +3496,10 @@
\eqrightmarginbox{#1}{#2}}
% \end{macrocode}
% The macro \cs{probvalue}, defined above, says
-%\begin{verbatim}
+%\begin{Verbatim}[xleftmargin=\parindent,fontsize=\small,
+%commandchars={!()},codes={\catcode`\%=9}]
%\mark{\theeqpointvalue\csname eqExam\endcsname\theeq@numparts}
-%\end{verbatim}
+%\end{Verbatim}
% so the \cs{botmark} contains the point value of this page and the part number for
% this page.
% \begin{macrocode}
@@ -3916,7 +3931,8 @@
%
% Below is an example of the use of the \texttt{splitsolution} environment
% (which is defined well below here).
-%\begin{verbatim}
+%\begin{Verbatim}[xleftmargin=\parindent,fontsize=\small,
+%commandchars={!()},codes={\catcode`\%=9}]
%\begin{problem}[5]
%This is a question worth $5$ points.
%\begin{splitsolution}
@@ -3928,7 +3944,7 @@
%\end{solution}
%\end{splitsolution}
%\end{problem}
-%\end{verbatim}
+%\end{Verbatim}
% Here, we include a graphic. We put it into a box, \cs{eqpanelbox} to get its dimensions.
% The \texttt{splitsolution} environment has one required argument, the total height of the
% solution. We then place the graphic in the \texttt{panel} environment, and write the solution
@@ -6017,51 +6033,87 @@
\newcommand\bopText{on the back of page~\boPage}
\newcommand\bopCoverPageText{on the back of the cover page}
\newcommand\OnBackOfPage[1][\bopText]{%
- \refstepcounter{backofpage}\label{bop\thebackofpage}
- \begingroup
- \csarg\ifx{r@bop\thebackofpage}\relax
- \def\boPage{??}\else
- \edef\eqe@temp{\csname r@bop\thebackofpage\endcsname}%
- \ifx\hyper@anchor\@undefined
- \edef\boPage{\expandafter\@secondoftwo\eqe@temp}\else
- \edef\boPage{\expandafter\@secondoffive\eqe@temp}\fi
- \c@eq@count\boPage
- \advance\c@eq@count-1\relax
+ \refstepcounter{backofpage}\label{bop\thebackofpage}
+ \begingroup
+ \csarg\ifx{r@bop\thebackofpage}\relax
+ \def\boPage{??}\else
+ \edef\eqe@temp{\csname r@bop\thebackofpage\endcsname}%
+ \ifx\hyper@anchor\@undefined
+ \edef\boPage{\expandafter\@secondoftwo\eqe@temp}\else
+ \edef\boPage{\expandafter\@secondoffive\eqe@temp}\fi
+ \c@eq@count\boPage
+ \advance\c@eq@count\m@ne
% \end{macrocode}
% If on page 1, we work on the back of page 1, otherwise, we work on the
% back of the previous page.
% \begin{macrocode}
- \edef\boPage
- {%
- \ifx\eqex@coverpage\relax
- \ifnum\value{eq@count}=0
- 1%
- \else
- \the\value{eq@count}%
- \fi
- \else
- \ifnum\value{eq@count}=0
- -1%
- \else
- \the\value{eq@count}%
- \fi
- \fi
- }%
- \fi
- \csarg\ifx{r@bop\thebackofpage}\relax#1\else
- \ifnum\boPage=-1\relax\bopCoverPageText\else#1\fi\fi
- \endgroup
+ \edef\boPage
+ {%
+ \ifx\eqex@coverpage\relax
+ \ifnum\value{eq@count}=\z@
+ 1%
+ \else
+ \the\value{eq@count}%
+ \fi
+ \else
+ \ifnum\value{eq@count}=\z@
+ -1%
+ \else
+ \the\value{eq@count}%
+ \fi
+ \fi
+ }%
+ \fi
+ \csarg\ifx{r@bop\thebackofpage}\relax#1\else
+ \ifnum\boPage=\m@ne\bopCoverPageText\else#1\fi\fi
+ \endgroup
}
% \end{macrocode}
% \end{macro}
%
-%\section{Vertical Space Filling Options}
+% \subsection{In support of matching-type questions}
+%
+% As a variation of a \env{problem*} question, a matching-type question
+% can be posed. The student matches each item in one column with an item
+% in a list of items in another column. The alternative words or phrases
+% are listed between the \DescribeMacro{\bMatchChoices}\cs{bMatchChoices}/\allowbreak
+% \DescribeMacro{\eMatchChoices}\cs{eMatchChoices} command pair.
+%
+% \changes{v5.2}{2021/02/26}{Support for matching-type questions}
+% \begin{macrocode}
+\def\bMatchChoices{\begingroup
+ \setcounter{partno}{0}
+ \renewcommand{\thepartno}{\Alph{partno}}
+ \partsformat{\Alph{partno}.}
+% \end{macrocode}
+% To prevent a link from forming (when the \opt{links} or \opt{online}
+% option is taken), we pass the \texttt{[h]} optional argument
+% to \cs{foritem} and \cs{item}.
+% \begin{macrocode}
+ \let\itemSAVE\item
+ \def\item{\itemSAVE[h]}
+% \end{macrocode}
+% This is the definition of \cs{foritem}, but renamed to
+% \cs{foritemSAVE}. Below the definition, we redefine
+% \cs{foritem} to \cs{foritemSAVE[h]}.
+% \begin{macrocode}
+ \newcommand{\foritemSAVE}[2][]{%
+ \setcounter{partno}{0}\def\@rgi{##1}\ifx\@rgi\@empty
+ \def\eqe@nextitem{\itemSAVE}\else
+ \def\eqe@nextitem{\itemSAVE[##1]}\fi
+ \foritem@cont{##2}}%
+ \def\foritem{\foritemSAVE[h]}
+}
+\def\eMatchChoices{\endgroup}
+% \end{macrocode}
+% \section{Vertical Space Filling Options}
%
% When the \opt{nosolutions} or the \opt{vspacewithsolns} is used, a
% vertical space is generated by the \env{solution} environment.
% Previously, this has just been a vertical white space, now, we provide
% the ability to fill the space with horizontal rules of different types.
-% Below is the implementation of this.
+% Below is the implementation of this. For this specialize question, the following
+% pair of commands are defined.
%
% \subsection{General filler lines commands and controls}
% \begin{macro}{\useFillerLines}