summaryrefslogtreecommitdiff
path: root/texmf-dist/source
diff options
context:
space:
mode:
authorNorbert Preining <norbert@preining.info>2017-07-13 09:20:26 +0900
committerNorbert Preining <norbert@preining.info>2017-07-13 09:20:26 +0900
commit305996352c1aa2f99d04a7a445c88b5ca44bc17b (patch)
tree8d4b71eef933b7c47f307f6d869d4d3fe07bc125 /texmf-dist/source
parentf13250c65aadfaaebc86769c49916dbcb1f06500 (diff)
add eqexam
Diffstat (limited to 'texmf-dist/source')
-rw-r--r--texmf-dist/source/latex/eqexam/doc/eqexamman.tex4611
-rw-r--r--texmf-dist/source/latex/eqexam/doc/fortextbook.zipbin0 -> 718935 bytes
-rw-r--r--texmf-dist/source/latex/eqexam/doc/fortextbook/fortextbook.pdfbin0 -> 577912 bytes
-rw-r--r--texmf-dist/source/latex/eqexam/eqexam.dtx8258
-rw-r--r--texmf-dist/source/latex/eqexam/eqexam.ins62
-rw-r--r--texmf-dist/source/latex/eqexam/script/eqAttach.asp202
6 files changed, 13133 insertions, 0 deletions
diff --git a/texmf-dist/source/latex/eqexam/doc/eqexamman.tex b/texmf-dist/source/latex/eqexam/doc/eqexamman.tex
new file mode 100644
index 00000000..c8ec9c86
--- /dev/null
+++ b/texmf-dist/source/latex/eqexam/doc/eqexamman.tex
@@ -0,0 +1,4611 @@
+\documentclass{article}
+%\usepackage{makeidx,showidx}
+\usepackage[fleqn]{amsmath}
+\usepackage{graphicx}
+\usepackage[
+ web={designv,
+ latextoc,forcolorpaper,
+ centertitlepage},
+ eforms
+]{aeb_pro}
+%\usepackage[designv,
+% latextoc,forcolorpaper,
+% centertitlepage]{web}
+%\usepackage{eforms}
+
+%\usepackage[nopoints,fortextbook,nomarginwrite,usecustomdesign]{eqexam}
+%\usepackage{longtable,colortbl}
+%\useFullWidthForPaper
+
+\usepackage{eqexaman}
+
+%\usepackage{srcltx}
+
+\hfuzz=1pt
+
+\def\AEBBook{\textsl{{Acro\!\TeX} eDucation System Tools: {\LaTeX} for interactive PDF documents}}
+\def\AEBP{\textsf{AeB Pro}}
+
+\DeclareFontFamily{U}{wi}{}
+\DeclareFontShape{U}{wi}{m}{n}{<-> wingding}{}
+\DeclareFontFamily{U}{webd}{}
+\DeclareFontShape{U}{webd}{m}{n}{<-> webdings}{}
+
+\font\zqacr=zqacr at 8pt
+
+
+
+\setlength{\mathindent}{\leftmargini}
+%\def\meta#1{\textit{$\langle$#1$\rangle$}}
+
+\makeatletter
+
+%\def\numberline#1{{\setlength{\fboxsep}{0pt}\fbox{\hb@xt@\@tempdima{#1\hfil}}}}
+
+%\renewcommand*\l@section{\addvspace{2pt}\@dottedtocline{1}{1.5em}{2.5em}}
+\renewcommand*\l@subsection{\addvspace{1pt}\@dottedtocline{2}{1.5em}{3em}}
+\renewcommand*\l@subsubsection{\addvspace{1pt}\@dottedtocline{3}{4.5em}{1.2em}}
+
+%\renewcommand*\l@subsubsection{\addvspace{1pt}\@dottedtocline{3}{7.4em}{1.2em}}
+
+%\renewcommand*\l@section{\@dottedtocline{1}{1.5em}{2.3em}}
+%\renewcommand*\l@subsection{\@dottedtocline{2}{4.8em}{3.4em}}
+%\renewcommand*\l@subsubsection{\@dottedtocline{3}{8.2em}{1.2em}}
+%\renewcommand*\l@subsubsection{\@dottedtocline{3}{7em}{1.2em}}
+
+
+\newcommand{\exAeBBlogPDF}[2][\urlAcroTeXBlog/]{\par\ifdim\lastskip>0pt\relax\vskip-\lastskip\fi
+\vskip\medskipamount\noindent\makebox[0pt][r]{%
+ \makebox[0pt][l]{\textcolor{blue}{\Pisymbol{webd}{254}}}%
+ \raisebox{-2pt}{\color{red}\href{#1?#2}{{\zqacr b\hspace{9.5pt}}}}\enspace}\ignorespaces}
+
+\newcommand{\exAeBBlogArticle}[2][\urlAcroTeXBlog/]{\par\ifdim\lastskip>0pt\relax\vskip-\lastskip\fi
+\vskip\medskipamount\noindent\makebox[0pt][r]{\makebox[0pt][l]{\hspace{-1pt}\textcolor{blue}{\Pisymbol{webd}{254}}}%
+\raisebox{.5pt}{\color{red}\href{#1?#2}{\ding{045}}\hspace{7.5pt}\enspace}}\ignorespaces}
+\definePath{\urlAcroTeXBlog}{http://www.acrotex.net/blog}
+
+\renewcommand*\descriptionlabel[1]{\hspace\labelsep
+ \normalfont #1}
+\newcommand{\aebDescriptionlabel}[1]{%
+ \setlength\dimen@{\amtIndent+\labelsep}%
+ {\hspace*{\dimen@}#1}}
+\makeatother
+\newenvironment{aebDescript}
+ {\begin{list}{}{\setlength{\labelwidth}{0pt}%
+ \setlength{\leftmargin}{\leftmargin}%
+ \setlength{\leftmargin}{\leftmargin+\amtIndent}%
+ \setlength\itemindent{-\leftmargin}%
+ \let\makelabel\aebDescriptionlabel
+ }}{\end{list}}
+
+\def\hardspace{{\fontfamily{cmtt}\selectfont\symbol{32}}}
+\def\AcroBlog{{Acro\!\TeX} Blog}
+\newlength{\aebdimen}
+\def\anglemeta#1{$\langle\textit{\texttt{#1}}\rangle$}
+\def\meta#1{\textit{\texttt{#1}}}
+\let\pkg\textsf
+\let\env\texttt
+\let\opt\texttt
+\let\app\textsf
+\def\AEB{\textsf{AeB}}
+\def\AcroTeX{Acro\!\TeX}
+\def\HTML{HTML}\def\FDF{FDF}
+\def\PDF{PDF}\def\URL{URL}
+\let\amtIndent\leftmargini
+\def\bNH{\begin{NoHyper}}\def\eNH{\end{NoHyper}}
+\def\nhnameref#1{\bNH\nameref{#1}\eNH}
+\def\nhNameref#1{\bNH\Nameref{#1}\eNH}
+\def\nhurl#1{\bNH\url{#1}\eNH}
+\def\grayV#1{\textcolor{gray}{#1}}
+\def\darg#1{\{#1\}}
+\def\parboxValign{t}
+\renewcommand*{\backrefalt}[4]{%
+ \ifcase #1\or
+ See page~#2.\else See pages~#2.\fi
+}
+\newenvironment{aebQuote}
+ {\list{}{\leftmargin\amtIndent}%
+ \item\relax}{\endlist}
+\newcommand{\FmtMP}[2][0pt]{\mbox{}\marginpar{%
+ \raisebox{.5\baselineskip+#1}{%
+ \expandafter\parbox\expandafter[\parboxValign]%
+ {\marginparwidth}{\aebbkFmtMp#2}}}}
+\def\aebbkFmtMp{\kern0pt\itshape\small
+ \ifusebw\color{gray}\else\color{blue}\fi
+ \raggedleft\hspace{0pt}}
+\def\dps{$\mbox{$\mathfrak D$\kern-.3em\mbox{$\mathfrak P$}%
+ \kern-.6em \hbox{$\mathcal S$}}$}
+\def\FitItIn{\eq@fititin}
+\def\endredpoint{\FitItIn{{\large\ifusebw\color{black}\else\color{red}\fi$\blacktriangleleft$}}}
+
+
+%\makeindex
+
+\title{The \texorpdfstring{\textsf{eqexam} Package\\}{eqexam Package, }
+part of the\texorpdfstring{\\Acro\TeX}{AcroTeX} eDucation Bundle}
+\author{D. P. Story}
+\subject{%
+ A LaTeX package for creating Test, quizzes, both for paper and for
+ online use; supports writing problems sets for textbook authors.%
+}
+\keywords{LaTeX, hyperref, PDF, exercises, quizzes}
+\university{{\AcroT} Software Development Team}
+\email{dpstory@acrotex.net}
+\version{v4.9, 2017/03/16}
+\copyrightyears{2005-\the\year}
+
+\chngDocObjectTo{\newDO}{doc}
+\begin{docassembly}
+var titleOfManual="The eqexam Manual";
+var manualfilename="Manual_BG_Print_eqexam.pdf";
+var manualtemplate="Manual_BG_Brown.pdf"; // Blue, Green, Brown
+var _pathToBlank="C:/Users/Public/Documents/ManualBGs/"+manualtemplate;
+var doc;
+var buildIt=false;
+if ( buildIt ) {
+ console.println("Creating new " + manualfilename + " file.");
+ doc = \appopenDoc({cPath: _pathToBlank, bHidden: true});
+ var _path=this.path;
+ var pos=_path.lastIndexOf("/");
+ _path=_path.substring(0,pos)+"/"+manualfilename;
+ \docSaveAs\newDO ({ cPath: _path });
+ doc.closeDoc();
+ doc = \appopenDoc({cPath: manualfilename, oDoc:this, bHidden: true});
+ f=doc.getField("ManualTitle");
+ f.value=titleOfManual;
+ doc.flattenPages();
+ \docSaveAs\newDO({ cPath: manualfilename });
+ doc.closeDoc();
+} else {
+ console.println("Using the current "+manualfilename+" file.");
+}
+var _path=this.path;
+var pos=_path.lastIndexOf("/");
+_path=_path.substring(0,pos)+"/"+manualfilename;
+\addWatermarkFromFile({
+ bOnTop:false,
+ bOnPrint:false,
+ cDIPath:_path
+});
+\executeSave();
+\end{docassembly}
+
+\begin{document}
+
+\maketitle
+
+\tableofcontents
+
+\section{Forward}
+
+For the past several years (this year is 2016), I've been writing a book
+titled,
+\begin{quote}
+\AEBBook.
+\end{quote}
+The book~\cite{book:AEBB} covers {\AEB}, which includes the \pkg{eforms}
+package, and {\AEBP} in \emph{great detail} and includes many examples to
+illustrate concepts and techniques. Numerous new examples are available on
+the CD-ROM that accompanies the book.
+
+During the time of the writing, each of the packages covered was examined,
+bugs were fixed, and many new and major features were created. Any new
+features developed in the course of writing the book are documented in the
+book; however, they are \emph{not included in this documentation}. You can
+either buy the yet-to-be-submitted book sometime in the future, or discover
+the features by studying the DTX documentation of the program files. Sorry,
+it took me three years to write the book, I don't want to spend another year
+on this documentation. \verb!:-{)!
+
+\begin{flushright}
+Dr. D. P. Story\\[3pt]
+January 16, 2016
+\end{flushright}
+
+\section{Introduction}
+
+In my classroom work at The University of Akron, I've been using a
+personal {\LaTeX} package, which is called \textsf{eqexam}, for creating
+my in-class tests, quizzes, homework assignments, and review documents
+(pre-tests/sample tests). In recent weeks---at the end of the Fall
+Semester, 2004, and prior to the Spring Semester, 2005, I have filled the
+mundane and boring days with work on \textsf{eqexam}, fixing and enhancing
+it quite a bit.
+
+The \textsf{eqexam} package is a stand-alone for {\LaTeX}, but is also
+tightly integrated with the {\cAcroEB}. \textsf{eqexam} will be
+distributed by itself, as well as a part of the {\cAcroB}. The integration
+with the {\AcroB} gives it many of the online features that users of the
+Bundle are familiar with.
+
+\newtopic (Version 3.0 or later) The method of formatting an \textsf{eqexam}
+document has changed, each \texttt{problem}/\texttt{problem*} environment
+is now in a list environment, the \texttt{eqequestions} environment. This
+environment is not normally used by the document author, but its
+parameters may be redefined. The purpose of this reformatting, is to open
+up \textsf{eqexam} for use by other packages. Textbook authors can now, I
+hope, easily integrate \textsf{eqexam} into the custom book format
+being used.
+
+\newtopic Let's have an overview of the package, with suggestions for
+possible uses.
+\begin{enumerate}
+ \item The first, and most obvious application of this package
+ is to create a \textcolor{blue}{pExam} or a
+ \textcolor{blue}{pQuiz}. (Here, the `\textcolor{blue}{p}'
+ prefix refers to \underline paper or \underline pulp; thus, we
+ can use \textsf{eqexam} to write paper Exams and/or pulp
+ Quizzes). You can write the questions and the solutions, and
+ publish (i.e., print the document on a printer) the exam/quiz
+ with no solutions---ready to be taken in class---, or {\LaTeX}
+ the source document with solutions listed after each question
+ to create an answer key, for your personal use, or for the use
+ by the class.
+
+ \item So much for pulp. Now on to `\textcolor{blue}{e}' (for
+ electronic publication). In some of my classes, I put sample
+ questions (review tests) on the web as {\PDF} documents. In
+ this case, you can create a {\PDF} document without the
+ solutions, and give the class time to solve the problems; then
+ publish the document (in {\PDF} on the web) with solutions.
+ The solutions can appear immediately after the questions, or
+ can be accumulated at the end of the document.
+
+ \item[] In the case where the solutions are at the end of the
+ document, you can add links from the question to the solution.
+
+ \item[] Documents can be published with color (to enhance the
+ on screen appearance) or can be published in black and white,
+ meant to be printed. Or, you can do both: a screen
+ version and a paper version.
+
+ \item By invoking the \texttt{online} option, the white space
+ left for hand-written answers to the questions become Acroform
+ multi-line text fields, multiple choice questions become radio
+ buttons, and fill-in questions also become text fields. The
+ student can bring up the exam, and take it at a computer (in a
+ CBT\footnote{Computer Based Testing.} lab). After the student
+ is finished, he/she can print out the exam, and submit it to
+ the instructor for traditional grading.
+
+ \item Now, here is an exciting feature of the \textsf{eqexam}
+ package, that of email submittal! This feature is not too
+ useful for technical fields (i.e., mathematics related fields)
+ that require students to enter special symbols, but for some
+ academic disciplines (English, History, Sociology, Politics
+ and Government, etc.) this feature could be quite
+ exciting.\footnote{Of course, I am addressing now the some six
+ people worldwide in these fields that use {\LaTeX} and \PDF!
+ For you six, this feature is for you!}
+
+ \item[] When you take the \texttt{email} option of
+ \textsf{eqexam}, as with the \texttt{online} option, the white
+ space left for hand-written answers to the questions become
+ Acroform multi-line text fields, multiple choice questions
+ become radio buttons, and fill-in questions also become text
+ fields. Additionally, a button is automatically provided to
+ submit by email the results of the test to the instructor. The
+ results arrive at the instructor's mailer as an {\FDF}
+ attachment. The instructor can open the {\FDF} and view in the
+ originating {\PDF} the responses given by the student.
+
+ \item[] The instructor can print out the document and grade in
+ a traditional way, or if the instructor has
+ \textbf{Acrobat~Pro} or \textbf{Standard}, the instructor can
+ use mark-up annotations within the PDF, save a copy of the
+ students test to a class folder, and email a copy of the
+ students exam, marked up with grade.\footnote{Seems doubtful
+ that anyone at this time has the expertise to do this! But
+ it's available if anyone ever wants it.}
+
+ \item[] If the exam is given for credit, it can be taken in a
+ secure lab.
+
+ \item Perhaps a more reasonable application of this email
+ submission feature of \textsf{eqexam} is the building and
+ publication of surveys and questionnaires! Perhaps
+ teacher evaluations! The environments of \textsf{eqexam} can
+ be easily used to write surveys and questionnaires to
+ solicit the opinion of a target population. Responses are
+ emailed to the designated person, who can summarize them.
+
+ \item[] By the way, speaking of summarizing results, a new
+ feature of \textbf{Acrobat Pro~7.0}, allows you to take a
+ folder of {\FDF} files, such as the ones created by email
+ submission, and extract all form fields and place results to a
+ comma-delimited file (\texttt{.csv}). This comma-delimited
+ file can be opened by a spreadsheet program and manipulated.
+ Cool.
+
+ \item (08/05/11) Version 3.0 of \textsf{eqexam} has a major option,
+ \texttt{fortextbook},\footnote{The \texttt{fortextbook} option is briefly
+ described on page~\pageref*{fortextbook}.} designed to support (U.S.)
+ textbook authors. Documentation for this option is found in the
+ \texttt{doc/fortextbook} folder. See also the series of blogs at the
+ \ulSetLink{http://www.acrotex.net/blog/?tag=fortextbook}{{Acro\TeX} Blog}.
+
+\end{enumerate}
+
+%\subsection{What's New}
+%
+%\begin{enumerate}
+%
+% \item (Version 1.7) Added the ability to randomize items in a
+% multiple choice/selection list. See \Nameref{s:random} and the
+% \texttt{allowrandomize} option, as listed in \Nameref{eqoptions}.
+%
+% \item (Version 1.6) In this version, I've added the command
+% \cs{thisterm} (see \Nameref{preamble}) and expanded the control of
+% multiple versions. Now you can have up to $26$ versions of the same
+% test! For details of this new multiple version scheme, see the
+% discussion in \Nameref{mutiVerNew}.
+%
+% \item[] Also added are \cs{forproblem} and \cs{foritem}. See \mlNameref{solnSets}.
+%
+% \item (Version 1.4) Added a \texttt{manswers} environment for
+% multiple choice questions where multiple selections are permitted.
+% \textsf{Exerquiz} version 6.04 or greater is required with the
+% \texttt{online} and \texttt{email} options. See the section
+% \Nameref{multiSelect} for details.
+%
+% \item (Version 1.3) Added in the \cs{bChoices} and
+% \cs{eChoices} pair for specifying multiple choice
+% alternatives. See the brief discussion in
+% the section \Nameref{multichoice}.
+%\end{enumerate}
+
+\section{Required and Optional Packages}
+
+The following packages that are not part of the normal {\LaTeX}
+distribution are \emph{required}:
+\begin{enumerate}
+\item \texttt{calc}: Used for calculation of the position of the
+ marginal points.
+
+\item \texttt{pifont}: Used when the \texttt{proofread} option is
+ used to indicate the correct answers to multiple choice questions.
+
+\item \texttt{comment}: Used to have optional content, useful for
+ developing exams for multiple sections of the same class.
+
+\item \texttt{multicol}: Used to create questions in multi-column mode.
+
+\item \texttt{verbatim}: Used to write solutions to the hard drive.
+\end{enumerate}
+
+\noindent Additionally, the following packages may be used
+depending on the options chosen:
+\begin{enumerate}
+\item \texttt{web}: Used when the \texttt{pdf}, \texttt{links},
+ \texttt{online} or the \texttt{email} option is taken.
+
+\item \texttt{exerquiz}: Used when the
+ \texttt{links}, \texttt{online} or the \texttt{email} option is
+ taken.
+\end{enumerate}
+Of course, \texttt{web} and \texttt{exerquiz}, in turn, input a
+whole plethora of packages. Consult the documentation for the
+\cAcroEB.
+
+\section{Installing \textsf{eqexam}}
+
+Create a folder in your \texttt{latex} search path named
+\textsf{eqexam} and place the package files \texttt{eqexam.dtx},
+\texttt{eqexam.ins}, \texttt{eqexam.def} and any \texttt{.cfg}
+files. (If you have an \texttt{acrotex} folder, you can place the
+files there as well.)
+
+Next, \texttt{latex} \texttt{eqexam.ins} to create
+\texttt{eqexam.sty} and \texttt{eqalone.def}. The other files
+(\texttt{*.tex} and \texttt{*.pdf}) can be placed anywhere.
+
+The \textsf{eqexam} is a stand alone package that is tightly
+integrated with the \cAcroB. The file \texttt{eqexam.def} comes
+from the {\cAcroB} to provide the necessary support for many of
+the commands and environments defined in \textsf{eqexam}. The file
+\texttt{eqalone.def} are miscellaneous definitions that are needed
+for the stand-alone version. When you choose one of the options
+\texttt{links}, \texttt{online} or \texttt{email}, then
+\textsf{Exerquiz} is included in the package files. When you use
+one of these options you will need the most recent version of the
+\cAcroEB, the one published concurrently with this package.
+
+\section{Demonstration files}
+
+\exAeBBlogPDF{cat=107} The original
+\href{\urlAcroTeXBlog/?cat=107}{\pkg{eqexam} demonstration files} are posted
+on the \href{\urlAcroTeXBlog/}{{Acro\TeX} Blog}. Throughout the manual, individual
+files are references and a link is provided to that resource. The source file is attached
+to all PDFs on the {Acro\TeX} Blog website.
+
+\exAeBBlogPDF{tag=eqexam-package}
+Additional demonstration files developed after the original set are also available
+from the {Acro\TeX} Blog. See the articles tagged as
+\textit{\href{\urlAcroTeXBlog/?tag=eqexam-package}{eqexam-package}}.
+
+%http://www.acrotex.net/blog/?tag=eqexam-package
+
+
+\section{Page Layout Considerations}
+
+With Version~3.0, you can design your own page layout scheme, perhaps to
+conform to a book style. The following are some basics on formatting for
+\textsf{eqexam}.
+
+The following two commands appear in \textsf{eqexam}, the first sets some basic
+page parameters.
+\begin{Verbatim}[xleftmargin=\leftmargini,fontsize=\fontsize{9}{11}\selectfont]
+\newcommand{\eqeSetExamPageParams}{%
+ \setlength{\headheight}{12pt}
+ \setlength{\topmargin}{-.5in}
+ \setlength{\headsep}{20pt}
+ \setlength{\oddsidemargin}{0pt}
+ \setlength{\evensidemargin}{0pt}
+ \setlength{\marginparsep}{11pt}
+ \setlength{\marginparwidth}{35pt}
+ \setlength{\footskip}{11pt}
+}
+\end{Verbatim}
+The second command calculates values for \cs{textwidth} and \cs{textheight}
+based on the the settings of the first command.
+\begin{Verbatim}[xleftmargin=\leftmargini,fontsize=\fontsize{9}{11}\selectfont]
+\newcommand{\eqExamPageLayout}{%
+ \setlength\textwidth\paperwidth
+ \addtolength{\textwidth}{-2in}
+ \addtolength{\textwidth}{-\oddsidemargin}
+ \setlength\textheight{\paperheight}
+ \addtolength\textheight{-2in}
+ \addtolength\textheight{-\headheight}
+ \addtolength\textheight{-\headsep}
+ \addtolength\textheight{-\topmargin}
+ \addtolength\textheight{-\footskip}
+}
+\end{Verbatim}
+When the package option \texttt{usecustomdesign} \textit{is not taken,}
+then the two commands \cs{eqeSetExamPageParams} and \cs{eqExamPageLayout}
+are executed immediately after the above definitions. These are the
+original parameters used by \textsf{eqexam}, designed to yield a maximum
+text body in which to typeset an exam. The margins are set at 1 inch, the
+\cs{topmargin} is raised up, all to maximize space.
+
+Now, if the package option \texttt{usecustomdesign} is specified, the
+commands \cs{eqeSet\-Exam\-Page\-Params} and \cs{eqExamPageLayout} are \emph{not
+executed}, the package designer can either do a \cs{renewcommand} for
+these two commands in the preamble with custom values inserted (and
+execute \cs{eqeSetExamPageParams} and \cs{eqExamPageLayout}), or the
+designer may use another package to set the page layout parameters (or
+take the default of the class being used). In the latter case,
+neither \cs{eqeSetExamPageParams} nor \cs{eqExamPageLayout} should be executed.
+
+\newtopic The following commands directly effect how the problems are
+displayed within an \textsf{eqexam} environment.
+
+\begin{Verbatim}[xleftmargin=\leftmargini,fontsize=\fontsize{9}{11}\selectfont]
+\eqexammargin{\normalsize\normalfont\bfseries00.\ }
+\end{Verbatim}
+The command \cs{eqexammargin} is a convenient way of specifying the
+\cs{labelwidth} as set by the \texttt{eqequestions} environment (see
+below). The command uses \cs{settowidth} to set the \cs{eqemargin} length.
+The \cs{eqemargin} may also be set directly with \cs{setlength}.
+\cs{eqexammargin} can be executed anytime between exam environments (or
+even between problems, though this is not a intuitive option). Normally it
+is executed once for the entire document; but may be executed multiple
+times to change margins.
+
+\begin{Verbatim}[xleftmargin=\leftmargini,fontsize=\fontsize{9}{11}\selectfont]
+\newcommand{\widthtpboxes}{35pt}
+\end{Verbatim}
+This command sets the width of the boxes that appear in the right margin
+when one of more of the options \texttt{pointsonright},
+\texttt{pointsonboth}, \texttt{totalsonleft}, \texttt{totalsonright}, are
+used. These boxes are used for exams, and not relevant for problem sets of
+textbooks. Normally, this parameter is not redefined.
+
+\begin{Verbatim}[xleftmargin=\leftmargini,fontsize=\fontsize{9}{11}\selectfont]
+\newenvironment{eqequestions}{%
+ \begin{list}{}{%
+ \setlength{\labelwidth}{\eqemargin}%
+ \setlength{\topsep}{3pt}\setlength{\parsep}{0pt}%
+ \setlength{\itemindent}{0pt}\setlength{\itemsep}{3pt}%
+ \setlength{\leftmargin}{\labelwidth}%
+ \settowidth{\labelsep}{\ }%
+ }\item\relax}{\end{list}}
+\end{Verbatim}
+This environment is opened at the beginning of a \texttt{problem}
+(\texttt{problem*}), and closed at the end of these environments.
+
+\section{Building an Exam}
+
+In this section, we outline the steps to create an exam using the
+\textsf{eqexam} package. Consult the sample exams for additional
+examples.
+
+\subsection{The Preamble}\label{preamble}
+
+Of course, we begin with the standard article class, and the
+\textsf{eqexam} package:
+\begin{Verbatim}[xleftmargin=\leftmargini,commandchars=!()]
+\documentclass{article}
+\usepackage[!meta(options)]{eqexam}
+\end{Verbatim}
+\noindent The \meta{options} are discussed in
+section~\ref{eqoptions}. Next comes a exam identification
+information:
+\begin{Verbatim}[xleftmargin=\leftmargini,fontsize=\fontsize{9}{11}\selectfont]
+\title[T1]{Test 1}
+\subject[C1]{Calculus I}
+\author{D. P. Story}
+\keywords{Calculus I, Section 004}
+\university{%
+ THE UNIVERSITY OF AKRON\\
+ Mathematics and Computer Science
+}
+\date{\thisterm, \the\year}
+\duedate{October 17, 2005}
+\end{Verbatim}
+\noindent The \cs{title}, \cs{subject}, \cs{author} and \cs{date}
+are the same as is used in the \textsf{web} package. These are
+used by the standard {\LaTeX} macro to create the heading line of
+the first page of the exam, and are used in the running headers.
+
+The \cs{title}, \cs{subject} have optional first arguments, where
+you can list a shorted version of the title or the subject. The
+shortened versions, if present, are used in the running headers.
+
+The \cs{keywords} is used when you publish your exam in {\PDF} and
+you use the \texttt{pdf} option (or \texttt{online}, \texttt{links},
+\texttt{email}). The value of the argument of \cs{keywords} appears
+in the keywords field of the document info dialog.
+
+When you take the \texttt{coverpage} option, the value of
+\cs{university} is used, along with some of the others on the
+cover page.
+
+I've also defined a keyword of \cs{duedate}, this might be useful
+when using \textsf{eqexam} to create homework assignments with a
+due date, or just to record the date of the exam. The argument of \cs{duedate} fills the text macro
+\cs{theduedate}. So that if you say \verb|\duedate{05/31/06}|, the macro
+\cs{theduedate} will expand to `05/31/06'.
+
+\newtopic Beginning with version~1.6, \cs{thisterm} is defined.
+The academic year of many American universities are divided into semesters
+(or terms); Fall, Spring, and Summer. The command \cs{thisterm} takes the current
+date and determines if it is the Fall, Spring or Summer Semester. For example,
+if the date of the compile is October 17, 2005, then \verb!\thisterm, \the\year!
+expands to `Fall, 2005'. This command is useful with the \cs{date} command.
+
+The command \cs{thisterm} can be redefined to conform to the terms
+of the document author's university. See the definition in
+\texttt{eqexam.dtx}, copy and modify it.
+
+\subsection{The \texttt{exam} Environment}\label{exam}
+
+An exam is contained within the \texttt{exam} environment.
+
+One of the things that I do in my courses, especially for the
+final exam, is to have a two-part exam. Typically, the first part
+is worth $100$ points and covers the new material not already
+tested; the second part is usually a $50$ point review. I grade
+these two parts separately and record them separately. Therefore,
+an \textsf{eqexam} test may contain one or more \texttt{exam}
+environments.\footnote{Remember, this was originally a personal
+package, meant to suit my own needs.}
+
+\newtopic After the preamble, we then say
+\begin{Verbatim}[xleftmargin=\leftmargini,fontsize=\fontsize{9}{11}\selectfont]
+\begin{document}
+
+\maketitle
+
+\begin{exam}[Part I.]{Part1}
+
+\begin{instructions}[Part I.]
+Solve each of the problems without error. If you make an error,
+points will be subtracted from your total score.
+\end{instructions}
+...
+...
+...
+\end{exam}
+
+\begin{exam}[Part II.]{Part2}
+
+\begin{instructions}[Part II.]
+The following is a short review of previously mastered material.
+\end{instructions}
+...
+...
+...
+\end{exam}
+\end{document}
+\end{Verbatim}
+After the \verb+\begin{document}+ and standard \cs{maketitle}, we begin an
+exam by opening an \texttt{exam} environment.
+
+\settowidth{\aebdimen}{\ttfamily\string\begin\darg{exam}[\meta{friendly\_name}]\darg{\meta{exam\_name}}}
+\begin{dCmd}[commandchars=!()]{\aebdimen+2\fboxsep+2\fboxrule}
+\begin{exam}[!meta(friendly_name)]{!meta(exam_name)}
+...
+\end{exam}
+\end{dCmd}
+\noindent This environment has two arguments: the first optional, the second
+required. The first argument is a user friendly name (used when the solutions
+are listed at the end of the document when there are multiple \texttt{exam}
+environments); the second required argument is the name of the of the exam,
+\texttt{Part1} or \texttt{Part2}, for example. This argument is used to build
+the names of the PDF Acroform field names. This argument should consist of
+letters and numbers only. You can use the command \cs{autoExamName} for the
+\meta{exam\_name}; this command will name each \texttt{exam} environment
+\texttt{exam1}, \texttt{exam2}, \texttt{exam3}, etc.
+
+Following the opening of the exam, typically, the instructor would have
+some instructions, this is the purpose of the \texttt{instructions}
+environment. It has one optional argument, heading text for the
+instructions; if this optional parameter is not provided, then the default
+word is used, the default word is determined by \cs{defaultInstructions},
+its default definition is
+\begin{Verbatim}[xleftmargin=\leftmargini]
+\defaultInstructions{Instructions.}
+\end{Verbatim}
+Following this label, the total number of points for this part is
+inserted, unless the \texttt{nosummarytotals} option is taken.
+
+\redpoint The optional argument of the \texttt{instructions}
+environment has a color associated with it, and is visible when you
+compile the document with the \texttt{forcolorpaper} option. This
+color can be set by the command \cs{instructionsColor}; this command
+takes a single argument, a named color:
+\begin{Verbatim}[xleftmargin=\leftmargini]
+\instructionsColor{blue}
+\end{Verbatim}
+\noindent The above is the default definition.
+
+
+\newtopic At this point, you would insert your questions. Following the
+listing of all the questions (and optionally, their solutions), you
+finish up by closing out the \texttt{exam} environment.
+
+Repeat, if additional parts to the exam are desired. Finally,
+finish off the document with \verb+\end{document}+.
+
+\redpoint You must \texttt{latex} your document \emph{three times} to be
+sure all points have been properly calculated.
+
+\subsection{The \texttt{problem} and \texttt{problem*} Environments}
+
+All questions are posed using the \texttt{problem} and
+\texttt{problem*} environments. The former is for a single
+question, the latter is for a question with multiple parts.
+
+\subsubsection{\texttt{problem}}\label{problem}
+
+The \texttt{problem} encloses a single question; the question
+itself may contain special constructs such as one or more fill-in
+the blanks.
+
+The syntax for \texttt{problem} is
+\begin{Verbatim}[xleftmargin=\leftmargini,fontsize=\fontsize{9}{11}\selectfont,
+ commandchars=!()]
+\begin{problem}[!meta(num)|*!meta(num)|empty][h|H]
+!anglemeta(Statement of question, which may contain special constructs)
+...
+...
+\begin{solution}[!meta(vspace)]
+...
+...
+\end{solution}
+\end{problem}
+\end{Verbatim}
+\noindent The environment takes two optional arguments. The first
+argument \meta{num} is the number of points for this problem, for
+example, if we want to have a $5$ point question, we would begin the
+environment like so, \verb+\begin{problem}[5]+; on the other hand, if we
+say \verb+\begin{problem}+, the problem has no points associated with it.
+If you specify points weight for a problem, the points appear in the
+margins (when one of the option \texttt{pointsonleft},
+\texttt{pointsonright}, or \texttt{pointsonboth} is specified); if the
+\texttt{*} form is specified (\meta{*num}), the point weight appears
+``in-line,'' just after the problem number; thus, typesetting a problem
+with the specification \verb!\begin{problem}[*5]! yields
+\begin{quote}
+\textbf{1.} (5 pts) \dots
+\end{quote}
+This is useful when the problems are put into a two-column format; the
+problems in the right-hand column do not have the margin to hold the
+points, in this case, we place the points ``in-line.''
+
+\newtopic The \texttt{problem} is actually a redefined \texttt{exercise}
+environment, as defined in \textsf{exerquiz}. The second parameter
+is inherited from the \texttt{exercise} environment. The second
+argument can optionally be an \texttt{h} or a \texttt{H}.
+
+Use \texttt{h} if you do not want the solution to appear at the
+end of document (when you do not use the \texttt{nosolutions} or
+the \texttt{solutionsafter} options); the solution, however, will
+appear if the \texttt{solutionafter} option is specified.
+
+For the \texttt{H} argument, the solution will not appear at the
+end of the document (just as in \texttt{h}), nor will it appear if you
+specify the \texttt{solutionsafter} option.
+
+To make things work correctly, if you do not want to have points
+for a question and want to hide the solution, use `\texttt{[]}'
+(empty brackets with no spaces) for the first argument.
+\begin{Verbatim}[xleftmargin=\leftmargini,fontsize=\fontsize{9}{11}\selectfont]
+\begin{problem}[][H]
+($5$ Points Extra Credit) Solve this problem for extra credit.
+\begin{solution}
+This solution will not appear in all cases, unless the second
+parameter is eliminated or is changed to h, in the latter case,
+the solution appears just for \texttt{solutonsafter}.
+\end{solution}
+\end{problem}
+\end{Verbatim}
+\noindent Here, this problem has no points that will be added into
+the total number of points for the test.
+
+The \texttt{solution} environment encloses the solutions. This environment
+is optional. The environment takes one optional parameter, namely the
+vertical space to leave for the student to work the problem. This vertical
+space is \emph{created only} when the document author takes the
+\texttt{nosolutions} option. For example,
+\begin{Verbatim}[xleftmargin=\leftmargini,fontsize=\fontsize{9}{11}\selectfont]
+\begin{problem}[10]
+Do this problem.
+\begin{solution}[2in]
+This is the solution.
+\end{solution}
+\end{problem}
+\end{Verbatim}
+\noindent This defines a $10$ point problem and leaves $2$ inches
+of vertical space following the problem statement for the student
+to respond, provided the \texttt{nosolutions} option has been taken.
+
+Be aware that the solution environment searches for its optional
+parameter, and will expand macros looking for a left bracket (\texttt{[}).
+In documents where the optional parameter is not used; this can lead to
+problems in compiling. For example, if you say,
+\verb!\begin{solution} \textbf{My solution:}...!, the command \cs{textbf}
+will be expanded prematurely and result in `My solution' not appearing in
+bold. Similarly, if you write \verb!\begin{solution} \begin{equation}...!
+can lead to compilation stopping. Suggested workarounds:
+\begin{itemize}
+ \item Supply empty brackets: \verb!\begin{solution}[]!
+ \item Use \cs{relax}: \verb!\begin{solution}\relax\textbf{...}!.
+ The \cs{relax} should not be on the line by itself.
+\begin{Verbatim}[xleftmargin=\leftmargini,fontsize=\fontsize{9}{11}\selectfont]
+\begin{solution}\relax % Not this
+\textbf{...}
+...
+\end{Verbatim}
+The above causes an unwanted newline. The next two examples show the
+``correct'' method.
+\begin{Verbatim}[xleftmargin=\leftmargini,fontsize=\fontsize{9}{11}\selectfont]
+\begin{solution}\relax\textbf{...} % correct
+...
+\end{Verbatim}
+\noexpand The \cs{relax} appearing on the second line.
+\begin{Verbatim}[xleftmargin=\leftmargini,fontsize=\fontsize{9}{11}\selectfont]
+\begin{solution}
+\relax\textbf{...} % correct
+...
+\end{Verbatim}
+\end{itemize}
+If you have no need for the vertical space in your document and putting in
+these workarounds is too much trouble, you can use a global solution. Use
+\cs{noSolnOpt} to globally turn off the check for the option parameter by
+the \texttt{solution} environment; \cs{ckSolnOpt} turns on parameter
+checking (the default). To summarize:
+\begin{Verbatim}[xleftmargin=\leftmargini,fontsize=\fontsize{9}{11}\selectfont]
+\ckSolnOpt % turn on checking for the optional argument (the default)
+\noSolnOpt % turn off checking for the optional argument
+\end{Verbatim}
+Place either of these two commands between problems to turn off (or back on) the
+parameter checking.
+
+\redpoint See \Nameref{eqoptions} for more details on
+the two options \texttt{nosolutions} and \texttt{solutionsafter}.
+
+\subsubsection{\texttt{problem*}}\label{problemstar}
+
+This environment is used when you want to ask a multi-part
+question, a series of related questions that are to be treated as
+a group.
+
+The syntax is
+\begin{Verbatim}[xleftmargin=\leftmargini,fontsize=\fontsize{9}{11}\selectfont,
+ commandchars=!()]
+\begin{problem*}[!meta(num)|!anglemeta(num)ea|\auto|empty][\Do!anglemeta(do_num)]
+Do each of the following problems, and be quick about it.
+\begin{parts}
+
+\item[h|H] The first question.
+\begin{solution}[1.5in]
+This is the solution to the first problem.
+\end{solution}
+
+\item[h|H] The second question.
+\begin{solution}[3in]
+This is the solution to the second problem.
+\end{solution}
+
+\end{parts}
+\end{problem*}
+\end{Verbatim}
+The \texttt{problem*} environment takes two optional parameters,
+the first one takes one of four values:
+\begin{aebDescript}
+ \item[\meta{num}] When the value of the first parameter is
+ a number, this represents the total number of points for this
+ multi-part question. Here, the instructor does not specify the
+ weight of each part.
+
+ \item[\meta{*num}] The points appear ``in-line'' rather than
+ in the margin.
+
+ \item[\anglemeta{num}\texttt{ea}] When you specify a number followed by
+ `\texttt{ea}' (which is short for \underbar{ea}ch). Thus,
+ `\texttt{[5ea]}' signifies that each part of this problem has
+ weight of $5$ points.
+
+ \item[\texttt{*\anglemeta{num}ea}] The points appear ``in-line'' rather than
+ in the margin.
+
+ \item[\cs{auto}] If the value of the first parameter is
+ \cs{auto}, then the total number of points is calculated
+ automatically from the points defined by the \cs{PTs} macro.
+ The \cs{PTs} would be placed following \cs{item} of each part
+ that is to be given points. For example:
+
+ \item[*\cs{auto}] The points appear ``in-line'' rather than
+ in the margin.
+
+\begin{Verbatim}[xleftmargin=\leftmargini,fontsize=\fontsize{9}{11}\selectfont]
+\begin{problem*}[\auto]
+Do each of the following problems, and be quick about it.
+\begin{parts}
+
+\item\PTs{3} The first question.
+\begin{solution}[1.5in]
+This is the solution to the first problem.
+\end{solution}
+
+\item\PTs{4} The second question.
+\begin{solution}[3in]
+This is the solution to the second problem.
+\end{solution}
+
+\end{parts}
+\end{problem*}
+\end{Verbatim}
+This defines a $7$ point problem.
+
+\item[\texttt{empty}] You need not specify any points at all. In
+this case do not include this first parameter, in which case, the
+second parameter is not used, so don't include it either.
+
+\end{aebDescript}
+
+\noindent Now for a description of the second parameter the
+\texttt{[\cs{Do}\anglemeta{do\_num}]} parameter. In my senior- or graduate-level
+classes, I sometimes ask a questions with multiple parts. As part
+of the instructions for that problem I write, ``Do exactly three
+of the following five problems.'' These questions are usually
+proof-type problems, and they can choose their best three to
+grade. In this context, all parts of the problem must be of the same
+weight; the weight of each is \anglemeta{num} of the \texttt{[\anglemeta{num}ea]}.
+
+This is what \texttt{[\cs{Do}\anglemeta{do\_num}]} does. When you specify
+\texttt{\cs{Do}3}, then only the points of $3$ of the problems are
+added into the exam total. This second parameter is only checked
+if the first parameter is \texttt{[\anglemeta{num}ea]}. For example,
+specifying
+\begin{Verbatim}[xleftmargin=\leftmargini,fontsize=\fontsize{9}{11}\selectfont]
+\begin{problem*}[5ea][\Do3]
+\end{Verbatim}
+creates a $15$ point question. This assumes there are $3$ or
+more parts to this question.
+
+By the way, there are two macros that are defined when the \cs{Do}
+is used, they are \cs{DoNum} and \cs{OutOfNum}; these expand to
+the (English) word for the number of problems to do, and the
+(English) word for the total number of problems. For example, if
+there were five parts to the problem below,\dots
+\begin{Verbatim}[xleftmargin=\leftmargini,fontsize=\fontsize{9}{11}\selectfont]
+\begin{problem*}[5ea][\Do3]
+Solve exactly \textit{\DoNum} of the following {\OutOfNum}
+problems. ....
+\end{problem*}
+\end{Verbatim}
+\noindent The instructions would read, ``Solve exactly
+\textit{three} of the following five problems.'' These macros can
+be easily redefined to reflect other languages. The numbers
+themselves are contained in the two macros \cs{nDoNum} and
+\cs{nOutOfNum}.
+
+\redpoint \texttt{parts} and \cs{item}: For a multi-part problem
+(\texttt{problem*}), the actual problems are enclosed in a
+\texttt{parts} environment, and each question is posed as an
+\cs{item} of that \texttt{list} environment. The command \cs{item}
+takes the \texttt{[h|H]} optional argument. As in the case of the
+\texttt{problem} environment, \texttt{h} prevents the solution
+from appearing at the end of the document (but it appears with
+\texttt{solutionsafter}), and \texttt{H} removes the solution in
+all cases.
+
+\paragraph{\texorpdfstring{\cs{leadinitem}}{\CMD{leadinitem}}}
+When using the \texttt{problem*} environment, there is an introductory sentence
+that sets up the multi-part problem set. For various reasons, some authors
+have asked to be able to pose multi-part questions without the
+introductory sentence. This is harder request than it sounds, but now
+there is the \cs{leadinitem} command. Study the code below.
+
+\begin{Verbatim}[xleftmargin=\leftmargini,fontsize=\fontsize{9}{11}\selectfont]
+\begin{problem*}[\auto]
+\leadinitem\PTs{3} The first question.
+\begin{solution}[1.5in]
+This is the solution to the first problem.
+\end{solution}
+
+\begin{parts}
+\item\PTs{4} The second question.
+\begin{solution}[3in]
+This is the solution to the second problem.
+\end{solution}
+...
+\end{parts}
+\end{problem*}
+\end{Verbatim}
+There is no introductory sentence. The problem starts off with
+\texttt{\cs{leadinitem}\cs{PTs\{3\}} The first question}; this problem
+is stated outside of the \texttt{parts} environment. The rest of the parts
+to this problem are listed, as usual, from within the \texttt{parts} environment.
+Only one \cs{leadinitem} is allowed per \texttt{problem*} environment.
+
+\newtopic The results of this code is viewed as follows, when typeset.
+
+\bigskip
+\noindent\hfill\begin{minipage}{\linewidth-2\leftmargini}
+\noindent\llap{($10^{\text{pts}}$)\quad}\textbf{1.}\ (a)\ The first question.\\[3pt]
+\phantom{\textbf{1.}\ }(b)\ The second question.\\[3pt]
+\phantom{\textbf{1.}\ }\dots
+\end{minipage}
+\bigskip
+
+The general syntax for \cs{leadinitem} is the same as that of the \cs{item} command within the
+\texttt{parts} environment; \verb!\leadinitem[h|H]!, \texttt{h} prevents the solution
+from appearing at the end of the document (but it appears with
+\texttt{solutionsafter} or with \texttt{answerkey}), and \texttt{H} removes the solution in
+all cases.
+
+\subsubsection{Page Breaking}
+
+The \texttt{exam}, \texttt{problem} and \texttt{problem*}
+environments use a (simple) page breaking algorithm to move a
+problem (or the beginning of an exam) to the next page.
+
+If an \texttt{exam} environment begins at the lower third of the
+page, it is moved to the next page. You can influence this page
+break by using \cs{fvsizeskip} just before the beginning of the
+\texttt{exam} environment, like so,
+\begin{Verbatim}[xleftmargin=\leftmargini]
+\fvsizeskip{.4}
+\end{Verbatim}
+\noindent \cs{fvsizeskip} takes a decimal number between $0$ and
+$1$. In the example above, the environment will move to a new page
+if it begins in the lower \texttt{.4\cs{textheight}} of the page. The
+default value is $.3$.
+
+There is a similar algorithm for \texttt{problem} and
+\texttt{problem} but is measured as a multiple of
+\cs{baselineskip}. If you place
+\begin{Verbatim}[xleftmargin=\leftmargini]
+\nbaselineskip{8}
+\end{Verbatim}
+\noindent just before a problem that appears near the bottom of
+the page, then it will be moved to the next page if it is within
+\texttt{8\cs{baselineskip}} of the bottom. The default for this
+command is $6$.
+
+\medskip\noindent
+The following are strategies for fitting the maximum
+number of questions on the minimum number of pages.
+\begin{enumerate}
+ \item \textbf{Moving: }Rearrange the order of the questions,
+ if a problem can't fit entirely on a page, you can
+ exchange or move a shorter problem to that place, and move the longer
+ problem to another page.
+
+ \item \textbf{Tweaking: }Modify the space defined by the
+ \texttt{solutions} environment to fit a problem on the page that
+ is below it.
+
+ \item \textbf{Placing work on back: }Using the
+ \hyperref[onbackofpage]{\cs{OnBackOfPage}} command,
+ page~\pageref{onbackofpage}, you can direct the student to
+ answer the question on the back of another page, and thus,
+ little space is needed to follow that
+ question.
+
+ \item \textbf{Working on separate sheets: }Of course, for some
+ types of exams, the exam just contains the questions, and the
+ students answer the questions on separate sheets of paper. For
+ this, you can use the \texttt{nospacetowork} option.
+\end{enumerate}
+
+
+\subsection{Fill-in Questions}
+
+In this section we cover the various fill-in constructs.
+
+\subsubsection{Short Fill-in Questions}
+For a question requiring one or more short fill-in responses,
+\textsf{eqexam} has the \cs{fillin} command, the syntax is
+\settowidth{\aebdimen}{\ttfamily\string\fillin[u|b]\darg{\meta{width}}\darg{\meta{answer}}}
+\begin{dCmd}[commandchars=!()]{\aebdimen+2\fboxsep+2\fboxrule}
+\fillin[u|b]{!meta(width)}{!meta(answer)}
+\end{dCmd}
+The first optional parameter determines whether the fill-in is
+underlined `\texttt{[u]}' or not `\texttt{[b]}', the default it to
+underline the fill-in. The second is the amount of horizontal
+space you want to leave for the student to write in the response.
+The third argument is the correct answer. This correct answer
+will appear when you compile the document with the
+\texttt{answerkey} option.
+
+\redpoint An example of \cs{fillin}.
+
+\begin{Verbatim}[xleftmargin=\leftmargini,fontsize=\fontsize{9}{11}\selectfont]
+\begin{problem}[5]
+It is well known that \fillin{1in}{Newton} and \fillin{1in}{Leibniz}
+are jointly credited as the founders of modern calculus.
+\begin{solution}
+It is well known that \underbar{Newton} and \underbar{Leibniz}
+are jointly credited as the founders of modern calculus.
+\end{solution}
+\end{problem}
+\end{Verbatim}
+
+\redpoint When you choose the \texttt{online} or \texttt{email}
+option, \cs{fillin} generates a text field.
+
+When the \texttt{usexkv} option, and if the \textsf{xkeyval} package is available on the
+system, \textsf{eqexam} extends the capability and control of \cs{fillin}.
+See \begin{NoHyper}\Nameref{extendfillin}\end{NoHyper}.
+
+\subsubsection{True/False Questions}
+
+True and false questions are, of course, just a special case of
+fill-in. A special command is available for true/false:
+\settowidth{\aebdimen}{\ttfamily\string\TF[\meta{width}]\darg{\meta{answer}}}
+\begin{dCmd}[commandchars=!()]{\aebdimen+2\fboxsep+2\fboxrule}
+\TF[!meta(width)]{!meta(answer)}
+\end{dCmd}
+\indent The required parameter, \meta{answer}, is the correct answer (e.g.,
+`T' or `F'). The macro creates an underlined blank space the width of which
+is \meta{wide}. When the \meta{width} is \emph{not specified},
+\cs{defaultTFwidth} (default \texttt{30pt}) is used (and this value can be redefined).
+
+The \cs{TF} command behaves differently from the generic
+\cs{fillin} command. Suppose you want to create a multi-part question
+(using \texttt{problem*}) consisting entirely of true/false
+questions. When an \cs{item} leads off with the \cs{TF} there are two possible
+formatting options: This one:
+
+\begingroup\parskip6pt\parindent30pt
+
+\def\Item#1{\par\hangindent\parindent\indent\llap{#1\enspace}\ignorespaces}%
+\parbox{4in}{\noindent
+ \Item{(a)}\underbar{\hspace{30pt}} Isaac Newton is considered to be one of
+ the founders of Calculus.}
+
+\medskip\noindent or this one:\medskip
+
+
+\def\Item#1{\par\hangindent\parindent\indent\llap{#1\enspace}\ignorespaces}
+\leavevmode\parbox{4in}{\Item{(a)}\underbar{\hspace{30pt}} Isaac Newton is considered to be one of
+ the founders of \hspace*{30pt} Calculus.}
+
+\endgroup
+
+\newtopic The first alignment is the default. To get the second
+alignment, you need to set the value of \cs{fillinWidth} to the
+common width value of the \cs{TF} fields. For example:
+\begin{Verbatim}[xleftmargin=\leftmargini]
+\fillinWidth\defaultTFwidth
+\end{Verbatim}
+\noindent When \cs{fillinWidth} is set to a positive length (the
+common width of the \cs{TF} field), the second alignment above is
+created.
+\begin{Verbatim}[xleftmargin=\leftmargini,fontsize=\fontsize{9}{11}\selectfont]
+\begin{problem*}[3ea]
+\textit{True} or \textit{False}.
+
+\fillinWidth\defaultTFwidth
+
+\begin{parts}
+
+ \item \TF{T} It is well known that Isaac Newton and
+ Gottfried Leibniz are jointly credited as the founders
+ of modern calculus.
+ ...
+ \item ...
+ ...
+\end{parts}
+\end{problem*}
+\end{Verbatim}
+
+\redpoint \textbf{Important:} The example above demonstrates the
+correct placement of \cs{fillinWidth}, just outside the
+\texttt{parts} environment, before it has the time to set up
+the paragraph shape of the environment.
+
+The change is only local to that \texttt{parts} environment.
+The \cs{fillinWidth} command goes outside a \texttt{parts}
+environment, and can cause strange results if executed within a
+\texttt{parts} environment. Setting it to a \meta{width} value
+other than the common width of the \cs{TF} fields will also create
+bad formatting.
+
+\redpoint Just use \cs{fillinWidth} as illustrated in the above
+example.
+
+\redpoint When you choose the \texttt{online} or \texttt{email}
+option, \cs{TF} generates a text field.
+
+\subsubsection{Long Fill-in Questions}
+
+There is no special command for a longer response question, just
+leave enough vertical white space for the student to respond, for
+example,
+\begin{Verbatim}[xleftmargin=\leftmargini,fontsize=\fontsize{9}{11}\selectfont]
+\begin{problem}[5]
+Do this problem
+\begin{solution}[1.5in]
+That's how you do it!
+\end{solution}
+\end{problem}
+\end{Verbatim}
+\noindent The above example leaves $1.5$ inches of vertical space to do the
+work.
+
+\redpoint When you choose the \texttt{online} or \texttt{email}
+option, this vertical space is changed into a multi-line text
+field.
+
+\subsection{Multiple Choice}\label{multichoice}
+
+For multiple choice questions, we use the \texttt{answers}
+environment. If the \texttt{online} or \texttt{email} option is
+taken, the choices are made into radio button fields so that
+\emph{only one alternative} can be chosen. When multiple selections
+are permitted, the \texttt{manswers} environment can be used, see
+\Nameref{multiSelect}.
+
+\begin{Verbatim}[xleftmargin=\leftmargini,fontsize=\fontsize{9}{11}\selectfont]
+\begin{problem*}[\auto] Answer each of the following.
+\begin{parts} %\sqLinks
+ \item\PTs{5} In what year did Columbus sail the ocean blue?
+ \begin{answers}{4}
+ \Ans0 1490 &\Ans0 1491\\
+ \Ans1 1492 &\Ans0 1493
+ \end{answers}
+ \item\PTs{6} In what year did Columbus sail the ocean blue?
+ \begin{answers}{1}
+ \Ans0 1490
+ \Ans0 1491
+ \Ans1 1492
+ \Ans0 1493
+ \end{answers}
+\end{parts}
+\end{problem*}
+\end{Verbatim}
+\noindent \textbf{Note:} No solutions are given for this problem.
+
+\redpoint Because the labels and values of the alternatives are
+based on the alphabet, the number of alternatives is restricted to
+twenty-six.
+
+The \texttt{answers} environment is borrowed from \texttt{exerquiz} and
+operates the same way. The one required argument is the number of columns
+to be used in displaying the alternative answers. If the number of columns
+is $1$, a \texttt{list} environment is used, otherwise a \texttt{tabular}
+environment is used.
+
+In the first item in the example above, we specify $6$ columns,
+and must use tabular notation (separate columns with
+`\texttt{\&}') and end rows with `\verb+\\+'. The second item in
+the example above uses $1$ column, the tabular notation is not
+needed, or used.
+
+The \cs{Ans} macro is used to designate which alternative is the
+correct answer ($1$ for correct, $0$ for not correct).
+
+\subsubsection{Using \texorpdfstring{\cs{bChoices}/\cs{eChoices}}
+{\CMD{bChoices}/\CMD{eChoices}}}
+Beginning with Version 1.3, an alternate style of specifying the
+alternatives is defined. A new pair of commands are defined: \cs{bChoices}
+and \cs{eChoices}. These two enclose the alternatives like so:
+
+\begin{Verbatim}[xleftmargin=\leftmargini,fontsize=\fontsize{9}{11}\selectfont]
+\begin{exam}{Exam1}
+\begin{instructions}
+Select the ``best'' answer and darken the corresponding oval on
+your scantron sheet.
+\end{instructions}
+\begin{problem}[5] In what year did Columbus sail the ocean blue?
+ \begin{answers}{3}
+ \bChoices
+ \Ans0 1490\eAns
+ \Ans0 1491\eAns
+ \Ans1 1492\eAns
+ \Ans0 1493\eAns
+ \eChoices
+ \end{answers}
+\end{problem}
+\begin{problem}[5] In what year did Columbus sail the ocean blue?
+ \begin{answers}{1}
+ \bChoices
+ \Ans0 1490\eAns
+ \Ans0 1491\eAns
+ \Ans1 1492\eAns
+ \Ans0 1493\eAns
+ \eChoices
+ \end{answers}
+\end{problem}
+\end{exam}
+\end{Verbatim}
+\noindent Notice that the set of alternatives are the same, and
+are specified in exactly the same way; the first question,
+however, is a tabular environment with $6$ columns (the argument
+of $6$ of the \texttt{answers} environment), the second question
+is a list environment (since the argument \texttt{answers}
+environment is $1$). Notice also that `\texttt{\&}' and
+`\verb!\\!' are not used, and that each alternative is terminated
+by \cs{eAns}.
+
+The \cs{bChoices} and \cs{eChoices} are creatures of the \textsf{exerquiz}
+package, and are fully documented in the reference for the
+\ulSetLink{http://www.math.uakron.edu/~dpstory/acrotex/aeb_man.pdf}{\cAcroB}.
+
+
+\subsubsection{\texorpdfstring{\cs{sqForms} versus \cs{sqLinks}}
+{\CMD{sqForms} versus \CMD{sqLinks}}}
+
+There are two styles of multiple choice: (1) enumerate the
+alternatives using letters; (2) enumerate the alternatives using
+boxes (that the student would check or fill-in). The default is (1),
+but you can change the default to (2) by using the \texttt{useforms}
+option. This styles can be locally changed by specifying the
+\cs{sqLinks} or \cs{sqForms} commands. In the above example, the
+\cs{sqLinks} command is commented out, but shows the correct
+position for it to change to style (1), which I am calling
+``links''. Within a multi-part, multiple choice set of questions,
+you can change one item to ``links'' and the next to ``forms.''
+Changes are local as long as you place the commands, \cs{sqLinks} or
+\cs{sqForms} within an environment (\texttt{parts},
+\texttt{problem}, or \texttt{problem*}).
+
+\subsubsection{Using Circles for Multiple Choice}\label{allowcirc4mc}
+
+Then the package option \texttt{allowcirc4mc} is used, the font standard
+{\LaTeX} font \texttt{lcircle10} is loaded at which point \textsf{eqexam}
+can use it to create circles, instead of rectangles, to indicate the parts
+in a multiple choice (MC) question. To use circles in a multiple choice
+question, execute the command,
+\begin{Verbatim}[xleftmargin=\leftmargini]
+\useCircForMC
+\end{Verbatim}
+prior to the MC question.
+
+\goodbreak
+
+To return to the use of rectangles, execute the command,
+\begin{Verbatim}[xleftmargin=\leftmargini]
+\useRectForMC
+\end{Verbatim}
+prior to the MC question.
+
+Both commands have a local context. If expanded inside a group, the
+definition going into the group will hold on exit from the group.
+
+\subsubsection{Using \texorpdfstring{\cs{proofingsymbol}}{\CMD{proofingsymbol}}
+and friends}
+
+By default, a check mark (\ding{52}) is used to indicate which of the
+alternatives in a MC problem is correct; however, there are other
+``proofing symbols'' that can be used. Below are two additional suggested
+proofing symbols.
+
+\makeatletter
+\font\eqe@lcir=lcircle10 at 10pt
+\bgroup
+\setbox0=\hbox{\eqe@lcir h}
+\xdef\eqe@cirDiam{\the\wd0}
+\@tempdima=.5\wd0
+\xdef\eqe@cirRadius{\the\@tempdima}
+\egroup
+\def\circGlyph#1#2{\hbox{\smash{\raisebox{\eqe@cirRadius}%
+ {\makebox[\eqe@cirDiam]{\llap{\rlap{\eqe@lcir#1}%
+ \hskip#2\relax}}}}}}
+\makeatother
+
+\begin{Verbatim}[xleftmargin=\leftmargini,commandchars=!()]
+\useCheckForProof (!normalfont Check !ding(52), the default)
+\useCrossForProof (!normalfont Cross !ding(56), alternative to check)
+\useCircForProof (!normalfont Circle !circGlyph(x)(1pt), appropriate with )\useCircForMC
+\end{Verbatim}
+All of these user friendly commands are based on the \cs{proofingsymbol}
+command. For example, the definitions of \cs{useCheckForProof} and
+\cs{useCrossForProof} are,
+\begin{Verbatim}[xleftmargin=\leftmargini,commandchars=!()]
+\newcommand{\useCheckForProof}{\symbolchoice{check}%
+ \proofingsymbol{\ding{52}}}
+\newcommand{\useCrossForProof}{\symbolchoice{cross}%
+ \proofingsymbol{\raisebox{-1pt}
+ {\rlap{\kern-1pt\Large\ding{56}}}}}
+\end{Verbatim}
+Both definitions use the \textsf{pifont} package to create the symbols.
+Note that some adjustment of size and position is used for the cross
+symbol.
+
+The command \cs{symbolchoice} is defined in the \textsf{eforms} package
+and does nothing in \textsf{eqexam} unless either \texttt{online} or
+\texttt{email} options are taken. From the \textsf{eforms} manual,
+possible values for \cs{symbolchoice} are \texttt{check}, \texttt{circle},
+\texttt{cross}, \texttt{square}, \texttt{diamond}, and \texttt{star}. The
+\cs{proofingsymbol} command is for marking the multiple choices when
+either the \texttt{answerkey} or \texttt{vspace\-with\-solns} option is
+taken. The choice of \cs{proofingsymbol} is `{\LaTeX}ed' into the
+document. The \cs{proofingsymbol} may be used to create other proofing
+symbols, as desired.
+
+\newtopic\textbf{Summary.} Currently, there only two geometric shapes used
+for multiple choice, rectangles (the default) and circles. To Shift
+between these two types, use \cs{useRectForMC} and \cs{useCircForMC},
+respectively. Accompanying the choice for geometric shape for MC is the
+symbol used to make the choice/correct answer. When the \texttt{answerkey} or
+\texttt{vspace\-with\-solns} option is used, the correct answer is marked
+using a symbol, current choices are \cs{useCheckForProof},
+\cs{useCrossForProof} and \cs{useCircForProof} (used with
+\cs{useCircForMC}).
+
+When the \texttt{vspace\-with\-solns} is used, solutions are written to
+the back of the document and markup up as they are with the
+\texttt{answerkey} option. To get the answers in the solutions section to
+have the same choices, you must write to the solutions file using
+\cs{writeToSolnFile}. Below is an example.
+
+\begin{Verbatim}[xleftmargin=\leftmargini,fontsize=\fontsize{9}{11}\selectfont]
+\useCircForMC\useCircForProof
+\writeToSolnFile{\protect\useCircForMC\protect\useCircForProof}
+\begin{problem}[5] In what year did Columbus sail the ocean blue?
+ \begin{answers}{3}
+ \bChoices
+ \Ans0 1490\eAns
+ \Ans0 1491\eAns
+ \Ans1 1492\eAns
+ \Ans0 1493\eAns
+ \eChoices
+ \end{answers}
+\end{problem}
+\end{Verbatim}
+Any multiple choice question that follows will also draw circles for
+multiple choice questions, and mark them with a filled circle.
+To shift back to the default, expand the following commands prior the next
+question.
+\begin{Verbatim}[xleftmargin=\leftmargini,fontsize=\fontsize{9}{11}\selectfont]
+\useRectForMC\useCheckForProof
+\writeToSolnFile{\protect\useRectForMC\protect\useCheckForProof}
+...
+\end{Verbatim}
+
+\subsection{Multiple Selection}\label{multiSelect}
+
+When writing a multiple choice question for which more than one
+alternative is permitted, use the \texttt{manswers} environment
+(\underbar multiple \underbar{answers}). The distinction between the
+\texttt{answers} and \texttt{manswers} environments is lost when
+publishing to paper, but becomes important with the \texttt{online}
+and \texttt{email} options.
+
+Use the \texttt{manswers} environment in the same way you use
+\texttt{answers}, except code in more than one correct answer. For
+example,
+\begin{Verbatim}[xleftmargin=\leftmargini,fontsize=\fontsize{9}{11}\selectfont]
+\begin{problem}[5]
+Which of the following are primary colors?
+\begin{manswers}{6} % specify tabular with 6 columns
+ \bChoices
+ \Ans1 Blue\eAns
+ \Ans0 Green\eAns
+ \Ans1 Yellow\eAns
+ \Ans0 Orange\eAns
+ \Ans1 Red\eAns
+ \eChoices
+\end{manswers}
+\begin{solution}
+Yes, red, blue and yellow are primary colors.
+\end{solution}
+\end{problem}
+\end{Verbatim}
+\noindent You can use the \cs{bChoices}/\cs{eChoices} pair to specify the
+alternatives, or you can use the standard tabular notation. As with the
+\texttt{answers} environment an argument of \texttt1 specifies a list
+environment. See \Nameref{multichoice} for more examples on the use of the
+\cs{bChoices}/\cs{eChoices} pair.
+
+\subsection{Randomizing Choices}\label{s:random}
+
+Beginning with version~1.7 of \textsf{eqexam}, the choices of a
+multiple choice/selection question can be randomized. The \texttt{random.tex}
+macro file by Donald Arseneau is used for this purpose.
+
+\newtopic The randomization is only allowed if the \texttt{allowrandomize}
+option of \textsf{eqexam} is used; otherwise, no randomization
+can occur.
+
+The randomization is only defined for choices listed between the
+pair \cs{bChoices} and \cs{eChoices}. The
+\cs{bChoices} command now takes two optional key-value arguments:
+\begin{itemize}
+ \item \texttt{nCols=\anglemeta{num}}: The number of columns to create, as described.
+ You can also use the old style by specifying just
+ \anglemeta{num}. Thus, \cs{bChoices[nCols=2]} and \cs{bChoices[2]}
+ are equivalent.
+ \item \texttt{random=\anglemeta{\upshape true|false}}: Specify this option if you want the choices
+ to be randomized. You can use the key word \texttt{random} instead of
+ \texttt{random=true}. For example, the following commands all will randomize the
+ choices, \cs{bChoices[random]} or \cs{bChoices[nCols=2,random]} or
+ \cs{bChoices[2,random=true]}. The default is to not randomize the
+ choices.
+\end{itemize}
+
+\newtopic The following is an example of the \texttt{random} option of \cs{bChoices}.
+\begin{Verbatim}[xleftmargin=\leftmargini,fontsize=\fontsize{9}{11}\selectfont]
+\begin{problem}[5]
+Try to guess the correct answer.
+ \begin{answers}{3}
+ \bChoices[nCols=2,random]
+ \Ans0 1 a choice\eAns
+ \Ans1\label{eq} 2 another choice\eAns
+ \Ans0 3 still another choice\eAns
+ \Ans0 4 another\eAns
+ \Ans0 5 incoming\eAns
+ \Ans0 6 more choices\eAns
+ \Ans0 7 another still\eAns
+ \Ans0 8 too many\eAns
+ \Ans0 9 choices\eAns
+ \eFreeze
+ \Ans0 10 None of these\eAns
+ \eChoices
+ \end{answers}
+\end{problem}
+\end{Verbatim}
+
+\newtopic Note the presence of the command \cs{eFreeze}. Any of
+the items listed after \cs{eFreeze} are not randomized, and are
+placed at the end of the list. So, for the example above, the first
+nine items will be randomized, whereas, the last item (None of
+these) will placed at the end of the list.
+
+\newtopic Additionally, there are five other commands that support the
+randomization feature.
+
+\begin{Verbatim}[xleftmargin=\leftmargini]
+\saveRandomSeed
+\inputRandomSeed
+\end{Verbatim}
+
+\newtopic A pseudo-random sequence of numbers requires an initial seed
+value. The \texttt{random.tex} macro file creates, by default, a
+seed value based on the data and time (the number of minutes since
+midnight); consequently, after every minute, the random sequence
+will change. By setting the value of the count register \cs{randomi}, as in
+\texttt{\string\randomi=24},
+the document author can also set the initial seed of the pseudo-random
+sequence.
+
+The command \cs{saveRandomSeed} will write the last seed used in the
+source file to an auxiliary file (\cs{jobname\_ran.sav}), while the
+command \cs{inputRandomSeed} inputs the seed stored in the
+\cs{jobname\_ran.sav} back into the beginning of the source file.
+These two commands should be placed in the preamble.
+
+By invoking both of these commands, a new pseudo-random sequence will be generated
+each time the source file is latexed.
+
+Assuming a \cs{jobname\_ran.sav} has already been created, by
+invoking the command \cs{inputRandomSeed} only (and not
+\cs{saveRandomSeed}), the seed already saved will be used for every
+subsequent compiling of the source document. Using the same seed is
+necessary in two situations:
+\begin{enumerate}
+ \item When the document contains one or more \cs{label} commands, using the same
+ seed gives you the same sequence every time you latex the document. This will
+ give the auxiliary files a chance to come up to date so that any referencing of the label
+ will be accurate.
+
+ \item When creating an exam with randomization that has several
+ versions, which later you publish the solutions to, it is
+ important that the randomization for the document is the same as
+ that for the solution document. By using \cs{inputRandomSeed} (and
+ not \cs{saveRandomSeed}), you should get the same sequence for the
+ solution document (unless you modify the source file, adding or
+ removing questions that have randomization).
+\end{enumerate}
+
+\newtopic\textbf{Things to look for:} If \textsf{eqexam} is not rearranging the order
+of the choices as you expect it to, it could be that
+\textsf{eqexam} is reading an old \texttt{.sav} file. Either delete that file
+in your source folder, or comment out \cs{inputRandomSeed} in your document.
+
+\begin{Verbatim}[xleftmargin=\leftmargini,commandchars=!()]
+\useRandomSeed{!meta(num)}
+\end{Verbatim}
+
+You may have several sections of the same class take the exam with the
+questions rearranged for each. Save the seed value used by
+\textsf{eqexam} to randomize the choices (open the \texttt{.sav}
+and copy and paste line you see into your document, for example, it
+could read \cs{randomi=132088850}. Then use \cs{useRandomSeed} to
+use that seed value for that class, for example
+\begin{Verbatim}[xleftmargin=\leftmargini]
+\useRandomSeed{132088850} % 11:00 class
+% \useRandomSeed{634952429} % 12:30 class
+\end{Verbatim}
+Of course comment out \cs{inputRandomSeed}.
+
+\begin{Verbatim}[xleftmargin=\leftmargini]
+\turnOnRandomize
+\obeyLocalRandomize
+\end{Verbatim}
+
+The command \cs{turnOnRandomize} overrides all local settings of \cs{bChoices}
+and causes all choice lists to be randomized. While \cs{obeyLocalRandomize}
+returns control to the local settings. For example,
+\begin{Verbatim}[xleftmargin=\leftmargini]
+\turnOnRandomize
+...
+\bChoices
+ \Ans...\eAns
+ \Ans...\eAns
+ ...
+\eChoices
+\end{Verbatim}
+will cause the choice list to be randomized, even though the
+\texttt{random} option was not specified. Whereas, in this code
+\begin{Verbatim}[xleftmargin=\leftmargini,fontsize=\fontsize{9}{11}\selectfont]
+\turnOnRandomize
+...
+\obeyLocalRandomize
+,,,
+\bChoices
+ \Ans...\eAns
+ \Ans...\eAns
+ ...
+\eChoices
+\end{Verbatim}
+the choices will not be randomized, because the \texttt{random}
+option was not specified; or they will be randomized if the
+\texttt{random} option is used.
+
+\newtopic\textcolor{red}{Limitations:} There are natural limitations on the use
+of \cs{bChoices} and \cs{eChoices} and consequently, there are
+limitations on the randomization. The content between \cs{Ans} and
+\cs{eAns} cannot have any verbatim text. This is usually not a
+problem for mathematical content, but could be a limitation for
+computer science where questions about syntax may be posed. I have
+in mind a work-around, but haven't pursued the problem as of yet.
+
+\subsection{Labeling Choices}
+
+The \cs{bChoices} command has a \texttt{label} key,
+\verb~\bChoices[label=~\texttt{\anglemeta{label}]}, used to specify a (unique) label for the
+current set of choices. When a label is specified, \textsf{eqexam} creates
+commands that save the label of each correct answers (for multiple
+choice/multiple selection problems), and saves the answer text for each
+correct answer. These can be read back into the document using some
+user-interface commands: \cs{useSavedAlts}, \cs{useSavedAns},
+\cs{useSavedAltsAns}, and \cs{useSavedNumAns}.
+
+%\handpoint The demo file for this feature is named \texttt{test03.tex}.\medskip
+
+\exAeBBlogPDF{p=1206} The demo file for this feature is named
+\texttt{test03.tex}, download
+\texttt{\href{\urlAcroTeXBlog/?p=1206}{test03.pdf}} from the {\AcroBlog}
+website. The source file is attached to the PDF.
+
+
+\settowidth{\aebdimen}{\ttfamily\string\useSavedAltsAns[\meta{num}]\darg{\meta{label}}}
+\begin{dCmd}[commandchars=!()]{\aebdimen+2\fboxsep+2\fboxrule}
+\useSavedAlts[!meta(num)]{!meta(label)}
+\useSavedAns[!meta(num)]{!meta(label)}
+\useSavedAltsAns[!meta(num)]{!meta(label)}
+\useSavedNumAns{!meta(label)}
+\end{dCmd}
+\noindent The optional argument is useful \emph{only if} the \cs{bChoices} appears in a
+\texttt{manswers} environment where there are more than one selectable answer. The required
+parameter is the value of the \texttt{label} key.
+\begin{description}\def\NH{\hspace{-\labelsep}}
+ \item\NH\cs{useSavedAlts\darg{\meta{label}}} expands to the
+ \meta{label} of the correct answer(s). For example
+ \cs{useSavedAlts\darg{\meta{label}}} might expand to (c); if there
+ are multiple answers, it might expand to (a), (c), a
+ comma-delimited list of labels of the (correct) answers. For
+ multiple selection, \cs{useSavedAlts[2]\darg{\meta{label}}} might
+ expand to (c), the label of the second correct answer.
+
+ \item\NH\cs{useSavedAns\darg{\meta{label}}} expands to the \emph{text}
+ of the correct answer(s). As an example,
+ \cs{useSavedAns\darg{\meta{label}}} might expand to $ y = x^3 $; if
+ there are multiple answers, it might expand to $ y = x^3 $, $ y =
+ -x^3 $, a comma-delimited list of the text of the (correct)
+ answers. For multiple selection,
+ \cs{useSavedAns[2]\darg{\meta{label}}} might expand to $ y = -x^3
+ $, the text of the second correct answer.
+
+ \item\NH\cs{useSavedAltsAns\darg{\meta{label}}} combines the two
+ previous commands. Again, for example,
+ \cs{useSavedAltsAns\darg{\meta{label}}} might expand to (c) $ y =
+ x^3 $. When there are multiple answers, it expands to a comma
+ delimited of labels and text. As with the other two commands, the
+ optional argument can be used to pick off a particular choice.
+ \item \NH\cs{useSavedNumAns\darg{\meta{label}}} is the number of
+ correct answers in the current list of choices.
+\end{description}
+
+\subsection{Gizmos and Gadgets}
+
+I have a couple of crazy gizmos that you can use.
+
+\subsubsection{The \texttt{workarea} Environment}
+
+For a mathematics test, we often pose
+a question that needs to be worked out. Vertical space is created
+by the \texttt{solutions} environment, and appears when the
+\texttt{nosolutions} or \texttt{vspacewithsolns} option is used; however, often we want to
+mark up this vertical space with additional instructions, a
+diagram or a figure. The problem is how can the author write over
+the provided white space. For this, \textsf{eqexam} provides the
+\texttt{workarea} environment. The syntax is:
+%\begin{Verbatim}[xleftmargin=\leftmargini,fontsize=\fontsize{9}{11}\selectfont]
+\settowidth{\aebdimen}{\ttfamily\anglemeta{Material that will overwrite the solutions vertical space}}
+\begin{dCmd}[commandchars=!()]{\aebdimen+2\fboxsep+2\fboxrule}
+\begin{workarea}[!meta(width)]{!meta(depth)}
+...
+!anglemeta(Material that will overwrite the solutions vertical space)
+...
+\end{workarea}
+\end{dCmd}
+This environment is placed immediately \emph{after} the \texttt{solutions}
+environment, and the value of its parameter should be the same as the
+optional parameter at the beginning the \texttt{solutions} environment
+(\cs{begin\darg{solutions}[\meta{depth}]}). The optional \meta{width}
+parameter is the width of the work area, which is \cs{linewidth} by default.
+The required \meta{depth} parameter is the depth of the work area and it
+should match the optional parameter of the \texttt{solutions} environment,
+directly above it.
+
+\begin{Verbatim}[xleftmargin=\leftmargini,fontsize=\fontsize{9}{11}\selectfont]
+\begin{problem}[3]
+This is a question.
+
+\begin{solution}[2in]
+This is the solution, let's hope it's correct, or I would be
+embarrassed to no end.
+\end{solution}
+
+\begin{workarea}{2in}
+\textit{Hint}: Think long and hard before answering.
+\par\vfill\hfill\setlength{\fboxsep}{2mm}
+\fbox{Answer:\fillin[n]{1in}{The correct answer.}}
+\end{workarea}
+\end{problem}
+\end{Verbatim}
+\noindent When the \texttt{nosolutions} option is taken, the
+\texttt{solutions} leaves $2$~inches of white space. The
+\texttt{workarea} environment that follows also specifies
+$2$~inches, and the content of this environment will overlap the
+white space. (The student would then work around the written
+material.) Here, we give a hint, and leave an answer box (a
+fill-in) for the student to insert his/her answer.
+
+When the \texttt{nosolutions} is not specified, the vertical space
+is not provided, and the \texttt{workarea} does nothing. If
+\texttt{solutionsafter} is specified, that space is replaced by
+the provided solution.
+
+\subsubsection{The \texorpdfstring{\cs{placeAtxy}}{\textbackslash placeAtxy} Command}
+
+The \cs{placeAtxy} command is another device that I've used to
+place a block of text or a graphic on top of the vertical space
+created by the \texttt{solutions} environment when the
+\texttt{nosolutions} or \texttt{vspacewithsolns} option is in effect.
+\settowidth{\aebdimen}{\ttfamily\string\placeAtxy\darg{\meta{x\_dim}}\darg{\meta{y\_dim}}\darg{\meta{content}}}
+\begin{dCmd}[commandchars=!()]{\aebdimen+2\fboxsep+2\fboxrule}
+\placeAtxy{!meta(x_dim)}{!meta(y_dim)}{!meta(content)}
+\end{dCmd}
+\noindent The first two arguments are the $x$ and $y$ coordinates
+(with dimensions) of where the \meta{content} is to be placed.
+If this command is placed below the \texttt{solutions}
+environment, then the origin is the lower left corner of the
+solutions box.
+
+The following example, places the frame box \framebox{Place a
+graph here} (roughly) one inch up and one inch shifted to the
+right, measured from the bottom left corner of the \texttt{solutions}
+environment (when the \texttt{nosolutions} option is in effect).
+As with \texttt{workarea}, \cs{placeAtxy} does nothing if the
+\texttt{nosolutions} option has not been taken.
+
+\begin{Verbatim}[xleftmargin=\leftmargini,fontsize=\fontsize{9}{11}\selectfont]
+\begin{problem}[3]
+This is a question.
+\begin{solution}[2in]
+This is the solution, let's hope it's correct, or I would be
+embarrassed to no end.
+\end{solution}
+\placeAtxy{1in}{1in}{\framebox{Place a graph here}}
+\end{problem}
+\end{Verbatim}
+\noindent The \cs{placeAtxy} command can also be used in
+combination with the \texttt{workarea} environment.
+
+%
+% Fixed with version 1.3. 02/07/05
+%
+% \redpoint With this release of \textsf{eqexam}, the
+% \texttt{splitsolution} environment does not obey the `\texttt{h}'
+% or `\texttt{H}' options. These options were discussed in section
+% on the \hyperref[problem]{\texttt{problem} environment}, on
+% page~\hyperref[problem]{\pageref*{problem}}.
+
+\subsubsection{The \texttt{splitsolution} Environment}
+
+I developed this environment to solve a problem with the
+\texttt{online} and \texttt{email} options. The white space
+created by the \texttt{solution} environment is converted into
+text fields (\PDF{} form fields). If the \texttt{workarea}
+environment or the \cs{placeAtxy} command is used to place content
+on the white space, the student will be in the position of having
+to type on top of this content. (See the demo file
+\texttt{\href{\urlAcroTeXBlog/?p=1198}{test01.pdf}}\marginpar{\mbox{\makebox[0pt][l]{\textcolor{blue}{\Pisymbol{webd}{254}}}\raisebox{-2pt}{\color{red}{{\zqacr
+b\hspace{9.5pt}}}}}} for an illustration of this.)
+
+
+Therefore, it was necessary to have a way to separate the space
+reserved for the text field, and the additional content you might
+want to appear in this white space area. The
+\texttt{splitsolution} environment is my solution to this problem.
+
+As of 2012/12/10, a new syntax has been implemented for the
+\texttt{splitsolution} and \texttt{panel} environments. Below is a
+side-by-side comparison of the new syntax and the old.
+
+\settowidth{\aebdimen}{\small\ttfamily\string\begin\darg{splitsolution}[\meta{width}][\meta{depth}]}
+\newtopic\begin{minipage}{\aebdimen+2\fboxsep+2\fboxrule}
+\begin{Verbatim}[commandchars=!(),fontsize=\small,frame=single]
+(!normalsize!normalfont!bfseries New Syntax)
+\begin{splitsolution}[!meta(width)][!meta(depth)]
+\begin{panel}[l|r]
+...
+\end{panel}
+\begin{solution}
+...
+\end{solution}
+\end{splitsolution}
+\end{Verbatim}
+\end{minipage}\quad
+\begin{minipage}{.45\linewidth}
+\begin{Verbatim}[commandchars=!(),fontsize=\small]
+(!normalsize!normalfont!bfseries Old Syntax)
+\begin{splitsolution}{!meta(depth)}
+\begin{panel}[l|r]{!meta(width)}
+...
+\end{panel}
+\begin{solution}
+...
+\end{solution}
+\end{splitsolution}
+\end{Verbatim}
+\end{minipage}
+\newtopic There has not been any feedback to this feature, so I am confident that
+this change has little impact on users. Both \meta{width} and
+\meta{height} are optional arguments for the new syntax of
+\texttt{splitsolution}. If there are no optional arguments, the default
+values of \cs{panelwidth} and \cs{panelheight}; these are automatically
+measured. If only one optional parameter is given, it is interpreted as
+\meta{height} (and the \meta{width} is taken to be \cs{panelwidth}). The
+default value of the optional parameter for the \texttt{panel} environment
+is now \texttt{r} rather than \texttt{l}.
+
+\redpoint Consider the following example.
+\begin{Verbatim}[numbers=left,xleftmargin=\leftmargini,fontsize=\fontsize{9}{11}\selectfont]
+\begin{problem}[7]
+This is a question worth $7$ points.
+\begin{splitsolution}
+\begin{panel}\relax
+\includegraphics[scale=.2]{fig1}
+\end{panel}
+\begin{solution}
+This a really good solution. I hope this solution is correct or I
+will be total embarrassed to no end. Even if it is wrong, maybe
+the students will appreciate my tremendous effort. You can see
+from the figure that the solution is obvious.
+\end{solution}
+\end{splitsolution}
+\end{problem}
+\end{Verbatim}
+Note the use of \cs{relax} in line~(4). The first object in the panel
+environment is a command. To prevent the command from expanding
+prematurely, place a \cs{relax} as above. This will give you the default
+parameter of \texttt{r} and prevent expansion. The use of \cs{relax} is
+only needed when there is a command immediately following the opening of
+the \texttt{panel} environment; otherwise, just \verb!\begin{panel}! should
+work correctly. The optional argument can always be specified,
+\verb!\begin{panel}[r]!; this too would prevent the premature expansion of
+any command that immediately follows.
+
+The \texttt{panel} environment takes its contents and writes it verbatim
+to a \textsf{CUT} file, then inputs it back in (at the end of the \texttt{panel}
+environment), and places its contents in the box \cs{eqpanelbox} where it
+takes it measurements of \cs{panelwidth} and \cs{panelheight} (the total
+height).
+
+The \texttt{splitsolution} environment \emph{must} enclose two
+other environments: The \texttt{panel} and the \texttt{solutions}
+environments, \emph{in that order}.
+
+The \texttt{panel} environment comes first and takes optional argument.
+The optional parameter has takes a value of `\texttt{r}' (the default) or
+`\texttt{l}'. The \texttt{r} (resp., \texttt{l}) option means the panel is
+to appear on the right (resp., left) of the solution (or vertical white
+space).
+
+After the \texttt{panel} environment comes the \texttt{solutions}
+environment. The optional parameter of this environment need not
+be specified, as it gets its value from the \texttt{split\-solution}
+parameter.
+
+There is a small gap of \texttt{3pt} (the default) inserted between the
+panel and the solution. The value of this gap is contained in the
+\cs{panelgap} command,
+\begin{Verbatim}[xleftmargin=\leftmargini]
+\newcommand\panelgap{3pt}
+\end{Verbatim}
+which can be redefined.
+
+\redpoint The depth (the default is \cs{panelheight}) that you specify as
+the parameter of the \texttt{splitsolution} environment needs to be large
+enough to accommodate your typeset solution; otherwise, the solution will
+overlap the next problem. This is because, unlike the solutions inside a
+\texttt{solution} environment (but not in a \texttt{splitsolution}
+environment) are typeset in a \texttt{minipage} with a specified depth.
+
+To extend the height of the solution, use the following method.
+\begin{Verbatim}[xleftmargin=\leftmargini]
+\begin{splitsolution}[\panelheight+1in]
+...
+\end{splitsolution}
+\end{Verbatim}
+This sets the total height to be the natural height of the panel plus 1 inch.
+
+\section{\textsf{eqexam} Options}\label{eqoptions}
+
+The options documented here are entered as optional arguments of the eqexam package:
+\begin{Verbatim}[xleftmargin=\leftmargini,commandchars=!()]
+\usepackage[!meta(optionals)]{eqexam}
+\end{Verbatim}
+The optional arguments can also be introduced through \texttt{exambuilder.cfg}, the configuration file.
+Create a text file with the name of \texttt{exambuilder.cfg}
+and create the line shown below.
+\begin{Verbatim}[xleftmargin=\leftmargini,commandchars=!()]
+\ExecuteOptionsX{!meta(optionals)}
+\end{Verbatim}
+Place \texttt{exambuilder.cfg} in the folder of the source file and not on the {\LaTeX}
+search path.
+
+\redpoint The \textsf{eqexam} package has numerous options, some
+inherited from \textsf{web}, some from \textsf{exerquiz}, and a
+number of new ones.
+\begin{description}
+ \item[\texttt{forpaper}] Take this option when you want to create
+ a black and white paper version of your test.
+
+ \item[\texttt{forcolorpaper}] Take this option
+ when you want to have a nice colorful paper version,
+ or are publishing on the web in {\PDF}. See \Nameref{customColor}.
+
+ \item[\texttt{nosolutions}] This is the normal option taken when
+ you are printing a test for distribution to a class of
+ students. When this option is taken, vertical space is
+ generated by the \texttt{solutions} environment based on
+ the value of its optional parameter. This leaves room for
+ the student to solve/answer the question.
+
+ \item[\texttt{nohiddensolutions}] If you use the \texttt{h}
+ optional parameter for \texttt{problem} or \cs{item}, the
+ solution will not be listed (at the end of the document)
+ \emph{when you do not specify} \texttt{nosolutions}; but
+ solutions will be typeset for the \texttt{solutionsafter} option.
+ This option will override this feature.
+
+ \item[\texttt{noHiddensolutions}] Normally, when you use the
+ \texttt{H} optional parameter for \texttt{problem} or \cs{item}, the
+ solution will not be listed when you use the \texttt{nosolutions} or
+ \texttt{so\-lu\-tions\-af\-ter} options for \textsf{eqexam}. This option will
+ override this feature.
+
+ \item[\texttt{solutionsafter}] Causes solutions to appear
+ following the statement of the problem.
+
+ When the \texttt{solutionsafter} is in effect, the word
+ \textit{Solution:} is typeset at the beginning of the solutions.
+ The command \cs{renameSolnAfterTo} can be used for conveniently
+ changing the \texttt{solutionsafter} label, for example, executing
+ the command \verb!\renameSolnAfterTo{\textbf{Proof:}}! prior to a
+ \texttt{solution} environment changes the label to
+ \textbf{Proof:}; \verb!\renameSolnAfterTo{}! produces no
+ label. These changes will be local to the group in which they are
+ made, or global of there they are not made in a group.
+
+ The command \cs{resetSolnAfterToDefault} sets the label text back to
+ the default. The default label is \verb!\textit{Solution}:!.
+
+ \item[\texttt{preview}] The bounding boxes are shown when this
+ option is taken, provided the \texttt{online} or \texttt{email}
+ option is chosen. See the description of these two options
+ below.
+
+ \item[\texttt{proofing}] Using this option will cause the
+ correct answer for multiple choice questions to be marked with
+ a check mark; the correct answers for fill-in questions
+ (\cs{fillin} or \cs{TF}) are also shown.\medskip
+
+ The \texttt{answerkey} option, described below,
+ executes the \texttt{proofing} and \texttt{solutions\-after}
+ options.
+
+\end{description}
+
+\redpoint The following options are unique to the \textsf{eqexam} package.
+
+\begin{description}
+\item[\texttt{pointsonleft}] The points for the problem are displayed in
+ the left margin.
+
+\item[\texttt{pointsonright}] The points for the problem are on the left
+ margin.
+
+\item[\texttt{pointsonboth}] Points are displayed in both margins.
+
+\item[\texttt{nopoints}] Causes points not to be displayed, or
+ calculated. Useful for writing documents that do not have points,
+ such as a questionnaire.
+
+\item[\texttt{totalsonleft}] The totals for each page can be
+ displayed at the bottom left corner of each page using this option.
+
+\item[\texttt{totalsonright}] The totals for each page can be
+ displayed at the bottom right corner of each page using this
+ option.
+
+\item[\texttt{nototals}] Use this option if you don't want any
+ totals at the bottom of the page.
+
+\item[\texttt{noparttotals}] When multiple \texttt{exam} environments appear on
+ the same page, they are separated by a horizontal rule. The page total
+ for the closing \texttt{exam} environment is inserted into the margin on
+ the same line as the horizontal rule. This option turns off the insertion
+ of the page total for the closing \texttt{exam} environment.\medskip
+
+ There are two commands that can be used for local control of
+ this feature, they are \cs{eoeTotalOff} and \cs{eoeTotalOn}.
+ When an \texttt{exam} ends near the bottom of one page, the
+ new exam will begin on the next page, this results in the
+ horizontal rule being generated with the end of exam totals,
+ and the totals at the bottom as well. If these two numbers are
+ the same, then you can turn off the end of exam total using
+ \cs{eoeTotalOff}. Use this command just above
+ \verb+\end{exam}+ and the changes will be local to that exam
+ part.
+
+\item[\texttt{parttotalsonright}] Place the part totals in the right
+ margin, this is the default.
+
+\item[\texttt{parttotalsonleft}] Place the part totals in the left
+ margin.
+
+\item[\texttt{nosummarytotals}] When you use the
+ \texttt{instructions} environment, the total points for
+ \texttt{exam} are displayed following the instruction heading.
+ Using this option turns off this feature.
+
+\item[\texttt{noseparationrule}] When the document has multiple
+ \texttt{exam} environments, a separation rule is placed between
+ them. This option turns off that feature.
+
+ The design of the separation rule may be modified by the document author
+ by redefining \cs{separationrule}, its definition is given below:
+\begin{Verbatim}[xleftmargin=\leftmargini]
+\newcommand{\separationrule}{\makebox[\linewidth]%
+{\centering\rule{.67\linewidth}{.4pt}}}
+\end{Verbatim}
+
+\item[\texttt{coverpage}] Some instructors like to have a cover
+ page for their exams, use this option to create a cover page. Use
+ the \cs{eqexcoverpagedesign} command to design your own cover page.
+
+\item[\texttt{coverpagesumry}] is a companion to the \texttt{coverpage} option,
+ \texttt{coverpagesumry} takes one of three values: \texttt{bypages}, \texttt{byparts}, \texttt{none}.
+
+\begin{description}
+ \item[\texttt{coverpagesumry=bypages}] If \texttt{bypages} is chosen, an ``Exam Record''
+ appears on the cover page. See the left-hand figure in
+ Figure~\ref{fig:ExamRecord}. A page total appears on each line. Note
+ ``Page~3,'' in the figure; the total there is ``$37\,\text{pts}\
+ (12\,\text{pts}+25\,\text{pts})$.'' This means that there are 37
+ points on page~3; on this page the first \texttt{exam} environment
+ ended and a second \texttt{exam} environment begins, there are 12
+ points on page~3 from the first \texttt{exam} environment, and 25
+ points on that page from the second \texttt{exam} environment.
+
+\begin{figure}[htb]
+\begin{center}
+\includegraphics[width=.4\linewidth]{bypages}\quad
+\includegraphics[width=.4\linewidth]{byparts}
+\caption{Exam Record}\label{fig:ExamRecord}
+\end{center}
+\end{figure}
+
+ \item [\texttt{coverpagesumry=byparts}] If \texttt{byparts} is chosen, an
+ ``Exam Record'' appears on the cover page that lists the number of
+ points per part. (Each exam environment is considered here a
+ ``part.'') See the right-hand figure in
+ Figure~\ref{fig:ExamRecord}.
+
+ \item [\texttt{coverpagesumry=none}] If this option is chosen (the default), no
+ ``Exam Record'' is generated. If the key \texttt{coverpagesumry} does not
+ appear in the option list of \textsf{eqexam}, no ``Exam Record'' is written.
+
+ \end{description}
+
+ See \Nameref{examrecord} for more details on this topic.
+
+\item[\texttt{nospacetowork}] When the \texttt{nosolutions} option
+ is taken, the \texttt{solutions}
+ environment leaves vertical space in which to respond to the
+ question. Use this option to override this behavior.\medskip
+
+ The command \cs{SpaceToWork} causes the white space to be
+ created again, and the \cs{NoSpaceToWork} turns it off again.
+ Use these two commands to turn on and off the creation of
+ vertical spaces in different parts of your exam.
+
+\item[\texttt{answerkey}] This is a convenience option equivalent
+ to \texttt{proofing} and \texttt{solutionsafter}. Useful for
+ creating an ``answer key'' with answers and solutions displayed.
+
+\item[\texttt{solutionsonly}] Using this option, it is possible to obtain
+a typeset document consisting of only the solutions to \textsf{eqexam} document.
+See \Nameref{solutionsonly} for further details.
+
+\item[\texttt{vspacewithsolns}] An unusual feature requested by a user
+ for homework assignments. This option is a combination of
+ \texttt{nosolutions} (where vertical space is left by the
+ \texttt{solutions} environment to respond to the question), but
+ the solutions are written the \cs{jobname.sol} and input back in
+ at the end of the document.
+
+ This option is incompatible with \texttt{answerkey},
+ \texttt{nosolutions}, and \texttt{solutionsafter}, so when
+ \texttt{vspacewithsolns} is used, it ``cancels'' these other
+ options.
+
+ The command \cs{showAllAnsAtEnd} is inserted at the top of the
+ \cs{jobname.sol} file and when \cs{jobname.sol} are input back
+ in, the command \cs{showAllAnsAtEnd} is executed. The definition
+ of \cs{showAllAnsAtEnd} is
+\begin{Verbatim}[xleftmargin=\leftmargini]
+\newcommand{\showAllAnsAtEnd}{%
+ \makeAnsEnvForSolnsAtEnd
+ \answerkeytrue\eq@proofingtrue
+ \eq@solutionsaftertrue\vspacewithsolnstrue
+ \displayworkareafalse\withsoldoctrue
+}
+\end{Verbatim}
+Basically, this turns on all the switches that correspond to the
+\texttt{answerkey} option. This command may be redefined to suite your
+purposes.
+
+\handpoint When this option is taken, the switch \cs{ifvspacewithsolns}
+may be used to bring in alternate content.
+
+See \Nameref{vspacewithsolns} for further details.
+
+\item[\texttt{ftbsolns}] An alias for \texttt{vspacewithsolns}.
+
+\item[\texttt{useforms}] Multiple choice questions have two forms,
+ (1) the choices are labeled using letters (a), (b), (c), etc.; or
+ (2) using a rectangular fill box. The default is~(1). The
+ \texttt{useforms} switches the default to~(2). You can use the
+ commands \cs{sqLinks} and \cs{sqForms} to change back and forth
+ between these two types within the exam document. Using one of
+ these commands outside a \texttt{problem} environment will
+ globally change the default, from within, it will only change the
+ default locally.
+
+\item[\texttt{myconfig}] If this option is taken, \textsf{eqexam}
+ looks for the configuration file \texttt{eqexam.cfg}. This
+ configuration file is input at the end of the package, and can be used
+ to redefine, for language localization purposes, any of the (text)
+ macros described in this manual. See the section \Nameref{custom} for
+ a partial listing of macros that can be redefined and placed in
+ \texttt{eqexam.cfg}.\medskip
+
+\item[\texttt{myconfigi}\dots\texttt{myconfigvi}] Six additional
+ options for inputting a configuration file. If you take one of
+ these options, \textsf{eqexam} inputs the corresponding
+ configuration file \texttt{eqexami.cfg}\dots\texttt{eqexamvi.cfg}.
+
+\item[\texttt{cfg}] Syntax: \texttt{cfg=\anglemeta{basename}}. If this option is taken,
+\textsf{eqexam} looks for a file named \texttt{\anglemeta{basename}.cfg} and is input.
+
+ For one of my recent classes, I wrote many
+ standard handouts documents: first day handout, assignment documents,
+ homework assignments, review documents, test documents, and
+ in-class notes. Each document-type had its own \textsf{eqexam}
+ format (configuration file, \texttt{eqexami.cfg}\dots\texttt{eqexamiv.cfg}.
+ It got confusing to keep track of all these configuration files. At which point
+ I decided to add a \emph{named} configuration scheme. If you use the key \texttt{cfg}
+ in the option list \texttt{cfg=firstday}, \textsf{eqexam} will look for a file
+ named \texttt{firstday.cfg}
+
+\item[\texttt{obeylocalversions}] An option put in to give greater control over
+ versions. Perhaps you have a \textsf{eqexam} file that has questions
+ with multiple versions. You would like to pick and choose the versions
+ to be used. In this case, using \texttt{obeylocalversions} will cause
+ \textsf{eqexam} to obey any \cs{selectVersion} commands embedded in
+ the document.
+
+\item[\texttt{allowrandomize}] Use this option to randomize
+ the multiple choice/selection questions. See \Nameref{s:random} for details.
+
+\item[\texttt{showgrayletters}] When \texttt{showgrayletters} is used, multiple choice
+questions will have a gray capital letter
+\texttt{A}, \texttt{B}, \texttt{C}, etc. underneath it. This letter
+can then be referred to in the text or the solution using the \cs{REF} command.
+
+See \Nameref{showgraylettersOpt} for more information.
+
+ \item[\texttt{usexkv}] When this option is used, and the document
+ author has the \textsf{xkeyval} package on his/her system, there is a
+ re-definition of the \cs{fillin} command. For more information,
+ see \Nameref{extendfillin}.
+
+ \item[\texttt{allowcirc4mc}] Allows to use of circles (created by
+ the \texttt{lcircle10} font) for multiple choice questions. See
+ \Nameref{allowcirc4mc} for details.
+
+
+\end{description}
+
+\redpoint The next option concerns a major new feature, available
+in \textsf{eqexam}, version 3.0 or later.
+
+\begin{description}
+ \item[\texttt{fortextbook}]\label{fortextbook} This option is designed support
+ textbook authors. See \mlNameref{ftbop} for a greater explanation.
+\end{description}
+
+\redpoint The next two apply to files that have several versions in them,
+these were defined for use by the \textsf{AeB Exam Builder}
+utility,\footnote{\url{http://www.acrotex.net/builders/}} but they are
+available to the document author.
+
+\begin{description}
+ \item[\texttt{max}] The value of \texttt{max}, \texttt{max=\anglemeta{N}},
+ is a positive integer. The value of \texttt{max} is the
+ number of versions for this document. This option executes
+ \cs{numVersions\darg{\anglemeta{N}}} at the end of the package.
+
+ \item[\texttt{rendition}] This is a key-value pair.
+ \texttt{rendition=\anglemeta{alpha}}, where \anglemeta{alpha} letter corresponding to
+ the version that is to be typeset. At the end of the package, the
+ command \cs{forVersion\darg{\anglemeta{alpha}}} is executed.
+
+\end{description}
+
+\redpoint The next four options require the {\cAcroB}, and all of
+its required packages, such as \textsf{hyperref}, their use
+implies you are going to publish the document as a {\PDF}.
+
+\begin{description}
+
+\item[\texttt{pdf}] This option doesn't do much, it brings in the
+ \textsf{web} package, which in turn, places the values of the
+ keywords (\cs{title}, \cs{author}, \cs{subject}, etc.) into the
+ Document Description dialog of the {\PDF}.
+
+\item[\texttt{links}] This option brings in both \texttt{web} and
+ \texttt{exerquiz}. When you do not use a solutions option
+ (\texttt{nosolutions} and \texttt{solutionafter}), the solutions
+ appear at the end of the document. When the \texttt{links} option
+ is used, links from the questions to the solutions are created.
+ Unless you use a ``paper option'' (\texttt{forpaper} and
+ \texttt{forcolorpaper}), each solution is on a different page,
+ making a document with a lot of pages. When you also specify a
+ paper option, the solutions are separated by a \cs{medskip}.
+
+\item[\texttt{online}] The \texttt{online} option implies the
+ previous two options, but does more. When this option is taken,
+ and the \texttt{nosolutions} option is specified, {\PDF} forms are
+ created: multiple choice questions become radio button fields;
+ fill-in questions become text fields, and the vertical space
+ created by the \texttt{solutions} environment become multi-line
+ text fields.\medskip
+
+ This may be a useful option for an exam taken in a
+ CBT\footnote{Computer Based Testing} lab, where the students
+ can type in their responses and when finished, print the
+ document to a lab printer to hand in.
+
+\item[\texttt{email}] This option implies the \texttt{online}
+ option, in addition, adds a submit button to the upper left corner
+ of the first page of the exam. The student can take the test in a
+ CBT lab, then submit the results to the instructor via email.
+
+\end{description}
+\noindent See the section \Nameref{email} for additional details
+of these last two options.
+
+\redpoint When any one of the four options above are taken, a
+driver needs to be specified as well, the choices are\dots
+
+\begin{description}
+\item[\texttt{dvipsone}] For users of the
+ {Y\!{\footnotesize\&}\!Y\TeX} System, such as myself.
+
+\item[\texttt{dvips}] For users of \textsf{dvips}, the
+ dvi-to-postscript converter.
+
+\item[\texttt{pdftex}] For users of \textsf{pdftex} application.
+
+\item[\texttt{dvipdfm}] For users of \textsf{dvipdfm} application.
+
+\item[\texttt{textures}] For \textsf{textures} users. (This
+option is totally untested.)
+\end{description}
+\noindent These options are passed on to \textsf{hyperref} and to
+\texttt{eforms}\footnote{A component of \AcroB.} for the proper
+creation of links and form fields.
+
+\subsection{Configuration Files}
+
+The \textsf{eqexam} looks for two configuration files, they are
+\texttt{web.cfg} and \texttt{eqexam.cfg}.
+
+The first one \texttt{web.cfg} may be already present on your hard
+drive if you use the {\AcroB}. Typically, desired default driver
+option is placed in here, for example, \texttt{web.cfg} might
+contain the single line,
+\begin{Verbatim}[xleftmargin=\leftmargini]
+\ExecuteOptions{dvips}
+\end{Verbatim}
+\noindent for users of the \textsf{dvips} application for
+converting \texttt{.dvi} files to \texttt{.ps} file. The drivers
+supported by \textsf{eqexam} are listed in the previous section.
+
+The second configuration file, \texttt{eqexam.cfg}, is input at
+the end of the package, provided the document author takes the
+\texttt{myconfig} option. Use this file to redefine some of the
+commands described in \Nameref{custom}, and elsewhere, to
+customize \textsf{eqexam}. An obvious use for this is to have a
+language customization of the package, input through
+\texttt{eqexam.cfg}.
+
+If you place \texttt{eqexam.cfg} in the {\LaTeX} search path,
+these customization will be global to all documents that specify
+the \texttt{myconfig} option. If is is placed in the source
+document folder (which is not in the {\LaTeX} search path) the
+changes are local to all documents developed in that folder.
+
+\subsection{The \texttt{solutionsonly} Option}\label{solutionsonly}
+
+With this option, it is possible to obtain a listing of only the solutions
+in an \textsf{eqexam} source file. A possible application of this feature
+is if you publish homework or practice test questions, you can later
+publish the solutions to them.
+
+%\handpoint The demo file for this option is \texttt{eqex\_solnsonly.tex}, where you
+%will find detailed instructions for how to do this. See also the file
+%\texttt{text03.tex}, which demos both the \texttt{solutionsonly} option and the
+%\texttt{vspacewithsolns} option.
+
+\exAeBBlogPDF{p=1227} The demo file for this option is
+\texttt{\href{\urlAcroTeXBlog/?p=1227}{eqex\_solnsonly.pdf}}, available from
+the {\AcroBlog} website. The source file is attached to the PDF. Within the
+source file, you will find detailed instructions for how to create a
+solutions-only file.
+
+
+\subsection{The \texttt{vspacewithsolns} Option}\label{vspacewithsolns}
+
+With option is a combination of \texttt{nosolutions} (where vertical
+spaces are left for extended response questions, and multiple choice and
+fill-in the blank are left, well, blank) and compiling the document
+with no options at all, in this case the solutions appear at the end of
+the document.
+
+To summarize, when \texttt{vspacewithsolns} is used, the test section is
+left blank for the student to fill in, but at the end of the document are
+the solutions. I've recently used this option to compile an old test (from
+a previous semester) and publish it on the web. The student can try
+solving the old test, with the solutions at the end of the
+document.\footnote{Another option is to first publish your old exam with
+the \texttt{nosolutions} option, then, after a suitable time, publish the same document
+with the \texttt{solutionsonly} option.}
+
+\newtopic An alias for this option is the option \texttt{ftbsolns}.
+
+\exAeBBlogPDF{p=1220} The demo file for this feature is named
+\texttt{\href{\urlAcroTeXBlog/?p=1220}{hw02.pdf}}. See also the file
+\texttt{\href{\urlAcroTeXBlog/?p=1206}{test03.pdf}}, which demos both the
+\texttt{solutionsonly} option and the \texttt{vspacewithsolns} option.
+
+\subsection{The \texttt{fortextbook} Option and \textsf{fortextbook} Package}\label{ftbop}
+
+This option is designed for authors of textbooks. The \texttt{fortextbook}
+option defines the \texttt{probset} environment---used to create problems
+sets in the textbook---as a re-purposing of the \texttt{exam}
+environment. When the text is compiled with the \texttt{studented} option
+(student edition), only odd-numbered solutions/answers are written to the
+end of the document; when the \texttt{instred} option (instructor edition) is
+used, all solutions/answers are written to the end of the document, there
+are options for annotating the book with the answers in the margins or
+following the questions (instructor edition).
+
+Documentation for this option is found in the \texttt{doc/fortextbook}
+folder. See the file \texttt{fortextbook.pdf} and its source file
+\texttt{fortextbook.ltx}.
+
+To use the \texttt{fortextbook} option, a whole panoply of options are needed,
+\begin{Verbatim}[xleftmargin=\leftmargini]
+\usepackage[%
+ fortextbook,ftbsolns,usecustomdesign,
+ forcolorpaper,noseparationrule,usexkv
+]{eqexam}
+\end{Verbatim}
+Accompanying the \textsf{eqexam} is a simple wrapper package called
+\texttt{fortextbook}, which basically calls \textsf{eqexam} with all the above
+options. So, the textbook author needs only to specify,
+
+\begin{Verbatim}[xleftmargin=\leftmargini]
+\usepackage{fortextbook}
+\end{Verbatim}
+The documentation for this option is quite extensive and is
+available in the separate document \texttt{fortextbook.pdf}. This
+document is a short ``textbook'' that illustrates and documents
+the features of this option.
+
+See the \textbf{\ulSetLink{http://www.acrotex.net/blog}{Acro\TeX{}
+Blog}} for several articles on the \texttt{fortextbook} option,
+beginning with the first article
+\textsl{\ulSetLink{http://www.acrotex.net/blog/?p=604}{The
+\texttt{fortextbook} option, Part 1, The Instructor Edition}}. A
+listing of all articles of the
+\ulSetLink{http://www.math.uakron.edu/~dpstory/eqexam.html}{\textsf{eqexam}
+package} may be obtained by following
+\ulSetLink{http://www.acrotex.net/blog/?tag=eqexam-package}{this
+link}.
+
+The full series of articles on the \texttt{fortextbook} option may be found under the
+\ulSetLink{http://www.acrotex.net/blog/?tag=fortextbook}{fortextbook tag} at the blog site.
+
+
+
+\section{The \texttt{online} and \texttt{email} Options}\label{email}
+
+When you use the \texttt{online} option, all fields created by the
+\cs{fillin} command, and this includes \cs{TF}, are converted into
+text fields, and the white space created by the \texttt{solutions}
+environment is converted to a multi-line text field. The fields
+manifest themselves when the document is viewed within the Adobe
+Reader, or any other {\PDF} viewer that supports form fields.
+
+This may be a useful option to the few people out there who are
+not in a technical field that requires specialized symbols to
+respond to a question. An exam created by the \texttt{online}
+option can be filled out online, printed, and submitted to the
+course instructor, perhaps within a lab setting.
+
+There are other applications, such as creating a course survey, or
+a questionnaire of some type the students can fill out and submit.
+The \texttt{email} option may be more appropriate for these
+applications.
+
+\subsection{The \texttt{email} Option}
+
+When you pass the \texttt{email} option to \textsf{eqexam}, this
+does everything the \texttt{online} option does, in addition, it
+creates a ``Submit'' button that appears in the top-left margin of
+the exam (it does not appear on the cover page), and is placed
+there by the \cs{maketitle} command, that normally goes just after
+the opening of the document environment, \verb+\begin{document}+.
+
+The forms button is all setup to submit to the server-side script,
+\textsf{eqAttach.asp}, an active server page using
+\textsf{vbscript} as its scripting language. This script, when
+properly installed and functional, receives the form data
+generated by the document and attaches it to an email, which it
+sends off to the designated destination. Before discussing how to
+install and use \textsf{eqAttach.asp}, let me cover some commands
+that controls this button as well as options for changing what is
+sent to the server-side script.
+
+When you take the \texttt{email} option, you need to supply a
+minimum of two pieces of information: the path to the server-side
+script \textsf{eqAttach.asp} and the email address of the person
+the results are to be sent. The command \cs{SubmitInfo} is used to
+supply this info, for example,
+\begin{Verbatim}[xleftmargin=\leftmargini]
+\SubmitInfo{http://localhost/scripts}{dpstory@uakron.edu}
+\end{Verbatim}
+This command takes two arguments, the first is the URL to the
+server-side folder that contains \textsf{eqAttach.asp}, the second
+argument is the email address of the recipient of the email. (You
+can have multiple recipients by separating the address by an
+comma.)
+
+After the student submits the responses to the questions, an email
+is sent to the recipient (the instructor, perhaps). When the
+recipient receives the email, s/he can save the {\FDF} attached file
+(containing the student responses) to a folder on the local hard
+drive. At least for a Windows machine when you open the {\FDF}, the
+{\PDF} will be fetched and the student data will be populated into
+the form fields.
+
+Once this is done, the instructor can either save the populated
+file to the hard drive for later processing (the Acrobat
+application needed for this step) or print it to a printer for
+grading by hand.
+
+If the instructor has Acrobat, s/he can use the markup capability
+of Acrobat to grade the electronic version of the test, and return
+the electronic version, with markup, to the student.
+
+Below is the subject and message body of a ``typical'' submittal for the
+student ``John Q. Student''.
+
+\begin{flushleft}
+Message Subject:
+\begin{Verbatim}[xleftmargin=\leftmargini]
+Exam Results: Test 1 of U. S. History
+\end{Verbatim}
+\end{flushleft}
+
+\begin{flushleft}
+Message Body:
+\begin{Verbatim}[xleftmargin=\leftmargini]
+Exam Information:
+ Course Name: U. S. History
+ Exam: Test 1
+ Student: John Q. Student
+ TimeOfQuiz: 1/19/2005 12:07:56 PM
+\end{Verbatim}
+The {\FDF} is attached.
+\end{flushleft}
+
+
+\noindent The following commands can be used to modify the email message.
+
+\redpoint\cs{EmailCourseName} is used to specify the name of the
+course. The default value for this is \cs{websubject}, obtained
+from the \cs{subject} macro used in the preamble; however, if you
+want a different name in the email, perhaps with more information
+included, you can redefine the value using this macro.
+\begin{Verbatim}[xleftmargin=\leftmargini]
+\EmailCourseName{\websubject} % the default
+\end{Verbatim}
+
+\noindent\textbf{\color{red}Important:} When you use {\TeX}
+formatting in the subject, such as
+\begin{Verbatim}[xleftmargin=\leftmargini]
+\subject{\bfseries Calculus 1}
+\end{Verbatim}
+and you are using the \texttt{email} option, it will
+be necessary to use \cs{EmailCourseName} to redefine the subject, e.g.,
+\verb+\EmailCourseName{Calculus 1}+, to avoid possible {\TeX} compile
+errors, or to prevent {\TeX} primitives being a part of your
+email!
+
+\redpoint\cs{EmailExamName} is used to specify the exam name of
+the course. The default value for this is \cs{webtitle}, obtained
+from the \cs{title} macro used in the preamble; however, if you
+want a different name in the email, perhaps with more information
+included, you can redefine the value using this macro.
+\begin{Verbatim}[xleftmargin=\leftmargini]
+\EmailExamName{\webtitle} % the default
+\end{Verbatim}
+
+\noindent\textbf{\color{red}Important:} If you use some {\TeX}
+formatting in the title, such as
+\begin{Verbatim}[xleftmargin=\leftmargini]
+\title{\bfseries Test 1}
+\end{Verbatim}
+and you are using the \texttt{email} option, it will be necessary
+to use \cs{EmailExamName} to redefine the title, e.g.,
+\verb+\EmailExamName{Test 1}+, to avoid possible {\TeX} compile
+errors, or to prevent {\TeX} primitives being a part of your
+email!
+
+\redpoint\cs{EmailSubject} The document author might want a custom
+subject in the email, instead of the standard one. By using this
+macro, he can design his own email subject.
+\begin{Verbatim}[xleftmargin=\leftmargini]
+\EmailSubject{} % the default
+\end{Verbatim}
+\noindent In this case \textsf{eqAttach.asp} inserts the standard one.
+\begin{Verbatim}[xleftmargin=\leftmargini]
+Exam Results: \webtitle of \websubject
+\end{Verbatim}
+\noindent The email would read ``\texttt{Exam Results: Test 1 of
+Calculus I}'', for example.
+
+To change the email subject we would put the following command in
+the preamble:
+\begin{Verbatim}[xleftmargin=\leftmargini]
+\EmailSubject{Another Set of Cool Results}
+\end{Verbatim}
+
+\redpoint \cs{ServerRetnMsg} The server script
+(\textsf{eqAttach.asp}) returns a message acknowledging the
+receipt of the data, this command allows the document author to
+customize the return message. The default definition is:
+\begin{Verbatim}[xleftmargin=\leftmargini]
+\ServerRetnMsg{}
+\end{Verbatim}
+\noindent In this case \textsf{eqAttach.asp} inserts the standard
+one, ``Exam results successfully sent to your instructor!''.
+
+To change the return message to something more meaningful, put
+this command in the preamble, for example,
+\begin{Verbatim}[xleftmargin=\leftmargini]
+\ServerRetnMsg{Your responses to the \\TeX Survey have been
+ received, thank you!}
+\end{Verbatim}
+
+\redpoint\cs{SubmitButtonLabel} is the label that appears on the
+submit button.
+\begin{Verbatim}[xleftmargin=\leftmargini]
+\SubmitButtonLabel{Submit} % the default
+\end{Verbatim}
+
+
+\subsubsection{Installing \textsf{eqAttach.asp}}
+
+On the server side, in order for \textsf{eqAttach.asp} to run
+correctly, Microsoft Internet Information Server (IIS), version
+4.0 or greater, is needed. The script \textsf{eqAttach.asp} needs
+to be placed where ASP scripts have execute permissions.
+
+The \textsf{eqAttach.asp} uses the \textsl{Acrobat FDF
+Toolkit}\footnote{Currently located at the
+\href{http://partners.adobe.com/public/developer/acrobat/devcenter.html}
+{Acrobat Family Developer Center}.}, version 6.0. Follow the
+directions for installation contained in the accompanying
+documentation.
+
+Install \textsf{eqAttach.asp} in a folder (perhaps called
+\texttt{Scripts}) designated to execute scripts. If you don't
+have such a folder, then the following steps explain how to
+create a virtual directory through IIS that points to this folder.
+
+\begin{enumerate}
+\item Create a new folder on the system (\texttt{Scripts}, for
+example). Its recommended location is inside the \texttt{Inetpub}
+folder.
+
+\item Place \textsf{eqAttach.asp} in this newly created folder.
+
+\item In the MMC snap-in for IIS, create a virtual directory by
+right-clicking on the Default Web Site and selecting \texttt{New >
+Virtual Directory}.
+
+\item Type ``Scripts'' (or whatever the name of the folder you
+created in~Step~1) as the alias for the virtual directory, and
+then link it to the physical directory you created in Step~1.
+
+\item Make sure that ``Script execution'' privileges are enabled.
+If not, enable them.
+\end{enumerate}
+
+
+\subsubsection{Setting up and Modifying the Script}
+
+On the server side, in order for \textsf{eqAttach.asp} to run
+correctly, Microsoft Internet Information Server (IIS), version
+4.0 or greater, is needed. The script \textsf{eqAttach.asp} should
+be placed where ASP scripts have execute permissions. There are
+two methods of sending e-mail:
+\begin{enumerate}
+ \item \texttt{CDONTS}: This method (which is commented out by
+ default) can be used on an NT server. Uncomment if you want to
+ use CDONTS, and comment out the CDOSYS code lines that follow.
+ \item \texttt{CDOSYS}: This can be run on a Win2000 or WinXP
+ server.
+\end{enumerate}
+
+The script needs to be modified appropriate to your server, in
+particular, search down in \texttt{eqAttach.asp} for the
+configuration line
+\begin{Verbatim}[xleftmargin=\leftmargini,fontsize=\fontsize{9}{11}\selectfont]
+eqMail.Configuration.Fields.Item
+ ("http://schemas.microsoft.com/cdo/configuration/smtpserver")
+ = "mySMTP"
+\end{Verbatim}
+\noindent replace \texttt{mySMTP} with your SMTP server.
+
+\subsubsection{Some Options}
+
+The default behavior of \textsf{eqAttach.asp} is to return a
+message to the document that indicates the receipt of the data,
+this message is``Exam results successfully sent to your
+instructor!'' The message, as explained earlier, can be changed
+using the \cs{ServerRetnMsg}, like so
+\begin{Verbatim}[xleftmargin=\leftmargini,fontsize=\fontsize{9}{11}\selectfont]
+\ServerRetnMsg{Your TeX survey results have been received, thank you.}
+\end{Verbatim}
+\noindent Now, if for whatever reason you don't want this
+confirmation message to return to the document for display in
+alert box, you can sent the \texttt{silent} as part of the query
+string. For example, if
+\begin{Verbatim}[xleftmargin=\leftmargini,fontsize=\fontsize{9}{11}\selectfont]
+\SubmitInfo{http://myWebSite/scripts/eqAttach.asp?silent\#FDF}
+ {myname@mymailprovider}
+\end{Verbatim}
+\noindent placed in the preamble of your document specifies the
+path to the script, silent mode, and the email address of the
+recipient of the form data.
+
+\medskip\noindent
+Another other feature of \textsf{eqAttach.asp} that can be changed
+through the query string is the \texttt{/F} key-value pair of the
+\texttt{FDF} sent out in email. The value of this key is the path
+to the document that sent the \texttt{FDF}, it may be a url (an
+address on the Internet) or it could be a file specification of a
+local hard drive. If you specify \texttt{nopath} in the query
+string, like so
+\begin{Verbatim}[xleftmargin=\leftmargini,fontsize=\fontsize{9}{11}\selectfont]
+\SubmitInfo{http://myWebSite/scripts/eqAttach.asp?nopath\#FDF}
+ {myname@mymailprovider}
+\end{Verbatim}
+\noindent then \textsf{eqAttach.asp} strips out the file path and
+leaves only the file name.
+
+\redpoint This is what I did with the \texttt{tex\_survey.tex}
+source file. I placed \texttt{tex\_survey.pdf} in a \texttt{LaTeX
+Survey} folder on my desktop. As the emails came in, I saved the
+\textsf{FDF} attachments to this folder. By (double) clicking on
+the \textsf{FDF}, \texttt{tex\_survey.pdf}, which is in the same
+folder, opened and the form data populated the fields from whence
+they were sent. It worked well for me.
+
+If you don't use the \texttt{nopath} option, when you click
+on an \texttt{FDF} file you've received by email, your browser
+opens and the PDF on the Internet is brought into the
+browser and the form data populates the form fields, \dots at least on
+a Windows machine. \texttt{:-)}
+
+\subsubsection{References}
+
+The following links were used as a reference in the development of the
+\texttt{Email.asp} script.
+\begin{itemize}
+ \item CDOSYS:
+ \begin{itemize}
+ \item \href{http://invisionportal.com/show_tutorial.asp?TutorialID=160}{Invision Portal} Tutorial: CDOSYS email tutorial
+ \item \href{http://msdn.microsoft.com/library/default.asp?url=/library/en-us/cdosys/html/_cdosys_imessage_interface.asp}
+ {MSDN}: CDO for Windows 2000. The IMessage Interface. (Use MIE to view this page.)
+ \item \href{http://www.asp101.com/articles/john/cdosmtprelay/default.asp}{ASP 101} Sending Email Via an External SMTP Server Using CDO
+ \end{itemize}
+ \item CDONTS
+ \begin{itemize}
+ \item \href{http://www.juicystudio.com/tutorial/asp/cdonts.html}{Juicy Studio} The ASP CDONTS Component
+ \item \href{http://www.devasp.com/Samples/mail.asp}{DevASP} Sending Mail from ASP with CDONTS.NewMail Object
+ \end{itemize}
+\end{itemize}
+
+\section{Bells, Whistles and other Customizations}
+
+\subsection{Customizations}\label{custom}
+
+We enumerate some commands for changing the default design of \textsf{eqexam}.
+
+\subsubsection{Course Info Commands}\label{courseInfo}
+
+\textsf{eqexam} has several commands for the student to provide some identification
+information.
+
+\redpoint \cs{eqexamName}. This command defines the macro
+\cs{eq@ExamName} that creates the underlined space for the student
+to enter his/her name, and also defines the text box form field,
+in the case the \texttt{online} or \texttt{email} options are
+taken. There are two (design) parameters for \cs{eqexamName}
+\begin{Verbatim}[xleftmargin=\leftmargini,commandchars=!()]
+\eqexamName[!meta(eforms_opts)]{!meta(width)}
+\end{Verbatim}
+\noindent The first optional parameter can be used to modify the
+appearance of the text field, see the \href{eformman.pdf}{eForms}
+documentation for details. The second parameter is the width of
+the field. The default definition is
+\begin{Verbatim}[xleftmargin=\leftmargini]
+\eqexamName[\Ff\FfRequired]{2.25in}
+\end{Verbatim}
+\noindent Here, the text field that will be generated (when
+\texttt{online} or \texttt{email} is specified) will be a required
+field. The total width of the space provided is $2.25$ inches.
+
+The command \cs{examNameLabel} controls the label to be used for
+this name field. It takes one parameter, the label
+to be used for the name field; the default definition is
+\verb+\examNameLabel{Name:}+.
+
+\redpoint \cs{eqSID}. This command defines the macro \cs{eq@SID}
+that creates the underlined space for the student to enter his/her
+student Identification number (SID), and also defines the text box
+form field, in the case the \texttt{online} or \texttt{email}
+options are taken. There are two (design) parameters for
+\cs{eqSID}
+\begin{Verbatim}[xleftmargin=\leftmargini,commandchars=!()]
+\newcommand\eqSID[!meta(eforms_opts)]{!meta(width)}
+\end{Verbatim}
+\noindent The first optional parameter can be used to modify the
+appearance of the text field, see the \href{eformman.pdf}{eForms}
+documentation for details. The second parameter is the width of
+the field. The default definition is
+\begin{Verbatim}[xleftmargin=\leftmargini]
+\eqSID[\Ff\FfRequired]{2.25in}
+\end{Verbatim}
+\noindent Here, the text field that will be generated (when
+\texttt{online} or \texttt{email} is specified) will be a required
+field. The total width of the space provided is $2.25$ inches.
+
+The command \cs{examSIDLabel} controls the label used for this SID field.
+It takes one parameter, the label to be used for the name field; the
+default is \verb+\examSIDLabel{SID:}+.
+
+\redpoint \cs{eqEmail}. This command defines the macro
+\cs{eq@Email} that creates the underlined space for the student to
+enter his/her student email address, and also defines the text box
+form field, in the case the \texttt{online} or \texttt{email}
+options are taken. There are two (design) parameters for
+\cs{eqEmail}
+\begin{Verbatim}[xleftmargin=\leftmargini,commandchars=!()]
+\newcommand\eqEmail[!meta(eforms_opts)]{!meta(width)}
+\end{Verbatim}
+\noindent The first optional parameter can be used to modify the
+appearance of the text field, see the \href{eformman.pdf}{eForms}
+documentation for details. The second parameter is the width of
+the field. The default definition is
+\begin{Verbatim}[xleftmargin=\leftmargini,]
+\eqEmail{2.25in}
+\end{Verbatim}
+\noindent Here, the text field that will be generated (when
+\texttt{online} or \texttt{email} is specified). The total width
+of the space provided is $2.25$ inches.
+
+
+The command \cs{examEmailLabel} controls the label to be used for
+this email field. It takes one parameter, the
+label to be used for the name field; the default definition is
+\verb+\examEmailLabel{Email:}+.
+
+
+\subsubsection{Changing the Title and Cover Page}
+
+\redpoint \cs{maketitle}. The main heading that appears at the top
+of the first page of the exam is created by the {\LaTeX}
+(redefined) command \cs{maketitle}. The \cs{maketitle} has some
+code to place the email button in the top margin, followed by the
+expansion of the command \cs{maketitledesign}, whose definition is
+\begin{Verbatim}[xleftmargin=\leftmargini,fontsize=\fontsize{9}{11}\selectfont]
+\newcommand\maketitledesign
+{%
+ \makebox[\textwidth]{\normalsize
+ \shortstack[l]{\strut\websubject\\\@date}\hfill
+ \shortstack[c]{\webtitle\\\strut\@altTitle}\hfill
+ \shortstack[l]{\strut\eq@ExamName\\\webauthor}}%
+}
+\end{Verbatim}
+This command can be redefined using \cs{renewcommand} to suite your needs, for example,
+\begin{Verbatim}[xleftmargin=\leftmargini,fontsize=\fontsize{9}{11}\selectfont]
+\makeatletter
+\renewcommand\maketitledesign
+{%
+ \makebox[\textwidth]{\normalsize
+ \shortstack[l]{\strut\websubject\\\webauthor, \@date}\hfill
+ \shortstack[l]{\webtitle\\\strut\@altTitle}\hfill
+ \shortstack[l]{\strut\eq@ExamName\\\eq@SID}}%
+}
+\makeatother
+\end{Verbatim}
+\noindent This code adds in a field for the student to enter
+his/her student Id, here we enclose the code in a
+\cs{makeatletter}/\cs{makeatother} because this redefinition
+occurs in the preamble, and the code has an `\texttt{@}' in it.
+
+Command elements that are appropriate to the redefinition are \cs{maketitledesign} are\dots
+\begin{description}
+ \item[\cs{websubject}] This is the course name, as determined by the \cs{subject} command.
+ \item[\cs{webtitle}] This is the exam name as determined by the \cs{title} command.
+ \item[\cs{altTitle}] An additional text field that is placed below \cs{webtitle}.
+ \item[\cs{@date}] This is the date as determined by the \cs{date} command.
+ \item[\cs{eq@ExamName}] This is the name field for the student to enter his/her name, as defined
+ by default or redefined by \cs{eqexamName}, see \Nameref{courseInfo}.
+ \item[\cs{eq@SID}] This is the student ID field for the student to enter his/her ID, as
+ defined by default, or redefined by the command \cs{eqSID}, see \Nameref{courseInfo}.
+ \item[\cs{eq@Email}] This is the student email field for the student to enter an email address, as
+ defined by default, or redefined by \cs{eqEmail}, see \Nameref{courseInfo}.
+ \item[\cs{theduedate}] This is a text macro defined by the \cs{duedate} command. For example, setting
+ \verb+\duedate{03/10/05}+ defines \cs{theduedate} so that it expands to \texttt{03/10/05}. May
+ be useful when redefining \cs{maketitledesign} for a homework assignment page.
+\end{description}
+
+\redpoint \cs{eqexcoverpagedesign}. When the \texttt{coverpage} option is
+taken, a default cover page appears unless it is redefined. The
+\textsf{eqexam} package provides \cs{eqexcoverpagedesign} to design your
+own cover page. The default cover page uses the
+
+\begin{description}
+ \item[\cs{websubject}] This is the course name, as determined by the \cs{subject} command.
+ \item[\cs{webtitle}] This is the exam name as determined by the \cs{title} command
+ \item[\cs{webuniversity}] This is the value set by the \cs{university} command, given
+ in the preamble.
+ \item[\cs{@date}] This is the date as determined by the \cs{date} command.
+ \item[\cs{eq@ExamName}] This is the name field for the student to enter his/her name, as defined
+ by default or redefined by \cs{eqexamName}, see \Nameref{courseInfo}.
+ \item[\cs{eq@SID}] This is the student ID field for the student to enter his/her ID, as
+ defined by default, or redefined by the command \cs{eqSID}, see \Nameref{courseInfo}.
+ \item[\cs{eq@Email}] This is the student email field for the student to enter his/her email address, as
+ defined by default, or redefined by \cs{eqEmail}, see \mlNameref{courseInfo}.
+\end{description}
+Copy the definition of \cs{eqexcoverpagedesign} from
+\textsf{eqexam.dtx} and modify as desired. Place the new
+definition in the preamble (enclosed between
+\cs{makeatletter} and \cs{makeatother}) or in a custom style file. No
+special support for this design is offered, because a cover page
+can be designed in so many different ways.
+
+\newtopic Another command associated with the \texttt{coverpage} option,is the
+\cs{place\-Cover\-Page\-Logo}, a simple command used 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}[xleftmargin=\leftmargini,fontsize=\fontsize{9}{11}\selectfont]
+\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.
+
+
+\subsubsection{Changing the Running Headers}
+
+There are two running headers, one header for the exam itself, and
+another when the solutions are shown at the end of the document.
+
+\redpoint Running Header for Exam. The commands \cs{lheadeqe},
+\cs{cheadeqe} and \cs{rheadeqe} are used for defining the left, right, and
+center running headers. \textbf{Note:} these commands have been recently
+renamed, originally they were named \cs{lhead}, \cs{chead} and \cs{rhead},
+but this conflicts with the \textsf{fancyhdr} package. If
+\textsf{fancyhdr} has not been loaded by the time \textsf{eqexam} is
+loaded, the eqexam definitions for \cs{lhead}, \cs{chead} and \cs{rhead}
+still hold. Generally, it is recommended that the new command be used,
+\cs{lheadeqe}, \cs{cheadeqe} and \cs{rheadeqe}.
+
+\begin{enumerate}
+\item \begin{Verbatim}[commandchars=!()]
+\lheadeqe{!meta(text)}
+\end{Verbatim}
+Changes the left header text of the running header. This command defines an
+internal macro \cs{eq@lhead} that actually contains the text. The default is
+\begin{Verbatim}[xleftmargin=\leftmargini]
+\lheadeqe{\shortwebsubject/\shortwebtitle}
+\end{Verbatim}
+
+\item \begin{Verbatim}[commandchars=!()]
+\cheadeqe{!meta(text)}
+\end{Verbatim}
+Changes the center header text of the running header.
+This command defines an internal macro \cs{eq@chead} that actually
+contains the text. The default is
+\begin{Verbatim}[xleftmargin=\leftmargini,fontsize=\fontsize{9}{11}\selectfont]
+\cheadeqe{-- Page \arabic{page}\space of \nPagesOnExam\space--}
+\end{Verbatim}
+
+\item \begin{Verbatim}[commandchars=!()]
+\rheadeqe{!meta(text)}
+\end{Verbatim}
+\noindent Changes the right header text of the running header.
+This command defines an internal macro \cs{eq@rhead} that actually
+contains the text.
+\item[]The default is \verb+\rhead{\eq@ExamName}+.
+\end{enumerate}
+If you want to redesign the layout of the running
+header, here is the macro that the above components fill.
+\begin{Verbatim}[xleftmargin=\leftmargini,fontsize=\fontsize{9}{11}\selectfont]
+\newcommand\runExamHeader{\eq@lhead\hfill\eq@chead\hfill\eq@rhead}
+\end{Verbatim}
+
+\redpoint Running Header for Solutions. The components of the
+running header for the solutions pages occur, as above, on the left, center
+and right of each header are defined by the commands \cs{lheadSol},
+\cs{cheadSol} and \cs{rheadSol}.
+
+\begin{enumerate}
+\item \begin{Verbatim}[commandchars=!()]
+\lheadSol{!meta(text)}
+\end{Verbatim}
+\noindent Changes the left header text of the running header. This
+command defines an
+internal macro \cs{eq@lheadSol} that actually contains the text. The default is
+\begin{Verbatim}[xleftmargin=\leftmargini]
+\lheadSol{\shortwebsubject/\shortwebtitle}
+\end{Verbatim}
+
+
+\item \begin{Verbatim}[commandchars=!()]
+\cheadSol{!meta(text)}
+\end{Verbatim}
+\noindent Changes the center header text of the running header.
+This command defines an internal macro \cs{eq@cheadSol} that
+actually contains the text. The default is
+\begin{Verbatim}[xleftmargin=\leftmargini,fontsize=\fontsize{9}{11}\selectfont]
+\cheadSol{-- Page \arabic{page}\space of \nPagesOnExam\space--}
+\end{Verbatim}
+
+\item \begin{Verbatim}[commandchars=!()]
+\rheadSol{!meta(text)}
+\end{Verbatim}
+\noindent Changes the right header text of the running header.
+This command defines an internal macro \cs{eq@rheadSol} that
+actually contains the text. The default definition is
+\verb+\rheadSol{SOLUTIONS}+.
+\end{enumerate}
+\noindent If you want to redesign the layout of the running
+header, here is the macro that the above components fill.
+\begin{Verbatim}[xleftmargin=\leftmargini]
+\newcommand\runExamHeaderSol
+ {\eq@lheadSol\hfill\eq@cheadSol\hfill\eq@rheadSol}
+\end{Verbatim}
+
+\subsubsection{Changing the Running Footers}
+
+The default set up of \textsf{eqexam} is to use no running footers;
+actually, that's not quite right. \textsf{eqexam} places the command
+\cs{settotalsbox} in the footer; this command is the one that places the
+totals boxes, when requested.
+
+\newtopic\textsf{eqexam} defines three commands for the footer,
+\settowidth{\aebdimen}{\ttfamily\string\lfooteqe\darg{\meta{text}}}
+\begin{dCmd}[commandchars=!()]{\aebdimen+2\fboxsep+2\fboxrule}
+\lfooteqe{!meta(text)}
+\cfooteqe{!meta(text)}
+\rfooteqe{!meta(text)}
+\end{dCmd}
+\noindent where the \meta{text} is placed at the left, center, and
+right of the running footer. The default for each is empty text. These
+three comprise the definition of \cs{runExamFooter}
+\begin{dCmd}{\linewidth}
+\newcommand{\runExamFooter}{\eq@lfoot\hfill\eq@cfoot\hfill\eq@rfoot}
+\end{dCmd}
+\noindent The \cs{settotalsbox} and \cs{runExamFooter} then appear in the definition
+of \cs{@oddfoot} in the definition of the \texttt{eqExamheadings} page style.
+\begin{Verbatim}[xleftmargin=\leftmargini]
+\renewcommand{\@oddfoot}{\settotalsbox\runExamFooter}
+\end{Verbatim}
+When doing any re-definition of the running footers at the \cs{@oddfoot} command,
+be sure to include \cs{settotalsbox} on the \emph{left side of the running footer}; otherwise,
+you will not have a totals box when you request one.
+
+
+\subsubsection{Exam Strings}
+
+In this section we list a new commands that contain information about the exam.
+
+\settowidth{\aebdimen}{\ttfamily\string\nPagesOnExam}
+\begin{dCmd}[commandchars=!()]{\aebdimen+2\fboxsep+2\fboxrule}
+\nPagesOnExam
+\end{dCmd}
+\noindent The command \cs{nPagesOnExam} expands to the total number of pages in the exam.
+
+\settowidth{\aebdimen}{\ttfamily\string\nQuesInExam\darg{\meta{exam\_name}}}
+\begin{dCmd}[commandchars=!()]{\aebdimen+2\fboxsep+2\fboxrule}
+\nQuesInExam[!meta(exam_name)]
+\end{dCmd}
+\noindent \cs{nQuesInExam} expands to the total number of questions in the
+exam. The command takes an optional argument, the \meta{exam\_name}
+(this is the name given the exam as the required argument of the
+\texttt{exam} environment). If the argument is not given, the name of the
+current exam is used (when executed within an \texttt{exam} environment).
+When \cs{nQuesInExam} outside an \texttt{exam} environment, the value of
+the optional argument needs to be specified.
+
+\newtopic There are several commands are useful for documents that have several
+\textsf{eqexam} environments, these are
+\settowidth{\aebdimen}{\ttfamily\string\percentForPart\darg{\meta{exam\_name}}}
+\begin{dCmd}[commandchars=!()]{\aebdimen+2\fboxsep+2\fboxrule}
+\theGrandTotal
+\totalForPart{!meta(exam_name)}
+\percentForPart{!meta(exam_name)}
+\end{dCmd}
+\noindent The first command sums the point totals for each of the
+\texttt{exam} environments. The latter two, each taking one argument, the
+name associated with the \texttt{exam}, reports the points for that
+\texttt{exam} environment and the percent of the total for that
+\texttt{exam} environment.
+
+\newtopic Below is a recent example taken from a final exam that I constructed for my class.
+\begin{Verbatim}[xleftmargin=\amtIndent,fontsize=\small]
+\begin{eqComments}[Final Exam:] (\theGrandTotal\space points) The
+final exam has two parts:
+ \textbf{Part I} (\totalForPart{InstrQuestions} points or
+ \percentForPart{InstrQuestions} of the total points) consists of
+ questions written by the instructor;
+ \textbf{Part II} (\totalForPart{GenEd} points or
+ \percentForPart{GenEd} of the total points) consists of
+ questions provided by the Department of Mathematics.
+\end{eqComments}
+\end{Verbatim}
+
+\promoteNewPageHere{10pt}
+
+\handpoint The calculation of \cs{percentForPart} is done in one of two ways:
+\begin{enumerate}
+ \item If the \textsf{fp} package is loaded, ``floating point
+ arithmetic'' is used and results are rounded to the number of
+ decimal points determined by \cs{nPctDecPts}, the default
+ definition of which is \verb!\newcommand{\nPctDecPts}{1}!. This command may be redefined
+ to another nonnegative integer value.
+\item Otherwise---if the \textsf{fp} package is \emph{not
+ loaded}---\TeX's count registers are used, the percentage rounded
+ to the nearest integer.
+\end{enumerate}
+
+\newtopic The calculations are made when the \cs{maketitle} command is
+expanded. If, for whatever reason, you are not using \cs{maketitle}, you
+can place the command that does the calculations,
+\cs{EQEcalculateAllTotals}, just after \verb!\begin{document}!, and before
+the first use of \cs{theGrandTotal} and \cs{percentForPart}.
+
+\settowidth{\aebdimen}{\ttfamily\string\firstPageOfExam\darg{\meta{exam\_name}}}
+\begin{dCmd}[commandchars=!()]{\aebdimen+2\fboxsep+2\fboxrule}
+\firstPageOfExam{!meta(exam_name)}
+\lastPageOfExam{!meta(exam_name)}
+\end{dCmd}
+\noindent These two commands expand the page numbers of the beginning and the ending
+of the exam environment, respectively, with name \meta{exam\_name}.
+
+\subsubsection{Localization of Strings}
+
+% Added 01/10/06
+% \examNameLabel
+% \ptsLabel, \ptsLabel
+% \eachLabel
+% \pointsLabel, \pointLabel
+% \defaultInstructions
+
+In this section we list various macros that expand to text
+appearing on an \textsf{eqexam} document. The default text is in
+English. These commands can be redefined to other English
+language phrases, or to other languages, and placed in the preamble of your document,
+or in one of the \texttt{.cfg} files.
+
+\begin{itemize}
+% Added 01/10/06
+\item\cs{examNameLabel}: On each page of the exam, there is a place
+for the student to enter her/his name. \cs{examNameLabel} can be
+used to define the name label, the default is
+\begin{Verbatim}[xleftmargin=\leftmargini]
+\examNameLabel{Name:}
+\end{Verbatim}
+\item \cs{examAnsKeyLabel}: When the \texttt{answerkey} option is in
+ effect, the line in which the student enters her/his name (labeled by
+ \cs{examNameLabel}) is filled by the value of the text macro
+ \cs{examAnsKeyLabel}. The default definition is
+\begin{Verbatim}[xleftmargin=\leftmargini]
+\examAnsKeyLabel{Answer Key}
+\end{Verbatim}
+Thus, when the \texttt{answerkey}
+option is used, the name field appears as follows:
+\begin{flushleft}
+\underbar{\makebox[2.5in][l]{Answer Key}}
+\end{flushleft}
+
+\item\cs{ptLabel} and \cs{ptsLabel}: Labels for indicating the points of a problem, the first is
+the singular form of the second. The default is
+\begin{Verbatim}[xleftmargin=\leftmargini]
+\ptLabel{pt} % singular form
+\ptsLabel{pts} % plural form
+\end{Verbatim}
+\item\cs{eachLabel}: Label for indicating the common point value of each of several parts
+of the same problem.
+\begin{Verbatim}[xleftmargin=\leftmargini]
+\eachLabel{ea.}
+\end{Verbatim}
+\item\cs{pointLabel} and \cs{pointsLabel}: The word for `points' used in the \texttt{instructions} environment
+ that lists the number of points in this exam. The default is
+\begin{Verbatim}[xleftmargin=\leftmargini]
+\pointLabel{point} % singular form
+\pointsLabel{points} % plural form
+\end{Verbatim}
+The \cs{pointsLabel} command defines \cs{eq@pointsLabel}, which,
+in turn, is used in the \cs{summaryTotalsTxt}, the definition of
+which follows:
+\begin{Verbatim}[xleftmargin=\leftmargini]
+\newcommand{\summaryTotalsTxt}
+ {($\summaryPointTotal\,\text{\eqpointsLabel}$)}
+\end{Verbatim}
+\item\cs{defaultInstructions}: The \texttt{instructions} environment has a default heading.
+The command \cs{defaultInstructions} allows you to change this heading. The default is
+\begin{Verbatim}[xleftmargin=\leftmargini]
+\defaultInstructions{Instructions.}
+\end{Verbatim}
+\end{itemize}
+
+\newtopic See \Nameref{ptTotalsBoxes} as well as the section \mlNameref{courseInfo} for
+additional details on these and commands useful for laying out the
+standard text of an \textsf{eqexam} document.
+
+\subsubsection{Customization of Color}\label{customColor}
+
+When the \texttt{forcolorpaper} option is used, various elements---such as
+section titles, instruction headers, color for fill-in problems, and so on---have default colors. In
+this section we list the color controls, along with their default definitions.
+
+\begin{Verbatim}[numbers=left,xleftmargin=\leftmargini,fontsize=\fontsize{10}{14}\selectfont]
+\proofingsymbolColor{red}
+\instructionsColor{blue}
+\eqCommentsColor{blue}
+\eqCommentsColorBody{black}
+\universityColor{blue}
+\titleColor{black}
+\authorColor{black}
+\subjectColor{blue}
+\linkcolor{blue}
+\nolinkcolor{blue}
+\fillinColor{red}
+\forceNoColor
+\end{Verbatim}
+
+\noindent\textbf{Description of Color Commands:}
+\begin{enumerate}
+ \item The color of the proofing symbol, it appear for multiple
+ choice questions with the \texttt{answerkey} option in effect.
+ \item The color of the header text for the \texttt{instructions} environment.
+ The header is the text that appears in the optional argument.
+ \item The color for the header text for the \texttt{eqComments} environment.
+ The header is the text that appears in the optional argument.
+ \item The color for the body of the text for the \texttt{eqComments} environment.
+ \item The color of the university, visible only when the \texttt{coverpage} option is taken.
+ \item The color of the title, visible only when the \texttt{coverpage} option is taken.
+ \item The color of the author, visible only when the \texttt{coverpage} option is taken.
+ \item The color of the subject, visible only when the \texttt{coverpage} option is taken.
+ \item The color applied to a link, applies only when \textsf{hyperref} is included through one of the PDF options,
+ \texttt{links}, \texttt{online}, or \texttt{email}.
+ \item The color applied to a link that has been turned off, applies
+ only when \textsf{hyperref} is included through one of the PDF options,
+ \texttt{links}, \texttt{online}, or \texttt{email}.
+ \item The color of the a fill-in (including a True/False question)
+ when one of the options \texttt{answerkey},
+ \texttt{vspacewithsolns}, or \texttt{solutionsonly} is
+ taken.
+ \item This convenience command forces all the above colors to black. Useful when you want to use the
+ \texttt{showgrayletters}. This produces a black and white document, with gray letters. (If you use the
+ \texttt{forpaper} option, the gray letters appear black.)
+\end{enumerate}
+
+
+\subsection{Creating Multiple Versions of Exam}
+
+Unfortunately, I teach multiple sections of the same course, and
+am faced with the problem of writing different exams for the same
+course each administered to a different section.
+
+Typically, I only have a need for two variations on the test; however,
+further extensions can be made, if needed (See \Nameref{mutiVerNew})
+
+\subsubsection{The Original Version Scheme}\label{mutiVerOrig}
+
+The \textsf{eqexam} package defines a boolean switch,
+\cs{ifVersionA} for this purpose. The two sections of the same
+course are ``Version A'' and ``Version B''. The default is that
+you are preparing an exam for ``Version A''.
+
+The command \cs{forVersion} sets the version: \verb+\forVersion A+
+sets version to ``Version A'', and \verb+\forVersion B+ set the
+version to ``Version B''. (The argument of the \cs{forVersion} command is case
+insensitive, so you also type in \verb+\forVersion b+.)
+
+For small variations in text, there is the \cs{ifAB} macro,
+\settowidth{\aebdimen}{\ttfamily\string\ifAB\darg{\anglemeta{Version A text}}%
+\darg{\anglemeta{Version B text}}}
+\begin{dCmd}[commandchars=!()]{\aebdimen+2\fboxsep+2\fboxrule}
+\ifAB{!anglemeta(Version A text)}{!anglemeta(Version B text)}
+\end{dCmd}
+\noindent for example, one could say,
+\begin{Verbatim}[xleftmargin=\leftmargini]
+\begin{problem}[2]
+Compute $\frac{d}{dx}\ifAB{x^2}{x^3}$.
+\end{problem}
+\end{Verbatim}
+\noindent For longer variations, the \texttt{comments} package is
+used to create comment environments that are included or excluded.
+The two environments are \texttt{verA} and \texttt{verB}.
+\begin{Verbatim}[xleftmargin=\leftmargini]
+\begin{problem}[2]
+Compute $\frac{d}{dx}\ifAB{x^2}{x^3}$.
+
+\begin{solution}[1in]
+We use standard techniques:
+\begin{verA}
+$$
+ \frac{d}{dx} x^2 = 2x
+$$
+\end{verA}
+\begin{verB}
+$$
+ \frac{d}{dx} x^3 = 3x^2
+$$
+\end{verB}
+\end{solution}
+\end{problem}
+\end{Verbatim}
+
+There are several convenience macros for referring to the exams
+generated by the two variations.
+
+Usually, an exam, test, homework assignment has a number associate
+with it, e.g. ``Exam 1'', ``Test 2'', ``Assignment~\#12'', etc\@.
+This number should be defined using the \cs{examNum} macro.
+\settowidth{\aebdimen}{\ttfamily\string\examNum\darg{\meta{num}}}
+\begin{dCmd}[commandchars=!()]{\aebdimen+2\fboxsep+2\fboxrule}
+\examNum{!meta(num)}
+\end{dCmd}
+where \meta{num} is the number to be associated
+with the exam (test, assignment) under construction.
+
+This command \emph{must appear before} \cs{title} in the
+preamble. The command \cs{examNum} takes its argument and defines
+another macro \cs{nExam}, which has no arguments, but expands to
+\meta{num}.
+
+The \textsf{eqexam} package defines two commands \cs{Exam} and
+\cs{sExam} to automatically enter the test information for the
+current version. In the preamble, you can say,
+\begin{Verbatim}[xleftmargin=\leftmargini]
+\title[\sExam]{\Exam}
+\end{Verbatim}
+\noindent \cs{Exam} is the long version of the test name, and takes as its
+argument the exam number. \cs{sExam} is the short version, having no
+argument. Both \cs{Exam} and \cs{sExam} use the value determined by
+\cs{examNum}, described above.
+
+The text of \cs{Exam} and \cs{sExam} are generated by the four
+commands,
+\begin{enumerate}
+\item \cs{VersionAtext\darg{\meta{text}}} This is the text for the long
+version of the exam name for ``Version A''. The default text is
+\begin{Verbatim}[xleftmargin=\leftmargini]
+\VersionAtext{Exam~\nExam--Version A}
+\end{Verbatim}
+
+\item \cs{VersionBtext\darg{\meta{text}}} This is the text for the long
+version of the exam name for ``Version B''. The default text is
+\begin{Verbatim}[xleftmargin=\leftmargini]
+\VersionAtext{Exam~\nExam--Version B}
+\end{Verbatim}
+
+\item \cs{shortVersionAtext\darg{\meta{text}}} This is the text for the
+short version of the exam name for ``Version A''. The default text
+is
+\begin{Verbatim}[xleftmargin=\leftmargini]
+\VersionAtext{Exam~\nExam A}
+\end{Verbatim}
+
+\item \cs{shortVersionBtext\darg{\meta{text}}} This is the text for the
+short version of the exam name for ``Version B''. The default text
+is
+\begin{Verbatim}[xleftmargin=\leftmargini]
+\VersionAtext{Exam~\nExam B}
+\end{Verbatim}
+\end{enumerate}
+
+\redpoint All the above commands,
+\textbf{\textcolor{blue}1}--\textbf{\textcolor{blue}4}, need to
+appear before \cs{title} in the preamble.\medskip
+
+\noindent Below is a ``typical'' example of how to correctly
+redefine all the version text.
+\begin{Verbatim}[xleftmargin=\leftmargini,fontsize=\fontsize{9}{11}\selectfont]
+\documentclass{article}
+\usepackage{amsmath}
+\usepackage[forpaper,pointsonleft,noparttotals,nosolutions]{eqexam}
+
+\examNum{1}
+\forVersion{B}
+\VersionAtext{Test~\nExam--003}
+\VersionBtext{Test~\nExam--007}
+\shortVersionAtext{T{\nExam}s3}
+\shortVersionBtext{T{\nExam}s7}
+
+\title[\sExam]{\Exam}
+\author{D. P. Story}
+\subject[C2]{Calculus II}
+\date{Spring \the\year}
+\keywords{Test \nExam, Section \ifAB{003}{007}}
+\end{Verbatim}
+
+
+\subsubsection{New Version Control}\label{mutiVerNew}
+
+In this section we introduce a new set of commands that supersede
+the commands defined above. Those commands were limited to only
+two versions. The ones below can handle up to $26$ versions.
+
+The steps for creating a multiple version \textsf{eqexam} document are as follows.
+\settowidth{\aebdimen}{\ttfamily\string\numVersions\darg{\meta{num}}}
+\begin{dCmd}[commandchars=!()]{\aebdimen+2\fboxsep+2\fboxrule}
+\numVersions{!meta(num)}
+\end{dCmd}
+\noindent In the preamble, declare the number of versions for this document
+ using \cs{numVersions}, e.g., \verb|\numVersions{3}|.
+\begin{Verbatim}[xleftmargin=\leftmargini,commandchars=!()]
+\longTitleText
+ {!anglemeta(Text_1)}
+ {!anglemeta(Text_2)}
+ ...
+ {!anglemeta(Text_n)}
+\endlongTitleText
+\end{Verbatim}
+\begin{Verbatim}[xleftmargin=\leftmargini,commandchars=!()]
+\shortTitleText
+ {!anglemeta(Text_1)}
+ {!anglemeta(Text_2)}
+ ...
+ {!anglemeta(Text_n)}
+\endshortTitleText
+\end{Verbatim}
+\textbf{Note:} If there are more titles than what are declared, the rest
+of the titles are absorbed (gobbled). If there are fewer titles than declared, a
+{\LaTeX} package error is generated, and ``fake'' titles are
+generated.
+
+
+\newtopic Next, state the long and short titles for the document,
+one for each of the declared number of versions given earlier in \cs{numVersions}.
+For example, we can use the value \cs{nExam} in our titles. Usage:
+\begin{Verbatim}[xleftmargin=\leftmargini]
+\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}
+These two commands give values to \cs{Exam} and \cs{sExam}. If
+\verb!\forVersion{a}! is executed, \cs{Exam} expands to the text \verb|Test~\nExam--Version A| and
+\cs{sExam} expands to \verb|T\nExam A|, using the example above. The value of \cs{nExam}
+is determined by the \cs{examNum} command, as described above.
+
+\newtopic Next is the command that does all the work. It creates alternate
+text macros for each of the versions declared using \cs{numVersions}. The syntax is
+\settowidth{\aebdimen}{\ttfamily\string\forVersion\darg{\meta{letter}}}
+\begin{dCmd}[commandchars=!()]{\aebdimen+2\fboxsep+2\fboxrule}
+\forVersion{!meta(letter)}
+\end{dCmd}
+For example, assuming \verb|\numVersions{3}|, \verb|\forVersion{a}| (or \verb|\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}[xleftmargin=\leftmargini]
+ Name the \vA{place}\vB{date}\vC{year} of the signing
+ of the Magna Carta.
+\end{Verbatim}
+\noindent Since \verb|forVersion{a}| was declared, only the \cs{vA} text
+is displayed, the others are gobbled up. But wait, time out, the \cs{forVersion}
+does more than that! It also creates a series of comment environments
+\verb|\begin{verA}/\end{verA}|, \verb|\begin{verB}/\end{verB}|, \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}[xleftmargin=\leftmargini,fontsize=\fontsize{9}{11}\selectfont]
+\numVersions{3}
+\forVersion{b}
+...
+\begin{document}
+...
+Solve the equation for $\vA{x}\vB{y}\vC{z}$:
+\[
+\begin{verA}
+ 2x + 4 = 7
+\end{verA}
+\begin{verB}
+ 5y + 2 = 4
+\end{verB}
+\begin{verC}
+ 3z - 2 = 2
+\end{verC}
+\]
+\end{Verbatim}
+
+\noindent Here is a final example of the multiple version scheme, taken from the preamble of one of
+my Calculus tests.
+
+\begin{Verbatim}[xleftmargin=\leftmargini,fontsize=\fontsize{9}{11}\selectfont]
+\documentclass{article}
+\usepackage{amsmath,graphicx}
+\usepackage[forpaper,pointsonleft,nototals,nosolutions]{eqexam}
+%\usepackage[forpaper,pointsonleft,nototals,answerkey]{eqexam}
+
+\numVersions{3}
+\forVersion{a}
+\examNum{1}
+\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
+
+\subject[C3]{Calculus III}
+\title[\sExam]{\Exam}
+\author{Dr.\ D. P. Story}
+\university
+{%
+ THE UNIVERSITY OF AKRON\\
+ Department of Theoretical and Applied Mathematics
+}
+\date{\thisterm\space\the\year} % Fall 2005
+\duedate{09/26/05} % actual date of the test
+% If you convert to pdf using a pdf (links, online, email)
+% option, this will appear in the keywords field of the
+% document info dialog.
+\keywords{\Exam, administered \theduedate}
+\end{Verbatim}
+
+\newtopic There is one additional command that can be used to locally control
+which version that is typeset in the document.
+\settowidth{\aebdimen}{\ttfamily\string\selectVersion\darg{\meta{num}}%
+\darg{\meta{total\_versions}}}
+\begin{dCmd}[commandchars=!()]{\aebdimen+2\fboxsep+2\fboxrule}
+\selectVersion{!meta(num)}{!meta(total_versions)}
+\end{dCmd}
+You can place the \cs{selectVersion} command in front of a question or a part of a question
+that has multiple versions. Through this command you can select which version to typeset,
+provided the option \texttt{obeylocalversions} is set. For example,
+\begin{Verbatim}[xleftmargin=\leftmargini]
+\selectVersion{3}{4}
+\begin{problem}[10]
+...
+\end{problem}
+\end{Verbatim}
+\noindent The \cs{selectVersion} command says there are four variations on the next question
+and the document author wants to use the third one (that would correspond to C, in the
+\cs{forVersion} command). Again, the \texttt{obeylocalversions} must be taken for
+\textsf{eqexam} to obey this command.
+
+\newtopic \textbf{Recommendation:} Each problem should
+have the command \cs{selectVersion} in front of it, even for parts.
+Suppose the document author says \verb!\numVersions{5}!, but some
+problems don't have five versions, what do you do? If there is a
+\cs{selectVersion} in front of a problem with multiple versions, the
+\cs{selectVersion} will partially expand to determine if it is
+needed. It is needed if the version specified by \cs{forVersion}, is
+greater than the number of versions for the problem. In this case,
+\cs{selectVersion} performs modular arithmetic to compute which
+version is to be used. For example, if \verb!\forVersion{E}! has
+been declared in the preamble, but a problem has only three
+variations, the \textsf{eqexam} will use variation B; if
+\verb!\forVersion{D}! was declared, version A is
+used, and so on.
+
+
+\subsection{The Point and Totals Boxes}\label{ptTotalsBoxes}
+
+There are two types of points boxes, but only one type of totals
+box. All the commands listed below can be redefined for language
+localizations, for example.
+
+\redpoint Points that appear in the left margin (the
+\texttt{pointsonleft} or \texttt{pointsonboth} options). There are two text macros
+that are used,
+\begin{Verbatim}[xleftmargin=\leftmargini]
+\newcommand\leftmarginPtsTxt[1]{(\small$#1^{\text{pts}}$)}
+\end{Verbatim}
+\noindent when the total points for that problem are shown, and the other
+\begin{Verbatim}[xleftmargin=\leftmargini]
+\newcommand\leftmarginPtsEaTxt[1]
+ {(\small$#1_{\text{ea.}}^{\text{pts}}$)}
+\end{Verbatim}
+\noindent when the author indicates that each sub-part of a problem
+is weighted the same, (when the author begins a \texttt{problem*}
+environment with \verb+\begin{problem*}[3ea]+, for example).
+
+\redpoint Points that appear in the right margin (options
+\texttt{pointsonright} or \texttt{pointsonboth}). These points appear
+in the bottom half of a box, the text for that box is determined by the
+following definition.
+\begin{Verbatim}[xleftmargin=\leftmargini]
+\newcommand\marginpointsboxtext[2]{\small$#1\,\text{pts}$}
+\end{Verbatim}
+\noindent By the way, the purpose of the upper part of the box is
+for the instructor to enter the number of points a student
+received for that problem.
+
+\redpoint Points specified by the \cs{PTs} command. This text is
+defined by \cs{itemPTsTxt} as follows. See the paragraphs on
+\Nameref{problemstar} for a discussion of the use of \cs{PTs}.
+\begin{Verbatim}[xleftmargin=\leftmargini]
+\newcommand\itemPTsTxt[1]{($#1$ pts)}
+\end{Verbatim}
+
+\redpoint \textbf{The totals box.} When you specify either option
+\texttt{totalsonleft} or \texttt{totalsonright}, you get a page totals
+box appearing in the lower left or right bottom corner.
+\begin{Verbatim}[xleftmargin=\leftmargini,fontsize=\small]
+\newcommand\totalsboxtext{\small$\theeqpointsthispage\,\text{pts}$}
+\end{Verbatim}
+where \texttt{eqpointsthispage} is a counter whose value
+at the end of each page \emph{should} be the page total. For tests
+that have multiple \texttt{exam} environments, if one exam part
+ends on a page, and another begins on the same page, this number
+(\texttt{eqpointsthispage}) is the total on the page from the
+beginning of the new exam part. In this case, at the end of the
+exam part, there should also appear a remaining total for that
+part on that page.
+
+The totals boxes are located in the lower right corner
+(\texttt{totalsonright}) or in the lower left corner
+(\texttt{totalsonleft}). Vertical placement of these boxes is controled
+by the length \cs{eqevtranstotbox}, its default value is
+\texttt{0pt}. To raise the boxes \texttt{6pt}, for example,
+execute \verb!\setlength{\eqevtranstotbox}{6pt}!; the box may be lowered
+by using a negative length.
+
+\redpoint \textbf{Summary Totals.} When you use the \texttt{instructions}
+environment to give initial instructions for an exam, the total
+points appears automatically in the text, unless you specify the
+\texttt{nosummarytotals} option. This text is defined by
+\cs{summaryTotalsTxt}, whose definition follows:
+\begin{Verbatim}[xleftmargin=\leftmargini,fontsize=\fontsize{9}{11}\selectfont]
+\newcommand\summaryTotalsTxt{($\summaryPointTotal\,\text{points}$)}
+\end{Verbatim}
+\noindent where \cs{summaryPointTotal} is a macro that expands to
+the total for this \texttt{exam} environment.
+
+\subsection{The \texttt{eqComments} Environment}
+
+In addition to the \texttt{instructions} environment, as explained
+in the section~\ref*{exam}, entitled \Nameref{exam}, should you want to insert
+additional instructions from within the body or the exam, use the
+\cs{eqComments} environment. The \cs{eqComments} environment has
+one optional argument, a formatted heading for the comments you
+want to make. For example,
+\begin{Verbatim}[xleftmargin=\leftmargini,fontsize=\fontsize{9}{11}\selectfont]
+\begin{eqComments}[Proofs.]
+Solve each of the problems~5--8 on a separate sheet of paper,
+do not write on the back of the paper. Follow the instructions
+provided for each problem. Use your little gray cells.
+\end{eqComments}
+\end{Verbatim}
+\noindent Such instructions must go between problems, of course,
+not within the body of either a \texttt{problem} or a
+\texttt{problem*} environment.
+
+\redpoint The optional argument has a color associated with it, and
+is visible when you compile the document with the
+\texttt{forcolorpaper} option. \cs{eqCommentsColor} colors the text that may appear
+in the optional argument of the environment; \cs{eqCommentsColorBody} colors the body
+of the text. Each take a single named color argument.
+\begin{Verbatim}[xleftmargin=\leftmargini]
+\eqCommentsColor{blue}
+\eqCommentsColorBody{black}
+\end{Verbatim}
+The above are the default definition.
+
+\subsection{The \texorpdfstring{\protect\cs{OnBackOfPage}}{\textbackslash OnBackOfPage} Command}\label{onbackofpage}
+
+In order to reduce the number of pages needed for an exam, I often
+cheat by asking the student to work on the back of one of the test
+pages.
+\begin{Verbatim}[xleftmargin=\leftmargini]
+\newcommand\bopText{on the back of page~\boPage}
+\newcommand\bopCoverPageText{(the cover page)}
+\newcommand\OnBackOfPage[1][\bopText]{%
+\end{Verbatim}
+
+For this, I use the \cs{OnBackOfPage} command
+\settowidth{\aebdimen}{\ttfamily\string\OnBackOfPage[\meta{text}]}
+\begin{dCmd}[commandchars=!()]{\aebdimen+2\fboxsep+2\fboxrule}
+\OnBackOfPage[!meta(text)]
+\end{dCmd}
+\noindent The optional argument allows you to enter variational
+text, text that varies from the default text. The default text is
+contained in \cs{bopText} macro, its definition is
+\begin{Verbatim}[xleftmargin=\leftmargini]
+\newcommand\bopText{on the back of page~\boPage}
+\end{Verbatim}
+\noindent where \cs{boPage} is the page the student is instructed
+to do the work. Thus, if you say, ``Continue \cs{OnBackOfPage}.''
+This would expand to ``Continue on the back of page 2.'', or
+whatever \cs{boPage} is determined to be.
+
+\newtopic To illustrate the use of the optional argument of
+\cs{OnBackOfPage}, you might say,
+\begin{quote}
+ \verb+\OnBackOfPage[The back of page~\boPage]+ can be used\\
+ to continue work, if necessary.
+\end{quote}
+This expands to
+``The back of page 2 can be used to continue work, if necessary.''
+
+The algorithm used to compute the page, \cs{boPage}, on which to
+continue to work is as follows: For all pages, except for the
+first page of the test, the student works on the back of the
+previous page. For the first page of the test, the student works
+on the back of the first page, unless there is a cover page, in
+which case the student is instructed to work on the back of that
+page.
+
+In the case of working on the back of the cover page, there is a variation on the
+instructions, \cs{OnBackOfPage} expands to ``on the back of page 1 (the cover page)''.
+The phrase ``(the cover page)'' can be redefined using the \cs{bopCoverPageText} command.
+The definition of this command is
+\begin{Verbatim}[xleftmargin=\leftmargini]
+\newcommand\bopCoverPageText{\space(the cover page)}
+\end{Verbatim}
+\noindent We could change this as follows,
+\begin{Verbatim}[xleftmargin=\leftmargini]
+\renewcommand\bopCoverPageText{, the cover page}
+\end{Verbatim}
+\noindent so that it would now read, ``on the back of page 1, the cover page''. To remove this feature
+altogether, you could redefine as
+\begin{Verbatim}[xleftmargin=\leftmargini]
+\renewcommand\bopCoverPageText{}
+\end{Verbatim}
+
+\subsection{\texorpdfstring
+ {The \cs{pushProblem} and \cs{popProblem} Commands}
+ {The \CMD{pushProblem} and \CMD{popProblem} Commands}
+}
+
+
+There may be an occasion when a multi-part question needs to be broken between parts,
+use the \cs{pushProblem} and \cs{popProblem} for this purpose. The push saves the
+counter value, and ends the \texttt{parts} environment. The pop restarts the
+\texttt{parts}, and resets the parts counter.
+
+\newtopic
+In the \texttt{multicols} environment below, we \cs{pushProblem}, then close \texttt{multicols}, we execute \cs{popProblem}, and then continue with the multi-parts in single column.
+\begin{Verbatim}[xleftmargin=\leftmargini,fontsize=\fontsize{9}{11}\selectfont]
+\begin{problem*}[\auto]
+Do each of the following without error.
+\begin{multicols}{2}
+ \begin{parts}
+ \item\PTs{3} This is a problem.
+ \begin{solution}[1in]\end{solution}
+
+ \item\PTs{3} This is a problem.
+ \begin{solution}[1in]\end{solution}
+\pushProblem
+\end{multicols}
+\popProblem
+ \item\PTs{4} Do this harder problem.
+ \begin{solution}[.5in]\end{solution}
+ \end{parts}
+\end{problem*}
+\end{Verbatim}
+\newtopic In the example, the first two questions appear in two
+column format, while the third appears in single column format. The
+same thing can be done in reverse, like so:
+\begin{Verbatim}[xleftmargin=\leftmargini,fontsize=\fontsize{9}{11}\selectfont]
+\begin{problem*}[\auto]
+Do each of the following without error.
+ \begin{parts}
+ \item\PTs{3} This is a problem.
+ \begin{solution}[1in]\end{solution}
+\pushProblem
+\begin{multicols}{2}
+\popProblem
+ \item\PTs{4} This is a hard problem.
+ \begin{solution}[1in]\end{solution}
+ \item\PTs{4} Do this harder problem.
+ \begin{solution}[1in]\end{solution}
+ \end{parts}
+\end{multicols}
+\end{problem*}
+\end{Verbatim}
+\newtopic Now, first question is in single column and the next two are in two column format.
+
+\handpoint In order to get the correct formatting, the \texttt{multicols} environment must begin
+before the \texttt{parts} environment.
+
+%\newtopic See \texttt{quiz02.tex} for an example of \cs{pushProblem} and \cs{popProblem}.
+
+\exAeBBlogPDF{p=1211} See \texttt{\href{\urlAcroTeXBlog/?p=1211}{quiz02.pdf}}
+for an example of \cs{pushProblem} and \cs{popProblem}.
+
+
+\subsection{\texorpdfstring{\protect\cs{qNewPage}, \protect\cs{aNewPage},
+ and \protect\cs{promoteNewPage}}
+ {\CMD{qNewPage}, \CMD{aNewPage}, and \CMD{promoteNewPage}}}\label{aqpNewPage}
+
+The command \cs{qNewPage} (questions newpage) and \cs{aNewPage}
+(answers newpage) are convenience commands for creating new pages.
+The first one expands to \cs{newpage} when the \cs{ifanswerkey} is
+false and the second one expands to \cs{newpage} when the
+\cs{ifanswerkey} is true; their definitions are
+\begin{Verbatim}[xleftmargin=\leftmargini]
+\newcommand\qNewPage{\ifanswerkey\else\newpage\fi}
+\newcommand\aNewPage{\ifanswerkey\newpage\fi}
+\end{Verbatim}
+
+The \cs{promoteNewPage} can be used to insert a page break, if needed.
+\settowidth{\aebdimen}{\ttfamily\string\promoteNewPage\darg{\meta{vspace}}}
+\begin{dCmd}[commandchars=!()]{\aebdimen+2\fboxsep+2\fboxrule}
+\promoteNewPage[!meta(vspace)]
+\end{dCmd}
+If there is more than \meta{vspace} left on the current page, a
+\cs{newpage} command is executed (a \cs{columnbreak} if in a
+\texttt{multicols} environment). The default value for \meta{vspace}
+is \cs{@fvsizeskip}\cs{textheight}, where \cs{@fvsizeskip} is a decimal
+number between 0 and 1 that is set by \cs{fvsizeskip}. The default is
+\verb!\fvsizeskip{.3}!. This means that if there is less than
+\verb!.3\textheight!, and new page is created. This may be too large for
+most applications, so you can pass a \meta{vspace} through the optional argument.
+For example, \cs{promoteNewPage[.25in]}.
+
+
+
+\subsection{Support for Solution Sets from a Text}\label{solnSets}
+
+I use \textsf{eqexam} not only for exams, quizzes and homework
+assignments, but also for solution sets for problems assigned from the text.
+
+Suppose the assignment was to solve, on a certain page in the text,
+problems which include \textbf{2}, \textbf{6} and \textbf{12(b)(d)} and
+it is desired to provide solutions to these problem. For this
+purpose, \textsf{eqexam} provides \cs{forproblem} and \cs{foritem}. These
+commands are used as follows:
+\begin{Verbatim}[xleftmargin=\leftmargini,fontsize=\fontsize{9}{11}\selectfont]
+\begin{exam}{HW\nExam}
+\begin{instructions}[Description] (10 points)
+Selected solutions from Assignments~24, 25, \S7.1.
+\end{instructions}
+
+\begin{eqComments}[\S7.1]
+\textbf{Solving Linear Equations}
+\end{eqComments}
+
+\forproblem{2}
+\begin{problem}
+Statement of problem.
+\begin{solution}
+Solution to this problem.
+\end{solution}
+\end{problem}
+
+\forproblem{6}
+\begin{problem}
+Statement of problem.
+\begin{solution}
+Solution to this problem.
+\end{solution}
+\end{problem}
+
+\forproblem{12}
+\begin{problem*}
+Statement of problem.
+\begin{parts}
+ \foritem{b} Statement for item (b)
+ \begin{solution}
+ Solution to this problem.
+ \end{solution}
+
+ \foritem{d} Statement for item (d)
+ \begin{solution}
+ Solution to this problem.
+ \end{solution}
+\end{parts}
+\end{problem*}
+\end{exam}
+\end{Verbatim}
+
+\subsection{Referencing Multiple Choice Questions}\label{showgraylettersOpt}
+
+When the \texttt{showgrayletters} option is used, each alternatives in a
+multiple choice question will have a gray capital letter \texttt{A},
+\texttt{B}, \texttt{C}, etc. underneath it. This letter can then be
+referred to in the text or the solution.
+
+The use of this option is global and is controlled by the switch,
+\cs{ifaeb\-show\-gray\-letters}. The gray letter feature can be turned on
+and off locally: To turn on this feature, insert the command
+\cs{graylettersOn} at some appropriately chosen point in
+the document; to turn off the gray letter feature insert
+\cs{graylettersOff}.
+
+\newtopic In support of the \texttt{showgrayletters} option is a new
+command \cs{REF}. \cs{REF} acts like the {\LaTeX} command \cs{ref}
+with the hyperref modifications, but it converts the reference to
+uppercase. When \cs{ref} would typeset the letter `a', for example,
+\cs{REF} would typeset the letter `A'. \cs{REF}, like \cs{ref},
+typesets a hyperref link. Hyperref defines a \texttt{*} version of
+\cs{ref}; \cs{ref*} typesets the reference, but does not create a
+link; \cs{REF*} does the same. When \cs{aebshowgraylettersfalse} is
+in effect, \cs{REF} does not capitalize the reference.
+
+\redpoint Below is an example of this.
+\begin{Verbatim}[xleftmargin=\leftmargini,fontsize=\fontsize{9}{11}\selectfont]
+\begin{problem}[5]
+Answer this if you can!
+\begin{answers}{2}
+\bChoices
+ \Ans0\label{testsqFirst} This is a possible answer.\eAns
+ \Ans1\label{testsqSecond} Try this one (the correct one).\eAns
+ \Ans0 This is an answer.\eAns
+ \Ans0 Another alternative.\eAns
+\eChoices
+\end{answers}
+\begin{solution}
+We reference alternatives (\REF*{testsqFirst}), an incorrect answer,
+and (\REF{testsqSecond}), the correct answer.
+\end{solution}
+\end{problem}
+\end{Verbatim}
+\newtopic Notice that the gray letters was not turned to off
+until after the usage of \cs{REF}.
+
+\newtopic\textcolor{red}{\bfseries Important} The gray letters are typeset into the document. Do not
+use a background color for the checkboxes as this color will cover
+up the gray letters. The default background color checkboxes is
+transparent, keep it that way.
+
+\newtopic When typesetting an exam for paper (using the \texttt{forpaper}
+option), the gray letters appear as black letters. If you want actual gray
+letters, you have to use the \texttt{forcolorpaper} option. In this case,
+you'll see the blue color appearing in various places. Change these blue
+colors to black using the following commands in the preamble:
+\settowidth{\aebdimen}{\ttfamily\string\forceNoColor}
+\begin{dCmd}[commandchars=!()]{\aebdimen+2\fboxsep+2\fboxrule}
+\forceNoColor
+\end{dCmd}
+
+
+\subsection{Displaying Points between two Markers}
+
+Some instructors might like a subdivide the exam into segments (or parts) and to have a total for
+that segment of problems. The \textsf{eqexam} package offers three commands for that purpose.
+\settowidth{\aebdimen}{\ttfamily\string\calcFromMarkers[\meta{formatting}]\darg{\meta{name2}}\darg{\meta{name3}}}
+\begin{dCmd}[commandchars=!()]{\aebdimen+2\fboxsep+2\fboxrule}
+\placeMarkerHere{!meta(name)}
+\calcFromMarkers[!meta(formatting)]{!meta(name2)}{!meta(name3)}
+\markerTotalFmt{!meta(formatting)}
+\end{dCmd}
+Place \cs{placeMarkerHere} outside of a \texttt{problem}/\texttt{problem*} environment, giving each
+a unique name; for example \verb!\placeMarkerHere{bQForm}!. Place
+\cs{calcFromMarkers} wherever you wish a calculation to be displayed, for example,
+
+\begin{Verbatim}[xleftmargin=\leftmargini,fontsize=\fontsize{9}{11}\selectfont]
+\placeMarkerHere{bQForm}
+\begin{eqComments}[Quadratic Formula\calcFromMarkers{eQForm}{bForm}.]
+Solve each of the following equations using the quadratic formula.
+\end{eqComments}
+..
+\begin{problem}[5]
+...
+\end{problem}
+...
+% Finished with problems that use the quadratic formula,
+% now create another marker for the next set of questions.
+\placeMarkerHere{eQForm}
+...
+\end{Verbatim}
+After you {\LaTeX} three times (and the totals are all brought up to date),
+the header of the \textbf{eqComments} should read \textbf{Quadratic
+Formula (12 points)}, where the \textbf{12 points} are the total of all
+points assigned between the \texttt{bQForm} marker and the \texttt{eQForm}
+marker.
+
+The formatting for the total points between markers is determined by the optional first parameter
+of \cs{calcFromMarkers}, and if there is no optional first parameter, by a global command,
+\cs{markerTotalFmt}, which sets the default formatting. The default definition of
+\cs{markerTotalFmt} is
+\begin{Verbatim}[xleftmargin=\leftmargini]
+\markerTotalFmt{ (\themarkerCnt\space points)}
+\end{Verbatim}
+The command \cs{themarkerCnt} references the counter \texttt{markerCnt} in which the calculations are made.
+Any redefinition of \cs{markerTotalFmt} should use \cs{themarkerCnt} to reference to value.
+
+You use the optional first parameter the same way as the definition of \cs{marker\-Total\-Fmt}. You can say, for
+example, you can type
+\begin{Verbatim}[xleftmargin=\leftmargini]
+\calcFromMarkers[ $\themarkerCnt^{\text{pts}}$]{eQForm}{bForm}
+\end{Verbatim}
+to get a formatted total \verb*! $12^{\text{pts}}$!, which typesets to ` $12^{\text{pts}}$'.
+
+You might have noticed that I've inserted a space character at the beginning of the definition
+\verb*!\markerTotalFmt{ (\themarkerCnt\space points)}!, and place \cs{calc\-From\-Markers} up against
+the previous word, as in
+\begin{Verbatim}[xleftmargin=\leftmargini]
+Quadratic Formula\calcFromMarkers{eQForm}{bForm}.
+\end{Verbatim}
+This is so that when the required totals are not defined---early in the {\LaTeX}ing process---there
+is no space between \texttt{Formula} and the period (.); this is nothing but a cosmetic trivial point. After
+you {\LaTeX} enough times, the full expansion appears as,
+\begin{Verbatim}[xleftmargin=\leftmargini]
+Quadratic Formula (12 points).
+\end{Verbatim}
+
+
+\subsection{Extending the \texorpdfstring{\protect\cs{fillin}}{\CMD{fillin}} Command}\label{extendfillin}
+
+When the document author uses the \texttt{usexkv} option, and the
+\textsf{xkeyval} package is found on the document author's system,
+the \cs{fillin} command is redefined to use key-value pairs in the
+optional first argument. The syntax for \cs{fillin} now is,
+%\begin{Verbatim}[xleftmargin=\leftmargini,fontsize=\fontsize{9}{11}\selectfont]
+\begin{dCmd}[commandchars=!(),fontsize=\small]{\linewidth}
+\fillin[
+ underline=true|false,u,b,boxed=true|false,boxpretext=!anglemeta(text),
+ align=l|r|c,boxsize=!anglemeta(!upshape(\tiny|...|normalsize|large|...|Huge)),
+ color=!anglemeta(namedcolor),format=!anglemeta(!upshape\bfseries|\ttfamily|\Large|!meta(whatever)),
+ enclosesoln=!anglemeta(!upshape(true|false)),fitwidth=!anglemeta(!upshape(true|false))
+]{!meta(width)}{!meta(answer)}
+\end{dCmd}
+\textbf{Parameter Description.} \cs{fillin} takes three parameters.
+\begin{enumerate}
+\item The first optional parameter uses a key-value system, these allow the document author
+to set the appearance and behavior of the field. The keys are described below.
+
+\item The second parameter \meta{width} is the amount of horizontal
+space to leave for the student to write in the response. For example,
+\begin{Verbatim}[xleftmargin=\leftmargini]
+\fillin[boxed,boxsize=Large]{1.5in}{$2x - 3$}
+\end{Verbatim}
+Yields the following results, depending on the option.
+\begin{alignat*}{2}
+&\makebox[1.5in][c]{\text{\texttt{nosolutions} option}}&&\qquad
+\makebox[1.5in][c]{\text{\texttt{answerkey} option}}\\
+&\boxed{\text{\Large\strut}\makebox[1.5in]{\hfill}}&&\qquad
+\boxed{\text{\Large\strut}\makebox[1.5in]{$2x-3$}}
+\end{alignat*}
+If this parameter is left empty,
+the \textsf{eqexam} uses the \meta{answer} parameter to determine the width of the field.
+The code
+\begin{Verbatim}[xleftmargin=\leftmargini]
+\fillin[boxed,boxsize=Large]{}{$2x - 3$}
+\end{Verbatim}
+gives a box the same width as the answer, $2x-3$, which is not very wide
+in this case. On the test, (compiled with the \texttt{nosolutions} option)
+the student would see this box
+$\boxed{\text{\Large\strut}\text{\phantom{$2x-3$}}}$. Though we can typeset the
+answer into this box, it is too narrow for the student to write the answer
+into; a better strategy is as follows:
+\begin{Verbatim}[xleftmargin=\leftmargini,fontsize=\small]
+\fillin[boxed,boxsize=Large]{\ifNoSolutions{1.5in}{}}{$2x - 3$}
+\end{Verbatim}
+Now, when the file is compiled under different options, we obtain
+\begin{alignat*}{2}
+&\makebox[1.5in][c]{\text{\texttt{nosolutions} option}}&&\qquad
+\makebox[1.5in][c]{\text{\texttt{answerkey} option}}\\
+&\boxed{\text{\Large\strut}\makebox[1.5in]{\hfill}}&&\qquad
+\makebox[1.5in][c]{$\boxed{\text{\Large\strut}2x-3}$}
+\end{alignat*}
+For the answer key version, the answer is enclosed is tightly enclosed, a
+cosmetic difference. See also the \texttt{fitwidth} option.
+
+\item[] The command \verb!\ifNoSolutions{#1}{#2}! executes the first parameter if
+the compile option is \texttt{nosolutions}, otherwise it executes the second parameter.
+
+\item The third argument, \meta{answer}, is the correct answer; this correct answer
+appears when the document is compiled with the \texttt{answerkey} option.
+\end{enumerate}
+
+\newtopic\textbf{The description of the key-value pairs for \cs{fillin}:}
+\begin{description}
+ \item[\texttt{underline}:] A Boolean switch, which if \texttt{true}, the
+ fill-in region is underlined. The default is \texttt{false}, the region
+ is not underlined.
+ \item[\texttt{u,b}:] Legacy options. If \texttt{u} is chosen, the region is
+ underlined, if \texttt{b} is chosen, the region is not underlined. Use
+ of the \texttt{underline} key is recommended.
+ \item[\texttt{boxed}:] A Boolean switch, which if \texttt{true}, the
+ fill-in region is boxed in using the \cs{boxed} command of
+ \textsf{amsmath} package. The default is \texttt{false}, the region is
+ not boxed.
+ \item[\texttt{boxpretext}:] A key that takes \meta{text} as its value. This
+ value will be placed in front of the third argument, labeled
+ \meta{answer} above. The \meta{text} appears in the box even when
+ the \texttt{answerkey} is not in effect. This key is ignored if the
+ \texttt{boxed} option is not taken.
+
+ This option allows you to create an expression like
+\begin{equation*}
+ \boxed{ y =\hspace{1in}\text{\Large\strut}}\quad\text{and with \texttt{answerkey}}\quad
+ \boxed{ y = \rlap{$2x^2 + 1$}\hspace{1in}\text{\Large\strut}}
+\end{equation*}
+ \item[\texttt{boxsize}:] This is a choice key, the choices being \texttt{tiny}, \texttt{scriptsize}, \texttt{footnotesize}, \texttt{small}, \texttt{normalsize},
+ \texttt{large}, \texttt{Large}, \texttt{LARGE}, \texttt{huge} and \texttt{Huge}. the smaller sizes probably are not useful,
+ I give them to you for free. This key allows you to adjust the height of the box. This key is ignored if the
+ \texttt{boxed} key does not appear in the option list. For example,
+\begin{flushleft}
+\hskip\leftmargini\begin{tabular}{@{}cc}
+ \makebox[1.2in][c]{\texttt{boxsize=Large}}&\makebox[1.2in][c]{\texttt{boxsize=Huge}}\\
+ \multicolumn{1}{@{}p{1.2in}}{\kern0pt\centering\fbox{\hspace{1in}\Large\strut}}&
+ \multicolumn{1}{p{1.2in}}{\kern0pt\centering\fbox{\hspace{1in}\Huge\strut}}
+\end{tabular}
+\end{flushleft}
+ Choice of size depends on the height of the anticipated response of
+ the student. The default is \texttt{normalsize}.
+
+ \item[\texttt{enclosesoln}:] This Boolean key only takes effect when the
+ \texttt{boxed} key is used, and when either the \texttt{nosolutions} or the
+ \texttt{vspacewithsolns} option is taken. When these conditions are
+ met, a box is created around the solution (the third parameter of \cs{fillin}); the solution
+ is enclosed in a \cs{phantom} so it is not seen, but the dimensions of the solution are used.
+ This key allows you to create a box or arbitrary dimension.
+
+A simple example would be
+\begin{Verbatim}[xleftmargin=\leftmargini,fontsize=\small]
+\fillin[boxed,enclosesoln,parbox={[t][1in]}]{2.4in}{%
+ The box is 2.4 inch wide and 1 inch high. The solution to
+ this problem appears when \texttt{answerkey} is in effect.
+}
+\end{Verbatim}
+Below shows how this command appears under different options.
+\begin{equation*}\def\fb#1{#1-2\fboxrule-2\fboxsep}
+\boxed{\phantom{\parbox[b][\fb{1in}][t]{\fb{2.4in}}{%
+ The box is 2.4 inch wide and 1 inch high. The solution to
+ this problem appears when the answerkey is in effect}
+}}\quad\boxed{\parbox[b][\fb{1in}][t]{\fb{2.4in}}{%
+ The box is 2.4 inch wide and 1 inch high. The solution to
+ this problem appears when \texttt{answerkey} is in effect.
+}}
+\end{equation*}
+The box on the left is appears when the \texttt{nosolutions} or
+\texttt{vspacewithsolns} is in effect. The one on the right appears when
+the \texttt{answerkey} option is taken. Note the size of the two boxes are
+the same.
+
+\textbf{Note:} The explanation of the \texttt{parbox} option used in this
+example appears below.
+
+\item[\texttt{fitwidth}] This key is an implementation of the
+ \cs{ifNoSolutions} strategy discussed earlier. If \texttt{fitwidth} is
+ specified and the \texttt{nosolutions} option (an \textsf{eqexam}
+ option) is in effect, the width of the fill-in region is taken from
+ the second parameter; however, if the \texttt{answerkey} option is
+ specified, the natural with of the answer (the third parameter) is
+ used.
+
+ \item[\texttt{align}:] A key that takes one of three values, \texttt{l},
+ \texttt{\texttt{r}}, and \texttt{c}. This key aligns the text within
+ the fill-in field (when the \texttt{answerkey} option is taken):
+ \texttt{l} (left-aligned), \texttt{c} (center, the default), \texttt{r}
+ (right-aligned). This parameter affects the position of the
+ \meta{answer}, and does not affect the position of the
+ \meta{text}, which is aligned left, of the \texttt{boxpretext} key.
+ The alignment becomes visible when the \texttt{answerkey} option is in
+ effect.
+
+ \item[\texttt{hiddenbox}:] When the \texttt{boxed} option is used,
+ \textsf{eqexam} uses an \cs{fbox} to enclose the content.
+ The \texttt{hiddenbox} is used with the \texttt{boxed} option and it
+ resets the lengths of \cs{fboxrule} and \cs{fboxsep} to
+ \texttt{0pt}. In this way, some of the features
+ (\texttt{enclosesoln} and \texttt{boxpretext}, for example) that
+ apply to boxed content can be used without the surrounding boundary
+ rule. See \texttt{parbox} for an example.
+
+ \item[\texttt{parbox}:] When this option is taken, \textsf{eqexam}
+ encloses the third argument (the answer) in a \cs{parbox}. The value
+ of the \texttt{parbox} option is the first three parameters of a
+ \cs{parbox}; for example \verb!parbox={[t][.5in][c]}! causes \cs{fillin}
+ to enclose the content in a \cs{parbox} with a height of \texttt{.5in}. The width
+ of the \cs{parbox} is taken to be the second parameter of
+ \cs{fillin} macro. The third parameter of \cs{fillin} becomes
+ \cs{parbox[t][.5in][c]\darg{\meta{width}}\darg{\meta{answer}}}.
+ The value of the \texttt{parbox} key needs to be
+ enclosed in braces, as just illustrated.
+
+Here is an example of the use of this key-value pair:
+\begin{Verbatim}[xleftmargin=\leftmargini,fontsize=\small]
+\fillin[parbox={[t][.5in]},boxed,hiddenbox,
+ boxpretext={\textbf{\textcolor{black}{Conclusion: }}},
+ format=\normalfont,enclosesoln]{\linewidth}{%
+ There is sufficient evidence at the $\alpha=0.05$ level to
+ conclude that the mean microwave repair cost is less than
+ \$100.}
+\end{Verbatim}
+If you say \cs{fillin[parbox,boxed,\meta{options}]\darg{\meta{width}}\darg{\meta{answer}}} (\texttt{parbox} with the
+empty argument), translates into \cs{parbox\darg{\meta{text}}}, the height of the box is the
+natural height of the content.
+
+Note the presence of the \texttt{hiddenbox} key, in this case, no rule
+or additional spacing appears around the box.
+
+ This typesets, when \texttt{answerkey} option is used as
+
+ \parbox[t][.5in]{\linewidth}{\textbf{\textcolor{black}{Conclusion: }}
+ There is sufficient evidence at the $\alpha=0.05$ level to
+ conclude that the mean microwave repair cost is less than
+ \$100.}
+
+ When \texttt{answerkey} is not used, the following is seen (by the student at test time):
+
+ \parbox[t][.5in]{\linewidth}{\textbf{\textcolor{black}{Conclusion: }}}
+
+ The same vertical space is used in both cases because of the \texttt{enclosesoln}
+ option taken in this example.
+
+ If the \texttt{hiddenbox} key is removed, a proper boxed region appears,
+
+ $\def\FB#1{#1-2\fboxrule-2\fboxsep}
+ \boxed{\parbox[t][\FB{.5in}]{\FB{\linewidth}}{\textbf{\textcolor{black}{Conclusion: }}
+ There is sufficient evidence at the $\alpha=0.05$ level to
+ conclude that the mean microwave repair cost is less than
+ \$100.}}$
+
+ Similarly, when \texttt{answerkey} is not used, the following is seen,
+
+ $\def\FB#1{#1-2\fboxrule-2\fboxsep}
+ \boxed{\parbox[t][\FB{.5in}]{\FB{\linewidth}}{%
+ \textbf{\textcolor{black}{Conclusion: }}\hfill\vfill}}$
+
+
+ \item[\texttt{color}:] The value of this key is a named color. The
+ \meta{answer} appears in this color, when \texttt{answerkey} option is
+ in effect. The default is red.
+
+ \item[\texttt{format}:] A general purpose formatting key. The value of the key can be most anything:
+ \cs{bfseries} (to change font series), \cs{ttfamily} (to change font family), \cs{Large} (to change size of
+ the \meta{answer} and \meta{text} (the value of \texttt{boxpretext}). Several formatting commands can appear
+ as the value; thus, \verb!format={\bfseries\Large}! makes the answer, when \texttt{answerkey} is in effect, appear in large bold font.
+ The default is \verb!format={\fillInFormatDefault}!, where the definition of the command \cs{fillInFormatDefault} is
+\begin{Verbatim}[xleftmargin=\leftmargini]
+\newcommand{\fillInFormatDefault}{\bfseries}
+\end{Verbatim}
+\end{description}
+The next three keys apply when a \texttt{boxed} option is not taken, that is, they
+apply to the case of \texttt{u} (\texttt{underlined}) or \texttt{b} (blank). The keys were designed
+for the \texttt{underline} option, however.
+\begin{description}
+\item[\texttt{lift}:] The syntax is \texttt{lift=length} This key lowers the underline without changing the baseline reference
+point of the content. For example, \texttt{lift=10pt} lowers the underlining by \texttt{10pt}.
+\begin{equation*}
+\frac{1}{2}+\frac{1}{3} = \underbar{\makebox[1in]{\ensuremath{\displaystyle\frac{3}{4}}}}
+\qquad
+\frac{1}{2}+\frac{1}{3} = \raisebox{-10pt}{\underbar{\raisebox{10pt}{\makebox[1in]{\ensuremath{\displaystyle\frac{3}{4}}}}}}
+\end{equation*}
+The expression on the right corresponds to
+\begin{Verbatim}[xleftmargin=\leftmargini]
+$...\fillin[lift=10pt]{1in}{\frac{3}{4}}...$
+\end{Verbatim}
+The underline is lowered to include the baseline of the denominator of the fraction.
+
+\item[\texttt{autolift}:] The \texttt{autolift} key takes the guesswork
+ out of the \texttt{lift}. When \texttt{autolift} is used, the depth of
+ the content of the answer field. For example, with the \texttt{autolift} key,
+ \verb!\fillin[autolift]{1in}{\frac{3}{4}}! yields
+ {\setbox0=\hbox{$\displaystyle\frac{3}{4}$}
+ \raisebox{-\dp0}{\underbar{\raisebox{\dp0}{\makebox[1in]{\ensuremath{\displaystyle\frac{3}{4}}}}}}}.
+ Now the fraction is exactly underlined.
+
+\item[\texttt{addtoautolift}:] The \texttt{addtoautolift} key is a companion to \texttt{autolift}.
+ If we assign \texttt{addtoautolift=3pt}, \texttt{3pt} additional lift is added
+ to the amount of lift determined by \texttt{autolift}. For example,
+\begin{small}%
+\begin{equation*}
+\setbox0=\hbox{$\displaystyle\frac{3}{4}$}
+\dimen0=\dp0 \advance\dimen0by3pt
+ \verb!\fillin[autolift,addtoautolift=3pt]{.5in}{\frac{3}{4}}!\ \text{yields}\
+ \raisebox{-\dimen0}{\underbar{\raisebox{\dimen0}{\makebox[.5in]{\ensuremath{\displaystyle\frac{3}{4}}}}}}
+\end{equation*}
+\end{small}%
+the number three-fourths is underlined plus \texttt{3pt} more.
+\end{description}
+The keys are processed by an \cs{edef}, this allows you to define a
+command with your favorite options; for example, you can define
+\begin{Verbatim}[xleftmargin=\leftmargini]
+\newcommand{\myBoxOpts}{boxed,boxsize=Large,align=l}
+\end{Verbatim}
+then in the exam, type
+\begin{Verbatim}[xleftmargin=\leftmargini]
+$\frac{\sqrt{-18}}{\sqrt{6}}=\fillin[\myBoxOpts]{1.5in}{3\imath}$
+\end{Verbatim}
+
+% dps Need to revise this section, I've changed how \fillin works.
+
+\paragraph*{\cs{fillin} boxed.} When the \texttt{boxed} key is used,
+the \cs{boxed} command of \texttt{amsmath} is used; This command needs to
+be in math mode. If the \texttt{boxed} key is used and the \cs{fillin}
+command is in math mode, then \cs{fillin} puts the \meta{answer} and
+\texttt{boxpretext} in math mode too; if \cs{fillin} command \emph{not in
+math mode} (i.e., it is in text mode), \cs{fillin} typesets the
+\meta{answer} and \texttt{boxpretext} in text mode. For example,
+\begin{Verbatim}[xleftmargin=\leftmargini]
+Let $ x = 4 $ and $ y = -3 $ and let $ z = 2x - 4y $ then
+ $\fillin[boxed,align=l,boxpretext={z=}]{1in}{20}$
+\end{Verbatim}
+When \texttt{answerkey} is used, the above question appears as
+\begin{quote}
+Let $ x = 4 $ and $ y = -3 $ and let $ z = 2x - 4y $ then
+ \fbox{\makebox[1in][l]{$ z=20 $ }}
+\end{quote}
+Here is an example in text mode
+\begin{Verbatim}[xleftmargin=\leftmargini]
+The first president of the US is
+ \fillin[boxed,align=c]{1.5in}{Washington}
+\end{Verbatim}
+When \texttt{answerkey} is used, the above question appears as
+\begin{quote}
+The first president of the US is
+ \fbox{\makebox[1.5in][c]{Washington}}
+\end{quote}
+Here is an example of mixed mode
+\begin{Verbatim}[xleftmargin=\leftmargini]
+The width of a rectangle is 20 feet and length is 15 feet.
+Find the area: $\fillin[boxed,align=l,
+ boxpretext={\text{Area: }}]{1in}{300\,\text{feet}}$
+\end{Verbatim}
+The answer is typeset in math mode, but the value of \texttt{boxpretext}
+needs to be typeset in text mode. When \texttt{answerkey} is used, the
+above question appears as
+\begin{quote}
+The width of a rectangle is 20 feet and length is 15 feet.
+Find the area: \fbox{\makebox[1in][l]{Area: $300\,\text{feet}$}}
+\end{quote}
+
+\paragraph*{\cs{fillin} not boxed.} The \cs{fillin} command will typeset
+the answer in math mode if \cs{fillin} is in math mode, and in text mode,
+otherwise. For example, each of the following typesets the same.
+\begin{Verbatim}[xleftmargin=\leftmargini]
+The area of a circle of radius $2$ is \fillin[u]{.5in}{$4\pi$}
+The area of a circle of radius $2$ is $\fillin[u]{.5in}{4\pi}$
+\end{Verbatim}
+
+\subsection{Vertical Space Fill Types}
+
+When the \texttt{nosolutions} or the \texttt{vspacewithsolns} is used, a
+vertical space is generated by the \texttt{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.
+
+%\redpoint The demo file for these features is \texttt{hw03.tex}.
+
+\exAeBBlogPDF{p=1222} The demo file for this feature is named
+\texttt{\href{\urlAcroTeXBlog/?p=1222}{hw03.pdf}}
+
+
+\newtopic There are two sets of commands.
+\settowidth{\aebdimen}{\ttfamily\string\useFillerDefault}
+\begin{dCmd}[commandchars=!()]{\aebdimen+2\fboxsep+2\fboxrule}
+\useFillerLines
+\useFillerDefault
+\end{dCmd}
+\noindent The first command sets the code to draw rule lines in the
+vertical white space, the second command reverts back to the default,
+plain vertical white space.
+
+\newtopic The next set of commands determine the type of line to be drawn
+in the white space.
+\settowidth{\aebdimen}{\ttfamily\string\fillTypeDashLine}
+\begin{dCmd}[commandchars=!()]{\aebdimen+2\fboxsep+2\fboxrule}
+\fillTypeHRule
+\fillTypeDashLine
+\fillTypeDots
+\fillTypeDefault
+\end{dCmd}
+\noindent The rule types are in the order listed: draw solid horizontal lines; draw
+dashed lines; draw dotted lines; draw the default line type (\cs{fillTypeHRule)}.
+
+\newtopic These two command determine color of the lines, and the spacing between lines.
+\settowidth{\aebdimen}{\ttfamily\string\eqWriteLineColor\darg{\meta{named\_color}}}
+\begin{dCmd}[commandchars=!()]{\aebdimen+2\fboxsep+2\fboxrule}
+\eqWriteLineColor{!meta(named_color)}
+\eqWLSpacing{!meta(length)}
+\end{dCmd}
+\noindent The default color is \texttt{gray} and the default vertical
+spacing between lines is
+\texttt{14pt}.
+
+\subsection{Keep vertical space with \texttt{answerkey}}
+
+One thing that has bothered me in my efforts to create the ``perfect''
+exam package, is the differences in vertical spacing between the exam the
+student sees (which is compiled with the \texttt{nosolutions} option), and
+the solutions document the instructor sees (as compiled with the
+\texttt{answerkey} option). The differences in vertical space of the two
+documents makes it harder for the eye to move from the student's exam to
+the answer key document and back again. In the past, I've used
+\cs{aNewPage} or \cs{qNewPage} to force page breaks so that the page
+breaks of the two document match, this makes it easier to get one page at
+a time.
+
+
+Below is a simple example to illustrate the above points. In the example below,
+we simulate
+\begin{Verbatim}[xleftmargin=\leftmargini]
+\begin{solution}[1in]
+$ x+1 = 4 \implies x = 3 $
+\end{solution}
+\end{Verbatim}
+\begin{flushleft}
+\setlength{\fboxsep}{0pt}
+\begin{tabular}{@{\hskip\leftmargini}cc}
+\texttt{nosolutions} & \texttt{answerkey}\\
+\fbox{\parbox[t][1in]{.4\linewidth}{\strut\kern0pt\vfill\hfill}}&
+\fbox{\parbox[t]{.4\linewidth}{\strut\textit{Solution:} $ x+1 = 4 \implies x = 3 $}}\\
+\end{tabular}
+\end{flushleft}
+We have put an \cs{fbox} around the vertical space so you can see the
+bottom of the vertical space, and better appreciate the point I am trying
+to make. When \texttt{nosolutions} is in effect, a vertical space of 1
+inch is created; when the \texttt{answerkey} is used, the vertical spacing
+is ignored, and the solution is typeset, as shown above. Notice the
+difference in the vertical spacing between the two.
+
+The \textsf{eqexam} package now attempts to build the solution environment
+so the vertical spacing is (roughly) the same.
+\settowidth{\aebdimen}{\ttfamily\string\vspacewithkeyOff}
+\begin{dCmd}[commandchars=!()]{\aebdimen+2\fboxsep+2\fboxrule}
+\vspacewithkeyOn
+\vspacewithkeyOff
+\end{dCmd}
+\noindent The first command turns on this new feature---the feature of trying to
+place the vertical spacing in the \texttt{answerkey} mode as requested by
+the optional argument of the \texttt{solution} environment. The second
+one, \cs{vspacewithkeyOff} (the default) turns off this new feature, and
+reverts to the old behavior of \textsf{eqexam}.
+
+Here is a representation of the effects of the command \cs{vspacewithkeyOn}.
+
+\begin{Verbatim}[xleftmargin=\leftmargini]
+\begin{solution}[1in]
+$ x+1 = 4 \implies x = 3 $
+\end{solution}
+\end{Verbatim}
+\begin{flushleft}
+\setlength{\fboxsep}{0pt}
+\begin{tabular}{@{\hskip\leftmargini}cc}
+\texttt{nosolutions} & \texttt{answerkey}\\
+\fbox{\parbox[t][1in]{.4\linewidth}{\strut\kern0pt\vfill\hfill}}&
+\fbox{\parbox[t][1in]{.4\linewidth}{\strut\textit{Solution:} $ x+1 = 4 \implies x = 3 $\hfill\vfill}}\\
+\end{tabular}
+\end{flushleft}
+As you can see, the vertical spacing with solutions is the same as
+without, the page breaks should be the same, and the positioning of the problems should be
+(roughly) the same throughout the test.
+
+\newtopic The commands \cs{vspacewithkeyOn} and \cs{vspacewithkeyOff} may
+be used anywhere (between problems or parts), but normally, one would put
+\cs{vspacewithkeyOn} in the preamble.
+
+\subsection{Annotating a Continuing Problem with Parts}
+
+% http://www.acrotex.net/blog/?p=698
+% Annotating a Continuing Problem with Parts, and Page totals
+The demonstration file for this feature is
+\begin{equation*}
+\textsl{\textsl{\ulSetLink{http://www.acrotex.net/blog/?p=698}{Annotating a
+Continuing Problem with Parts, and Page totals}}}
+\end{equation*}
+found at the \textbf{\ulSetLink{http://www.acrotex.net/blog}{Acro\TeX{} Blog}}
+
+\newtopic A situation often encountered is when a problem with parts crosses a page
+boundary; the problem continues on the next page without any annotation.
+This feature works to insert a text string at the top of the next page, a
+string that gives the reader (student) the context of the part.
+
+\medskip\noindent
+\begin{minipage}{\linewidth}
+\begin{minipage}[t]{.5\linewidth-5pt}
+\emph{(Page 2)}\\
+\textbf{4.} Solve each of the following.
+\begin{enumerate}
+\item[(a)] Solve this
+\item[(b)] Solve this
+\end{enumerate}
+\end{minipage}\hfil\vrule\hfill
+\begin{minipage}[t]{.5\linewidth-10pt}
+\emph{(Page 3)}\\
+\textbf{Problem~4 continued.}
+\begin{enumerate}
+\item[(c)] Solve this
+\item[(d)] Solve this
+\end{enumerate}
+\end{minipage}
+\end{minipage}
+\newtopic Above is an illustration of how this feature works.
+
+%the default string is \textbf{Problem \texttt{<num>} continued.}
+
+\settowidth{\aebdimen}{\ttfamily\string\turnContAnnotOff}
+\begin{dCmd}[commandchars=!()]{\aebdimen+2\fboxsep+2\fboxrule}
+\turnContAnnotOff
+\turnContAnnotOn
+\end{dCmd}
+\noindent The feature may be turned off and on using the above two commands. These
+commands are usually in the preamble, but they can appear between problems
+or between \texttt{exam} environments.
+
+\newtopic The annotatation text that appears is determined by the definition of
+\cs{annotContStr}.
+\begingroup\obeyspaces%
+\settowidth{\aebdimen}{\ttfamily \string\textbf\darg{Problem\string~\string\eqeCurrProb\string\space continued.}\}}%
+\begin{dCmd}[commandchars=!()]{\aebdimen+2\fboxsep+2\fboxrule}
+\newcommand{\annotContStr}{%
+ \textbf{Problem~\eqeCurrProb\space continued.}}
+\end{dCmd}
+\endgroup\noindent where \cs{eqeCurrProb} is the current problem number.
+\cs{annotContStr} may be redefined, but be sure to include the problem
+number \cs{eqeCurrProb}.
+
+The insertion of the continuation annotation uses \cs{promoteNewPage}, see
+Section~\ref{aqpNewPage} on page~\pageref{aqpNewPage} for a description of
+\cs{promoteNewPage}.
+
+\settowidth{\aebdimen}{\ttfamily\string\newcommand\darg{\string\ic@vspacedefault}\darg{1in}}
+\begin{dCmd}[commandchars=!()]{\aebdimen+2\fboxsep+2\fboxrule}
+\acvspace{!meta(vspace)}
+\resetacvspace
+\newcommand{\ic@vspacedefault}{1in}
+\end{dCmd}
+\noindent The above three lines describes some commands for controlling the generation of a new page
+through the use of \cs{promoteNewPage}. The first one \cs{acvspace} is used to set the option
+parameter of \cs{promoteNewPage}. The default value for promoting a new page is \texttt{.25in}, as
+defined by \cs{ic@vspacedefault}, which can be redefined. The command \cs{resetacvspace} resets
+the optional argument of \cs{promoteNewPage} back to its default. All definitions are local, so the revert to
+their original values when a group is exited.
+
+
+\subsection{The Exam Record}\label{examrecord}
+
+% http://www.acrotex.net/blog/?p=703
+% The Exam Record on the Cover Page
+
+The demonstration file for this feature is
+\begin{equation*}
+\textsl{\textsl{\ulSetLink{http://www.acrotex.net/blog/?p=703}{The Exam Record on the Cover Page}}}
+\end{equation*}
+found at the \textbf{\ulSetLink{http://www.acrotex.net/blog}{Acro\TeX{} Blog}}
+
+
+\newtopic When choose the \texttt{coverpage} option and the \texttt{coverpagesumry} option is set to either
+\texttt{byparts} or \texttt{bypages}, you get an \textbf{Exam Record} appearing on the cover page.
+See Figure~\ref{fig:ExamRecord}, page~\pageref{fig:ExamRecord}.
+
+There are several commands that can be used to customize the layout of the \textbf{Exam Record}
+\begin{Verbatim}[xleftmargin=\leftmargini,numbers=left]
+\eqeSumryHoriz
+\eqeSumryVert
+\end{Verbatim}
+These two commands arrange the \textbf{Exam Record}
+relative to the student/instructor information. The former is a horizontal
+arrangement, the latter is a vertical arrangement, \cs{eqeSumryVert} is the default.
+
+\newtopic Below are several text commands for customizing the text in the \textbf{Exam Record}
+box:
+\begin{Verbatim}[xleftmargin=\leftmargini,numbers=left]
+\newcommand{\cpSumryHeader}{\textbf{Exam Record}}
+\newcommand{\cpSumryPts}{\,\text{pts}}
+\newcommand{\cpSumryPage}{Page}
+\newcommand{\cpSumryTotal}{Total:}
+\newcommand{\cpSumryGrade}{Grade:}
+\cpSetSumryWidth{.5\linewidth}
+\end{Verbatim}
+The meanings of numbers~(1)--(5) are apparent from Figure~\ref{fig:ExamRecord}, page~\pageref{fig:ExamRecord},
+where these strings are on display. Number~(6) determines the width of the \textbf{Exam Record}, its default
+is half the \cs{linewidth}.
+
+\newtopic The \textbf{Exam Record} by default is enclosed in an \cs{fbox}, use the command
+\cs{cpNofbox} in the preamble to remove this enclosing box.
+
+\newtopic\textbf{Naming conventions for \texttt{byparts}.} When
+\texttt{coverpagesumry=byparts}, there are several naming options
+available. The default name of each part is the exam name (the required
+argument of the \texttt{exam} environment. By specifying
+\cs{useUIPartNames} in the preamble, the user friendly name is used (the
+one that appears as the optional first argument of the \texttt{exam}
+environment. The user friendly names are used when the solutions are
+listed in the back of the document (for example, when the option
+\texttt{vspacewithsolns} is specified). These user-friendly names may be too wide
+to put in the \textbf{Exam Record}, in this case, you can executed
+\cs{useCustomPartNames} in the preamble. This allows you to define your own names
+that are to appear in the \textbf{Exam Record}. To define your custom names, use
+the \cs{customNaming} command:
+\begin{Verbatim}[xleftmargin=\leftmargini,commandchars=+\(\)]
+\customNaming{+meta(name)}{+meta(text)}
+\end{Verbatim}
+where, \meta{name} is the name of the exam, and \meta{text} is the text to appear
+in the \textbf{Exam Record}. For example, the following definitions might be made
+for a two part final exam, the first part the instructor is free to pose questions,
+the second part are Department supplied questions.
+\begin{Verbatim}[xleftmargin=\leftmargini]
+\customNaming{Part1}{Instr Qs:}
+\customNaming{Part2}{Dept Qs:}
+\end{Verbatim}
+
+\subsection{Calculate problem range between two markers}
+
+I have defined the command In response to a user who wanted more
+information about problem ranges between two marks, the command
+\cs{calcQsBtwnMarkers} is the proposed solution. The syntax is\dots
+\begin{Verbatim}[xleftmargin=\leftmargini,commandchars=+\(\)]
+\calcQsBtwnMarkers[+meta(Mrk2)]{+meta(Mrk1)}
+\end{Verbatim}
+The required parameter (\meta{Mrk1}) is called the \emph{primary mark}.
+The command defines a number of other commands based on the primary
+mark name. \cs{calcQsBtwnMarkers} calculates the first and
+last problem numbers of the questions between the command
+\cs{calcQsBtwnMarkers} that has \meta{Mrk1} as its \emph{primary marker} and
+another command \cs{calcQsBtwnMarkers} that has \meta{Mrk2} as its \emph{primary
+marker}. The names of the commands produced are all based in the primary
+marker name \meta{Mrk1}.
+
+\newtopic As mentioned above, there are several other commands
+\cs{calcQsBtwnMarkers} defines.
+\cs{calcQsBtwnMarkers[\meta{Mrk2}]}\verb!{!\meta{Mrk1}\verb!}! defines the
+following commands:
+\begin{itemize}
+
+\item \cs{\meta{Mrk1}Start} is the first question number that follows the placement
+of the command \cs{calcQsBtwnMarkers} with \meta{Mrk1} as its primary marker.
+
+\item \cs{\meta{Mrk1}End} is the last question number between two
+\cs{calcQsBtwnMarkers} commands having \meta{Mrk1} and \meta{Mrk2} as their
+primary marks.
+
+\item \cs{\meta{Mrk1}nQs} is the number of questions appearing
+between \cs{calcQsBtwnMarkers} commands having primary marks of
+\meta{Mrk1} and \meta{Mrk2}.
+\end{itemize}
+Three other commands are defined for easy user access.
+\begin{itemize}
+\item \cs{markStartFor}\verb!{!\meta{Mrk1}\verb!}! expands to \cs{\meta{Mrk1}Start}.
+\item \cs{markEndFor}\verb!{!\meta{Mrk1}\verb!}! expands to \cs{\meta{Mrk1}End}.
+\item \cs{markNumQsFor}\verb!{!\meta{Mrk1}\verb!}! expands to \cs{\meta{Mrk1}nQs}.
+\end{itemize}
+Use the command \cs{calcQsBtwnMarkers} without the optional first argument as the last mark
+in your \texttt{exam} environment.
+
+%\handpoint The demo file for this feature is named \texttt{markqs.tex}.
+
+\exAeBBlogPDF{p=1231} The demo file for this feature is named
+\texttt{\href{\urlAcroTeXBlog/?p=1231}{markqs.pdf}}
+
+\newpage
+\markright{References}
+
+\begin{thebibliography}{[1]}\label{references}
+\addcontentsline{toc}{section}{\protect\numberline{}References}
+\backrefparscanfalse
+\def\srtln{\vskip-\baselineskip\vskip-\parsep}
+\def\lngln{\vskip-\parsep}
+
+\bibitem{book:AEBB}
+ D. P. Story, \textsl{\AEBBook}, in preparation. \backrefprint
+
+\end{thebibliography}
+
+
+\end{document}
diff --git a/texmf-dist/source/latex/eqexam/doc/fortextbook.zip b/texmf-dist/source/latex/eqexam/doc/fortextbook.zip
new file mode 100644
index 00000000..e3210cfd
--- /dev/null
+++ b/texmf-dist/source/latex/eqexam/doc/fortextbook.zip
Binary files differ
diff --git a/texmf-dist/source/latex/eqexam/doc/fortextbook/fortextbook.pdf b/texmf-dist/source/latex/eqexam/doc/fortextbook/fortextbook.pdf
new file mode 100644
index 00000000..4619dc88
--- /dev/null
+++ b/texmf-dist/source/latex/eqexam/doc/fortextbook/fortextbook.pdf
Binary files differ
diff --git a/texmf-dist/source/latex/eqexam/eqexam.dtx b/texmf-dist/source/latex/eqexam/eqexam.dtx
new file mode 100644
index 00000000..951c5f74
--- /dev/null
+++ b/texmf-dist/source/latex/eqexam/eqexam.dtx
@@ -0,0 +1,8258 @@
+% \iffalse
+% makeindex -s gglo.ist -o eqexam.gls eqexam.glo
+% makeindex -s gind.ist -o eqexam.ind eqexam.idx
+%<*copyright>
+%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
+%% eqexam.sty package, %%
+%% Copyright (C) 2005--2017 D. P. Story %%
+%% dpstory@uakron.edu %%
+%% %%
+%% This program can redistributed and/or modified under %%
+%% the terms of the LaTeX Project Public License 1.2 %%
+%% Distributed from CTAN archives in directory %%
+%% macros/latex/base/lppl.txt; either version 1 of the %%
+%% License, or (at your option) any later version. %%
+%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
+%</copyright>
+%<package>\NeedsTeXFormat{LaTeX2e}
+%<package>\ProvidesPackage{eqexam}
+%<package> [2017/03/16 v4.9 An Exam Construction Package (dps)]
+%<package>\def\eqexamdefReq{2017/03/16}
+%<*driver>
+\documentclass{ltxdoc}
+\GlossaryPrologue{\section{{Change History}}}%
+\IndexPrologue{\section{{Index}}}%
+\value{IndexColumns}=2
+\value{GlossaryColumns}=2
+\usepackage{makeidx}
+\usepackage[colorlinks,hyperindex]{hyperref}
+%\pdfstringdefDisableCommands{\let\\\textbackslash}%
+\EnableCrossrefs
+\CodelineIndex
+\RecordChanges
+\InputIfFileExists{aebdocfmt.def}{\PackageInfo{eqexam}{Inputting aebdocfmt.def}}
+ {\def\IndexOpt{\DescribeMacro}\let\setupFullwidth\relax
+ \PackageInfo{eqexam}{aebdocfmt.def cannot be found}}
+\begin{document}
+ \let\pkg\textsf
+ \def\switchCats{\catcode`\{=12\relax\catcode`\}=12\relax
+ \catcode`\(=1\relax\catcode`\)=2\relax}
+ \GetFileInfo{eqexam.sty}
+ \title{\textsf{eqexam}: An Exam Construction Package}
+ \author{D. P. Story\\
+ Email: \texttt{dpstory@uakron.edu}}
+ \date{Processed \today}
+ \maketitle
+ \tableofcontents
+ \let\Email\texttt
+ \DocInput{eqexam.dtx}
+\IfFileExists{\jobname.ind}{\newpage\setupFullwidth\PrintIndex}{\paragraph*{Index} The index goes here.\\Execute
+ \texttt{makeindex -s gind.ist -o eqexam.ind eqexam.idx} on the command line and recompile
+ \texttt{eqexam.dtx}.}
+\IfFileExists{\jobname.gls}{\PrintChanges}{\paragraph*{Change History} The list of changes goes here.\\Execute
+ \texttt{makeindex -s gglo.ist -o eqexam.gls eqexam.glo} on the command line and recompile
+ \texttt{eqexam.dtx}.}
+\end{document}
+%</driver>
+% \fi
+%
+% \StopEventually{}
+%
+% \InputIfFileExists{aebDoNotIndex.def}{\PackageInfo{eqexam}{Inputting aebDoNotIndex.def}}
+% {\PackageInfo{eqexam}{aebDoNotIndex.def cannot be found}}
+%
+% \section{Introduction}
+%
+% This package is my attempt at writing a set of macros for creating exams.
+% The package can be used with or without \textsf{web} or \textsf{exerquiz}.
+% When used without, what is produced is a document suitable for printing.
+% When \textsf{exerquiz} is used, the same document is produced, but with
+% hypertext links to solutions. This may be useful for publishing solutions
+% on the web, or publishing pretests with/without solutions.
+%
+% The package must be as flexible as possible vis-\`a-vis PDF. (1)
+% \textsf{web} only does not add much, it does input hyperrref and test info
+% such as \cs{title}, \cs{subject}, etc are placed in the Document Info
+% fields of the PDF. (2) If \textsf{exerquiz} is also input (prior to
+% \textsf{eqexam}), then hyperlinks will be created to the solutions to the
+% test, if solutions are included at the end of the document. (3) If
+% \textsf{web} and \textsf{exerquiz} are input, and the \texttt{online}
+% option is taken, then the checkboxes will be come interactive, the space
+% left to work the problems will be multi-line text boxes, fill-ins limited
+% to True/False and simple text fill-in the blank will also become text
+% boxes.
+%
+% When in \texttt{online} mode, the student can take the test in a computer
+% lab, the completed exam can be printed and handed in, or perhaps submitted
+% server-side script.
+%
+% \medskip\noindent (2011/05/13) The version of \textsf{eqexam} is a
+% departure from previous versions. Previously, the list of problems were
+% not in list, they were left-justified, with the problem number extending
+% out into a little area determined by \cs{oddsidemargin}. This makes it
+% hard to reformat a list of problems to fit into a custom book format.
+% This new version defines a new environment, \texttt{eqequestions}, that
+% makes each problem into a list. The list environment allows for an easy
+% redesign of the formatting of the problems. The purpose of this new
+% scheme, is to open up \textsf{eqexam} as a format package that can be used
+% by author for writing a textbook.
+%
+% The \texttt{fortextbook} option supplies support for authors writing a
+% textbook. The \texttt{exam} environment is re-cast into the
+% \texttt{probset} environment, it can be used to write problem sets within
+% the text. there is a version for the instructor and the student. The
+% instructors version writes answers to the problem sets to the margins (or
+% inline). Two solutions are offered, short and long. The short solutions
+% appear in the back of the book (odd-numbered ones for the student edition.
+% The long solutions are used to build the stand-alone solutions manuals for
+% both the student and the instructor. More details are found in
+% \Nameref{fortextbook}, see also \Nameref{fortextbookstyle}.
+%
+% \newpage
+% \section{Package options and Process Options}
+% Let us catalog the options of this package.
+%
+% \subsection{Early inclusion of packages}
+% We include these packages early in the process of loading.
+% \begin{macrocode}
+%<*package>
+% \end{macrocode}
+%\changes{v3.1b}{2012/06/18}{New requirement \textsf{ifpdf}}
+% \begin{macrocode}
+\RequirePackage{ifpdf}[2006/02/20]
+\RequirePackage{ifxetex}[2006/08/21]
+% \end{macrocode}
+% Very useful package for defining key-values.
+% \begin{macrocode}
+\usepackage{xkeyval}
+% \end{macrocode}
+%
+% \subsection{Options New to \textsf{eqexam}}
+% Here are some options unique to this package.
+% \IndexOpt{usecustomdesign}
+% Use this option to avoid \textsf{eqexam} from setting up the ``standard'' page layout.
+% \begin{macrocode}
+\DeclareOptionX{usecustomdesign}{\eqcustomdesigntrue}
+\newif\ifeqcustomdesign \eqcustomdesignfalse
+\DeclareOptionX{nocustomdesign}{\let\eqe@nocustomdesign=1}
+\let\eqe@nocustomdesign=0
+% \end{macrocode}
+% \IndexOpt{fortextbook}
+% An option to extend the application of \textsf{eqexam} to provide support
+% (exercises, providing solutions, short solutions, answers, and hints) for
+% authors writing textbooks. See \Nameref{fortextbook}.
+% \begin{macrocode}
+\DeclareOptionX{fortextbook}{\eqfortextbooktrue}
+\newif\ifeqfortextbook \eqfortextbookfalse
+% \end{macrocode}
+% \IndexOpt{forinstr}
+% \IndexOpt{forstudent}
+% These two options simply set a switch to signal the intention of the
+% document author.
+% \begin{macrocode}
+\DeclareOptionX{forinstr}{\eqforinstrtrue}
+\DeclareOptionX{forstudent}{\eqforinstrfalse}
+\newif\ifeqforinstr \eqforinstrfalse
+% \end{macrocode}
+% \IndexOpt{nomarginwrite}
+% The switch \cs{ifeqwritetomargins} is used by the \texttt{fortextbook}
+% 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}
+% Using this option, the check for the margin width is not done,
+% and writing to the margins is turned off.
+% (\cs{marginpar} still works)
+% \begin{macrocode}
+\DeclareOptionX{nomarginwrite}{\eqwritetomarginsfalse}
+\newif\ifeqwritetomargins\eqwritetomarginstrue
+% \end{macrocode}
+%
+% \paragraph*{Configuration Files.}
+% This section contains options for the configuration files.
+% \IndexOpt{cfg}
+% The \texttt{cfg} option is used to specify a named configuration file, extension
+% must be \texttt{.cfg}; usage \texttt{cfg=hwdoc}.
+%\changes{v3.0u}{2012/09/03}{Added the \texttt{cfg} option for inputting
+% a custom config file.}
+%\changes{v3.1d}{2012/09/29}{Added \cs{ifeqexamCFG} and cs{eqexamCFG}; these are
+% used by \textsf{ATB} to attached the configuration file.}
+% \begin{macrocode}
+\define@key{eqexam.sty}{cfg}[]{%
+ \def\arg@i{#1}\ifx\arg@i\@empty
+ \PackageWarning{eqexam}{No value for `cfg' specified}\else
+ \def\ifeqexamCFG{true}\def\eqexamCFG{#1.cfg}%
+ \AtEndOfPackage{\InputIfFileExists{#1.cfg}
+ {\typeout{Inputting #1.cfg}}{\PackageWarning{eqexam}{%
+ Cannot find configuration file #1.cfg}}}\fi
+ }
+\def\ifeqexamCFG{false}
+\let\eqexamCFG\@empty
+% \end{macrocode}
+% \IndexOpt{myconfig}\IndexOpt{myconfigi...myconfigvi}
+% We offer seven sets of configuration files, that should be enough, especially
+% light of the new \texttt{cfg} option, defined above.
+% \changes{v3.0t}{2012/25/01}{Added four more CFG files are the request
+% of a user.}
+% \begin{macrocode}
+\@for\eqe@tmp@i:={},i,ii,iii,iv,v,vi\do{%
+ \edef\eqe@tmp@exp{%
+ \noexpand\DeclareOptionX{myconfig\eqe@tmp@i}%
+ {\noexpand\AtEndOfPackage{\expandafter\noexpand
+ \csname eqemyconfig\eqe@tmp@i\endcsname}}%
+ }\eqe@tmp@exp
+}
+% \end{macrocode}
+%
+% \paragraph*{Point options.}
+% Options relating to points, points on left, right, both, no points,
+% totals on left and right.
+% \IndexOpt{pointsonleft}
+% \IndexOpt{pointsonright}
+% \IndexOpt{pointsonboth}
+% \IndexOpt{nopoints}
+% \IndexOpt{totalsonleft}
+% \IndexOpt{totalsonright}
+% \IndexOpt{nozerototals}
+% We offer options for points and totals.
+% \begin{macrocode}
+\DeclareOptionX{pointsonleft}{\AtEndOfPackage{\PointsOnLeft}}
+\DeclareOptionX{pointsonright}{\AtEndOfPackage{\PointsOnRight}}
+\DeclareOptionX{pointsonboth}{\AtEndOfPackage{\PointsOnBothSides}}
+\DeclareOptionX{nopoints}{\AtEndOfPackage{\NoPoints}}
+\DeclareOptionX{totalsonleft}{\AtEndOfPackage{\TotalsOnLeft}}
+\DeclareOptionX{totalsonright}{\AtEndOfPackage{\TotalsOnRight}}
+\DeclareOptionX{nozerototals}{\AtEndOfPackage{\noZeroTotals}}
+% \end{macrocode}
+%
+% \paragraph*{Totals options.}
+%
+% \IndexOpt{nototals}
+% \IndexOpt{noparttotals}
+% \IndexOpt{parttotalsonright}
+% \IndexOpt{parttotalsonleft}
+% \IndexOpt{noseparationrule}
+% \IndexOpt{nosummarytotals}
+% Options relating to totals
+% \begin{macrocode}
+\let\eqe@YES=y \let\eqe@NO=n
+\let\eqe@One=1 \let\eqe@Zero=0
+\let\eqe@Two=2 \let\eqe@Three=3 \let\eqe@Four=4
+\DeclareOptionX{nototals}{\AtEndOfPackage{\NoTotals}}
+\DeclareOptionX{noparttotals}{%
+ \AtEndOfPackage{\let\eq@parttotals\eqe@NO}}
+\DeclareOptionX{parttotalsonright}{%
+ \def\eqeomarginbox{\eqeomarginboxright}}
+\DeclareOptionX{parttotalsonleft}{%
+ \def\eqeomarginbox{\eqeomarginboxleft}}
+\def\eqeomarginbox{\eqeomarginboxright}
+\DeclareOptionX{noseparationrule}{%
+ \AtEndOfPackage{\separationruleOff}}
+% \AtEndOfPackage{\let\separationrule\relax}}
+\DeclareOptionX{nosummarytotals}{\let\eq@nosummarytotals\eqe@YES}
+% \end{macrocode}
+%
+% \paragraph*{cover page options.} There are two such options,
+% \texttt{coverpage} and \texttt{cover\-page\-sumry}.
+% \IndexOpt{coverpage}
+% If this option is taken, a cover page is generate.
+% \begin{macrocode}
+\DeclareOptionX{coverpage}{\def\eqex@coverpage{\eqexcoverpage}%
+ \setcounter{page}{0}}
+% \end{macrocode}
+% \IndexOpt{coverpagesumry}
+% If this option is taken, an \textbf{Exam Record} is generated on the
+% cover page, provided the \texttt{coverpage} option is taken. Possible
+% values aer \texttt{byparts}, \texttt{bypages}, or \texttt{none}.
+% \begin{macrocode}
+\define@choicekey+{eqexam.sty}{coverpagesumry}[\val\nr]%
+ {byparts,bypages,none}{%
+ \ifcase\nr\relax
+ \def\sumryAnnots{\cpSumrybyparts}\or
+ \def\sumryAnnots{\cpSumrybypages}\or
+ \let\sumryAnnots\relax
+ \fi
+}{\PackageWarning{aeb}{Bad choice for coverpagesumry, permissible values
+ are byparts, bypages, and none. Try again}}
+\let\sumryAnnots\relax
+% \end{macrocode}
+%
+% \paragraph*{Options related to how the document is built.}
+%
+% \IndexOpt{nospacetowork}
+% The vertical space defined by the solution environment is removed.
+% \begin{macrocode}
+\DeclareOptionX{nospacetowork}{%
+ \AtEndOfPackage{\let\eq@insertverticalspace\eqe@NO}}
+% \end{macrocode}
+% \IndexOpt{answerkey}
+% Equivalent to solutionsafter and proofing.
+% \begin{macrocode}
+\newif\ifanswerkey \answerkeyfalse
+\DeclareOptionX{answerkey}{\AnswerKey}
+\def\AnswerKey{\answerkeytrue\eq@proofingtrue
+ \eq@solutionsaftertrue}
+% \end{macrocode}
+% \IndexOpt{vspacewithsolns}
+% When \texttt{vspacewithsolns} is used, vertical space is created by
+% the solutions environment, and the solutions are written to the
+% end of the file.
+% \changes{v2.0d}{2011/03/04}{%
+% Added the \texttt{vspacewithsolns} option}
+% \IndexOpt{ftbsolns}
+% Added \texttt{ftbsolns} as an alias for \texttt{vspacewithsolns}
+% \changes{v3.0h}{2011/08/17}{% 2011/08/17 v3.0h Added the
+% \texttt{vspacewithsolns} option}. This is implemented through
+% a Boolean switch \cs{ifvspacewithsolns}, which I'm sorry now I've made
+% so long. To make up for that bad decision, I also define
+% \DescribeMacro{\ifkeyalt}\cmd{ifkeyalt} to be \cmd{\ifvspacewithsolns}
+% with making conditional decisions, of course, one cannot say
+% \cs{keyalttrue}.
+% \begin{macrocode}
+\newif\ifvspacewithsolns\vspacewithsolnsfalse
+\def\ifkeyalt{\csname ifvspacewithsolns\endcsname}
+\def\ifkeyOrkeyalt{\ifanswerkey
+ \def\eqe@next{\csname iftrue\endcsname}\else
+ \ifvspacewithsolns\def\eqe@next{\csname iftrue\endcsname}\else
+ \def\eqe@next{\csname iffalse\endcsname}\fi\fi\eqe@next}
+\DeclareOptionX{vspacewithsolns}{%
+ \vspacewithsolnstrue\displayworkareatrue}
+\DeclareOptionX{ftbsolns}{%
+ \vspacewithsolnstrue\displayworkareatrue}
+% \end{macrocode}
+% \IndexOpt{useforms}
+% Use forms (if online option is taken); otherwise draw rectangles for
+% multiple choice/multiple selection questions.
+% \begin{macrocode}
+\DeclareOptionX{useforms}{\AtEndOfPackage{\def\sqstar{*}}}
+% \end{macrocode}
+% \IndexOpt{allowcirc4mc}
+% This option uses \texttt{lcircle10} to draw circles around multiple choice questions.
+% \begin{macrocode}
+\newif\ifallowcircmc \allowcircmcfalse
+\DeclareOptionX{allowcirc4mc}{\allowcircmctrue}
+% \end{macrocode}
+%
+% \paragraph*{PDF Options} The various options to go beyond paper!
+%
+% \IndexOpt{online}
+% \IndexOpt{pdf}
+% \IndexOpt{links}
+% \IndexOpt{email}
+% Options related to the interactive capability of \textsf{eqexam}.
+% \changes{v3.1b}{2012/06/18}{Added \cs{eqe@auto@chk@drivers}}
+% For each of the PDF options, we auto-check for \textsf{pdftex}
+% and \textsf{xetex}.
+% \begin{macrocode}
+\def\eqe@auto@chk@drivers{\ifpdf\ExecuteOptionsX{pdftex}\else
+ \ifxetex\ExecuteOptionsX{xetex}\fi\fi}
+\newif\ifeqeonline \eqeonlinefalse
+\DeclareOptionX{online}{\eqe@auto@chk@drivers
+ \let\eq@online\eqe@YES\eqeonlinetrue\ExecuteOptionsX{links}}
+\DeclareOptionX{pdf}{\eqe@auto@chk@drivers\let\load@web\eqe@YES}
+\DeclareOptionX{links}{\eqe@auto@chk@drivers
+ \let\load@web\eqe@YES\let\load@exerquiz\eqe@YES}
+\DeclareOptionX{email}{\eqe@auto@chk@drivers
+ \let\use@email\eqe@YES\ExecuteOptionsX{online}}
+% \end{macrocode}
+% \IndexOpt{obeylocalversions}
+% This option is used for multiple versions of a document.
+% \begin{macrocode}
+\newif\ifeqobeylocalversion \eqobeylocalversionfalse
+\DeclareOptionX{obeylocalversions}{\eqobeylocalversiontrue}
+% \end{macrocode}
+% \IndexOpt{usexkv}
+% Causes the \textsf{xkeyval} package to be input, this option extends the
+% option list of
+% \cs{fillIn}.
+% \begin{macrocode}
+\DeclareOptionX{usexkv}{\let\eq@usexkeys\eqe@YES}
+% \end{macrocode}
+%\texttt{2014/12/19} Now, the \texttt{usexkeys} is on by default.
+%\changes{v3.5a}{2014/12/19}{Made \texttt{usexkeys} as default}
+% \begin{macrocode}
+\let\eq@usexkeys\eqe@YES
+% \end{macrocode}
+%
+%\paragraph*{Renditions} Options relating to renditions.
+% \IndexOpt{max}
+% \IndexOpt{rendition}
+% The \texttt{max} and \texttt{rendition} option can be used instead of the
+% \verb!\numVersions{2}! and \verb!\forVersion{a}!, respectively. These options
+% allow you to set the version information though a package option. This allows us, for
+% example, to use a \textsf{cfg} file such as \texttt{rendition.cfg} to dynamically set the version.
+% This feature is used primarily by \textsf{AeB Exam Builder}.
+% \changes{v2.0}{2010/03/05}
+% {%
+% Switched over to \textsf{xkeyval}, added max and rendition to be consistent
+% with the renditions package, though we don't use the rendition package
+% itself. \textsf{eqexam} has a more extensive renditions system already.
+% Introduced this mostly for use AeB Exam Builder.
+% }
+% \begin{macrocode}
+\let\eq@renditionOptions\@empty
+\let\eq@max@selected\@empty \let\eq@ren@selected\@empty
+\DeclareOptionX{max}{\def\eq@max@selected{#1}%
+ \g@addto@macro\eq@renditionOptions{\numVersions{#1}}}
+\DeclareOptionX{rendition}{\def\eq@ren@selected{#1}%
+ \g@addto@macro\eq@renditionOptions{\forVersion{#1}}}
+% \end{macrocode}
+% \paragraph*{Randomization} Options relating to randomization.
+% \IndexOpt{allowrandomize}
+% Use this option to randomize the choices of a multiple choice question.
+% \begin{macrocode}
+\DeclareOptionX{allowrandomize}{\AtEndOfPackage{\inputRandomizeChoices}}
+\def\inputRandomizeChoices{\InputIfFileExists{aebrandom.def}
+ {\typeout{inputting aebrandom.def}}{cannot find aebrandom.def}}
+% \end{macrocode}
+%
+% \paragraph*{Set Misc. Defaults and Helper Macros.}
+% We set some defaults, and define macros for use by the document author.
+% \begin{macrocode}
+\let\eq@online\eqe@NO
+\def\ifisOnline{\ifx\eq@online\eqe@YES}
+\let\use@email\eqe@NO
+\let\load@web\eqe@NO
+\let\load@exerquiz\eqe@NO
+\def\sqLinks{\def\sqstar{}}\sqLinks
+\def\sqForms{\def\sqstar{*}}
+\def\NoSpaceToWork{\let\eq@insertverticalspace\eqe@NO}
+\def\SpaceToWork{\let\eq@insertverticalspace\eqe@YES}
+\let\eq@nototals\eqe@NO
+\let\eq@nosummarytotals\eqe@NO
+\let\eq@parttotals\eqe@YES
+\let\eqx@separationrule\eqe@YES
+\let\eq@insertverticalspace\eqe@YES
+\let\eqex@coverpage\relax
+\def\@reportpoints{0}
+\let\marginpoints\@empty
+\let\totalsbox=\hfil
+% \end{macrocode}
+%
+% \subsection{Options from and for \textsf{web}}
+% \IndexOpt{forpaper}
+% \IndexOpt{forcolorpaper}
+% Here is the list of options of \textsf{exerquiz} we plan to recognize.
+% \changes{v4.6a}{2016/06/04}{Added \string\cs{ifequsecolor} to easily distinguish between
+% \string\texttt{forpaper} and \string\texttt{forcolorpaper} options.}
+% \begin{macrocode}
+\@ifundefined{ifequsecolor}{\newif\ifequsecolor\equsecolorfalse}{}
+\DeclareOptionX{forpaper}{\equsecolorfalse\eqforpapertrue
+ \PassOptionsToPackage{monochrome}{\eq@ColorPackage}}
+\DeclareOptionX{forcolorpaper}{\equsecolortrue\eqforpapertrue} % for print
+% \end{macrocode}
+% \IndexOpt{preview}
+% Preview shows outlines for form fields.
+% \begin{macrocode}
+\DeclareOptionX{preview}{\previewtrue}
+% \end{macrocode}
+% \IndexOpt{webOpts}
+% Pass options to \textsf{web}, when \texttt{pdf} or higher is used.
+% \begin{macrocode}
+\define@key{eqexam.sty}{webOpts}[]{\def\eqe@webOpts{#1,\eqDriverName}}
+\def\eqe@webOpts{\eqDriverName}
+% \end{macrocode}
+%
+% \subsection{Options from and for \textsf{exerquiz}}
+% Options from \textsf{exerquiz} that are useful for this package.
+% \IndexOpt{exerquizOpts}
+% Pass options to \textsf{exerquiz}, when \texttt{links} or higher is used.
+% \begin{macrocode}
+\define@key{eqexam.sty}{exerquizOpts}[]{\def\eqe@eqOpts{#1,nodljs}}
+\def\eqe@eqOpts{nodljs}
+% \end{macrocode}
+% \IndexOpt{nosolutions}
+% \IndexOpt{nohiddensolutions}
+% \IndexOpt{noHiddensolutions}
+% \IndexOpt{solutionsafter}
+% \changes{v1.7b}{2007/21/07}{Added a \texttt{solutionsonly} option}
+% \IndexOpt{solutionsonly}
+% Solutions related options
+% \begin{macrocode}
+% dps 03/04/11
+\DeclareOptionX{nosolutions}{\eq@nolinktrue\eq@nosolutionstrue
+ \displayworkareatrue}
+\DeclareOptionX{nohiddensolutions}{\eq@globalshowsolutionstrue}
+\DeclareOptionX{noHiddensolutions}%
+ {\eq@globalshowsolutionstrue\AtBeginDocument{\def\Hidesymbol{h}}}
+\DeclareOptionX{solutionsafter}{\eq@solutionsaftertrue
+ \displayworkareafalse}
+\DeclareOptionX{solutionsonly}{%
+ \solutionsonlytrue\answerkeytrue\displayworkareafalse
+ \AtEndOfPackage{\therearesolutionstrue\let\exerSolnsHeadnToc\relax}}
+% \end{macrocode}
+% \IndexOpt{proofing}
+% The \texttt{proofing} option sets a switch that controls whether
+% the checkbox for multiple choice questions appears, and whether
+% the answer for the \cs{fillin} command appears. \cmd{\ifeq@proofing}
+% is set to true when the \texttt{answerkey} option is taken.
+% \begin{macrocode}
+\DeclareOptionX{proofing}{\eq@proofingtrue}
+% \end{macrocode}
+% We provide two helper commands for turning on or off proofing. These are
+% \DescribeMacro{\showproofing}\cmd{\showproofing} for turning on proofing
+% and \DescribeMacro{\hideproofing}\cmd{\hideproofing} for turning off proofing.
+% There was some reason for defining these two, but can't remember now.
+% \begin{macrocode}
+\newcommand{\showproofing}{\eq@proofingtrue}
+\newcommand{\hideproofing}{\eq@proofingfalse}
+% \end{macrocode}
+% \IndexOpt{showgrayletters}
+% \changes{v1.7c}{2008/08/21}
+% {
+% Added the \texttt{showgrayletters} option to eqexam
+% (ported from exerquiz)
+% }
+% When this option is in effect, capital letters in gray appear under
+% the multiple choice question boxes.
+% \begin{macrocode}
+\newif\ifaebshowgrayletters\aebshowgraylettersfalse
+\DeclareOptionX{showgrayletters}%
+ {\AtEndOfPackage{\aebshowgrayletterstrue}}
+% \end{macrocode}
+%
+%\changes{v2.0i}{2011/04/17 }
+%{
+% Added the switch \cs{ifdisplayworkarea} to better control when the
+% work area is to be displayed.
+%}
+% \begin{macrocode}
+\newif\ifdisplayworkarea \displayworkareafalse
+% \end{macrocode}
+%
+% \paragraph*{Color packages}
+% We set the color package, \texttt{xcolor} preferred.
+% \begin{macrocode}
+\IfFileExists{xcolor.sty}%
+{\def\eq@ColorPackage{xcolor}\def\eqe@color@opt{table}%
+ \PassOptionsToPackage{xcolor}{table}}
+{\def\eq@ColorPackage{color}\let\eqe@color@opt\@empty}
+% \end{macrocode}
+% \DescribeMacro{noxcolor}\texttt{noxcolor} forces the use of the color package.
+% \begin{macrocode}
+\DeclareOptionX{noxcolor}{\def\eq@ColorPackage{color}}
+% \end{macrocode}
+%
+% \subsubsection{Title page options}
+% To\DescribeMacro{useclassmaketitle} support the use of eqexam outside a straight exam document, we allow the
+% user to bypass the redefinition of \cs{maketitle}. This is automatic
+% with the \texttt{fortextbook} option.
+% \begin{macrocode}
+\newif\if@eqeuseclassmaketitle \@eqeuseclassmaketitlefalse
+\DeclareOptionX{useclassmaketitle}{\@eqeuseclassmaketitletrue}
+\newif\if@bypasseqexamheading \@bypasseqexamheadingfalse
+\DeclareOptionX{bypasspkgpagestyle}{\@bypasseqexamheadingtrue
+ \ExecuteOptionsX{nototals}}
+% \end{macrocode}
+% \subsection{Drivers Recognized}
+% These drivers are only relevant when
+% a \textsf{PDF} option is taken (\texttt{pdf}, \texttt{links}, \texttt{online}, \texttt{email}).
+% For ordinary paper documents, it is not necessary to specify the driver. If you
+% put the assignment/homework/test (solns) on the web, suggested option is \texttt{pdf},
+% this inputs hyperref, and the document info dialog is filled in.
+% \IndexOpt{dvipsone}
+% \IndexOpt{dvips}
+% \IndexOpt{pdftex}
+% \IndexOpt{dvipdfm}
+% \IndexOpt{dvipdfmx}
+% \IndexOpt{xetex}
+% \IndexOpt{textures}
+% The list of recognized and supported drivers.
+% \begin{macrocode}
+\DeclareOptionX{dvipsone}{%
+ \def\eqe@drivernum{0}\def\eqDriverName{dvipsone}%
+ \PassOptionsToPackage{\eq@ColorPackage}{dvipsone}}
+\DeclareOptionX{dvips}{\def\eqe@drivernum{0}\def\eqDriverName{dvips}%
+ \PassOptionsToPackage{\eq@ColorPackage}{dvips}}
+\DeclareOptionX{pdftex}{\def\eqe@drivernum{1}\def\eqDriverName{pdftex}%
+ \PassOptionsToPackage{\eq@ColorPackage}{pdftex}}
+\DeclareOptionX{dvipdfm}{%
+ \def\eqe@drivernum{2}\def\eqDriverName{dvipdfm}%
+ \PassOptionsToPackage{\eq@ColorPackage}{dvipdfm}}
+\DeclareOptionX{dvipdfmx}{\def\eqe@drivernum{2}%
+ \def\eqDriverName{dvipdfmx}%
+ \PassOptionsToPackage{\eq@ColorPackage}{dvipdfmx}}
+\DeclareOptionX{xetex}{\def\eqe@drivernum{2}\def\eqDriverName{xetex}%
+ \PassOptionsToPackage{\eq@ColorPackage}{xetex}}
+\DeclareOptionX{textures}{%
+ \def\eqe@drivernum{3}\def\eqDriverName{textures}%
+ \PassOptionsToPackage{\eq@ColorPackage}{textures}}
+\DeclareOptionX*{%
+ \PassOptionsToPackage{\CurrentOption}{\eq@ColorPackage}}
+\def\eqe@drivernum{5}
+\let\eqDriverName\@empty
+% \end{macrocode}
+% If \textsf{exerquiz} is not loaded, when we need to define some of the switches that
+% were defined in \textsf{exerquiz}.
+%
+% The following switches are used in the options above, and are also defined
+% in web, exerquiz, or eforms.
+% \begin{macrocode}
+\newif\ifeq@solutionsafter \eq@solutionsafterfalse
+\newif\ifsolutionsonly\solutionsonlyfalse
+\newif\ifeq@hidesolution \eq@hidesolutionfalse
+\newif\ifeq@globalshowsolutions \eq@globalshowsolutionsfalse
+\newif\ifeq@nosolutions \eq@nosolutionsfalse
+\newif\ifeq@proofing \eq@proofingfalse
+\newif\ifeq@nolink \eq@nolinkfalse
+\@ifundefined{ifpreview}{\newif\ifpreview \previewfalse}{}
+\newif\ifeqforpaper \eqforpaperfalse
+% \end{macrocode}
+% We define the commands for inputting the CFG files.
+% \begin{macrocode}
+\def\eqe@csarg#1#2{\expandafter#1\csname#2\endcsname}
+\@for\eqe@tmp@i:={},i,ii,iii,iv,v,vi\do{\eqe@csarg
+ \edef{eqemyconfig\eqe@tmp@i}{\noexpand
+ \InputIfFileExists{eqexam\eqe@tmp@i.cfg}{}{}}%
+ \eqe@tmp@exp
+}
+% \end{macrocode}
+%
+% \subsection{Bring in Config Files}
+%
+% First read \texttt{web.cfg}, to possibly get the driver, then input
+% \texttt{eqecus.opt}, which is used to create convenient custom options.
+% \changes{v1.6e}{2006/05/07}{%
+% Added a custom option feature. Just before the options are processed, the
+% tex compiler looks for the file \texttt{eqecus.opt}. This file should
+% contain one or more custom options. }
+%
+% 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}
+%\DeclareOptionX{atbdbopts}
+%{%
+% \ExecuteOptionsX{online}
+% \ExecuteOptionsX{forcolorpaper}
+% \ExecuteOptionsX{nosolutions}
+% \ExecuteOptionsX{nopoints}
+% \ExecuteOptionsX{nototals}
+% \ExecuteOptionsX{nospacetowork}
+% \ExecuteOptionsX{obeylocalversions}
+% \ExecuteOptionsX{myconfig}
+%}
+%\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},
+% but can be used locally.
+% \begin{macrocode}
+\InputIfFileExists{web.cfg}{}{}
+\InputIfFileExists{eqecus.opt}{}{}
+% \end{macrocode}
+%\changes{v2.0}{2010/03/05}
+%{
+% Added exambuilder.cfg for use by AeB Exam Builder, to pass the values of the options
+% max and rendition to eqexam.
+%}
+% These two are used by the \textsf{rendition} package and the exam builder utility.
+% \begin{macrocode}
+\InputIfFileExists{rendition.cfg}{}{}
+\InputIfFileExists{exambuilder.cfg}{}{}
+% \end{macrocode}
+%
+% \subsection{Process Options}
+%
+% Now process the options.
+% \begin{macrocode}
+\ProcessOptionsX
+% \end{macrocode}
+% \changes{v3.2c}{2013/02/23}{Added \cs{selectedMC} at end of package}
+% The \cs{selectedMC} command contains the choice for the styling for the
+% region multiple choice questions: rectangles or circles. The default is
+% rectangles.
+% \begin{macrocode}
+\AtEndOfPackage{\selectedMC}
+% \end{macrocode}
+% (2015/07/12) Move the inclusion of the color package prior to loading many of the other
+% required packages.
+% \begin{macrocode}
+\edef\eqe@tmpexp{\noexpand
+\RequirePackage{\eq@ColorPackage}}\eqe@tmpexp
+% \end{macrocode}
+% We require a minimal version for \textsf{xcolor}.
+%\changes{}{2015/07/21}{add \cs{let}\cs{CT@arc@}\cs{relax}}
+% \begin{macrocode}
+\@ifpackageloaded{xcolor}{\AtEndOfPackage{\let\CT@cell@color\relax
+ \let\CT@arc@\relax}%
+ \@ifpackagelater{xcolor}{2004/07/04}{}{\PackageError{eqexam}{%
+ *************************************************\MessageBreak
+ * Your Version of `xcolor.sty' is too old!\MessageBreak
+ * You need the version from 2004/07/04 or newer\MessageBreak
+ * or use: \string\usepackage[noxcolor]{eqexam}\MessageBreak
+ * or \string\documentclass[noxcolor]{article}\MessageBreak
+ *************************************************}{}%
+ }%
+}{}
+% \end{macrocode}
+% If \texttt{nocustomdesign} option is taken, we set the switch
+% \cmd{\eqcustomdesignfalse}.
+% \begin{macrocode}
+\if\eqe@nocustomdesign1\eqcustomdesignfalse\fi
+% \end{macrocode}
+% Define a \cs{immediate}\cs{write} helper macro.
+% \begin{macrocode}
+\long\def\eqe@IWO#1{\immediate\write#1}
+% \end{macrocode}
+% \paragraph*{Early definitions for the \texttt{fortextbook} option.}
+% \begin{macro}{\showAllAnsAtEnd}
+% If the user has chosen the \texttt{vspacewithsolns} option, we must turn
+% of all other solution options, namely \texttt{answerkey}. This command is
+% used internally.
+% \changes{v4.6b}{2016/10/02}{Include \string\cs{eqTopOfSolnPage} from \string\pkg{exerquiz}
+% to support copying question to solution page.}
+% \medskip\par\noindent
+% (2016/10/02) Include \cs{eqTopOfSolnPage} from \pkg{exerquiz}
+% to support copying question to solution page.
+% \begin{macrocode}
+\newcommand{\showAllAnsAtEnd}{%
+ \makeAnsEnvForSolnsAtEnd\eqTopOfSolnPage
+ \answerkeytrue\eq@proofingtrue
+ \eq@solutionsaftertrue\vspacewithsolnstrue
+ \displayworkareafalse\withsoldoctrue
+}
+% \end{macrocode}
+% \begin{macro}{\makeAnsEnvForSolnsAtEnd}
+% One user wanted to be able to use the \texttt{answers} environment
+% in the solutions section at the end of the document (when the
+% \texttt{vspacewithsolns} is used). Here it is. This definition
+% is added to the definition of \cmd{\showAllAnsAtEnd}.
+% \begin{macrocode}
+\newcommand{\makeAnsEnvForSolnsAtEnd}{%
+% \end{macrocode}
+% \changes{v3.1e}{2012/11/10}{Removed hard-wired \cs{proofingsymbol}}
+% \begin{macrocode}
+% \proofingsymbol{\ding{52}}%
+ \let\answers\answers@sq
+ \let\endanswers\endanswers@sq
+ \let\manswers\manswers@sq
+ \let\endmanswers\endmanswers@sq
+}
+% \end{macrocode}
+% \begin{macrocode}
+\newcommand{\solAtEndFormatting}[1]{\def\eqeAEFormatting{#1}}
+\let\eqeAEFormatting\@empty
+% \end{macrocode}
+% \cs{writeAllAnsAtEnd} writes the \cs{showAllAnsAtEnd} command to the solutions file.
+% \begin{macrocode}
+\def\writeAllAnsAtEnd{\ifsolutionsonly\else
+ \let\quiz@solns\ex@solns
+ \eqe@IWO\quiz@solns{\string\showAllAnsAtEnd}%
+ \ifx\eqeAEFormatting\@empty\else
+ \eqe@IWO\quiz@solns{\string\eqeAEFormatting}\fi
+ \fi
+}
+% \end{macrocode}
+% \end{macro}
+% \end{macro}
+% \begin{macro}{\setSolnMargins}
+% Sets the value of \cs{eqemargin} in the context of the solution file,
+% this command is redefined later.
+% \begin{macrocode}
+\newcommand{\setSolnMargins}[1]{\setlength\eqemargin{#1}}
+% \end{macrocode}
+% \end{macro}
+% (2011/05/08) In the new version of \textsf{eqexam}, the one that makes
+% the problems within an \texttt{exam} environment, into a list, the
+% solutions file that appears at the end of the document also needs to be
+% put into a list. Here, we define the command that writes the beginning of
+% the \texttt{eqequestions} environment to the beginning of the
+% \cs{jobname.sol} file. We hard-wire write \verb!\setSolnMargins{\the\eqemargin}!
+% to the solution file, but leave a back door open to write an alternate string.
+% (2014/03/20) \DescribeMacro{\altSetSolnMargins}\cmd{\altSetSolnMargins} allows you,
+% through its argument to pass an alternate string.
+% \begin{macrocode}
+\def\altSetSolnMargins#1{\def\alt@SetSolnMargins{#1}}
+\let\alt@SetSolnMargins\@empty
+\def\writeBeginEqeQuestions{%
+ \ifsolutionsonly\else
+ \let\quiz@solns\ex@solns
+ \ifx\alt@SetSolnMargins\@empty
+ \writeToSolnFile{\string\setSolnMargins{\the\eqemargin}}\else
+ \writeToSolnFile{\alt@SetSolnMargins}\fi
+ \writeToSolnFile{\string\noindent\string\begin{eqequestions}}%
+ \fi
+}
+% \end{macrocode}
+% (2011/05/08) We define the command that writes the end of the \texttt{eqequestions}
+% environment to the beginning of the \cs{jobname.sol} file.
+% \begin{macrocode}
+\newcommand{\setBtwnExamSkip}[1]{\gdef\btwnExamSkipAmt{#1}%
+ \def\btwnExamSkip{\ifdim#1=0pt\else
+ \vskip#1\relax\fi}}
+\setBtwnExamSkip{6pt}
+\def\writeEndEqeQuestions{%
+ \ifsolutionsonly\else
+ \let\quiz@solns\ex@solns
+ \eqe@IWO\quiz@solns{\string\end{eqequestions}^^J}%
+ \writeToSolnFile{\string\btwnExamSkip^^J}%
+ \fi
+}
+% \end{macrocode}
+% If \cs{ifvspacewithsolns} we set the switches need to simulate
+% \texttt{nosolutions}.
+% \begin{macrocode}
+\ifvspacewithsolns
+ \answerkeyfalse\eq@proofingfalse\eq@solutionsafterfalse
+ \eq@nolinkfalse\eq@nosolutionsfalse\displayworkareatrue
+\fi
+% \end{macrocode}
+%
+% \subsection{Save Switch Values}
+%
+% Now, save the current state of the switches defined above. When, and if,
+% the packages web, \textsf{exerquiz} and \textsf{eforms} are loaded, they will overwrite the
+% choices set by the author, so we save them.
+% \begin{macrocode}
+\let\savedeq@online\eq@online
+\let\savedifeq@solutionsafter\ifeq@solutionsafter
+\let\savedifeq@hidesolution\ifeq@hidesolution
+\let\savedifeq@globalshowsolutions\ifeq@globalshowsolutions
+\let\savedifeq@nosolutions\ifeq@nosolutions
+\let\savedifeq@proofing\ifeq@proofing
+\let\savedifeq@nolink\ifeq@nolink
+\let\savedifpreview\ifpreview
+\let\savedifeqforpaper\ifeqforpaper
+\let\ifnosolutions\ifeq@nosolutions
+% \end{macrocode}
+% \section{Required Packages}
+% The following are the required packages for \textsf{eqexam}.
+% \begin{macrocode}
+\RequirePackage{amstext,amssymb}
+% \end{macrocode}
+% \begin{macrocode}
+\@ifundefined{if@fleqn}{\let\fleqnOn\relax\let\fleqnOff\relax}
+ {\def\fleqnOn{\@fleqntrue}\def\fleqnOff{\@fleqnfalse}}
+% \end{macrocode}
+% Bring the \texttt{comment} package in early, before \texttt{verbatim}, these two
+% clash a bit.
+% \begin{macrocode}
+\RequirePackage{comment}
+% \end{macrocode}
+% The macro \cs{includeexersolutions} is defined in \textsf{eqexam.def}. We execute
+% the command \cs{include@solutions} before the web package is loaded. The \textsf{web} package
+% has a \cs{AtEndDocument} as well, and inserts a new page that we don't want.
+% \begin{macrocode}
+\AtEndDocument{\includeexersolutions}
+% \end{macrocode}
+% If user has specified one of the pdf options (pdf, links, online, email), we bring in
+% the web package.
+% \begin{macrocode}
+\@ifpackageloaded{web}{\let\load@web\eqe@YES}{%
+ \ifx\load@web\eqe@YES\ifnum\eqe@drivernum=5
+ \PackageInfo{eqexam}{You have not selected a driver %
+ for eqexam. Perhaps the \MessageBreak
+ driver is introduced through web.cfg%
+ }\fi\expandafter\RequirePackage\expandafter[\eqe@webOpts]{web}%
+ \edef\@pdfcreator{\@pdfcreator, The eqexam Package}\fi
+}
+% \end{macrocode}
+% If user has specified links, online or email, we bring in the exerquiz package.
+% \begin{macrocode}
+\@ifpackageloaded{exerquiz}{\let\load@exerquiz\eqe@YES}{%
+ \let\symbolchoice\@gobble
+ \ifx\load@exerquiz\eqe@YES\expandafter
+ \RequirePackage\expandafter[\eqe@eqOpts]{exerquiz}[2011/08/30]
+% \end{macrocode}
+% We input \textsf{exerquiz} with the \texttt{nodljs}, we don't need all the JavaScript
+% to process interactive shortquizzes or quizzes, but we do want the option of
+% adding in document JavaScript, so after we input \textsf{exerquiz}, we set the
+% switches to allow these features.
+% \begin{macrocode}
+ \let\importdljs\eqe@YES\let\execjs\eqe@YES
+ \fi
+}
+\@ifpackageloaded{eforms}{}{%
+% \end{macrocode}
+% If \textsf{eforms} is not loaded, we define \cs{symbolchoice}, which is
+% defined in \textsf{eforms} to gobble up its argument, we don't need it.
+% \begin{macrocode}
+ \let\symbolchoice\@gobble
+}
+% \end{macrocode}
+% Here is a fix to a problem I've been having previewing in \textsf{dviwindo}. I've traced
+% the problem down to \cs{@pdfviewparams}. Redefining \cs{@pdfviewparams} as follows.
+% \begin{macrocode}
+\def\eqDvipsone{dvipsone}
+\@ifpackageloaded{hyperref}
+ {\ifx\eqDriverName\eqDvipsone
+ \renewcommand\@pdfviewparams{ null null null}\fi
+ }{\let\textorpdfstring\@firstoftwo}
+% \end{macrocode}
+% Now that we have possibly input \textsf{web} or \textsf{exerquiz}, we need to restore the authors options.
+% \begin{macrocode}
+\let\eq@online\savedeq@online
+\let\ifeq@solutionsafter\savedifeq@solutionsafter
+\def\ifsolutionsafter{\ifeq@solutionsafter} % user interface
+\let\ifeq@hidesolution\savedifeq@hidesolution
+\let\ifeq@globalshowsolutions\savedifeq@globalshowsolutions
+\let\ifeq@nosolutions\savedifeq@nosolutions
+\let\ifeq@proofing\savedifeq@proofing
+\let\ifeq@nolink\savedifeq@nolink
+\let\ifpreview\savedifpreview
+\let\ifeqforpaper\savedifeqforpaper
+% \end{macrocode}
+% Other packages of interest.
+% \begin{macrocode}
+\RequirePackage{calc}
+\RequirePackage{pifont}
+\RequirePackage{array}
+% \end{macrocode}
+% Here, I input the \texttt{verbatim} package after the comment package.
+% \begin{macrocode}
+\RequirePackage{verbatim}
+% \end{macrocode}
+% When constructing paper tests, I often use a multi-column format for some of
+% the questions, so let's require this package
+% \begin{macrocode}
+\RequirePackage{multicol}
+\setlength\columnseprule{.4pt}
+\raggedcolumns\multicolsep=3pt
+\newcommand{\setmulticolprob}{%
+ \setlength{\linewidth}{\linewidth+\eqemargin}}
+% \end{macrocode}
+% For the \texttt{fortextbook} option, we require \textsf{eso-pic}.
+% \begin{macrocode}
+\edef\eqe@reqPack{\ifeqfortextbook\noexpand\RequirePackage{eso-pic}\else
+\relax\fi}
+\eqe@reqPack
+% \end{macrocode}
+% We've processed the options, I need to detect whether the document author
+% has not chosen any solutions options.
+% \begin{macrocode}
+\@ifundefined{ifsolutionsAtEnd}
+ {\newif\ifsolutionsAtEnd\solutionsAtEndtrue}{}
+\ifvspacewithsolns\solutionsAtEndtrue\fi
+\ifanswerkey\solutionsAtEndfalse\fi
+\ifeq@nosolutions\solutionsAtEndfalse\fi
+\ifeq@solutionsafter\solutionsAtEndfalse\fi
+% \end{macrocode}
+% \section{Page Layout}
+% (2011/05/08) The revised version of \texttt{eqexam} allows the document author
+% to more easily design the size of the page; the new version makes all content
+% inside the \texttt{exam} environment into a list, this gives us better control over the
+% margins and spacing.
+% \begin{macro}{\eqexammargin}
+% (2011/05/08) Use this command to set the margin for the \texttt{exam} environment.
+% \begin{macrocode}
+\@ifundefined{eqemargin}{\newlength{\eqemargin}}{}
+\providecommand{\prbDecPt}[1]{\def\eqe@decPointPrb{#1}}
+\def\eqe@decPointPrb{.}\def\eqe@dpsepPrb{\ }
+\providecommand{\prbPrtsep}[1]{\def\eqe@prtsepPrb{#1}}
+\def\eqe@prtsepPrb{\ }
+\providecommand{\prbNumPrtsep}[1]{\def\eqe@hspannerPrb{#1}}
+\def\eqe@hspannerPrb{\ }
+\newcommand{\eqexammargin}[2][\normalsize\normalfont\bfseries]{%
+ \settowidth{\eqemargin}{#1#2\eqe@decPointPrb\eqe@hspannerPrb}}
+% \end{macrocode}
+% (2011/05/08) The default margin for the \textsf{eqexam} environment, two digits and a space.
+% \begin{macrocode}
+\eqexammargin{00}
+% \end{macrocode}
+%\changes{v3.0s}{2012/01/01}{%
+% Moved a copy of \cs{eqe@spannerSoln} out of the \texttt{ftbsty} to the \texttt{package} section,
+% its needed here as well.}
+% \begin{macrocode}
+\def\eqe@hspannerSoln{\ } % space after prob number
+\providecommand{\solNumPrtsep}[1]{\def\eqe@hspannerSoln{#1}}
+% \end{macrocode}
+% \end{macro}
+% \begin{macro}{\eqeSetExamPageParams}
+% (2011/05/08) The default spacing maximizes the amount of space on the page.
+% \begin{macrocode}
+\newcommand{\eqeSetExamPageParams}{%
+ \setlength{\headheight}{12pt}
+ \setlength{\topmargin}{-.5in}
+ \setlength{\headsep}{20pt}
+ \setlength{\oddsidemargin}{0pt}
+ \setlength{\evensidemargin}{0pt}
+ \setlength{\marginparsep}{11pt}
+ \setlength{\marginparwidth}{35pt}
+ \setlength{\footskip}{11pt}
+}
+% \end{macrocode}
+% \end{macro}
+% \begin{macro}{\eqExamPageLayout}
+% Set the basic parameters of this exam page package
+% \begin{macrocode}
+\newcommand{\eqExamPageLayout}{%
+ \setlength\textwidth\paperwidth
+ \addtolength{\textwidth}{-2in}
+ \addtolength{\textwidth}{-\oddsidemargin}
+ \setlength\textheight{\paperheight}
+ \addtolength\textheight{-2in}
+ \addtolength\textheight{-\headheight}
+ \addtolength\textheight{-\headsep}
+ \addtolength\textheight{-\topmargin}
+ \addtolength\textheight{-\footskip}
+}
+% \end{macrocode}
+% (2011/05/08) If \texttt{usecustomdesign} is used it is expected that
+% \cs{eqe\-Set\-Exam\-Page\-Params} and \cs{eqeSetExamPageParams} are redefined in he preamble,
+% otherwise, we set up the standard parameters; otherwise
+% \begin{macrocode}
+\ifeqcustomdesign\else
+\eqeSetExamPageParams
+\eqExamPageLayout
+\fi
+% \end{macrocode}
+% \end{macro}
+% A simple page layout scheme for this exam.
+% \begin{macrocode}
+\newcommand{\ps@eqExamheadings}
+{%
+ \renewcommand{\@oddhead}{%
+ {\normalfont\normalsize\ifnum\value{page}<2
+ \hfil\else\eqExamRunHead\fi}}%
+ \renewcommand{\@evenhead}{\@oddhead}
+ \renewcommand{\@oddfoot}{\settotalsbox\runExamFooter}
+ \renewcommand{\@evenfoot}{\@oddfoot}
+}
+\raggedbottom
+% \end{macrocode}
+% \section{Counters, Lengths and Tokens}
+% Some counters to keep track of things. \DescribeEnv{eqpointsofar}
+% \DescribeEnv{eqpointsthispage} The first two counters keep track, respectively,
+% of the total points so far up the current page, and the number of points
+% on the current page. \DescribeEnv{eq@numparts} The counter \texttt{eq@numparts}
+% holds the number of parts of the multi-part question.
+% \begin{macrocode}
+\newcounter{eqpointsofar}
+\newcounter{eqpointsthispage}
+\newcounter{eq@numparts}
+\newcounter{eq@count}
+\newtoks\partNames \partNames={}
+\newlength{\eq@tmplengthA}
+\newbox{\eq@pointbox}
+\newlength{\eq@pointboxtotalheight}
+% \end{macrocode}
+% Some scratch registers to do calc calculations.
+% \begin{macrocode}
+\newlength{\eqetmplengtha}
+\newlength{\eqetmplengthb}
+% \end{macrocode}
+% \section{Some Macros to Support the Options}
+% We make a few definitions to support various options.
+% \begin{macrocode}
+\def\PointsOnLeft{\def\@reportpoints{1}\let\marginpoints\eqleftmargin}
+\def\PointsOnRight{\def\@reportpoints{2}\relax
+ \let\marginpoints\eqrightmarginbox}
+\def\PointsOnBothSides{\def\@reportpoints{3}\relax
+ \let\marginpoints\eqbothmargins}
+\newif\ifeqe@nopoints \eqe@nopointsfalse
+\def\NoPoints{\if\isInExamEnv\eqe@NO
+ \eqe@nopointstrue\def\@reporttotals{0}\let\totalsbox=\hfil
+ \let\marginpoints\@empty\let\eq@nosummarytotals\eqe@YES\else
+ \PackageWarning{eqexam}{The \string\NoPoints\space ignored;
+ it needs to be executed\MessageBreak outside of an
+ exam environment}\fi}
+\def\TotalsOnLeft{\def\@reporttotals{1}\def\totalsbox{\totalsboxleft}}
+\def\TotalsOnRight{\def\@reporttotals{2}\def\totalsbox{\totalsboxright}}
+\def\noZeroTotals{\let\eqe@zeroTotalsAllowed\eqe@NO}
+\def\allowZeroTotals{\let\eqe@zeroTotalsAllowed\eqe@YES}
+\allowZeroTotals
+\def\NoTotals{\def\@reporttotals{0}\let\totalsbox=\hfil}
+\def\SummaryTotalsOn{\let\eq@nosummarytotals\eqe@NO}
+\def\SummaryTotalsOff{\let\eq@nosummarytotals\eqe@YES}
+\def\eoeTotalOff{\let\eq@parttotals\eqe@NO}
+\def\eoeTotalOn{\let\eq@parttotals\eqe@YES}
+\def\separationruleOn{\let\eqx@separationrule\eqe@YES}
+\def\separationruleOff{\let\eqx@separationrule\eqe@NO}
+\def\AllowFitItIn{\global\let\eq@fititin\eqfititin}
+\def\DoNotFitItIn{\global\let\eq@fititin\@gobble}
+% \end{macrocode}
+%\changes{v3.0p}{2011/09/22}{Added \cs{NoSolutions} to be executed in
+%preamble, needed with the fortextbook package.}
+% \begin{macrocode}
+\def\NoSolutions{\eq@nolinktrue\eq@nosolutionstrue
+ \displayworkareatrue}
+\@onlypreamble\NoSolutions
+% \end{macrocode}
+% \begin{macro}{\vspacewithkeyOn}
+% \begin{macro}{\vspacewithkeyOff}
+%\changes{v2.0k}{2011/04/29}{Added user interface to the switch
+%\cs{ifkeepdeclaredvspacing}, which is defined in \texttt{eqexam.def}/\textsf{exerquiz}.}
+% User interface to keeping the declare vspace, even when
+% the \texttt{answerkey} (or \texttt{solutionsafter}) option is taken. The switch
+% \cs{ifkeepdeclaredvspacing} is defined in \texttt{eqexam.def}/\textsf{exerquiz}.
+% \begin{macrocode}
+\def\vspacewithkeyOn{\keepdeclaredvspacingtrue}
+\def\vspacewithkeyOff{\keepdeclaredvspacingfalse}
+% \end{macrocode}
+% \end{macro}
+% \end{macro}
+%\DescribeMacro{\displayPointsOn}\cmd{\displayPointsOn} displays the points, if not otherwise
+% overridden and the command \DescribeMacro{\displayPointsOff}\cmd{\displayPointsOff} turns off the
+% display of points. In either case, points are calculated.
+% \begin{macrocode}
+\newif\ifdispl@yPoints\displ@yPointstrue
+\newcommand{\displayPointsOn}{\displ@yPointstrue}
+\newcommand{\displayPointsOff}{\displ@yPointsfalse}
+\newif\ifl@stDispl@yPoints\l@stDispl@yPointsfalse
+% \end{macrocode}
+% \begin{macro}{\encloseProblemsWith}
+%\changes{v1.7b}{2007/21/07}
+%{%
+% Added \cs{encloseProblemsWith} to support the \texttt{solutionsonly} option
+%}
+% \cs{encloseProblemsWith} to support the \texttt{solutionsonly} option
+% \begin{macrocode}
+\def\encloseProblemsWith#1{%
+ \ifsolutionsonly\excludecomment{#1}\else
+ \includecomment{#1}\fi
+}
+% \end{macrocode}
+% \end{macro}
+% \section{Colors}
+% \begin{macro}{\proofingsymbolColor}
+% \begin{macro}{\instructionsColor}
+% \begin{macro}{\eqCommentsColor}
+% \begin{macro}{\universityColor}
+% \begin{macro}{\titleColor}
+% \begin{macro}{\authorColor}
+% \begin{macro}{\subjectColor}
+% \begin{macro}{\linkcolor}
+% \begin{macro}{\nolinkcolor}
+% \begin{macro}{\fillinColor}
+% \begin{macro}{\forceNoColor}
+% \begin{macro}{\eqEndExamTotalColor}
+% Here we list commands for controlling colors. There are some other
+% colors defined in the stand alone code.
+% \changes{v1.6e}{2006/05/07}
+% {
+% Added easy user access to various colors, \cs{proofing\-symbol\-Color},
+% \cs{instructionsColor}, \cs{eqCommentsColor}, \cs{authorColor},
+% \cs{title\-Color}, \cs{universityColor} and \cs{subjectColor}
+% }
+% \begin{macrocode}
+\providecommand{\proofingsymbolColor}[1]{\def\@proofingsymbolColor{#1}}
+\proofingsymbolColor{red}
+\providecommand{\instructionsColor}[1]{\def\@instructionsColor{#1}}
+\instructionsColor{blue}
+\providecommand{\eqCommentsColor}[1]{\def\@eqCommentsColor{#1}}
+\eqCommentsColor{blue}
+\providecommand{\eqCommentsColorBody}[1]{\def\@eqCommentsColorBody{#1}}
+\eqCommentsColorBody{black}
+\providecommand{\universityColor}[1]{\def\webuniversity@color{#1}}
+\universityColor{blue}
+\providecommand{\titleColor}[1]{\def\webtitle@color{#1}}
+\titleColor{black}
+\providecommand{\authorColor}[1]{\def\webauthor@color{#1}}
+\authorColor{black}
+\providecommand{\subjectColor}[1]{\def\websubject@color{#1}}
+\subjectColor{blue}
+\providecommand{\linkcolor}[1]{\def\@linkcolor{#1}}
+\linkcolor{blue}
+\providecommand{\nolinkcolor}[1]{\def\@nolinkcolor{#1}}
+\nolinkcolor{black}
+\providecommand{\eqEndExamTotalColor}[1]{\def\endexamtotal@color{#1}}
+\eqEndExamTotalColor{black}
+\newcommand\fillinColor[1]{\def\eq@fillinColor{#1}}\fillinColor{red}
+\providecommand{\sectionColor}[1]{\def\web@sectionsColorOld{#1}
+ \def\aeb@sectioncolor{#1}}
+\sectionColor{blue}
+\newcommand{\forceNoColor}{%
+ \proofingsymbolColor{black}\instructionsColor{black}
+ \eqCommentsColor{black}\universityColor{black}
+ \titleColor{black}\authorColor{black}
+ \subjectColor{black}\linkcolor{black}
+ \nolinkcolor{black}\fillinColor{black}
+ \eqEndExamTotalColor{black}
+ \if\load@web\eqe@YES\sectionColor{black}\fi
+}
+% \end{macrocode}
+% \end{macro}
+% \end{macro}
+% \end{macro}
+% \end{macro}
+% \end{macro}
+% \end{macro}
+% \end{macro}
+% \end{macro}
+% \end{macro}
+% \end{macro}
+% \end{macro}
+% \end{macro}
+% \section{Version Control}
+% Here are some simple macros use to create two versions,
+% version A and version B, of the same test.
+% \begin{macro}{\examNum}
+% Convenience macro for holding the exam number. It sets the
+% value of \cs{nExam}.
+% \begin{macrocode}
+\def\examNum#1{\def\nExam{#1}}
+\examNum{1}
+% \end{macrocode}
+% \end{macro}
+% \begin{macro}{\Exam}
+% \begin{macro}{\sExam}
+% Convenience macros for titling the exam. Usage:
+%\begin{verbatim}
+%\VersionAtext{Test~\nExam--Version A}
+%\VersionBtext{Test~\nExam--Version B}
+%\shortVersionAtext{T\nExam A}
+%\shortVersionBtext{T\nExam B}
+%
+%\examNum{1}
+%\forVersion{c}
+%\subject[C3]{Calculus III}
+%\title[\sExam]{\Exam}
+%\author{Dr.\ D. P. Story}
+%\end{verbatim}
+% These next two definitions are overwritten by the two
+% commands \cs{longTitleText} and \cs{shortTitleText}.
+% \begin{macrocode}
+\def\Exam{\ifAB{\eq@VersionAtext}{\eq@VersionBtext}}
+\def\sExam{\ifAB{\eq@shortVersionAtext}{\eq@shortVersionBtext}}
+% \end{macrocode}
+% \end{macro}
+% \end{macro}
+% \begin{macro}{\VersionAtext}
+% \begin{macro}{\VersionBtext}
+% \begin{macro}{\shortVersionAtext}
+% \begin{macro}{\shortVersionBtext}
+% Convenience macros for entering the text for the title, long and short
+% for versions A and B.
+% \begin{macrocode}
+\def\VersionAtext#1{\def\eq@VersionAtext{#1}}
+\def\VersionBtext#1{\def\eq@VersionBtext{#1}}
+\def\shortVersionAtext#1{\def\eq@shortVersionAtext{#1}}
+\def\shortVersionBtext#1{\def\eq@shortVersionBtext{#1}}
+\VersionAtext{Exam~\nExam--Version A}
+\VersionBtext{Exam~\nExam--Version B}
+\shortVersionAtext{Exam~\nExam A}
+\shortVersionBtext{Exam~\nExam B}
+% \end{macrocode}
+% \end{macro}
+% \end{macro}
+% \end{macro}
+% \end{macro}
+% In this section we introduce a new set of commands that supersedes
+% the commands defined above. Those commands were limited to only
+% two versions. The ones below can handle up to $26$ versions.
+% \begin{macrocode}
+\newtoks\eqtemptokena
+\newtoks\eqtemptokenb
+% \end{macrocode}
+% \begin{macro}{\numVersions}
+% In the preamble, declare the number of versions for this document
+% using \cs{numVersions}, e.g., |\numVersions{3}|. This sets the value
+% of \cs{eq@nVersions}
+% \begin{macrocode}
+\def\numVersions#1{\ifnum#1>26\def\eq@nVersions{26}%
+ \PackageWarning{eqexam}{The value of \string\numVersions\space is
+ too large. \MessageBreak Choose a natural number less than 27}
+ \else\def\eq@nVersions{#1}\fi}
+% \end{macrocode}
+% \end{macro}
+% \begin{macro}{\longTitleText}
+% \begin{macro}{\endlongTitleText}
+% \begin{macro}{\shortTitleText}
+% \begin{macro}{\endshortTitleText}
+% 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}
+% 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
+% \cs{numVersions}.
+%
+% If there are more titles than what is declared, the rest are absorbed (gobbled).
+% If there are fewer titles than declared, a {\LaTeX} package error is generated,
+% and substitute titles are generated.
+% \changes{v1.9f}{2009/10/06}
+% {
+% Modified \cs{longTitleText}, \cs{shortTitleText} to have an optional
+% argument (A--Z;a--z). You can select a particular title from a list
+% of titles. If no optional argument is passed, then the title determined
+% by \cs{forVersion} is used.
+% }
+% Modified \cs{longTitleText} and \cs{shortTitleText} to have an optional
+% argument (A--Z;a--z). You can select a particular title from a list
+% of titles. If no optional argument is passed, then the title determined
+% by \cs{forVersion} is used.
+% \begin{macrocode}
+\newcommand{\longTitleText}[1][]{%
+ \ifeqglobalversion\let\eq@selectedVersion@save\eq@selectedVersion
+ \else\let\eq@selectedVersion@save\relax\fi
+ \uppercase{\def\eqe@localTextTitle{#1}}%
+ \ifx\eqe@localTextTitle\@empty\else
+ \expandafter\forVersion\expandafter{\eqe@localTextTitle}\fi
+ \eqe@contTitleText{\Exam}{\endlongTitleText}%
+}
+\def\endlongTitleText{l}
+\newcommand{\shortTitleText}[1][]{%
+ \ifeqglobalversion\let\eq@selectedVersion@save\eq@selectedVersion
+ \else\let\eq@selectedVersion@save\relax\fi
+ \uppercase{\def\eqe@localTextTitle{#1}}%
+ \ifx\eqe@localTextTitle\@empty\else
+ \expandafter\forVersion\expandafter{\eqe@localTextTitle}\fi
+ \eqe@contTitleText{\sExam}{\endshortTitleText}%
+}
+\def\endshortTitleText{s}
+% \end{macrocode}
+% Both title commands, above, call this macro which sets the environment
+% for \cs{@gatherTitleText}, which gathers the list of titles.
+% \begin{macrocode}
+\def\eqe@contTitleText#1#2{%
+ \setcounter{eq@count}{0}%
+ \eqtemptokena={}\let\endtitleMarker#2
+ \@gatherTitleText{#1}%
+}
+% \end{macrocode}
+% \end{macro}
+% \end{macro}
+% \end{macro}
+% \end{macro}
+% This command gathers each title and places it as the argument of a
+% \cs{v<LETTTER>} command. These are accumulated in token registers
+% then saved in \cs{Exam} and \cs{sExam}.
+% \begin{macrocode}
+\def\@gatherTitleText#1#2{%
+ \def\eqe@argii{#2}
+ \if\endtitleMarker\eqe@argii
+% \end{macrocode}
+% Encountered the end marker. See if we have collected the
+% correct number of titles declared. If we have collected too
+% few, we note an warning in the log, and create titles.
+% \begin{macrocode}
+ \ifnum\value{eq@count}>\eq@nVersions\let\eqe@next\relax
+ \else\def\eqe@next{\eq@shortTitlesFix{#1}}\fi
+ \else
+ \stepcounter{eq@count}
+ \eqtemptokenb=\expandafter{#2}
+ \xdef#1{\the\eqtemptokena\expandafter\noexpand
+ \csname v\Alph{eq@count}\endcsname{\the\eqtemptokenb}}
+ \xdef\sExam{\the\eqtemptokena\expandafter\noexpand
+ \csname v\Alph{eq@count}\endcsname{\the\eqtemptokenb}}
+ \eqtemptokena=\expandafter{#1}
+ \ifnum\value{eq@count}<\eq@nVersions
+ \def\eqe@next{\@gatherTitleText{#1}}%
+ \else
+ \def\eqe@next{%
+ \if\endtitleMarker\endlongTitleText
+ \expandafter\eqe@absorbTokensLong
+ \else
+ \expandafter\eqe@absorbTokensShort
+ \fi
+ }%
+ \fi
+ \fi
+ \eqe@next
+}
+\long\def\eqe@absorbTokensLong#1\endlongTitleText{%
+ \protected@xdef\Exam{\Exam}\ifx\eq@selectedVersion@save\relax
+ \eqe@offVersion\else\expandafter\forVersion\expandafter
+ {\eq@selectedVersion@save}\fi}
+\long\def\eqe@absorbTokensShort#1\endshortTitleText{%
+ \protected@xdef\sExam{\sExam}\ifx\eq@selectedVersion@save\relax
+ \eqe@offVersion\else\expandafter\forVersion\expandafter
+ {\eq@selectedVersion@save}\fi}
+% \end{macrocode}
+% We have reached \cs{endtitleMarker}, but the count is still less than \cs{eq@nVersions},
+% so we'll warn the user, and create titles for user.
+% \begin{macrocode}
+\def\eq@shortTitlesFix#1{%
+ \PackageWarning{eqexam}{You have defined an insufficient number
+ of titles\MessageBreak for the number of versions declared in
+ \string\numVersions.\MessageBreak Please fix the problem}%
+ \stepcounter{eq@count}%
+ \if\endtitleMarker\endlongTitleText
+ \edef\eqe@tmp{\noexpand\@gatherTitleText{\noexpand#1}
+ {??---Title \# \the\value{eq@count}---??}%
+ \noexpand\endlongTitleText}
+ \else
+ \edef\eqe@tmp{\noexpand\@gatherTitleText{\noexpand#1}
+ {T\#\the\value{eq@count}??}\noexpand\endshortTitleText}
+ \fi
+ \addtocounter{eq@count}{-1}%
+ \eqe@tmp
+}
+% \end{macrocode}
+% Here, we define \cs{ifAB} so that document under the old system
+% still work properly, I hope. Usage of \cs{ifAB} at this point
+% is discouraged.
+% \begin{macrocode}
+\def\ifAB#1#2{\if\eq@selectedVersion A#1%
+ \else\if\eq@selectedVersion B#2\fi\fi}
+\def\eq@replaceToken#1{#1}
+% \end{macrocode}
+% \begin{macro}{\forVersion}
+% Here is the command that does all the work. It creates alternate
+% text macros for each of the versions declared using \cs{numVersions}.
+%
+% 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}
+% 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}
+%\numVersions{3}
+%\forVersion{b}
+%...
+%\begin{document}
+%...
+% Solve the equation for $\vA{x}\vB{y}\vC{z}$:
+%\[
+%\begin{verA}
+% 2x + 4 = 7
+%\end{verA}
+%\begin{verB}
+% 5y + 2 = 4
+%\end{verB}
+%\begin{verC}
+% 3z - 2 = 2
+%\end{verC}
+%\]
+%\end{verbatim}
+% \changes{1.6b}{2006/04/03}
+% {
+% Changed the alphabet environments \texttt{A}, \texttt{B}, etc.\ due to a
+% conflict with \cs{S}, the control sequence for the \textsf{amsmath} package
+% for a section: \cs{S} expands to \S. Names changed to \texttt{verA}, \texttt{verB}, etc.
+% }
+% \changes{v1.6f}{2006/10/24}
+% {
+% Fixed a bug in the \cs{eqe@initializeMultiVersions} command, made sure that any
+% already defined comment environments are set to relax.
+% }
+% \begin{macrocode}
+\newif\ifeqglobalversion \eqglobalversionfalse
+\newif\ifeqlocalversion \eqlocalversionfalse
+\newif\if@templocalversion \@templocalversionfalse
+\def\eqe@initializeMultiVersions{%
+ \let\save@message\message\let\message\@gobble
+ \@tfor\eqe@tmp:=ABCDEFGHIJKLMNOPQRSTUVWXYZ\do{%
+ \expandafter\let\csname v\eqe@tmp\endcsname\@gobble
+ \expandafter\excludecomment\expandafter{ver\eqe@tmp}%
+ \expandafter\let\csname Afterver\eqe@tmp Comment\endcsname\relax
+ }\let\message\save@message
+}
+\AtBeginDocument{\let\eqe@initializeMultiVersions\relax}
+% \end{macrocode}
+% (09/10/04) Trying to fix a bug in the case when the version selected is greater
+% then the number of versions available for a given problem; that is, when modular
+% arithmetic occurs (in \cs{selectVersion}).
+% \begin{macrocode}
+\let\eqe@@onVersion\@empty
+\def\eqe@onVersion{\g@addto@macro\eqe@@onVersion}
+\let\eqe@@offVersion\@empty
+\def\eqe@offVersion{\g@addto@macro\eqe@@offVersion}
+\let\eqe@@holdTemp\@empty
+\def\eqe@holdTemp{\g@addto@macro\eqe@@holdTemp}
+% \end{macrocode}
+% Two commands to turn on and off versions (the \cs{v<LETTER>} and the \texttt{ver<LETTER>}
+% environment).
+%
+% Throughout the definitions below, we use \cs{csarg}, a command that is defined in the
+% \textsf{comment} package.
+% \begin{macrocode}
+\def\eqe@showArg#1{#1}
+\def\eqe@turnOnComment#1{%
+% \csarg\let{v#1}\@empty
+ \csarg\let{v#1}\eqe@showArg
+ \edef\exp@temp{\noexpand\includecomment{ver#1}}\exp@temp
+}
+\def\eqe@turnOffComment#1{%
+ \csarg\let{v#1}\@gobble
+ \edef\exp@temp{\noexpand\excludecomment{ver#1}}\exp@temp
+ \csarg\let{Afterver#1Comment}\relax
+}
+% \end{macrocode}
+% Finally, the \cs{forVersion} command. \DescribeMacro{\selVersion}\cmd{\selVersion}
+% holds the version selected in upper-case.
+% \begin{macrocode}
+\def\forVersion#1%
+{%
+ \eqe@initializeMultiVersions
+ \let\eqe@@onVersion\@empty
+ \let\eqe@@offVersion\@empty
+ \global\eqglobalversiontrue
+ \setcounter{eq@count}{0}%
+ \uppercase{\edef\eq@selectedVersion{#1}}%
+ \edef\selVersion{\eq@selectedVersion}%
+ \@ifundefined{eq@nVersions}{\PackageInfo{eqexam}{%
+ \string\numVersions\space has not been declared, \MessageBreak
+ taking the number of versions to be 2.}\def\eq@nVersions{2}}{}%
+ \loop
+ \stepcounter{eq@count}%
+ \expandafter\if\Alph{eq@count}\eq@selectedVersion
+ \xdef\eq@nSelectedVersion{\the\value{eq@count}}%
+ \setcounter{eq@count}{27}\fi
+ \ifnum\value{eq@count}<26\repeat
+ \ifnum\eq@nSelectedVersion >\eq@nVersions
+ \PackageError{eqexam}
+ {The value of \string\forVersion
+ \space(\eq@selectedVersion)\MessageBreak
+ exceeds the value of \string\numVersions\space
+ (\eq@nVersions)}%
+ {Decrease the value of \string\forVersion.}%
+ \fi
+ \setcounter{eq@count}{0}%
+ \let\save@message\message\let\message\@gobble
+ \loop
+ \stepcounter{eq@count}%
+ \csarg\let{After\Alph{eq@count}Comment}\relax
+ \lowercase
+ {%
+ \if#1\alph{eq@count}%
+ \eqe@turnOnComment{\Alph{eq@count}}%
+% \end{macrocode}
+% (09/10/04) Save the commands for turning on the version with
+% \cs{eqe@onVersion}, and for turning it off with
+% \cs{eqe@offVeresion}.
+% \begin{macrocode}
+ \edef\temp@exp{\noexpand
+ \eqe@turnOnComment{\Alph{eq@count}}}%
+ \expandafter\eqe@onVersion\expandafter{\temp@exp}%
+ \edef\temp@exp{\noexpand
+ \eqe@turnOffComment{\Alph{eq@count}}}%
+ \expandafter\eqe@offVersion\expandafter{\temp@exp}%
+ \else
+ \eqe@turnOffComment{\Alph{eq@count}}%
+ \fi
+ }%
+ \ifnum\value{eq@count}<\eq@nVersions\repeat
+ \let\message\save@message
+}
+% \end{macrocode}
+% Let us assume version A initially, user with reset this in document.
+%\changes{1.6c}{2006/05/02}
+%{%
+% At the end of the package, set the initial value of \cs{select\-Version} to
+% \string\verb!*+\string\selectVersion{26}+ and set the initial value
+% of \cs{forVersion} to \string\verb!*+\string\forVersion{A}+.
+%}
+% \begin{macrocode}
+\AtEndOfPackage{\numVersions{26}\forVersion{A}%
+ \eq@renditionOptions}
+% \end{macrocode}
+% \end{macro}
+% \begin{macro}{\selectVersion}
+% When an exam has questions in which the number of variations are not all the same,
+% 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}
+%\selectVersion{2}{3}
+%\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}
+% {%
+% added \cs{selectVersion} command, also the command was fixed \cs{forVersion} so that it can be changed
+% within the document, added switches to control new selection.
+% }
+%\changes{v3.7}{2015/02/11}{Worked on the logic}
+% \begin{macrocode}
+\def\selectVersion#1#2{% #1 \le #2
+ \xdef\nLocalSelection{#1}\xdef\nLocalVersions{#2}%
+% \end{macrocode}
+% If obey local version is in effect and the local selection is not empty,
+% no modular arithmetic is needed in the first loop below
+% of \cs{nLocalSelection}.
+% \begin{macrocode}
+ \let\needsModArith\eqe@YES
+ \ifeqobeylocalversion\ifx\nLocalSelection\@empty\else
+ \let\needsModArith\eqe@NO\fi\fi
+% \end{macrocode}
+% When the solutions appear at the end of the document, the version may not match
+% the version for the question. We need to use a private hook defined in
+% \textsf{exerquiz} (and \texttt{eqexam.def}) to reproduce the same settings going into
+% each solution at the end. So, we write the \cs{selectVersion} to the solution
+% file.
+% \begin{macrocode}
+ \edef\exer@solnheadhook{%
+ \string\selectVersion{#1}{#2}}%
+% \end{macrocode}
+% Turn off messaging.
+% \begin{macrocode}
+ \let\save@message\message\let\message\@gobble
+% \end{macrocode}
+% Reset the selected version, the one selected in the preamble. A previous problem
+% may have changed the version due to modular arithmetic.
+% \begin{macrocode}
+ \eqe@@onVersion
+ \ifx\eqe@@holdTemp\@empty\else
+% \end{macrocode}
+% If \cs{eqe@holdTemp} is non-empty, this means that modular
+% arithmetic was performed on the previous problem. We need to turn
+% on the original choice, and turn off the temporary choice, then
+% clear the command \cs{eqe@@holdTemp}.
+% \begin{macrocode}
+ \eqe@@onVersion\eqe@@holdTemp
+ \let\eqe@@holdTemp\@empty
+ \fi
+% \end{macrocode}
+% If \cs{eqglobalversion} is \texttt{true}, then a \cs{forVersion}
+% has been executed. If the number of versions declared by
+% \cs{numVersions} is greater than the number of local versions for
+% this problem, then we perform modular arithmetic to get an
+% appropriate alternative. It may be necessarily to temporarily put
+% \cs{eqobeylocalversion} to true to accomplish, but we use change it
+% back at the end.
+% \begin{macrocode}
+\ifx\needsModArith\eqe@YES
+ \ifeqglobalversion\ifnum\eq@nSelectedVersion>\nLocalVersions
+% \end{macrocode}
+% If we perform modular arithmetic, turn off original choice.
+% \begin{macrocode}
+ \eqe@@offVersion
+% \end{macrocode}
+% Now perform mod arithmetic
+% \begin{macrocode}
+ {\count0=\eq@nSelectedVersion \count2=\count0
+ \advance\count0by-1 \divide\count0by\nLocalVersions
+ \multiply\count0by\nLocalVersions %\count2=\eq@nSelectedVersion
+ \advance\count2by-\count0
+ \xdef\nLocalSelection{\the\count2 }%
+ \ifeqobeylocalversion\else
+ \global\@templocalversiontrue
+ \global\eqobeylocalversiontrue\fi}%
+ \global\let\eqe@@holdTemp\@empty
+ \fi\fi
+\fi
+ \ifeqobeylocalversion
+ \global\eqlocalversiontrue
+ \setcounter{eq@count}{0}%
+% \end{macrocode}
+% If local selection is empty, use the version requested by \cs{forVersion},
+% modular arithmetic may have to be performed.
+% arithmetic to resolve the matter
+% \begin{macrocode}
+ \ifx\nLocalSelection\@empty
+ \def\nLocalSelection{\eq@nSelectedVersion}%
+ \fi
+% \end{macrocode}
+% If local selection exceeds number of local versions, use modular
+% arithmetic to resolve the matter
+% \begin{macrocode}
+ \ifnum\nLocalSelection>\nLocalVersions
+ {\count0=\nLocalSelection
+ \count2=\count0
+ \advance\count0by-1 \divide\count0by\nLocalVersions
+ \multiply\count0by\nLocalVersions
+ \advance\count2by-\count0
+ \xdef\nLocalSelection{\the\count2 }}%
+ \fi
+ \let\save@message\message\let\message\@gobble
+ \loop
+ \stepcounter{eq@count}%
+ \csarg\let{Afterver\Alph{eq@count}Comment}\relax
+ \lowercase
+ {%
+ \ifnum\value{eq@count}=\nLocalSelection
+ \eqe@turnOnComment{\Alph{eq@count}}%
+ \edef\temp@exp{\noexpand
+ \eqe@turnOffComment{\Alph{eq@count}}}%
+ \expandafter\eqe@holdTemp\expandafter{\temp@exp}%
+ \else
+ \eqe@turnOffComment{\Alph{eq@count}}%
+ \fi
+ }%
+ \ifnum\value{eq@count}<\nLocalVersions\repeat
+ \let\message\save@message
+ \fi
+ \if@templocalversion\global\eqobeylocalversionfalse\fi
+% \end{macrocode}
+% added 09/10/03 reset back to default
+% \begin{macrocode}
+ \@templocalversionfalse
+ \let\message\save@message
+}
+% \end{macrocode}
+% \end{macro}
+% \section{Title Definitions from Web}
+% \begin{macro}{\title}
+% \begin{macro}{\subject}
+% \begin{macro}{\author}
+% \begin{macro}{\email}
+% \begin{macro}{\keywords}
+% \begin{macro}{\university}
+% Make Title Definitions taken from the \texttt{Web} package. This is
+% to maintain compatibility with \texttt{Web}.
+% \begin{macrocode}
+\@ifpackageloaded{web}{}{%
+ \@ifpackageloaded{hyperref}{}{\let\texorpdfstring\@firstoftwo}%
+ \let\web@save@title\title
+ \def\title{\@ifnextchar[{\@web@title}{\@web@title[]}}
+ \def\@web@title[#1]#2{\gdef\webtitle{#2}%
+ \@ifundefined{hypersetup}{}{\hypersetup{pdftitle={#2}}}%
+ \def\webArg{#1}\ifx\webArg\@empty\gdef\shortwebtitle{#2}\else
+ \gdef\shortwebtitle{#1}\fi\web@save@title{#2}}
+ \let\web@saved@author\author
+ \def\author#1{\gdef\webauthor{#1}%
+ \@ifundefined{hypersetup}{}{\hypersetup{pdfauthor={#1}}}%
+ \web@saved@author{#1}}
+ \def\subject{\@ifnextchar[{\@subject}{\@subject[]}}
+ \def\@subject[#1]#2{\def\webArg{#1}%
+ \ifx\webArg\@empty\gdef\shortwebsubject{#2}\else
+ \gdef\shortwebsubject{#1}\fi\gdef\websubject{#2}%
+ \@ifundefined{hypersetup}{}{\hypersetup{pdfsubject={#2}}}}
+ \def\email#1{\gdef\webemail{#1}}
+ \def\keywords#1{\gdef\webkeywords{#1}%
+ \@ifundefined{hypersetup}{}{\hypersetup{pdfkeywords={#1}}}}
+ \def\university#1{\gdef\webuniversity{#1}}
+ \def\copyrightyears#1{\gdef\webcopyrightyears{#1}}
+ \def\version#1{\gdef\web@version@value{#1}%
+ \edef\webversion{\ifx\web@version@value\@empty\else
+ \noexpand\web@versionlabel\noexpand\
+ \noexpand\web@version@value\fi}%
+ }
+ \let\web@version@value\@empty
+ \def\versionLabel#1{\def\web@versionlabel{#1}}
+ \versionLabel{Version}
+ \def\web@toc{Table of Contents}
+ \def\web@continued{cont.}
+% set some defaults
+ \title{}\author{}\email{}\subject{}\keywords{}\university{}
+ \providecommand{\optionalPageMatter}[2][]{%
+ \def\optionalpagematter{#2}}
+ \def\optionalpagematter{}
+}
+% \end{macrocode}
+% \end{macro}
+% \end{macro}
+% \end{macro}
+% \end{macro}
+% \end{macro}
+% \end{macro}
+% \begin{macro}{\date}
+% {\LaTeX} (\TeX) defines a \cs{date} command that is also used by \textsf{eqexam}.
+% \begin{macrocode}
+\def\duedate#1{\def\theduedate{#1}}
+\duedate{}
+% \end{macrocode}
+% \end{macro}
+% \begin{macro}{\duedate}
+% In addition to these, we also define a \cs{duedate} macro, may be useful for
+% writing assignments with a due date.
+% \begin{macrocode}
+\def\duedate#1{\def\theduedate{#1}}
+\duedate{}
+% \end{macrocode}
+% \end{macro}
+% \begin{macro}{\thisterm}
+% The command \cs{thisterm} can be used in the \cs{date} field to indicate the term
+% of this test, for example, \verb!\date{\thisterm, \the\year}! This command may
+% be redefined to conform to your own academic terms.
+% \begin{macrocode}
+\newcommand\thisterm{%
+% if prior to June (Jan--May)
+ \ifnum\month<6Spring\else
+% if prior to August (June-July)
+ \ifnum\month<8Summer\else
+% August or later; if Sept--Dec
+ \ifnum\month>8Fall\else
+% Month of August; if after 25th
+ \ifnum\day>25Fall\else
+% if it's 25th or earlier in month of August
+ Summer\fi\fi\fi\fi
+}
+% \end{macrocode}
+% \end{macro}
+% \section{Identification Information}
+% We define a series of commands in support of building an exam: Lines to identify
+% the student and his/her student id (SID), the instructors email address, the name of the
+% test and the course.
+%\par\medskip
+%\noindent\DescribeMacro{\eqExamName}\DescribeMacro{\examNameLabel} provides a line for the student to enter his/her name into the
+% exam. The command \cs{examNameLabel} can be used to define the name label, the default
+% is \texttt{Name:}
+%
+% Will insert a text box as well if the \texttt{option} is taken in addition
+% to \texttt{nosolutions} and with \texttt{solutionsafter} not taken.
+% This macro defines \cs{eq@ExamName}, which actually contains the code.
+% The first (optional) parameter is passed to \cs{insTxtFieldIdInfo}, and can be
+% used to change the appearance of the text field created; the second required parameter
+% is the width of the field.
+% \begin{macrocode}
+\newcommand{\examAnsKeyLabel}[1]{%
+ \def\@examAnsKeyLabel{\ifanswerkey\space #1\fi}}
+\examAnsKeyLabel{Answer Key}
+\newcommand\examNameLabel[1]{\gdef\@examNameLabel{#1\@examAnsKeyLabel}}
+\examNameLabel{Name:}
+\newcommand{\idinfoHighlight}[1]{\def\eqe@idinfohl{#1}}
+\idinfoHighlight{\underbar}
+\newcommand\eqExamName[2][]{%
+ \def\eqExamName@argi{#1}\def\eqExamName@argii{#2}}
+\def\eq@ExamName{\bgroup
+ \settowidth\eq@tmplengthA{\@examNameLabel\ }%
+ \@tempdima=\eqExamName@argii\relax
+ \advance\@tempdima by-\eq@tmplengthA
+ \eqe@idinfohl{\makebox[\eqExamName@argii][l]{\@examNameLabel}}%
+ \expandafter\insTxtFieldIdInfo\expandafter[\eqExamName@argi]%
+ {\@tempdima}{IdInfo.Name}\egroup}
+% \end{macrocode}
+% Here we set the field to be a required field with width of $2.25$ inches
+% \begin{macrocode}
+\eqExamName[\Ff\FfRequired]{2.25in}
+% \end{macrocode}
+% \DescribeMacro{\eqSID} provides a line for the student to enter his/her ID number (SID).
+%
+% Will insert a text box as well if the \texttt{option} is taken in addition
+% to \texttt{nosolutions} and with \texttt{solutionsafter} not taken.
+% The first (optional) parameter is passed to \cs{insTxtFieldIdInfo}, and can be
+% used to change the appearance of the text field created; the second required parameter
+% is the width of the field.
+% \begin{macrocode}
+\newcommand\examSIDLabel[1]{\gdef\@examSIDLabel{#1}}
+\examSIDLabel{SID:}
+\newcommand\eqSID[2][]{\def\eqSID@argi{#1}\def\eqSID@argii{#2}}
+\def\eq@SID{\bgroup\settowidth\eq@tmplengthA{\@examSIDLabel\ }%
+ \@tempdima=\eqSID@argii\relax\advance\@tempdima by-\eq@tmplengthA
+ \eqe@idinfohl{\makebox[\eqSID@argii][l]{\@examSIDLabel}}%
+ \expandafter\insTxtFieldIdInfo\expandafter[\eqSID@argi]%
+ {\@tempdima}{IdInfo.SID}\egroup}
+% \end{macrocode}
+% Here we set the field to be a required field with width of $2.25$ inches
+% \begin{macrocode}
+\eqSID[\Ff\FfRequired]{2.25in}
+% \end{macrocode}
+% \DescribeMacro{\eqEmail} provides a line for the student
+% to enter his/her email address. Useful for documents submitted by email, the
+% instructor can reply.
+%
+% Will insert a text box as well if the \texttt{option} is taken in addition
+% to \texttt{nosolutions} and with \texttt{solutionsafter} not taken.
+% The first (optional) parameter is passed to \cs{insTxtFieldIdInfo}, and can be
+% used to change the appearance of the text field created; the second required parameter
+% is the width of the field.
+% \begin{macrocode}
+\newcommand\examEmailLabel[1]{\gdef\@examEmailLabel{#1}}
+\examEmailLabel{Email:}
+\newcommand\eqEmail[2][]{%
+ \def\eqExam@argi{#1}\def\eqEmail@argii{#2}}
+\gdef\eq@Email{\bgroup\settowidth\eq@tmplengthA{\@examEmailLabel\ }%
+ \@tempdima=\eqEmail@argii\relax\advance\@tempdima by-\eq@tmplengthA
+ \underbar{\makebox[\eqEmail@argii][l]{\@examEmailLabel}}%
+ \expandafter\insTxtFieldIdInfo\expandafter[\eqEmail@argi]%
+ {\@tempdima}{IdInfo.email}\egroup}
+% \end{macrocode}
+% Here we set the field to be a field with width of $2.25$ inches. (Not set to be a required field.)
+% \begin{macrocode}
+\eqEmail{2.25in}
+% \end{macrocode}
+% \DescribeMacro{\insTxtFieldIdInfo} The above macros (\cs{eqExamName}, \cs{eqSID} and \cs{eqEmail})
+% all call this macro, which inserts a Acroforms text field if the \texttt{option} is taken in addition
+% to \texttt{nosolutions} and with \texttt{solutionsafter} not taken.
+%
+% The first (optional) parameter is used to change the appearance of the text field.
+% The second parameter is the width of the field, and the third is the field name.
+% \begin{macrocode}
+\def\insTxtFieldIdInfo[#1]#2#3{%
+ \@ifundefined{@quiz}{}{\if\eq@online\eqe@YES
+ \ifeq@nosolutions\ifeq@solutionsafter\else
+ \raisebox{-1bp}{\makebox[0pt][r]{%
+ \textField[\BC{}#1]{#3}{#2}{11bp}}}%
+ \fi\fi\fi
+ }%
+}
+% \end{macrocode}
+% \DescribeMacro{\SubmitInfo} is required when the \texttt{email} option is taken,
+% and should appear in the preamble. The first argument is the URL to the \textsf{eqAttach.asp}
+% code on the server, and the second is the email of the instructor is to receive the results.
+% (Multiple recipients can be specified by separating each with a comma.)
+% \begin{macrocode}
+\def\SubmitInfo#1#2{%
+ \def\EqExam@SubmitURL{#1}\def\@EmailInstr{#2}%
+}
+% \end{macrocode}
+% \DescribeMacro{\EmailCourseName} is used to specify the course name of the course. The default
+% value for this is \cs{websubject}, obtained from the \cs{subject} macro used in the preamble; however,
+% if you want a different name in the email, perhaps with more information included, you can redefine
+% the value using this macro.
+% \begin{macrocode}
+\def\EmailCourseName#1{\def\@EmailCourseName{#1}}
+% \end{macrocode}
+% Here's the default value.
+% \begin{macrocode}
+\EmailCourseName{\websubject}
+% \end{macrocode}
+% \DescribeMacro{\EmailExamName} is used to specify the exam name of the course. The default
+% value for this is \cs{webtitle}, obtained from the \cs{title} macro used in the preamble; however,
+% if you want a different name in the email, perhaps with more information included, you can redefine
+% the value using this macro.
+% (Multiple recipients can be specified by separating each with a comma.)
+% \begin{macrocode}
+\def\EmailExamName#1{\def\@EmailExamName{#1}}
+% \end{macrocode}
+% Here's the default value.
+% \begin{macrocode}
+\EmailExamName{\webtitle}
+% \end{macrocode}
+% \DescribeMacro{\EmailSubject} The document author mail want a custom subject in the email, instead
+% of the standard one. By using this macro, he can design his own email subject.
+% \begin{macrocode}
+\def\EmailSubject#1{\def\@EmailSubject{#1}}
+% \end{macrocode}
+% Here's the default value, which generates no custom subject line.
+% \begin{macrocode}
+\EmailSubject{}
+% \end{macrocode}
+% In this case \textsf{eqAttach.asp} inserts the standard one.
+%\begin{verbatim}
+%Exam Results: \webtitle of \websubject
+%\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}
+% returns a message acknowledging the receipt of the data. \cs{ServerRetnMsg} is used to customize
+% this message.
+% \begin{macrocode}
+\def\ServerRetnMsg#1{\def\@ServerRetnMsg{#1}}
+% \end{macrocode}
+% Here's the default value, which generates no custom return message
+% \begin{macrocode}
+\ServerRetnMsg{}
+% \end{macrocode}
+% \noindent\DescribeMacro{\SubmitButtonLabel} is the label that appears on the submit button.
+% \begin{macrocode}
+\def\SubmitButtonLabel#1{\def\@SubmitButtonLabel{#1}}
+% \end{macrocode}
+% Here's the default value.
+% \begin{macrocode}
+\SubmitButtonLabel{Submit}
+% \end{macrocode}
+% \DescribeMacro{\SubmitButton} is the macro that provides the submit button
+% when the \texttt{email} option is taken. It appears automatically at the top of
+% the first page of the exam, and appears only if \texttt{nosolutions} has has been
+% taken, and \texttt{solutionsafter} has not been taken.
+% \begin{macrocode}
+\let\priorSubmitJS\@gobble
+\let\postSubmitJS\@empty
+\def\SubmitButton
+{%
+ \ifx\use@email\eqe@YES\ifeq@nosolutions\ifeq@solutionsafter\else
+ \makebox[0pt][l]{\pushButton
+ [\CA{\@SubmitButtonLabel}\A{\JS{%
+ var _eqEok2Submit = true;\r
+ var aSubmitFields = new Array("eqexam", "IdInfo");\r
+ \priorSubmitJS\r
+ if(_eqEok2Submit) this.submitForm("\EqExam@SubmitURL",
+ true, false, aSubmitFields);\r
+ \postSubmitJS
+ }}]{Submit}{1.5in}{16bp}}%
+ \makebox[0pt][l]{\textField[\F\FHidden\DV{\@EmailInstr}
+ \V{\@EmailInstr}]{IdInfo.mailTo}{11bp}{11bp}}%
+ \makebox[0pt][l]{\textField[\F\FHidden\DV{\@EmailCourseName}
+ \V{\@EmailCourseName}]{IdInfo.courseName}{11bp}{11bp}}%
+ \makebox[0pt][l]{\textField[\F\FHidden\DV{\@EmailExamName}
+ \V{\@EmailExamName}]{IdInfo.examName}{11bp}{11bp}}%
+ \makebox[0pt][l]{\textField[\F\FHidden\DV{\@EmailSubject}
+ \V{\@EmailSubject}]{IdInfo.subject}{11bp}{11bp}}%
+ \makebox[0pt][l]{\textField[\F\FHidden\DV{\@ServerRetnMsg}
+ \V{\@ServerRetnMsg}]{IdInfo.retnmsg}{11bp}{11bp}}%
+ \fi\fi\fi
+}
+% \end{macrocode}
+% \begin{macrocode}
+\def\thequizno{\if\probstar*\Alph{quizno}\else\alph{quizno}\fi}
+\def\linkContentFormat{%
+ \if\probstar*\Alph{quizno}\else\alph{quizno}\fi}
+\def\linkContentWrapper{(\hfil\linkContentFormat\hfil)}%
+\def\Ans@r@l@Defaults
+{%
+ \BC{}\S{S}\W{1}\Ff{\FfNoToggleToOff}
+ \textSize{12}\textColor{0 g}
+}
+% \end{macrocode}
+% (2014/03/12) Added \verb!\eq@hspanner\ignorespaces!, in the next two commands. Fixes
+% problems with spacing following the choice box.
+% \begin{macrocode}
+\newcommand{\optsRadioBtnf}[1]{\def\eqe@optsRadiof{#1}}
+\newcommand{\optsRadioBtnl}[1]{\def\eqe@optsRadiol{#1}}
+\let\eqe@optsRadiof\@empty\let\eqe@optsRadiol\@empty
+\def\eqExam@Ans@sq@l{\leavevmode
+ \if\eq@listType1\stepcounter{quizno}\else\ifwithsoldoc
+ \stepcounter{quizno}\else\refstepcounter{quizno}\fi\fi
+ \PBS\raggedright\settowidth{\eq@tmplength}{\eq@lw@l}%
+ \sbox{\eq@tmpbox}{\eq@l@l}\eq@tmpdima=\wd\eq@tmpbox
+ \def\link@@Content{\linkContentWrapper}%
+ \hangindent=\eq@tmplength\hangafter=1\relax
+ \edef\fieldName{%
+ \if\probstar*eqexam.\curr@quiz.\theeqquestionnoi.part\thepartno%
+ \else
+ eqexam.\curr@quiz.\theeqquestionnoi%
+ \fi
+ }%
+ \if\eq@online\eqe@YES\relax
+ \makebox[0pt][l]{%
+ \radio@@Button{\presets{\eqe@optsRadiol}}{\fieldName}%
+ {\eq@tmpdima}{\RadioFieldSize}{\Ans@choice\alph{quizno}}%
+ {\eq@protect\A}{\eq@setWidgetProps\eq@l@check@driver}%
+ {\Ans@r@l@Defaults\every@RadioButton\every@qRadioButton}}%
+ \else
+ \edef\@linkcolor{\@nolinkcolor}%
+ \fi
+ \ifeq@nosolutions\edef\@linkcolor{\@nolinkcolor}\fi
+ \textcolor{\@linkcolor}{\makebox[\eq@tmpdima]{\link@@Content}}%
+ \Ans@proofing{\eq@tmpdima}%
+ \eq@hspanner\ignorespaces
+}
+\def\eqExam@Ans@sq@f{\if\eq@listType1\stepcounter{quizno}\else
+ \ifwithsoldoc\stepcounter{quizno}\else\refstepcounter{quizno}\fi\fi
+ \PBS\raggedright\settowidth{\eq@tmplength}{\eq@lw@f}%
+ \eq@tmpdima=\wd\eq@tmpbox%
+ \hangindent=\eq@tmplength\hangafter=1\relax
+ \if\eq@online\eqe@NO\previewtrue
+ \insertGrayLetters
+ \Ans@sq@f@driver
+ \else
+ \ifanswerkey\previewtrue
+ \Ans@sq@f@driver
+ \else
+% \ifallowcircmc
+% \ifx\Bbox\eqe@BboxCirc\symbolchoice{circle}\fi\fi
+ \edef\fieldName{%
+ \if\probstar*eqexam.\curr@quiz.\theeqquestionnoi.%
+ part\thepartno%
+ \else
+ eqexam.\curr@quiz.\theeqquestionnoi%
+ \fi
+ }\insertGrayLetters
+ \radio@@Button{\presets{\eqe@optsRadiof}}%
+ {\fieldName}{\RadioFieldSize}%
+ {\RadioFieldSize}{\Ans@choice\alph{quizno}}{\eq@protect\A}%
+ {\eq@setWidgetProps\eq@RadioCheck@driver}%
+ {\@@Ans@sq@f@Defaults\Ans@sq@f@Actions\every@RadioButton
+ \every@sqRadioButton\insert@circlesymbol}%
+ \fi
+ \fi
+ \Ans@proofing{\RadioFieldSize}%
+ \eq@hspanner\ignorespaces
+}
+\newcommand{\optsCkBxf}[1]{\def\eqe@optscbf{#1}}
+\newcommand{\optsCkBxl}[1]{\def\eqe@optscbl{#1}}
+\let\eqe@optscbl\@empty\let\eqe@optscbf\@empty
+\def\eqExam@Ans@ck@sq@l{\leavevmode
+ \if\eq@listType1\stepcounter{quizno}\else
+ \ifwithsoldoc\stepcounter{quizno}\else\refstepcounter{quizno}\fi\fi
+ \PBS\raggedright\settowidth{\eq@tmplength}{\eq@lw@l}%
+ \sbox{\eq@tmpbox}{\eq@l@l}\eq@tmpdima=\wd\eq@tmpbox
+ \def\link@@Content{\linkContentWrapper}%
+ \hangindent=\eq@tmplength\hangafter=1\relax
+ \edef\fieldName{%
+ \if\probstar*eqexam.\curr@quiz.\theeqquestionnoi.%
+ part\thepartno.\alph{quizno}%
+ \else
+ eqexam.\curr@quiz.\theeqquestionnoi.\alph{quizno}%
+ \fi
+ }%
+ \if\eq@online\eqe@YES\relax
+ \makebox[0pt][l]{\check@@Box{\presets{\eqe@optscbl}}{\fieldName}%
+ {\eq@tmpdima}{\RadioFieldSize}{\Ans@choice\alph{quizno}}%
+ {\eq@protect\A}{\eq@setWidgetProps\eq@l@check@driver}%
+ {\Ans@r@l@Defaults\every@RadioButton\every@qRadioButton}}%
+ \else
+ \edef\@linkcolor{\@nolinkcolor}%
+ \fi
+ \ifeq@nosolutions\def\@linkcolor{\@nolinkcolor}\fi
+ \textcolor{\@linkcolor}{\makebox[\eq@tmpdima]{\link@@Content}}%
+ \Ans@proofing{\eq@tmpdima}%
+ \eq@hspanner\ignorespaces
+}
+\def\eqExam@Ans@ck@sq@f{\if\eq@listType1\stepcounter{quizno}\else
+ \ifwithsoldoc\stepcounter{quizno}\else\refstepcounter{quizno}\fi\fi
+ \PBS\raggedright\settowidth{\eq@tmplength}{\eq@lw@f}%
+ \eq@tmpdima=\wd\eq@tmpbox%
+ \hangindent=\eq@tmplength\hangafter=1\relax
+ \if\eq@online\eqe@NO\previewtrue
+ \insertGrayLetters
+ \Ans@sq@f@driver
+ \else
+ \ifanswerkey\previewtrue
+ \Ans@sq@f@driver
+ \else
+ \edef\fieldName{%
+ \if\probstar*eqexam.\curr@quiz.\theeqquestionnoi.%
+ part\thepartno.\alph{quizno}%
+ \else
+ eqexam.\curr@quiz.\theeqquestionnoi.\alph{quizno}%
+ \fi
+ }\insertGrayLetters
+ \mbox{\check@@Box{\presets{\eqe@optscbf}}{\fieldName}%
+ {\RadioFieldSize}{\RadioFieldSize}%
+ {\Ans@choice\alph{quizno}}{\eq@protect\A}%
+ {\eq@setWidgetProps\eq@RadioCheck@driver}%
+ {\@@Ans@sq@f@Defaults\Ans@sq@f@Actions\every@RadioButton
+ \every@sqRadioButton}}%
+ \fi
+ \fi
+ \Ans@proofing{\RadioFieldSize}%
+ \eq@hspanner\ignorespaces
+}
+% \end{macrocode}
+% \DescribeMacro{\optsMlTextField} is used to pass options to the multiline
+% text field.
+% \begin{macrocode}
+\def\optsMlTextField#1{\def\eqe@optsmltf{#1}}
+\let\eqe@optsmltf\@empty
+\def\eqExamPriorVspace#1{%
+ \edef\fieldName{%
+ \if\probstar*eqexam.\curr@quiz.%
+ \theeqquestionnoi.part\thepartno.solution%
+ \else
+ eqexam.\curr@quiz.\theeqquestionnoi.solution%
+ \fi
+ }%
+ \nobreak\noindent\textField[\BC{}\presets{\eqe@optsmltf}
+ \Ff\FfMultiline]{\fieldName}{\linewidth}{#1}\@gobble
+}
+% \end{macrocode}
+%
+% Test to see if \texttt{exerquiz} is loaded. If not, we input
+% the `stand alone', \texttt{eqalone.def}, followed by \texttt{eqexam.def}. The latter
+% definition file is maintained in \texttt{exerquiz.dtx} under the \texttt{eqexam} option.
+%
+% \begin{macrocode}
+\@ifpackageloaded{exerquiz}{%
+ \let\Ans@sq@l\eqExam@Ans@sq@l
+ \let\Ans@sq@f\eqExam@Ans@sq@f
+ \let\Ans@ck@sq@l\eqExam@Ans@ck@sq@l
+ \let\Ans@ck@sq@f\eqExam@Ans@ck@sq@f
+ \def\eqexheader@wrapper{\makebox[0pt][r]{%
+ \hypertarget{qex.\the@exno}{\eqexheader}}}%
+ \if\eq@online\eqe@YES\relax
+ \newcounter{@cntfillin}%
+ \let\eqPriorVspace\eqExamPriorVspace
+ \fi
+}%
+{%
+ \input{eqalone.def}
+ \input{eqexam.def}
+% \end{macrocode}
+% \changes{v4.9}{2017/03/16}{Updated \string\pkg{eqexam} to reflect changes in \string\texttt{eqexam.def}.}
+% \begin{macrocode}
+ \@ifl@ter{def}{eqexam}{\eqexamdefReq}{}
+ {\PackageWarningNoLine{eqexam}
+ {This version of eqexam requires eqexam.def\MessageBreak
+ dated \eqexamdefReq\space or later}}
+ \def\eqexheader@wrapper{\makebox[0pt][r]{\eqexheader}}
+}
+% \end{macrocode}
+% We wrote \verb!\begin{eqequestions}! to the top of the solutions file (\cs{jobname.sol}.
+% \begin{macrocode}
+%\writeBeginEqeQuestions
+% \end{macrocode}
+% If the \texttt{vspacewithsolns} is in effect, we write solutions to the end of the document.
+% \begin{macrocode}
+\AtBeginDocument{%
+ \ifvspacewithsolns\writeAllAnsAtEnd\else
+ \ifeqfortextbook\writeAllAnsAtEnd\fi\fi
+}
+% \end{macrocode}
+% We execute \cs{vspacewithkeyOff}, which sets \cs{ifkeepdeclaredvspacing} to false,
+% the default behavior of \textsf{eqexam} before the new feature.
+% \begin{macrocode}
+\vspacewithkeyOff
+% \end{macrocode}
+% \begin{macrocode}
+%</package>
+% \end{macrocode}
+% \section{Stand alone Code}
+%
+% \begin{macrocode}
+%<*standalone>
+% \end{macrocode}
+% Now we begin the listing of the stand alone code. This code is necessary if
+% \textsf{exerquiz} has not been loaded, which is the case if there is no \textsf{PDF} options
+% or if the \texttt{pdf} option is taken.
+%
+% Many of the following definitions are given in \texttt{eforms}, which was recently separated
+% from \texttt{exerquiz} and is now maintained as a separate package.
+% \begin{macrocode}
+\ProvidesFile{eqalone.def}
+ [2012/25/01 v3.0t Minimal code used by eqexam (dps)]
+\@ifundefined{eq@tmpbox}{\newsavebox{\eq@tmpbox}}{}% defined in eforms
+\@ifundefined{eq@tmpdima}{\newdimen\eq@tmpdima}{} % defined in eforms
+\def\RadioFieldSize{11bp}
+% \end{macrocode}
+% \begin{macrocode}
+\newdimen\eqcenterWidget
+% \end{macrocode}
+% This macro is used to vertically center the response box on the line. Seems to
+% work well.
+% \begin{macrocode}
+\def\centerWidget
+#1{%
+ \eqcenterWidget=#1
+ \eqcenterWidget=.5\eqcenterWidget
+ \advance\eqcenterWidget by-4bp
+}
+% \end{macrocode}
+% \DescribeMacro{\eqe@Bbox}When the \texttt{preview} option has been used, draw a frame box
+% around the bounding rectangle.
+% \changes{}{2015/06/04}{Added \cs{previewColor}}
+% \DescribeMacro\previewColor\cmd{\previewColor} adds some color to the preview (bounding boxes). The
+% default is \texttt{black}.
+% \begin{macrocode}
+\providecommand\previewColor{black}
+\def\eqe@BboxRect#1#2{\hbox{\color{\previewColor}\vbox{\hrule width #1
+ \hbox to#1{\vrule height#2\hfill\vrule height#2}\vfill\hrule}}}
+\def\useRectForMC{\let\Bbox\eqe@BboxRect}
+\def\selectedMC{\useRectForMC}
+% \end{macrocode}
+% \DescribeMacro{\Rect} is used internally to color a link.
+% \begin{macrocode}
+\def\Rect#1{\textcolor{\@linkcolor}{#1}}
+% \end{macrocode}
+% The auxiliary file \texttt{eqexam.def}, created by \textsf{exerquiz}, writes
+% \DescribeMacro{\ReturnTo}\cs{ReturnTo} to the \textsf{SOL} file
+% in the form \verb!\ReturnTo{page.1}{\mbox{}}!. We want to remove the
+% \cs{mbox} because it causes, at times, more vertical space that is wanted
+% in an exam document.
+% \begin{macrocode}
+\def\eqe@striphbox\mbox#1{#1}
+\newcommand{\ReturnTo}[2]{\eq@fititin{\eqe@striphbox#2}}
+% \end{macrocode}
+%\section{Switching proofing symbols}
+% \DescribeMacro{\proofingsymbol} The definition of the proofing symbol, this
+% symbol marks the correct answer of a multiple choice question when the
+% \texttt{proofing} option is used.
+% \begin{macrocode}
+\newcommand{\proofingsymbol}[1]{%
+ \def\@proofingsymbol{\textcolor{\@proofingsymbolColor}{#1}}}
+% \end{macrocode}
+% This is the answers macro for the link-style and is called from the \texttt{eqexam.def} file.
+% \begin{macrocode}
+%</standalone>
+% \end{macrocode}
+% \begin{macrocode}
+%<*package>
+% \end{macrocode}
+% In response to the \texttt{allowcircmc}, we load \texttt{lcircle10} and use the `h' and `x'
+% glyph.
+% \begin{macrocode}
+\def\selectedMC{\useRectForMC}
+\ifallowcircmc
+ \font\eqe@lcir=lcircle10 at 12pt
+ \bgroup
+% \end{macrocode}
+% Get the width of the `h', the circle has zero height and depth. Set the
+% diameter and radius of the circle.
+% \begin{macrocode}
+ \setbox0=\hbox{\eqe@lcir h}
+ \xdef\eqe@cirDiam{\the\wd0}
+ \@tempdima=.5\wd0
+ \xdef\eqe@cirRadius{\the\@tempdima}
+ \egroup
+% \end{macrocode}
+% A command to use the circle (h) and the filled circle (x).
+% \begin{macrocode}
+ \def\circ@Glyph#1#2{\hbox{\smash{\raisebox{\eqe@cirRadius}%
+ {\makebox[\eqe@cirDiam]{\llap{\rlap{\eqe@lcir#1}%
+ \hskip#2\relax}}}}}}
+% \end{macrocode}
+% Added preview color to the circle version of the bounding box. The color
+% accessed through \cs{previewColor}, its default is \texttt{black}.
+% \begin{macrocode}
+ \def\eqe@BboxCirc#1#2{\hbox{%
+ \textcolor{\previewColor}{\circ@Glyph{h}{0pt}}}}
+% \end{macrocode}
+% For proofing purposes, prepare the filled circle in the form of the command
+% \cs{circProofingForCirc}.
+% \begin{macrocode}
+ \def\circProofingForCirc{\centerWidget\RadioFieldSize
+ \lower\eqcenterWidget\circ@Glyph{x}{1.4pt}}
+ \if\eq@online\eqe@YES
+% \end{macrocode}
+% If online (\texttt{online} or \texttt{email} option), we cancel these commands.
+% \begin{macrocode}
+ \def\useCircForMC{\let\Bbox\eqe@BboxCirc\useMCCircles}
+ \def\selectedMC{\useCircForMC}
+ \@ifundefined{eqe@BboxRect}
+ {\def\useRectForMC{\let\Bbox\ef@Bbox\useMCRects}}
+ {\def\useRectForMC{\let\Bbox\eqe@BboxRect\useMCRects}}
+% \let\useRectForMC\relax
+ \else % if not online
+ \@ifundefined{eqe@BboxRect}
+ {\def\useRectForMC{\let\Bbox\ef@Bbox}}
+ {\def\useRectForMC{\let\Bbox\eqe@BboxRect}}
+ \def\useCircForMC{\let\Bbox\eqe@BboxCirc}
+ \def\selectedMC{\useCircForMC}
+ \fi
+ \def\useCircForProof{\symbolchoice{circle}%
+ \proofingsymbol{\circProofingForCirc}}
+\else
+% \end{macrocode}
+% If \texttt{allowcircmc} is not taken
+% \begin{macrocode}
+ \if\eq@online\eqe@YES
+ \def\useCircForMC{\let\Bbox\eqe@BboxCirc\useMCCircles}
+ \@ifundefined{eqe@BboxRect}
+ {\def\useRectForMC{\let\Bbox\ef@Bbox\useMCRects}}
+ {\def\useRectForMC{\let\Bbox\eqe@BboxRect\useMCRects}}
+ \else
+ \@ifundefined{eqe@BboxRect}
+ {\def\useRectForMC{\let\Bbox\ef@Bbox}}
+ {\def\useRectForMC{\let\Bbox\eqe@BboxRect}}
+ \def\useCircForMC{\useRectForMC}
+ \def\selectedMC{\useRectForMC}
+ \fi
+ \let\useCircForProof\relax
+\fi
+% \end{macrocode}
+%\DescribeMacro{\useRectForMS}\cmd{\useRectForMS} When declared, rectangles are
+% used for multiple selection, similarly, \DescribeMacro{\useCircForMS}\cmd{\useCircForMS}
+% uses circles if \texttt{allowcirc4mc} is in effect.
+% \begin{macrocode}
+\newif\ifuserectforms
+\def\useRectForMS{\userectformstrue}
+\def\useCircForMS{\userectformsfalse}
+% \end{macrocode}
+% \changes{v3.1e}{2012/11/10}{Changed default for \cs{proofingsymbol}}
+% \begin{macrocode}
+\newcommand{\useCheckForProof}{\symbolchoice{check}%
+ \proofingsymbol{\ding{52}}}
+\useCheckForProof
+% \end{macrocode}
+% Similarly, for a cross, we get a nice `handwritten' cross \verb!\ding{56}!, !when we latex
+% the document; for the \texttt{online} or \texttt{email} option, we get a simple cross in the
+% active radio button field.
+% \begin{macrocode}
+\newcommand{\useCrossForProof}{\symbolchoice{cross}%
+ \proofingsymbol{\raisebox{-1pt}{\rlap{\kern-1pt\Large\ding{56}}}}}
+% \end{macrocode}
+%
+% \section{The Main Code}
+% We now continue with the main package. Mostly, we define macros specific to the
+% \texttt{eqexam} package: define the \texttt{problem} and \texttt{problem*} environments,
+% macros for calculating totals per page, etc.
+%
+% \begin{macrocode}
+\def\MCcolor{black}
+\def\Ans@sq@l@driver{\edef\@linkcolor{\MCcolor}%
+ \Rect{\makebox[\eq@tmpdima]{\linkContentWrapper}}%
+ \Ans@proofing{\eq@tmpdima}%
+}
+% \end{macrocode}
+% This is the answers macro for the form-style and is called from the \texttt{eqexam.def} file.
+% \begin{macrocode}
+\def\Ans@sq@f@driver{%
+ \centerWidget\RadioFieldSize
+ \leavevmode\lower\eqcenterWidget\Bbox %\eqe@Bbox
+ {\RadioFieldSize}{\RadioFieldSize}%
+ \Ans@proofing{\RadioFieldSize}%
+}
+% \end{macrocode}
+% Write quiz solutions to the exercise solutions file
+% \begin{macrocode}
+\def\eq@sqsllabel{\string\textbf{Solution to Quiz:}}
+\def\sqsllabel{\eq@sqsllabel}
+% \end{macrocode}
+% \begin{macro}{\writeToSolnFile}
+% General purpose command for writing to the solution file.
+% \begin{macro}{\preExamSolnHead}
+% Executed just before a user friendly name
+% \begin{macro}{\examSolnHeadFmt}
+% Format for the user friendly name
+% \begin{macro}{\postExamSolnHead}
+% Executed just after a user friendly name
+% \begin{macrocode}
+\let\quiz@solns\ex@solns
+\newcommand{\preExamSolnHead}{\goodbreak\noindent}
+\newcommand{\examSolnHeadFmt}[1]{\textbf{#1}}
+\newcommand{\postExamSolnHead}{\par\medskip}
+\newcommand{\writeToSolnFile}[1]{%
+ \let\quiz@solns\ex@solns
+ \set@display@protect
+ \eqe@IWO\quiz@solns{#1}%
+ \set@typeset@protect
+}
+% \end{macrocode}
+% We will write all solutions to the \texttt{.sol} auxiliary file.
+% \begin{macrocode}
+\def\eqe@writetoSolns#1{%
+ \set@display@protect
+ \eqe@IWO\quiz@solns{\string\preExamSolnHead
+ \string\examSolnHeadFmt{#1}\string\postExamSolnHead}%
+ \set@typeset@protect
+}
+\def\eqe@writetoAux#1{%
+ \set@display@protect
+ \eqe@IWO\@auxout{#1}%
+ \set@typeset@protect
+}
+% \end{macrocode}
+% \end{macro}
+% \end{macro}
+% \end{macro}
+% \end{macro}
+% Turn off interactivity of short quiz.
+\def\Ans@sq@l@Actions{}
+\def\Ans@sq@f@Actions{}
+% \begin{macrocode}
+% \end{macrocode}
+% This macro is defined in \texttt{exerquiz}, but has a little different definition for \textsf{eqexam}.
+% \begin{macrocode}
+\def\Ans@proofing
+#1{%
+ \ifeq@proofing\if\Ans@choice1\relax
+ \llap{\rlap{\,\@proofingsymbol}\hskip#1\relax}%
+ \fi\fi
+}
+% \end{macrocode}
+% This macro gets the page number of the last page of the exam. It is read in through
+% a macro definition made and written to the \texttt{.aux} file.
+% \begin{macrocode}
+\def\eq@ExamLastPage{\csname eqExamLastPage\endcsname}
+\newcommand{\nPagesOnExam}{\csname eqExamLastPage\endcsname}
+\newcommand{\nPagesOfQues}{\ifvspacewithsolns
+ \csname eqExamQuesLastPage\endcsname\else
+ \csname eqExamLastPage\endcsname\fi}
+\newcommand{\nPagesOfSols}{\def\eqExamNumPagesSolns{0}%
+ \csarg\ifx{eqExamLastPage}\relax\else
+ \csarg\ifx{eqExamLastPage}\relax\else
+ {\count\z@=\nPagesOnExam\relax\advance
+ \count\z@-\nPagesOfQues\relax
+ \xdef\eqExamNumPagesSolns{\the\count\z@}}\fi\fi
+ \eqExamNumPagesSolns
+}
+% \end{macrocode}
+% \begin{macro}{\lastPageOfExam}
+%\changes{v2.0l}{2011/05/05}{%
+% Returns the page number of the end of the exam with a given name.
+%}
+% Returns the page number of the end of the exam with a name of \texttt{\#1}.
+% \begin{macro}{\firstPageOfExam}
+%\changes{v2.0l}{2011/05/05}{%
+% Returns the page number of the beginning of the exam with a given name.
+%}
+% Returns the page number of the beginning of the exam with a name of \texttt{\#1}.
+% \begin{macrocode}
+\newcommand{\lastPageOfExam}[1]{\pageref{#1PageEnd}}
+\newcommand{\firstPageOfExam}[1]{\pageref{#1PageBegin}}
+% \end{macrocode}
+% \end{macro}
+% \end{macro}
+% The last two commands are meant to produce typeset numbers; however, there
+% is a need to convert these to numbers that tex's registers can manipulate.
+% Here goes. \DescribeMacro{\eqe@defNumRefii}\cmd{\eqe@defNumRefii} takes
+% its argument and strips away the other arguments of \cs{pageref}; it picks
+% off the second of two or five, depending if \textsf{hyperref} is loaded.
+% It defines a macro |\csname nRefii@#1\endcsname| whose value is a page
+% number of the referenced object.
+% \begin{macrocode}
+\newcommand{\eqe@defNumRefii}[1]{%
+ \@ifundefined{hyperref}{\let\@getsecondOf\@secondoftwo}
+ {\let\@getsecondOf\@secondoffive}%
+ \@ifundefined{r@#1}{%
+% \end{macrocode}
+% If the reference \texttt{r@\#1} is undefined, define the value to be 0
+% \begin{macrocode}
+ \csarg\gdef{nRefii@#1}{0}}{%
+% \end{macrocode}
+% If the reference \texttt{r@\#1} is defined, define the value to be
+% the second argument of \cs{r@\#1} expanded
+% \begin{macrocode}
+ \expandafter\xdef\csname nRefii@#1\endcsname
+ {\expandafter\expandafter\expandafter
+ \@getsecondOf\csname r@#1\endcsname}%
+ }%
+}
+% \end{macrocode}
+% \DescribeMacro{\eqe@numRefii} takes one argument, the control
+% name. Its value is zero or \cs{nRefii@\#1}. This expands to a number
+% in all cases. It can be used in tex comparisons.
+% \begin{macrocode}
+\def\eqe@numRefii#1{%
+ \csarg\ifx{nRefii@#1}\relax 0\else
+ \@nameuse{nRefii@#1}\fi}
+% \end{macrocode}
+% \begin{macro}{\numLastPageOfExam}
+% \begin{macro}{\numFirstPageOfExam}
+% 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{macrocode}
+\newcommand{\numLastPageOfExam}[1]{\eqe@numRefii{#1PageEnd}}
+\newcommand{\numFirstPageOfExam}[1]{\eqe@numRefii{#1PageBegin}}
+% \end{macrocode}
+% \end{macro}
+% \end{macro}
+% \begin{macrocode}
+\newcommand{\makeRefsNums}{%
+ \@ifundefined{thePartNames}{}{\begingroup
+ \def\\##1{\typeout{processing ##1}%
+ \eqe@defNumRefii
+ {##1PageEnd}\eqe@defNumRefii{##1PageBegin}}%
+ \thePartNames
+ \endgroup}%
+}
+% \end{macrocode}
+% \begin{macrocode}
+\AtBeginDocument{\makeRefsNums}
+% \end{macrocode}
+% \subsection{Running Heads and Feet}
+% We develop a series of macros for creating running headers and footers for the exam.
+% \begin{macro}{\lheadeqe}
+% \begin{macro}{\cheadeqe}
+% \begin{macro}{\rheadeqe}
+%\changes{2.0a}{2010/05/06}{
+% Changed the definitions of \cs{lhead}, \cs{chead}, and \cs{rhead} so they don't clash
+% with the \textsf{fancyhdr} package. If \textsf{fancyhdr} is not loaded at the time \textsf{eqexam} is loaded, we
+% \cs{let} the old names to the new names. Therefore, when \textsf{fancyhdr} is loaded first use
+% the new definitions.
+%}
+% Set the left, center, and right running headers.
+% \begin{macrocode}
+\newcommand{\lheadeqe}[1]{\def\eq@lhead{#1}}
+\lheadeqe{\shortwebsubject/\shortwebtitle}
+\newcommand{\cheadeqe}[1]{\def\eq@chead{#1}}
+\cheadeqe{-- Page \arabic{page} of {\nPagesOnExam} --}
+\newcommand{\rheadeqe}[1]{\def\eq@rhead{#1}}
+% \end{macrocode}
+% The default is \cs{eq@ExamName}, which is defined by \cs{eqExamName}, the default displays the word \texttt{"Name"}
+% and an underlined horizontal space for the student to enter his/her name.
+% \begin{macrocode}
+\rheadeqe{\eq@ExamName}
+% \end{macrocode}
+% \begin{macro}{\lhead}
+% \begin{macro}{\chead}
+% \begin{macro}{\rhead}
+% These are the original names for the headers, we'll keep them if
+% \textsf{fancyhdr} is not already loaded to maintain compatibility
+% with previous versions of \textsf{eqexam}. The use of these commands
+% is \emph{discouraged}.
+% \begin{macrocode}
+\@ifpackageloaded{fancyhdr}{}{%
+ \let\lhead\lheadeqe
+ \let\chead\cheadeqe
+ \let\rhead\rheadeqe
+}
+% \end{macrocode}
+% \end{macro}
+% \end{macro}
+% \end{macro}
+% \end{macro}
+% \begin{macro}{\runExamHeader}
+% \begin{macro}{\eqExamRunHead}
+% The running header of the exam, may be redefined.
+% \begin{macrocode}
+\newcommand{\runExamHeader}{\eq@lhead\hfill\eq@chead\hfill\eq@rhead}
+\newcommand\eqExamRunHead{%
+ \addtolength\textwidth{\oddsidemargin}%
+ \noindent\hspace*{-\oddsidemargin}\makebox[\textwidth]
+ {\runExamHeader}%
+}
+% \end{macrocode}
+% \end{macro}
+% \end{macro}
+% \paragraph*{Running footers.}
+% One or two users wanted to use running footers, so
+% here they are.
+% \begin{macro}{\lfooteqe}
+% \begin{macro}{\cfooteqe}
+% \begin{macro}{\rfooteqe}
+% There has been some demand for running footers. You have to be
+% a little careful, \textsf{eqexam} uses the footer for the
+% command \cmd{\settotalsbox}, which puts in the totals for the pages
+% either on the left (\texttt{totalsonleft}) or right (\texttt{totalsonright}) side, depending on the option.
+% \begin{macrocode}
+\newcommand{\lfooteqe}[1]{\def\eq@lfoot{#1}}
+\lfooteqe{}
+\newcommand{\cfooteqe}[1]{\def\eq@cfoot{#1}}
+\cfooteqe{}
+\newcommand{\rfooteqe}[1]{\def\eq@rfoot{#1}}
+\rfooteqe{}
+% \end{macrocode}
+% \DescribeMacro{\runExamFooter}Considering the defaults for the left, center, and right footer elements,
+% the default footer contributes nothing, except inserting
+% \cmd{\settotalsbox} (see the definition of \cs{@oddfoot})
+% \begin{macrocode}
+\newcommand{\runExamFooter}{\eq@lfoot\hfill\eq@cfoot\hfill\eq@rfoot}
+% \end{macrocode}
+% \end{macro}
+% \end{macro}
+% \end{macro}
+% \end{macro}
+% \end{macro}
+% \paragraph*{Running headers for solutions.}
+% We provide a special set of headers for the solution pages.
+% The document author needs to manage running footers for the solution
+% pages.
+% \begin{macro}{\lheadSol}
+% \begin{macro}{\cheadSol}
+% \begin{macro}{\rheadSol}
+% \begin{macro}{\runExamHeaderSol}
+% \begin{macro}{\eqsolutionshook}
+% The running header of the exam, when solutions are included at the end of
+% the document, perhaps for posting the solutions to the exam, or
+% publication of a ``pretest''. Note that \cs{eqsolutionshook} is defined
+% in \texttt{exerquiz/eqexam.def}. May be redefined.
+% \begin{macrocode}
+\newcommand{\lheadSol}[1]{\def\eq@lheadSol{#1}}
+\lheadSol{\shortwebsubject/\shortwebtitle}
+\newcommand{\cheadSol}[1]{\def\eq@cheadSol{#1}}
+\cheadSol{-- Page \arabic{page} of {\eq@ExamLastPage} --}
+\newcommand{\rheadSol}[1]{\def\eq@rheadSol{#1}}
+\rheadSol{SOLUTIONS}
+% \end{macrocode}
+% The \cs{runExamHeaderSol} distributes the three solution headers across
+% the page.
+% \begin{macrocode}
+\newcommand{\runExamHeaderSol}
+ {\eq@lheadSol\hfill\eq@cheadSol\hfill\eq@rheadSol}
+% \end{macrocode}
+% The solutions headers are inserted using the \cs{eq@solutionshook}, see
+% the definition of \cmd{\exerSolnInput}.
+% \begin{macrocode}
+\def\eq@solutionshook
+{%
+ \gdef\eqExamRunHead{\addtolength\textwidth{\oddsidemargin}%
+ \noindent\hspace*{-\oddsidemargin}\makebox[\textwidth]
+ {\runExamHeaderSol}}%
+}
+% \end{macrocode}
+% \end{macro}
+% \end{macro}
+% \end{macro}
+% \end{macro}
+% \end{macro}
+% \subsection{\texorpdfstring{\protect\cs{maketitle}}{\textbackslash{maketitle}} definitions}
+% \begin{macro}{\maketitle}
+% \begin{macro}{\maketitledesign}
+% \begin{macro}{\altTitle}
+% Standard {\LaTeX} macro, but this time it is used to create the header at the top of the first
+% page of the exam. Typically, consisting of two rows of info. (1) first row has course name, exam name, and
+% a place for the student to put his/her name. (2) second row has date and instructor. May be redefined.
+%
+% Modify the title by redefining \cs{maketitledesign}, the \cs{maketitle} command
+% itself has {\LaTeX} commands in it that should not be changed.
+% \changes{v1.6i}{2007/09/18}
+%{
+% Added the command \cs{altTitle} as an alternate title for the exam
+% document. This alternate title appear centered under the title
+% of the document.
+%}
+% \begin{macrocode}
+\newcommand\maketitledesign
+{%
+ \makebox[\textwidth]{\normalsize
+ \shortstack[l]{\strut\websubject\\\@date}\hfill
+ \shortstack[c]{\webtitle\\\strut\@altTitle}\hfill
+ \shortstack[l]{\strut\eq@ExamName\\\webauthor}}%
+}
+\def\altTitle#1{\def\@altTitle{#1}}
+\let\@altTitle\@empty
+\def\eqemaketitle
+{%
+% \end{macrocode}
+% \cs{EQEcalculateAllTotals}: We don't actually calculate all totals, just
+% some of them. We do calculate the grade total of all the \texttt{exam}
+% environments in the document, we also calculate the percentage that each
+% exam contributes to to the total. If \cs{maketitle} is not used, for
+% whatever reason, this command should be calculated explicitly just after
+% |\begin{document}|.
+% \changes{v3.0y}{2012/04/20}{Moved \cs{EQEcalculateAllTotals} from the bottom
+% to the top of \cs{eqemaketitle}. In case the author wants the grand total
+% of the exam in the title, we need to make all calculations before
+% \cs{maketitledesign.}}
+% \begin{macrocode}
+ \EQEcalculateAllTotals
+ \begingroup
+% \addtolength\textwidth{\oddsidemargin}%
+ \noindent%\hspace*{-\oddsidemargin}%
+ \raisebox{.7in}[0pt][0pt]{\SubmitButton}%
+ \maketitledesign
+ \endgroup
+}
+% \end{macrocode}
+% If the \texttt{fortextbook} option is not taken, we set up the usual \cs{maketitle} definition.
+% If the \texttt{useclassmaketitle} option is taken, we don't redefine either.
+% \begin{macrocode}
+\ifeqfortextbook
+ \@ifpackageloaded{web}{\let\maketitle\web@save@maketitle}{}%
+\else
+ \if@eqeuseclassmaketitle
+ \@ifpackageloaded{web}{\let\maketitle\web@save@maketitle}{}%
+ \else
+ \let\maketitle\eqemaketitle
+ \fi
+\fi
+% \end{macrocode}
+% \end{macro}
+% \end{macro}
+% \end{macro}
+% \subsection{The cover page definitions}
+% \begin{macro}{\eqexcoverpage}
+% The \texttt{eqexam} package allows for the possibility of a cover page, if the \texttt{coverpage}
+% option is taken.
+% \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}
+% 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.
+%\changes{v1.9b}{2009/09/29}{Added \cs{placeCoverPageLogo} to insert a logo on the cover page.}
+% \begin{macrocode}
+\newcommand\placeCoverPageLogo[3]{%
+ \def\eqe@insertLogo{\hbox to0pt{%
+ \hspace*{#1}\smash{\raisebox{#2}{#3}}\hss}}}
+\let\eqe@insertLogo\relax
+% \end{macrocode}
+% Define \cs{eqexcoverpage}, this command places \cs{eqe@insertLogo} and
+% \cs{eqex\-cover\-page\-design} in a group. It is this command that gets executed when
+% the user calls for the \texttt{coverpage} option.
+% \begin{macrocode}
+\def\eqexcoverpage{%
+ \begingroup
+ \pagenumbering{roman}
+ \eqe@insertLogo
+ \eqexcoverpagedesign
+ \endgroup\newpage
+ \pagenumbering{arabic}
+}
+% \end{macrocode}
+% \end{macro}
+% \end{macro}
+% \begin{macro}{\eqexcoverpagedesign}
+% The \texttt{eqexam} package allows for the possibility of a cover page,
+% if the \texttt{coverpage} option is taken. This macro can and should be
+% redefined to fit your needs. The definition below is just a
+% representative example.
+% \begin{macro}{\coverpagesubject}
+% \begin{macro}{\coverpageUniversityFmt}
+% \begin{macro}{\coverpageSubjectFmt}
+% \begin{macro}{\coverpageTitleFmt}
+% The following four commands are used with the cover page.
+% The \cs{cover\-page\-sub\-ject} is used to provide a special subject
+% for the cover page, different from \cs{websubject}. The others
+% are used for formatting.
+%\changes{v1.9a}{2009/28/09}{Added these various Fmt commands for coverpage.}
+% \begin{macrocode}
+\newcommand{\coverpagesubject}[1]{\def\coverpage@subject{#1}}
+\let\coverpage@subject\@empty
+\def\eqexamsubject{\ifx\coverpage@subject\@empty\websubject
+ \else\coverpage@subject\fi}
+\newcommand{\coverpageUniversityFmt}[1]{%
+ \def\eqex@coverpageUniversityFmt{#1}}
+\coverpageUniversityFmt{\bfseries\large}
+\newcommand{\coverpageSubjectFmt}[1]{%
+ \def\eqex@coverpageSubjectFmt{#1}}
+\coverpageSubjectFmt{\bfseries\large}
+\newcommand{\coverpageTitleFmt}[1]{%
+ \def\eqex@coverpageTitleFmt{#1}}
+\coverpageTitleFmt{\bfseries\large}
+\newcommand\cpCID[1]{\def\cp@@CID{#1}}
+\let\cp@@CID\@empty
+%\newcommand\coverpageCID[1]{\def\cpCID@argi{#1}}
+\newcommand{\cpSetCIDWidth}[1]{\bgroup\setlength{\@tempdima}{#1}
+ \xdef\cpCID@argi{\the\@tempdima}\egroup}
+\def\cp@CID{\bgroup\settowidth\eq@tmplengthA{\cp@@CID}%
+ \@tempdima=\cpCID@argi\relax
+ \advance\@tempdima-\eq@tmplengthA
+ \eqe@idinfohl{\makebox[\cpCID@argi][l]{\cp@@CID}}\egroup}
+\cpSetCIDWidth{2.25in}
+%\coverpageCID{2.25in}
+% \end{macrocode}
+% \end{macro}
+% \end{macro}
+% \end{macro}
+% \end{macro}
+% When \texttt{coverpage} and \texttt{coverpagesumry} are used, an \textbf{Exam Record}
+% is generated, just a summary may appear beneath the name and ID section of the cover
+% page (\DescribeMacro{\qeSumryVert}\cmd{\qeSumryVert}) or to the right
+% (\DescribeMacro{\eqeSumryHoriz}\cmd{\eqeSumryHoriz}).
+% \begin{macrocode}
+\def\eqeSumryVert{\def\eqe@SumryVert{\par\vfill}%
+ \let\eqe@SumryHoriz\relax
+ \def\eqe@@SumryVert{\vspace{\stretch{-1}}\bigskip}}
+\def\eqeSumryHoriz{\def\eqe@SumryHoriz{\hfill}\let\eqe@SumryVert\relax
+ \let\eqe@@SumryVert\relax}
+% \end{macrocode}
+% The default is a horizontal orientation.
+% \begin{macrocode}
+\eqeSumryHoriz
+% \end{macrocode}
+% We can name the components of the \textbf{Exam Record} by page or by parts. For the case
+% they are named by parts, there are three options: You can used the exam name (the default);
+% you can use the friendly name of the exam (the optional argument), executing
+% \DescribeMacro{\useUIPartNames}\cmd{\useUIPartNames} invokes this option; you can use
+% custom names (useful if the friendly names are too long), execute the command
+% \DescribeMacro{\useCustomPartNames}\cmd{\useCustomPartNames} for this option.
+% \begin{macrocode}
+\def\eqe@coverPageNaming{0}
+\newcommand{\useUIPartNames}{\def\eqe@coverPageNaming{1}}
+\newcommand{\useCustomPartNames}{\def\eqe@coverPageNaming{2}}
+% \end{macrocode}
+% When there is custom naming (\cmd{\customNaming}), we need to provide the user with a
+% way of defining these custom names. \DescribeMacro{\customNaming}\cmd{\customNaming}
+% provides that mechanism. The command takes two arguments, the first is
+% \meta{name}, the exam name, the second is the associated \meta{text} the text that is to appear
+% in the \textbf{Exam Record}
+% \begin{macrocode}
+\newcommand{\customNaming}[2]{\@namedef{userCustom#1}{#2}}
+% \end{macrocode}
+% \begin{macrocode}
+\newcommand{\cpSetNameAndIDWidth}[1]{\bgroup
+ \setlength{\@tempdima}{#1}%
+ \xdef\cp@SetNameAndIDWidth{\the\@tempdima}\egroup}
+\cpSetNameAndIDWidth{.45\textwidth}
+\newcommand{\cpEnclNameAndID}[1]{\def\cp@EnclNameAndID{#1}}
+\let\cp@EnclNameAndID\@empty
+\newcommand{\cpSetHghtFrstLn}[1]{\def\cp@HghtFrstLn{#1}}
+\def\cp@HghtFrstLn{0pt}
+\def\cp@setHghtFrstLn{\rule[\cp@HghtFrstLn]{0pt}{0pt}}
+\newcommand\cpNameAndID{\noindent
+ \edef\eqExamName@argii{\cp@SetNameAndIDWidth}%
+ \edef\eqSID@argii{\cp@SetNameAndIDWidth}%
+ \edef\cpCID@argi{\cp@SetNameAndIDWidth}%
+ \cp@EnclNameAndID{\parbox[b]{\cp@SetNameAndIDWidth}{\parindent0pt
+ \cp@setHghtFrstLn\eq@ExamName\\[2ex]
+ \ifx\cp@@CID\@empty\eq@SID\else\cp@CID\fi\\[2ex]
+ \ifx\use@email\eqe@YES\eq@Email\\[2ex]\fi
+ \textcolor{\webauthor@color}{\webauthor}, \@date\vskip0pt}}}
+% \end{macrocode}
+% Now we present the definition of \cs{eqexcoverpagedesign}.
+% \begin{macrocode}
+\newcommand{\eqexcoverpagedesign}
+{%
+ \begingroup
+ \parindent0pt
+ \thispagestyle{empty}
+% \addtolength\textwidth{\oddsidemargin}
+ \vspace*{.1\textheight}
+ \noindent%\hspace*{-\oddsidemargin}%
+ \makebox[\linewidth]{\parbox{\linewidth}%
+ {\eqex@coverpageUniversityFmt
+ \color{\webuniversity@color}%
+ \centering\webuniversity}}
+ \par\vspace{.1\textheight}
+ \noindent%\hspace*{-\oddsidemargin}%
+ \makebox[\linewidth]{\parbox{\linewidth}%
+ {\eqex@coverpageSubjectFmt
+ \color{\websubject@color}%
+ \centering\eqexamsubject}}
+ \par\vspace{\bigskipamount}
+ \noindent%\hspace*{-\oddsidemargin}%
+ \makebox[\linewidth]{\parbox{\linewidth}%
+ {\eqex@coverpageTitleFmt
+ \color{\webtitle@color}%
+ \centering\webtitle}}
+ \par\vspace{\stretch{1}}
+ \optionalpagematter
+ \par\vspace{\stretch{1}}\cpNameAndID
+ \eqe@SumryHoriz\eqe@SumryVert
+ \sumryAnnots
+ \endgroup
+}
+% \end{macrocode}
+% \end{macro}
+% The following are various local strings used in the \textbf{Exam Record}, the
+% default is to use English words.
+% \begin{macro}{\cpSumryHeader}
+% The header that appears at the top of the box
+% \begin{macro}{\cpSumryPts}
+% The formatting for the number of points
+% \begin{macro}{\cpSumryPage}
+% The word for ``Page''
+% \begin{macro}{\cpSumryTotal}
+% The word for ``Total''
+% \begin{macro}{\cpSumryGrade}
+% The word for ``Grade''
+% \begin{macro}{\cpSetSumryWidth}
+% The width of the summary box
+% \begin{macro}{\cpUsefbox}
+% Enclose in an \cs{fbox}? The default is yes
+% \begin{macro}{\cpNofbox}
+% Do not enclose in an \cs{fbox}
+% \begin{macrocode}
+\newcommand{\cpSumryHeader}{\textbf{Exam Record}}
+\newcommand{\cpSumryPts}{\,\text{pts}}
+\newcommand{\cpSumryPage}{Page}
+\newcommand{\cpSumryTotal}{Total:}
+\newcommand{\cpSumryGrade}{Grade:}
+\newcommand{\cpSetSumryWidth}[1]{\bgroup\setlength{\@tempdima}{#1}
+ \xdef\cp@SetSumryWidth{\the\@tempdima}\egroup}
+\cpSetSumryWidth{.5\textwidth}
+\newcommand{\cpUsefbox}{\let\cp@Usefbox\fbox}
+\cpUsefbox
+\newcommand{\cpNofbox}{\let\cp@Usefbox\mbox}
+\newcommand{\cprulelength}{1.5in}
+% \end{macrocode}
+% \end{macro}
+% \end{macro}
+% \end{macro}
+% \end{macro}
+% \end{macro}
+% \end{macro}
+% \end{macro}
+% \end{macro}
+% A helper command used in \cs{cpSumybyparts}
+% \begin{macrocode}
+\def\cp@IsertNaming#1{%
+ \ifcase\eqe@coverPageNaming
+ #1\or\@nameuse{userFriendly#1}\or
+ \@nameuse{userCustom#1}\else#1\fi
+}
+% \end{macrocode}
+% \DescribeMacro{\cpSumrybyparts}
+% The routine for building the summary box, where we list the statistics
+% for each part.
+% \begin{macrocode}
+\newcommand{\cpSumrybyparts}{%
+ \eqe@@SumryVert\cp@Usefbox{%
+ \ifx\cp@Usefbox\fbox
+ \def\cp@sumryWdth{\cp@SetSumryWidth-2\fboxrule-2\fboxsep}\else
+ \def\cp@sumryWdth{\cp@SetSumryWidth}\fi
+ \begin{minipage}[b]{\cp@sumryWdth}\kern0pt
+ \begin{flushleft}
+ \setlength{\eqetmplengtha}{\cprulelength}%
+ \edef\eqe@cprulelength{\the\eqetmplengtha}%
+ \csarg\ifx{NumberOfParts}\relax
+ \else
+ \count2=0
+ \medskip
+ \cpSumryHeader\par\parskip\bigskipamount
+ \def\\##1{\advance\count2by\csname ##1total\endcsname
+ \underbar{\makebox[0pt][l]{%
+ \cp@IsertNaming{##1}}\hspace*{\eqe@cprulelength}}%
+ / $\eqe@ptsFmt{\csname ##1total\endcsname}%
+ \cpSumryPts$\par}\thePartNames
+ \fi
+ \underbar{\makebox[0pt][l]{\cpSumryTotal}%
+ \hspace{\eqe@cprulelength}}/
+ $\eqe@ptsFmt{\the\count2\relax}\cpSumryPts$ \par
+ \underbar{\makebox[0pt][l]{\cpSumryGrade}%
+ \hspace{\eqe@cprulelength}}%
+ \ifx\cp@Usefbox\fbox\medskip\fi
+ \end{flushleft}\kern0pt
+ \end{minipage}}\par
+}
+% \end{macrocode}
+% \DescribeMacro{\cpSumrybypages}
+% The routine for building the summary box, where we list the statistics
+% for each page.
+% \begin{macrocode}
+\newcommand{\cpSumrybypages}{%
+ \eqe@@SumryVert\cp@Usefbox{%
+ \ifx\cp@Usefbox\fbox
+ \def\cp@sumryWdth{\cp@SetSumryWidth-2\fboxrule-2\fboxsep}\else
+ \def\cp@sumryWdth{\cp@SetSumryWidth}\fi
+ \begin{minipage}[b]{\cp@sumryWdth}\kern0pt
+ \begin{flushleft}
+ \setlength{\eqetmplengtha}{\cprulelength}%
+ \edef\eqe@cprulelength{\the\eqetmplengtha}%
+ \csarg\ifx{NumberOfParts}\relax
+ \else\medskip\count0=0\relax\count2=0\relax
+ \cpSumryHeader\par\parskip\bigskipamount
+ \ifsolutionsAtEnd
+ \@ifundefined{eqExamQuesLastPage}{\def\NUMPAGES{0}}
+ {\edef\NUMPAGES{\@nameuse{eqExamQuesLastPage}}}%
+ \else
+ \@ifundefined{eqExamLastPage}{\def\NUMPAGES{0}}
+ {\edef\NUMPAGES{\@nameuse{eqExamLastPage}}}%
+ \fi
+ \@whilenum\count0<\NUMPAGES\relax\do{%
+ \advance\count0by1\relax
+ \@ifundefined{Page\the\count0total}{\count4=0\relax}
+ {\count4=\@nameuse{Page\the\count0total}\relax}%
+ \csarg\ifx{Page\the\count0spilltotal}\relax
+ \else\advance\count4by\csname%
+ Page\the\count0spilltotal\endcsname\relax\fi
+ \advance\count2by\count4\relax\underbar{%
+ \makebox[0pt][l]{\cpSumryPage~\the\count0}%
+ \hspace*{\eqe@cprulelength}}/
+ $\eqe@ptsFmt{\the\count4\relax}%
+ \cpSumryPts$\csarg\ifx{Page\the\count0spilltotal}\relax
+ \else\ $(\@nameuse{Page\the\count0spilltotal}%
+ \cpSumryPts+\@nameuse{Page\the\count0total}%
+ \cpSumryPts)$\fi\par
+ }%
+ \fi
+ \underbar{\makebox[0pt][l]{\cpSumryTotal}%
+ \hspace{\eqe@cprulelength}}/
+ $\eqe@ptsFmt{\the\count2\relax}\cpSumryPts$\par
+ \underbar{\makebox[0pt][l]{\cpSumryGrade}%
+ \hspace{\eqe@cprulelength}}%
+ \ifx\cp@Usefbox\fbox\medskip\fi
+ \end{flushleft}\kern0pt
+ \end{minipage}}\par
+}
+% \end{macrocode}
+% If the author takes the \texttt{coverpage} option, \cs{eqex@coverpage} is set equal
+% to \cs{eqexcoverpagedesign}, otherwise, it is set equal to \cs{relax}.
+% \begin{macrocode}
+\AtBeginDocument{\eqex@coverpage}
+% \end{macrocode}
+% \subsection{Insert Points in Margins and Compute Page Totals}
+% Here we attempt to place point values of a problem in the margins and
+% to compute the page totals.
+%
+%\begin{macro}{\probvalue}
+% This is a fundamental macro for keeping track of the points of the problem.
+% It increments the counter \texttt{eqpointvalue}, which keeps a running total
+% of the points of the current part of the exam, puts the value in the margins,
+% and sets a \texttt{mark}, so that at the end of the page, we can compute the
+% number of points on the current page. This macro is used in several situations,
+% for example, in the \texttt{problem} environment, \cs{manualcalcparts} and in
+% \cs{autocaleparts}. \textbf{Should not be redefined}.
+%\begin{flushleft}
+%Parameters
+%\begin{verbatim}
+%#1 = total points for this problem
+%#2 = 0 if total points, otherwise, #2 is the number of points each
+% problem.
+%\end{verbatim}
+%\end{flushleft}
+% \begin{macrocode}
+\def\@marktotalvalue{\global\let\eqe@innermarkpts\relax
+ \if@bypasseqexamheading\else\def\eqe@marktxt{%
+ \theeqpointvalue\@nameuse{eqExam}\theeq@numparts}%
+ \ifx\endparts\endexercise@parts@tabular
+ \xdef\eqe@innermarkpts{\noexpand\mark{\eqe@marktxt}}\else
+ \mark{\eqe@marktxt}\fi\fi}
+\def\probvalue#1#2{\addtocounter{eqpointvalue}{#1}%
+ \ifdispl@yPoints\marginpoints{#1}{#2}\fi
+ \@marktotalvalue}
+% \end{macrocode}
+% \end{macro}
+% \DescribeMacro{\widthtpboxes} is the width of the box in the margins that
+% contains the points or totals. The design of the box keys off this width.
+% \begin{macrocode}
+\newcommand{\widthtpboxes}{35pt}
+% \end{macrocode}
+% \DescribeMacro{\marginboxdesign} is the basic box that encloses the points
+% on the right, and the totals. This box may be redefined as desired, in which case,
+% \cs{measurePtBoxHt} should be re-executed.
+% \begin{macrocode}
+\newcommand{\marginboxdesign}[2][]{%
+ \parbox{\widthtpboxes}{\tabcolsep=0pt\relax
+ \begin{tabular}{|c|}\hline
+ \vrule height15pt width0pt#1\\\hline
+ \makebox[\widthtpboxes-2\fboxrule]{#2}\\\hline
+ \end{tabular}%
+ }%
+}
+% \end{macrocode}
+% \begin{macro}{\eqleftmarginbox}
+% This macro places the problem value in the left margin, can be redefined, if you dare.
+%\begin{flushleft}
+% Parameters
+%\begin{verbatim}
+%#1 = total points for this problem
+%#2 = 0 if total points, otherwise, #2 is the number of points each
+% problem.
+%\end{verbatim}
+%\end{flushleft}
+% Currently, this macro is not used so I'll make it into verbatim text.
+%\begin{verbatim}
+\newcommand{\eqleftmarginbox}[2]{\makebox[0pt][r]{%
+ \setlength\tabcolsep{0pt}%
+ \raisebox{-.5\height}[0pt][0pt]{%
+ \marginboxdesign{\marginpointsboxtext{#1}{#2}}%
+ }\hspace*{\marginparsep}\hspace*{\eqemargin}}%
+}
+%\end{verbatim}
+% \end{macro}
+% \paragraph*{Formatting the points}
+% \begin{macro}{\ptsLabel}
+% \begin{macro}{\eachLabel}
+% \begin{macro}{\pointsLabel}
+% The following three convenience commands can be used to localize some of
+% the strings to other languages.
+% \begin{macrocode}
+\providecommand{\ptsLabel}[1]{\def\eqptsLabel{#1}}\ptsLabel{pts}
+\providecommand{\ptLabel}[1]{\def\eqptLabel{#1}}\ptLabel{pt}
+\newcommand{\eachLabel}[1]{\def\eqeachLabel{#1}}\eachLabel{ea.}
+% \end{macrocode}
+% These next two are used by the \texttt{instructions} environment to display
+% the points for the exam.
+% \begin{macrocode}
+\newcommand{\pointsLabel}[1]{%
+ \def\eqpointsLabel{#1}}\pointsLabel{points}
+\newcommand{\pointLabel}[1]{%
+ \def\eqpointLabel{#1}}\pointLabel{point}
+% \end{macrocode}
+% \end{macro}
+% \end{macro}
+% \end{macro}
+% \paragraph*{pointsonleft or pointsonboth}
+% \begin{macro}{\marginpointtext}
+% Creates the text for \cs{eqleftmargin} to use. From the macro definition,
+% if \texttt{\#2} is 0, then we write the points for the problem, else, we write
+% the points each for the problem. \DescribeMacro{\leftmarginPtsTxt}\cmd{\leftmarginPtsTxt}
+% is the formatting for the total points for the problem; while
+% \DescribeMacro{\leftmarginPtsEaTxt}\cmd{\leftmarginPtsEaTxt} is the formatting
+% for the \verb!{problem*}{<num>ea}!-type problems.
+%
+% \begin{macro}{\pointsAsText}
+% We begin by giving the user a choice, typeset
+% the points in math mode (the default) or typeset in the normal font.
+% \begin{macrocode}
+\def\pointsAsText{\def\eqe@ptsFmt{\text}}
+\let\eqe@ptsFmt\relax
+\@onlypreamble\pointsAsText
+% \end{macrocode}
+% \end{macro}
+% \DescribeMacro{\marginpointtext} determines, based on \texttt{\#2}
+% whether the points are `points each' or not, and calls either
+% \cmd{\leftmarginPtsTxt} or \cmd{\leftmarginPtsTxt}, as appropriate.
+% \begin{macrocode}
+\newcommand{\marginpointtext}[2]{\ifnum#2=0\leftmarginPtsTxt{#1}\else
+ \leftmarginPtsEaTxt{#2}\fi
+}
+% \end{macrocode}
+% \DescribeMacro{\leftmarginPtsTxt} displays points in the left margin:
+% \mbox{(\small$\texttt{\#1}^{\mbox{\scriptsize{pt}}}$)} or
+% \mbox{(\small$\texttt{\#1}^{\mbox{\scriptsize{pts}}}$)},
+% where \texttt{\#1} is the number of points for this problem.
+% \begin{macrocode}
+\newcommand{\leftmarginPtsTxt}[1]{(\small$\eqe@ptsFmt{#1}^{\text{%
+ \ifnum#1=1\relax\eqptLabel\else\eqptsLabel\fi}}$)}
+% \end{macrocode}
+% \DescribeMacro{\leftmarginPtsEaTxt} displays `points each' in the left margin:
+% \mbox{(\small$\texttt{\#1}_{\mbox{\scriptsize{ea.}}}^{\mbox{\scriptsize{pt}}}$)} or
+% \mbox{(\small$\texttt{\#1}_{\mbox{\scriptsize{ea.}}}^{\mbox{\scriptsize{pts}}}$)},
+% where \texttt{\#1} is the number of points for each part of this problem.
+% \begin{macrocode}
+\newcommand{\leftmarginPtsEaTxt}[1]{(\small$\eqe@ptsFmt{#1}_{\text{%
+ \eqeachLabel}}^{\text{\ifnum#1=1\relax\eqptLabel\else
+ \eqptsLabel\fi}}$)}
+% \end{macrocode}
+% \end{macro}
+% \begin{macro}{\eqleftmargin}
+% Places the number of points (or points each) in the left margin. Can be redefined as
+% desired. This macro is used when author chooses the \texttt{pointsonleft}
+% or \texttt{pointsonbothsides} option. The text for the points is defined above,
+% \cmd{\marginpointtext}.
+% \begin{macrocode}
+\newcommand{\eqleftmargin}[2]{\makebox[0pt][r]{\marginpointtext{#1}{#2}%
+ \setlength{\@tempdima}{\marginparsep+\eqemargin}%
+ \hspace*{\@tempdima}}}
+% \end{macrocode}
+% \end{macro}
+% \paragraph*{pointsonright or pointsonboth}
+% \begin{macro}{\marginpointsboxtext}
+% When the author selects \texttt{pointsonright} or \texttt{pointsonbothsides}, a box
+% appears in the right margin containing problem totals, this is the text for the box.
+% \begin{macrocode}
+\newcommand{\marginpointsboxtext}[2]{\small$\eqe@ptsFmt{#1}\,\text{%
+ \ifnum#1=1\relax\eqptLabel\else\eqptsLabel\fi}$}
+% \end{macrocode}
+% \end{macro}
+% \begin{macro}{\eqrightmarginbox}
+% When the author selects \texttt{pointsonright} or \texttt{pointsonbothsides}, a box
+% appears in the right margin containing problem totals, this is the box that appears.
+% \begin{macro}{\insertPointsBoxPDF}
+% \begin{macro}{\insertTotalsBoxPDF}
+% These two commands are \cmd{\let}ing them be either a form field (that the
+% document author can fill in during online grading, or as \cs{relax}. It depends
+% on whether the \texttt{email} option is taken or not.
+% \begin{macrocode}
+\def\@insertPointsBoxPDF
+{
+ \def\fieldName{pointsgiven.\curr@quiz.page\thepage.%
+ \theeqquestionnoi}%
+ \calcTextField[\F\FHidden\BC{}\Q1\textColor{1 0 0 rg}]
+ {\fieldName}{\widthtpboxes}{15pt}%
+}
+\def\@insertTotalsBoxPDF
+{
+ \def\fieldName{pagetotals.\curr@quiz.page\thepage}%
+ \calcTextField[\F\FHidden\BC{}\Q1\textColor{1 0 0 rg}
+ \AA{\AACalculate{AFSimple_Calculate("SUM",
+ new Array("pointsgiven.\curr@quiz.page\thepage"));}}]
+ {\fieldName}{\widthtpboxes}{15pt}%
+}
+\ifx\use@email y
+ \let\insertPointsBoxPDF\@insertPointsBoxPDF
+ \let\insertTotalsBoxPDF\@insertTotalsBoxPDF
+\else
+ \let\insertPointsBoxPDF\@empty
+ \let\insertTotalsBoxPDF\@empty
+\fi
+% \end{macrocode}
+% \end{macro}
+% \end{macro}
+% The points box that appears in the left margin, may be re-defined, if you dare.
+% At the bottom of the box goes the points for the problem, if the \texttt{email} option
+% is used, in the top, a text field is inserted.
+% \begin{macrocode}
+\newcommand{\eqrightmarginbox}[2]{\makebox[0pt][l]{%
+ \setlength\tabcolsep{0pt}%
+% \end{macrocode}
+% (2011/05/08) new calculation for the right point box.
+% \begin{macrocode}
+ \setlength{\@tempdima}{\textwidth-\eqemargin+\marginparsep}%
+ \hspace*{\@tempdima}%
+ \raisebox{-.5\height}[0pt][0pt]{%
+ \marginboxdesign[\insertPointsBoxPDF]%
+ {\marginpointsboxtext{#1}{#2}}%
+ }\hfil
+ }%
+}
+% \end{macrocode}
+% At the end of each exam \verb!\end{exam}! the part totals can be optionally
+% displayed on the right. This is the box for doing that.
+% \begin{macrocode}
+\newcommand{\eqeomarginboxright}[2]{\makebox[0pt][l]{%
+ \setlength\tabcolsep{0pt}%
+ \setlength{\@tempdima}{\textwidth+\marginparsep-\parindent}%-\parindent
+ \hspace*{\@tempdima}%
+ \raisebox{-.5\height}[0pt][0pt]{%
+ \marginboxdesign[\insertTotalsBoxPDF]%
+ {\marginpointsboxtext{#1}{#2}}%
+ }\hfil
+ }%
+}
+% \end{macrocode}
+% At the end of each exam \verb!\end{exam}! the part totals can be optionally
+% displayed on the left. This is the box for doing that.
+% \begin{macrocode}
+\newcommand{\eqeomarginboxleft}[2]{\noindent\makebox[0pt][r]{%
+ \raisebox{-.5\height}[0pt][0pt]{%
+ \marginboxdesign[\insertTotalsBoxPDF]%
+ {\marginpointsboxtext{#1}{#2}}%
+ }{\settowidth{\@tempdimb}{\eqe@hspannerPrb}%
+ \setlength{\@tempdima}{\marginparsep+\eqemargin-\@tempdimb}%
+ \hspace*{\@tempdima}}}\hfil
+}
+% \end{macrocode}
+% \DescribeMacro{\measurePtBoxHt} We measure the height of our point/total boxes and store it
+% in the length \cs{eq@pointboxtotalheight}, which is used
+% to separate the boxes so they don't overlap.
+% \begin{macrocode}
+\newcommand{\measurePtBoxHt}{\setbox\eq@pointbox\hbox{%
+ \marginboxdesign{\marginpointsboxtext{00}{0}}%
+ }\setlength\eq@pointboxtotalheight{.5\ht\eq@pointbox}%
+ \xdef\halfHtPtBox{\the\eq@pointboxtotalheight}%
+ \setlength\eq@pointboxtotalheight{\dp\eq@pointbox+\ht\eq@pointbox}%
+ \xdef\totHtPtBox{\the\eq@pointboxtotalheight}%
+ \xdef\dpPtBox{\the\dp\eq@pointbox}%
+ \xdef\htPtBox{\the\ht\eq@pointbox}%
+}
+\measurePtBoxHt
+% \end{macrocode}
+% \end{macro}
+% A helper command to set both margin boxes.
+% \begin{macrocode}
+\newcommand{\eqbothmargins}[2]{\eqleftmargin{#1}{#2}%
+ \eqrightmarginbox{#1}{#2}}
+% \end{macrocode}
+% The macro \cs{probvalue}, defined above, says
+%\begin{verbatim}
+%\mark{\theeqpointvalue\csname eqExam\endcsname\theeq@numparts}
+%\end{verbatim}
+% so the \cs{botmark} contains the point value of this page and the part number for
+% this page.
+% \begin{macrocode}
+\def\lastparttotaled{0}
+% \end{macrocode}
+% The \texttt{botmark} looks like \texttt{18\string\eqExam0}, where $18$ will be the total number of
+% points accumulated for this exam part. We need to retrieve these number, I don't remember why
+% I save them this way.
+%
+% \DescribeMacro{\parsetotals}
+% The \cs{parsetotals} macro is called in \cs{settotalsbox} to retrieve the ongoing point values
+% from \cs{botmark}, and returns two parameters, contained in \cs{argi} and \cs{argiii}.
+% \DescribeMacro{\stripeqExam}
+% Whereas, \cs{stripeqExam} just retrieves the first parameter only.
+% \begin{macrocode}
+\def\parsetotals#1\eqExam#2\end{\def\argi{#1}\def\argii{#2}}
+\def\stripeqExam#1\eqExam{\def\argii{#1}}
+% \end{macrocode}
+% \begin{macro}{\settotalsbox}
+% This is the box containing the page total, it may appear on the left or right side bottom
+% corner.
+% \begin{macrocode}
+\def\settotalsbox{%
+ \expandafter\parsetotals\botmark\eqExam\end
+ \ifx\argi\@empty\hfil
+ \else\ifx\argii\@empty\hfil
+ \else
+ \expandafter\stripeqExam\argii
+% \end{macrocode}
+% Set \texttt{eqpointsthispage} equal to \cs{argi}, which should be the accumulated total
+% for this part of the test so far.
+% \begin{macrocode}
+ \setcounter{eqpointsthispage}{\argi}%
+% \end{macrocode}
+% This subtract \texttt{eqpointsofar}, which should be the total for this test part through the
+% previous page. The difference is the number of points for this page.
+% \begin{macrocode}
+ \addtocounter{eqpointsthispage}{-\value{eqpointsofar}}%
+% \end{macrocode}
+% Now we set \texttt{eqpointsofar} to the new accumulated total \cs{argi}.
+% \begin{macrocode}
+ \setcounter{eqpointsofar}{\argi}%
+% \end{macrocode}
+% And save to the auxiliary file for later usage.
+% \begin{macrocode}
+ \xdef\lastparttotaled{\argii}%
+ \eqe@IWO\@auxout{\string\csarg\string\gdef{Page\thepage total}%
+ {\theeqpointsthispage}}%
+% \end{macrocode}
+% Finally, place the totals box.
+% \begin{macrocode}
+ \totalsbox
+ \fi
+ \fi
+}
+% \end{macrocode}
+% \end{macro}
+% \DescribeMacro{\totalsboxtext} This is the text that appears in the totals boxes
+% \begin{macrocode}
+\newcommand\totalsboxtext{\small$
+ \eqe@ptsFmt{\theeqpointsthispage}\,\text{%
+ \ifnum\theeqpointsthispage=1\relax\eqptLabel\else
+ \eqptsLabel\fi}$}
+% \end{macrocode}
+% \DescribeMacro{\eqevtranstotbox}\cmd{\eqevtranstotbox} is a length
+% that can be used to raise or lower the position of the total boxes
+% in the left/right bottom corner. The default is \texttt{0pt}.
+% \begin{macrocode}
+\newlength\eqevtranstotbox
+\setlength{\eqevtranstotbox}{0pt}
+% \end{macrocode}
+% \DescribeMacro{\totalsboxleft}\DescribeMacro{\totalsboxright} There are two totals boxes, one for the left and one
+% for the right side. These can be redefined as desired.
+% \begin{macrocode}
+\def\eqe@chkZeroTotals{\let\eqe@allow\eqe@YES
+ \ifx\eqe@zeroTotalsAllowed\eqe@NO
+ \ifnum\theeqpointsthispage=0 \let\eqe@allow\eqe@NO\fi\fi}
+\newcommand{\totalsboxleft}{\eqe@chkZeroTotals
+ \ifx\eqe@allow\eqe@YES
+ \makebox[0pt][r]{\setlength\tabcolsep{0pt}%
+ \raisebox{-\height+\eqevtranstotbox}[0pt][0pt]{%
+ \marginboxdesign[\insertTotalsBoxPDF]{\totalsboxtext}%
+ }\hspace*{\marginparsep}%
+ }\fi\hfil
+}
+\newcommand{\totalsboxright}{\eqe@chkZeroTotals
+ \ifx\eqe@allow\eqe@YES
+ \makebox[0pt][l]{\setlength\tabcolsep{0pt}%
+ \hspace*{\textwidth}\hspace*{\marginparsep}%
+ \raisebox{-\height+\eqevtranstotbox}[0pt][0pt]{%
+ \marginboxdesign[\insertTotalsBoxPDF]{\totalsboxtext}%
+ }%
+ }\fi\hfil
+}
+% \end{macrocode}
+% We begin the document by declaring the current part is part 0 with 0 points. This is the default,
+% in case the author writes a document with no parts or points!
+% \begin{macrocode}
+\ifeqe@nopoints\else\if@bypasseqexamheading\else
+\AtBeginDocument{\mark{0\csname eqExam\endcsname0}}
+\fi\fi
+% \end{macrocode}
+% At the end of the document, we write out the number of parts for this test, and
+% the names of the parts the author has given each part.
+% \begin{macrocode}
+\AtEndDocument{%
+ \eqe@IWO\@auxout{\string\csarg\string\gdef{NumberOfParts}%
+ {\arabic{eq@numparts}}}%
+ \eqe@IWO\@auxout{\string\csarg\string\gdef{thePartNames}%
+ {\the\partNames}}%
+ \clearpage\addtocounter{page}{-1}\writelastpage\relax
+ \addtocounter{page}{1}%
+}
+% \end{macrocode}
+% \begin{macro}{\theGrandTotal}
+% When an exam has multiple parts, the total of each part is computed
+% and the grand total is computed with \cs{theGrandTotal}.
+% \begin{macrocode}
+\newcommand\theGrandTotal{%
+ $\eqe@ptsFmt{\csname eqeGrandTotal\endcsname}$}
+% \end{macrocode}
+% \end{macro}
+% \begin{macro}{\totalForPart}
+% User access to the total for a exam environment, one argument, the name of the exam.
+% \begin{macro}{\percentForPart}
+% Attempts to calculate the percent of the total that the referenced exam (\texttt{\#1})
+% contributes to the grand total.
+% \begin{macrocode}
+\newcommand{\totalForPart}[1]{$\eqe@ptsFmt{\csname#1total\endcsname}$}
+\def\tot@lForPart#1{\csname#1total\endcsname}
+\newcommand{\percentForPart}[1]{$\eqe@ptsFmt
+ {\csname#1percent\endcsname}$\%}
+% \end{macrocode}
+% \end{macro}
+% \end{macro}
+%
+%\subsection{Computing Number of Points within a Segment of the Exam}
+%
+% We add some commands for calculating number of points in a segment of the exam.
+% A segment being defined subset of consecutive problems within an exam. We can
+% define segments by placing markers (using \cs{placeMarkerHere}) between problems. We can
+% then calculate the total number of points between markers.
+%
+% The counter below is a scratch counter for making the calculations. We assume the
+% \texttt{calc} package is loaded, it does the work for us.
+%
+% \begin{macrocode}
+\newcounter{markerCnt}
+% \end{macrocode}
+% \begin{macro}{\placeMarkerHere}
+% Placed outside of any \texttt{problem}/\texttt{problem*} environment, this command
+% takes one argument, the symbolic name for this marker. We write to the auxiliary file
+% and define a command whose name is based on \texttt{\#1}, and whose value is
+% the cumulative total \cs{theeqpointvalue}.
+%\changes{v1.8}{2008/11/02}
+%{
+% Added a set of commands \cs{placeMarkerHere}, \cs{calcFromMarkers},
+% and \cs{markerTotalFmt} to enable the calculation of totals of segments
+% of the exam.
+%}
+% \begin{macrocode}
+\def\placeMarkerHere#1{%
+ \eqe@IWO\@auxout{\string\csarg\string\gdef
+ {#1SaveTotalHere}{\theeqpointvalue}}%
+}
+% \end{macrocode}
+% \end{macro}
+% \begin{macro}{\calcFromMarkers}
+% Once the markers are in place, we can calculate the number of points defined between
+% two such markers. The \cs{calcFromMarkers} takes three arguments, \texttt{\#2} and
+% \texttt{\#3} are the symbolic names of the two markers. While, \texttt{\#1} is an optional
+% argument for formatting the calculation. The default is \cs{@markerTotalFmt}, defined
+% below in \cs{markerTotalFmt}. The value of the total is \cs{themarkerCnt}.
+% \begin{macrocode}
+\newcommand{\calcFromMarkers}[3][\@markerTotalFmt]{%
+ \@ifundefined{#2SaveTotalHere}{}%
+ {\@ifundefined{#3SaveTotalHere}{}{\setcounter{markerCnt}%
+ {\@nameuse{#2SaveTotalHere}-\@nameuse{#3SaveTotalHere}}%
+ \ifnum\value{markerCnt}<0\relax
+ \setcounter{markerCnt}{-\value{markerCnt}}\fi#1}}%
+}
+% \end{macrocode}
+% \end{macro}
+% \begin{macro}{\markerTotalFmt}
+% Used to set the global format of the marker totals. The value of the marker total
+% is \cs{themarkerCnt}. The default follows the definition of \cs{markerTotalFmt}
+% \begin{macrocode}
+\newcommand{\markerTotalFmt}[1]{\def\@markerTotalFmt{#1}}
+\markerTotalFmt{\space(\themarkerCnt\space points)}
+% \end{macrocode}
+% \end{macro}
+% \begin{macro}{\calcQsBtwnMarkers}
+% \changes{v3.1}{2012/05/16}{Added \cs{calcQsBtwnMarkers}}
+% \cs{calcQsBtwnMarkers[\meta{Mrk2}]}|{|\meta{Mrk1}|}| does a number of things; primarily,
+% it determines the range of the questions between the two marks. The names of the
+% commands produced are all based in the first marker name \meta{Mrk1}.
+% \DescribeMacro{ \bslash\meta{Mrk1}Start}\cs{\meta{Mrk1}Start} is the first question number that follows the
+% the placement of \cs{calcQsBtwnMarkers}. Similarly,
+% \DescribeMacro{ \bslash\meta{Mrk1}End}\cs{\meta{Mrk1}End}
+% is the last question number between the two marks \meta{Mrk1} and \meta{Mrk2}.
+%
+% We also calculate \DescribeMacro{ \bslash\meta{Mrk1}nQs}\cs{\meta{Mrk1}nQs}, the number of questions appearing between
+% \meta{Mrk1} and \meta{Mrk2}.
+% \begin{macrocode}
+\newcommand{\calcQsBtwnMarkers}[2][]{\setcounter{markerCnt}{0}%
+ \def\eqe@argi{#1}%
+% \end{macrocode}
+% \cs{\meta{Mrk1}thisQnum} is the question number in effect at the point where
+% the command \cs{calcQsBtwnMarkers} is inserted.
+% \begin{macrocode}
+ \eqe@IWO\@auxout{\string\csarg\string\gdef
+ {#2thisQnum}{\theeqquestionnoi}}%
+% \end{macrocode}
+% \cs{\meta{Mrk1}Start} is 0 if undefined.
+% \begin{macrocode}
+ \@ifundefined{#2thisQnum}{\csarg\xdef{#2Start}{0}%
+ \eqe@IWO\@auxout{\string\csarg\string\gdef
+ {#2Start}{0}}%
+ }{%
+% \end{macrocode}
+% \cs{\meta{Mrk1}Start} is the current question number plus 1.
+% \begin{macrocode}
+ \setcounter{markerCnt}{\value{eqquestionnoi}+1}\csarg
+ \xdef{#2Start}{\the\value{markerCnt}}%
+ \eqe@IWO\@auxout{\string\csarg\string\gdef
+ {#2Start}{\@nameuse{#2Start}}}%
+ }
+% \end{macrocode}
+% Using now both \meta{Mrk1} and \meta{Mrk2} we calculate the difference
+% in the two. Result held in \texttt{markerCnt}. If there is no optional parameter, \meta{Mrk2},
+% do not produce the \cs{\meta{Mrk1}thisQnum}.
+% \begin{macrocode}
+ \ifx\eqe@argi\@empty\else
+ \@ifundefined{#2thisQnum}{\setcounter{markerCnt}{0}}%
+ {\@ifundefined{#1thisQnum}{\setcounter{markerCnt}{0}}{%
+ \setcounter{markerCnt}%
+ {\@nameuse{#1thisQnum}-\@nameuse{#2thisQnum}}%
+ }}%
+ \fi
+% \end{macrocode}
+% \cs{\meta{Mrk1}nQs} is the number of questions that appear between
+% \meta{Mrk1} and \meta{Mrk2}.
+% \begin{macrocode}
+ \csarg\xdef{#2nQs}{\the\value{markerCnt}}%
+ \eqe@IWO\@auxout{\string\csarg\string\gdef
+ {#2nQs}{\the\value{markerCnt}}}%
+% \end{macrocode}
+% \cs{\meta{Mrk1}End} is 0 if undefined. If there is no optional parameter, \meta{Mrk2},
+% do not produce the \cs{\meta{Mrk1}End}
+% \begin{macrocode}
+ \ifx\eqe@argi\@empty\else
+ \@ifundefined{#1thisQnum}{\csarg\xdef{#2End}{0}%
+ \eqe@IWO\@auxout{\string
+ \csarg\string\gdef{#2End}{0}}%
+ }{%
+% \end{macrocode}
+% \cs{\meta{Mrk1}End} is \cs{\meta{Mrk2}thisQnum}.
+% \begin{macrocode}
+ \csarg\xdef{#2End}{\@nameuse{#1thisQnum}}%
+ \eqe@IWO\@auxout{\string\csarg\string\gdef
+ {#2End}{\@nameuse{#2End}}}%
+ }%
+ \fi
+}
+% \end{macrocode}
+% \begin{macro}{\markStartFor}
+% \begin{macro}{\markEndtFor}
+% \begin{macro}{\markNumQsFor}
+% We provide a user interface to the three macros defined above. The required
+% parameter is a mark (a name that was used as the first argument of
+% \cmd{\calcQsBtwnMarkers}).
+% \begin{macrocode}
+\newcommand{\markStartFor}[1]{\@nameuse{#1Start}}
+\newcommand{\markEndFor}[1]{\@nameuse{#1End}}
+\newcommand{\markNumQsFor}[1]{\@nameuse{#1nQs}}
+% \end{macrocode}
+% \end{macro}
+% \end{macro}
+% \end{macro}
+% \end{macro}
+%
+% \subsection{Useful Commands to Write Problems}
+%
+% \subsubsection{The \texorpdfstring{\cs{placeAtxy}}{\textbackslash{placeAtxy}} command}
+% \begin{macro}{\placeAtxy}
+% Use to place material within the solutions area that is visible to the student
+% on the test document. Syntax:
+% \begin{quote}\switchCats\ttfamily
+% \string\placeAtxy{\meta(x\_dim)}{\meta(y\_dim)}{\meta(content)}
+% \end(quote)
+% \cs{placeAtxy} goes immediately after \verb!\end{solution}!
+% \begin{macrocode}
+\newcommand{\placeAtxy}[3]{{%
+ \par\nointerlineskip
+ \ifdisplayworkarea
+ \ifx\eq@insertverticalspace\eqe@YES
+ \makebox[0pt][l]{\hspace*{-\parindent}\hspace*{#1}%
+ \raisebox{#2}[0pt][0pt]{#3}}\fi
+ \fi
+}}
+% \end{macrocode}
+% \end{macro}
+% \subsubsection{The \texttt{workarea} environment}
+% As of this writing, 2012/12/09, this segment of code has been re-written. The
+% \texttt{splitsolution} and \texttt{panel} environments have a new syntax. I've never
+% gotten any feedback from user who use these environments, so I suspect the impact
+% of these changes are minimal.
+% \begin{environment}{workarea}
+% A work area is an environment used when we display vertical space such as when the
+% \texttt{nosolutions} and \texttt{vspacewithsolns} options are in effect.
+% \DescribeMacro{\workareasb}\cmd{\workareasb} is a save box used in the
+% argument of \texttt{lrbox} to save the contents of the \texttt{minipage}.
+% \begin{quote}\switchCats\ttfamily
+% \string\begin{workarea}[\meta(width)]{\meta(depth)}\\
+% ...\\
+% \string\end{workarea}
+% \end(quote)
+% \begin{macrocode}
+\newsavebox{\workareasb}
+\newenvironment{workarea}[2][\linewidth]
+{%
+ \removelastparskip
+ \edef\workareadepth{\if\currhideopt H0pt\else#2\fi}%
+ \begin{lrbox}{\workareasb}\setlength{\eqetmplengtha}{#1}%
+ \begin{minipage}[b][\workareadepth][t]{\eqetmplengtha}\vspace*{3pt}%
+}{%
+ \end{minipage}\end{lrbox}%
+% \end{macrocode}
+% \texttt{4/5/11} Changed the logic here, so the \texttt{workarea} is available
+% for the \texttt{vspace\-with\-solns} option.
+% \begin{macrocode}
+ \par\ifdisplayworkarea
+ \ifx\eq@insertverticalspace\eqe@YES
+ \removelastparskip
+ \vspace{-\baselineskip}%
+ \if\currhideopt H\else
+ \noindent\strut\smash{\usebox{\workareasb}}%
+ \fi\fi
+ \fi
+}
+% \end{macrocode}
+% \end{environment}
+% \subsubsection{The \texttt{splitsolution} environment}
+% \begin{environment}{splitsolution}
+%\changes{v3.2}{2012/12/10}{Rewrote splitsolution and related code to change the syntax.}
+% This is a special solution environment designed for use with the
+% \texttt{online} or \texttt{email} options, but it is compatible with all other options
+% as well.\par\medskip\noindent
+%\begin{minipage}{.55\linewidth}
+%\textbf{New Syntax}\\[3pt]
+%\begingroup\small
+% \switchCats\ttfamily
+% \string\begin{splitsolution}[\meta(width)][\meta(depth)]\\
+% \string\begin{panel}[l\string|r]\\
+% ...\\
+% \string\end{panel}\\
+% \string\begin{solution}\\
+% ...\\
+% \string\end{solution}\\
+% \string\end{splitsolution}
+%\par\endgroup
+%\end{minipage}\hfil
+%\begin{minipage}{.45\linewidth}
+%\textbf{Old Syntax}\\[3pt]
+%\begingroup\small
+% \switchCats\ttfamily
+% \string\begin{splitsolution}{\meta(depth)}\\
+% \string\begin{panel}[l\string|r]{\meta(width)}\\
+% ...\\
+% \string\end{panel}\\
+% \string\begin{solution}\\
+% ...\\
+% \string\end{solution}\\
+% \string\end{splitsolution}
+%\par\endgroup
+%\end{minipage}
+%\par\medskip\noindent
+% The \texttt{panel} writes its contents to a CUT file, then inputs it back
+%in to get its dimensions, it places the contents in the box
+%\cs{eqpanelbox}.
+%
+% Below is an example of the use of the \texttt{splitsolution} environment
+% (which is defined well below here).
+%\begin{verbatim}
+%\begin{problem}[5]
+%This is a question worth $5$ points.
+%\begin{splitsolution}
+%\begin{panel}\relax
+%\includegraphics[scale=.2]{fig1}
+%\end{panel}
+%\begin{solution}
+%This a really good solution and worthy of a $5$ points.
+%\end{solution}
+%\end{splitsolution}
+%\end{problem}
+%\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
+% in the usual way.
+%\par\medskip\noindent
+% We arrive at the \DescribeEnv{splitsolution}\texttt{splitsolution} environment.
+% \begin{macrocode}
+\def\splitsolution{%
+ \@ifnextchar[{\splitsolutioni}%
+ {\splitsolutioniii{\panelwidth}{\panelheight}}%
+}
+\def\splitsolutioni[#1]{%
+ \@ifnextchar[{\splitsolutionii{#1}}
+ {\splitsolutioniii{\panelwidth}{#1}}%
+}
+\def\splitsolutionii#1[#2]{%
+ \splitsolutioniii{#1}{#2}%
+}
+\def\splitsolutioniii#1#2{%
+ \@ifundefined{panel@write}{\newwrite\panel@write}{}%
+ \gdef\ss@Argiii{#1}\gdef\ss@Argii{#2}%
+% \end{macrocode}
+% Here, we \cs{let} \cs{solution} to \cs{@sssolution} and replace it with
+% \cs{@ssSolution}
+% \begin{macrocode}
+ \let\@sssolution\solution
+ \let\end@sssolution\endsolution
+ \let\solution\@ssSolution
+ \let\endsolution\end@ssSolution
+ \par\noindent\ignorespaces
+% \end{macrocode}
+% The \texttt{panel} environment should appear next, just after the \verb!\begin{splitslution}!
+% \begin{macrocode}
+}
+\def\endsplitsolution{%
+ \ifeq@solutionsafter\strut\par\fi
+ \ifx\solutionparshape\@empty\else
+ \advance\linewidth-\leadinIndentPrtSep\fi %%dps
+ \edef\eqe@workwidth{\if\ss@Argi l\noexpand\ss@Argiii
+ \else\noexpand\linewidth\fi}%
+ \edef\eqe@workfill{\if\ss@Argi l\else\hfill\fi}%
+ \begin{workarea}[\eqe@workwidth]{\eqedepth}%
+ \let\panelGetDimen\relax%
+ \eqe@workfill\input{panel\thepanel@cnt.cut}%
+ \end{workarea}
+ \strut\par
+}
+% \end{macrocode}
+% \end{environment}
+%\par\medskip\noindent
+% \DescribeMacro{\panelgap}\cs{panelgap} is the separation between solution area
+% and the panel. \DescribeMacro{\eqpanelbox} is a box to put things into, to measure their
+% dimensions. The user accessible commands \DescribeMacro{\panelwidth}\cs{panelwidth} returns the
+% width and \DescribeMacro{\panelheight}\cs{panelheight} the height. There is a special counter
+% \DescribeMacro{panel@cnt}\texttt{panel@cnt} to keep track of the panels generated.
+% \begin{macrocode}
+\newcommand\panelgap{3pt}
+\newsavebox{\eqpanelbox}
+\newdimen\eqepanelwidth
+\newdimen\eqepanelheight
+% \end{macrocode}
+% The \DescribeMacro{\getDimSSPanel}\cs{getDimSSPanel} is an internal command. It
+% places it argument in the box \cs{eqpanelbox} and gets its dimensions. It
+% save the dimensions as \cs{eqepanelwidth} and \cs{eqepanelheight} (the total height).
+% \begin{macrocode}
+\newcommand{\getDimSSPanel}[1]{%
+ \sbox{\eqpanelbox}{#1}%
+ \eqepanelwidth=\wd\eqpanelbox
+ \eqepanelheight=\ht\eqpanelbox
+ \advance\eqepanelheight by\the\dp\eqpanelbox
+}
+% \end{macrocode}
+% \DescribeMacro{\panelwidth}\cs{panelwidth} and \DescribeMacro{\panelheight}\cs{panelheight}
+% are aliases for the dimension registers. This is for compatibility with previous versions.
+% \begin{macrocode}
+\def\panelwidth{\eqepanelwidth}
+\def\panelheight{\eqepanelheight}
+\newcounter{panel@cnt}
+% \end{macrocode}
+% \DescribeMacro{panel} environment goes inside the \texttt{splitsolution}
+% environment. Permissible values of the first parameter are \texttt{r} and
+% \texttt{l}, the default being \texttt{l}. This is the alignment parameter.
+% The second argument is the width of the panel.
+% \begin{macrocode}
+\def\panel{\def\eqe@panelir{\eqe@paneli[r]}%
+ \@ifnextchar[{\eqe@paneli}
+ {\@ifnextchar\relax{\expandafter\eqe@panelir\@gobble}%
+ {\eqe@paneli[r]}}%
+}
+% \end{macrocode}
+% We continue the \texttt{panel} environment.
+% \begin{macrocode}
+\def\eqe@paneli[#1]{%
+ \gdef\ss@Argi{#1}\def\eqe@l{l}\def\eqe@r{r}%
+ \ifx\ss@Argi\@empty\gdef\ss@Argi{r}\else
+ \ifx\eqe@l\ss@Argi\else\ifx\eqe@r\ss@Argi\else
+ \PackageError{eqexam}{Permissible arguments for panel are l and r}
+ {Use l or r for the argument of panel.}\fi\fi\fi
+ \stepcounter{panel@cnt}%
+ \immediate\openout \panel@write panel\thepanel@cnt.cut
+% \end{macrocode}
+% Manage the \texttt{h}, \texttt{H}, and global overrides.
+% \begin{macrocode}
+ \if\currhideopt H%
+ \eqe@IWO\panel@write{\vfill}%
+ \immediate\closeout\panel@write
+ \gdef\ss@Argii{0pt}%
+ \else
+ \if\currhideopt h\ifeq@solutionsafter\else
+ \ifeq@globalshowsolutions\else
+ \eqe@IWO\panel@write{\vfill}%
+ \immediate\closeout\panel@write
+ \gdef\ss@Argii{0pt}%
+ \fi\fi
+ \fi
+ \fi
+ \begingroup
+% \end{macrocode}
+% Write the contents of this environment to the file
+% \texttt{panel\string\thepanel@cnt.cut}.
+% \begin{macrocode}
+ \let\verbatim@out\panel@write
+% \end{macrocode}
+% We begin by writing \verb!\panelGetDimen{%! to the CUT file
+% \begin{macrocode}
+ {\lccode`C=`\%\lccode`P=`\{
+ \lowercase{\eqe@IWO\verbatim@out{\string\panelGetDimen PC}}}%
+% \end{macrocode}
+% Followed by the verbatim listing of the \texttt{panel} environment.
+% \begin{macrocode}
+ \verbatimwrite
+}
+\def\endpanel{%
+ \endverbatimwrite
+% \end{macrocode}
+% After the verbatim write, we write \verb!}! to close off the argument
+% of \cs{panelGetDimen}.
+% \begin{macrocode}
+ {\lccode`P=`\}\lowercase{\eqe@IWO\verbatim@out{P}}}%
+ \immediate\closeout\panel@write
+ \endgroup
+% \end{macrocode}
+% The command \cs{eqePANEL} cut does all the work at the end of this environment.
+% We first \cs{let} \cs{panelGetDimen} to \cs{getDimenSSPanel} and input the
+% CUT file. This loads the panel contents into \cs{eqpanelbox}, and gets their
+% dimensions. We set the value of \cs{ss@Argiii} which is the width parameter
+% of the \texttt{splitsolution} environment. \cs{mp@Width} calculates the width.
+% \begin{macrocode}
+ \gdef\eqePANELCUT{%
+ \let\panelGetDimen\getDimSSPanel
+ \input{panel\thepanel@cnt.cut}%
+ \setlength{\eq@tmpdima}{\ss@Argiii}%
+ \xdef\ss@Argiii{\the\eq@tmpdima}%
+ \xdef\mp@Width{\ifeq@solutionsafter\linewidth
+ \else\linewidth-\ss@Argiii-\panelgap\fi}%
+ }\aftergroup\eqePANELCUT
+}
+% \end{macrocode}
+% \cs{eqe@IW} is a macro that either writes verbatim text (\texttt{\#1}), or
+% it gobbles the argument, depending on whether have \texttt{solutionsafter}, \texttt{nosolutions},
+% hidden or not hidden.
+% \begin{macrocode}
+\long\def\eqe@IW#1{%
+ \ifeq@solutionsafter
+ \let\eqe@next\@empty
+ \else
+ \def\eqe@next{\eqe@IWO\verbatim@out{#1}}%
+ \ifeq@nosolutions\else
+ \if\currhideopt H%
+ \gdef\ss@Argii{0pt}\let\eqe@next\@empty
+ \else
+ \if\currhideopt h%
+ \ifeq@globalshowsolutions\else
+ \gdef\ss@Argii{0pt}\let\eqe@next\@empty
+ \fi
+ \fi
+ \fi
+ \fi
+ \fi
+ \eqe@next
+}
+% \end{macrocode}
+% The \texttt{splitsolution} environment \cs{let}s the solution environment
+% to the internal \texttt{@ssSolution} environment. It performs various tasks
+% then turns it over to the old solution environment, which has been \cs{let}
+% to \cs{@sssolution}.
+% \begin{macrocode}
+\newenvironment{@ssSolution}[1][\ss@Argii]%
+{%
+ \def\eqe@argi{#1}\ifx\eqe@argi\@empty\else
+% \setlength{\eq@tmpdima}{#1}%
+%
+ \let\soln@keys@nLines\@empty
+ \edef\panelheight{\the\panelheight}%
+ \edef\panelwidth{\the\panelwidth}%
+ \edef\temp@exp{\noexpand
+ \setkeys*{soln@keys}{#1}}\temp@exp
+% \setkeys*{soln@keys}{#1}%
+ \ifx\soln@keys@nLines\@empty
+ \edef\ss@Argii{\XKV@rm}%
+ \else
+ \@tempdima\wlVspace\relax
+ \@tempdima=\soln@keys@nLines\@tempdima
+ \edef\ss@Argii{\the\@tempdima}%
+ \ifx\XKV@rm\@empty\else
+ \if@equsedim\edef\ss@Argii{\XKV@rm}\fi\fi
+ \fi
+ \setlength{\eq@tmpdima}{\ss@Argii}%
+% \ifx\sameVspace\@empty\gdef\sameVspace{0pt}\fi
+% \end{macrocode}
+% If the \texttt{panelheight} is greater than the requested height,
+% we make the requested height equal to \texttt{panelheight}.
+% \begin{macrocode}
+ \ifdim\eqepanelheight>\eq@tmpdima
+ \eq@tmpdima\eqepanelheight\fi
+ \xdef\ss@Argii{\the\eq@tmpdima}%
+ \fi
+% \end{macrocode}
+% We calculate the depth of the solutions; this is generally the values
+% passed to use as the optional argument, and encapsuled by \cs{ss@Argii}.
+% \begin{macrocode}
+ \xdef\eqedepth{%
+ \ifvspacewithsolns\ss@Argii\else
+ \ifeq@nosolutions\ss@Argii\else
+ \ifeq@solutionsafter\ss@Argii\else0pt\fi\fi\fi}%
+% \end{macrocode}
+% The width is either \cs{linewidth} or \verb!\linewidth-\ss@Argiii-\panelgap!,
+% where \cs{ss@Argiii} is the width of the panel.
+% \begin{macrocode}
+ \xdef\mp@Width{\ifeq@solutionsafter\noexpand\linewidth\else
+ \noexpand\linewidth-\ss@Argiii-\panelgap\fi}%
+% \end{macrocode}
+% If its a left panel\dots
+% \begin{macrocode}
+ \if\ss@Argi l%
+ \ifeq@solutionsafter
+ \def\eqe@lPanel{\parbox[b][\eqedepth][t]{\ss@Argiii}
+% \end{macrocode}
+% Here, and elsewhere, we \cs{let} \cs{panelGetDimen} to \cs{relax} when we
+% want to purely input the CUT file in the solution.
+% \begin{macrocode}
+ {\let\panelGetDimen\relax
+ \input{panel\thepanel@cnt.cut}\vfill}\hfill}%
+ \def\eqe@rPanel{\@empty}%
+ \else
+% \end{macrocode}
+% For the left panel, we need to subtract \cs{eqemargin}
+% \begin{macrocode}
+ \def\eqe@subleftgutter{-\string\eqemargin}%
+ \def\eqe@lPanel{%
+ \string\parbox[b][\string\eqedepth]{\ss@Argiii}%
+ {\string\let\string\panelGetDimen\string\relax
+ \string\input{panel\thepanel@cnt.cut}%
+ \string\vfill}\string\hfill^^J}%
+ \def\eqe@rPanel{\@empty}%
+ \fi
+ \else
+% \end{macrocode}
+% If its a right panel\dots
+% \begin{macrocode}
+ \ifeq@solutionsafter
+ \def\eqe@lPanel{\@empty}%
+ \def\eqe@rPanel{%
+ \hfill\parbox[b][\eqedepth][t]{\ss@Argiii}
+ {\let\panelGetDimen\relax
+ \hfill\input{panel\thepanel@cnt.cut}\vfill}}%
+ \else
+% \end{macrocode}
+% For the right panel, we do not to subtract \cs{eqemargin} as above.
+% \begin{macrocode}
+ \let\eqe@subleftgutter\@empty
+ \def\eqe@lPanel{\@empty}%
+ \def\eqe@rPanel{%
+ \string\hfill\string\parbox[b][\string\eqedepth]%
+ {\ss@Argiii}{\string\endgraf%
+ \string\noindent\string\hfill%
+ \string\let\string\panelGetDimen\string\relax
+ \string\input{panel\thepanel@cnt.cut}%
+ \string\vfill}}%
+ \fi
+ \fi
+ \let\verbatim@out\ex@solns
+ \par\ifeq@solutionsafter\smallskip\fi
+% \end{macrocode}
+% Since everything is put a box, we set the \cs{linewidth}, and
+% set \cs{solutionparshape} to \cs{@empty}.
+% \begin{macrocode}
+ \ifx\solutionparshape\@empty\else
+ \advance\linewidth-\leadinIndentPrtSep\fi %%dps
+ \let\solutionparshape\@empty
+ \noindent\minipage{\linewidth}%
+ \if\ss@Argi l\noindent\parbox[b][\eqedepth][t]{\ss@Argiii}%
+ {\vfill}\hfill\fi
+ \minipage[b][\eqedepth][t]{\mp@Width}%
+ {\lccode`C=`\%\lowercase{\eqe@IW{%
+ \string\def\string\panelgap{\panelgap}%
+ \string\setlength{\string\panelwidth}{\ss@Argiii}%
+ \string\def\string\eqedepth
+ {\ifeq@nosolutions\ss@Argii\else\ss@Argii\fi}C}}}%
+ {\lccode`C=`\%\lowercase{\eqe@IW{%
+ \string\strut\string\noindent%
+% \string\strut\par\string\nobreak\string\noindent%
+ \string\hbox\space to\string\linewidth\bgroup^^J%
+ \eqe@lPanel\string\minipage[b][\string\eqedepth][t]%
+ {\string\linewidth\eqe@subleftgutter%
+ -\string\panelwidth-\string\panelgap}C
+ }}}%
+ \ifeq@solutionsafter
+ \noindent\strut\hbox to\linewidth\bgroup
+ \eqe@lPanel
+ \minipage[b][\eqedepth][t]{\linewidth-\ss@Argiii-\panelgap}%
+ \def\solutionsafterSkip{}%
+ \fi
+% \end{macrocode}
+% Here, we start the original definition of the solutions environment, which was \cs{let}
+% to \cs{@sssolution}.
+% \begin{macrocode}
+ \ifx\soln@keys@nLines\@empty
+ \edef\passedss@Argii{\ss@Argii}\else
+ \edef\passedss@Argii{\ss@Argii,nLines=\soln@keys@nLines}\fi
+ \expandafter\@sssolution\expandafter[\passedss@Argii]%
+}{%
+ \eqe@IW{\string\endminipage\eqe@rPanel\egroup}%
+ \ifeq@solutionsafter\endminipage\eqe@rPanel\egroup\fi
+ \end@sssolution
+ \endminipage\endminipage
+}
+% Redefine the \cs{paragraph} command
+% \begin{macrocode}
+\renewcommand{\paragraph}
+ {\@startsection{paragraph}{4}{0pt}{12pt}{-3pt}{\bfseries}}
+% \end{macrocode}
+% \begin{macro}{\defaultInstructions}
+% For the \texttt{instructions} environment, defined next, the default string
+% for the instructions is \cs{eq@default@Instructions}, this command is
+% defined using \cs{defaultInstructions}.
+% \begin{macrocode}
+\newcommand{\defaultInstructions}[1]{\def\eq@default@Instructions{#1}}
+\defaultInstructions{Instructions.}
+% \end{macrocode}
+% \end{macro}
+%
+% \begin{environment}{instructions}
+% Each test, or a part of a test usually have instructions. This \texttt{instruction}
+% environment is used in this purpose. Normally, the number of points for the part is
+% displayed following the heading (the default is \textbf{Instructions.}). You can
+% eliminate the total points from the instructions by taking the \texttt{nosummarytotals}
+% option.
+%
+% \begin{macrocode}
+\newcommand{\beforeInstrSkip}{1ex}
+\newcommand{\afterInstrSkip}{-0em}
+\newcommand\hInstrSpace{\ }
+\newcommand\styleInstr{\bfseries}
+\newenvironment{instructions}[1][\eq@default@Instructions]{%
+% \end{macrocode}
+% If \cs{summaryPointTotal} is zero, show no summary points.
+% \begin{macrocode}
+ \@ifundefined{\thisexamlabel total}{\let\eq@nosummarytotals\eqe@YES}
+ {\ifnum\summaryPointTotal=0 \let\eq@nosummarytotals\eqe@YES\fi}%
+ \expandafter\def\expandafter\eq@argi\expandafter{#1}%
+ \def\hsi{\hInstrSpace}%
+% \end{macrocode}
+% We start a paragraph environment
+% \begin{macrocode}
+ \@startsection{paragraph}{4}{\z@}%
+ {\beforeInstrSkip\space\@plus1ex \@minus.2ex}%
+ {\afterInstrSkip}{\normalfont\normalsize\styleInstr}*%
+ {\textcolor{\@instructionsColor}{#1}\normalcolor%
+ \ifx\eq@nosummarytotals\eqe@YES\else\ifx\eq@argi\@empty\else\hsi\fi
+ {\normalfont\summaryTotalsTxt}\hsi\fi}\hskip-\lastskip
+ \ifx\eq@nosummarytotals\eqe@YES\ifx\eq@argi\@empty\else\hsi\fi\fi
+ \normalfont\normalsize\ignorespaces
+}{\par\vskip\beforeInstrSkip\relax}
+% \end{macrocode}
+% \cmd{\summaryPointTotal}\DescribeMacro{\summaryPointTotal} contains the total points
+% for the current exam; the command \cmd\summaryTotalsTxt\DescribeMacro\summaryTotalsTxt\ defines its the formatting
+% for the points. The command \cmd\nQuesInExam\DescribeMacro\nQuesInExam\ is the total number
+% of questions in the exam.
+% \begin{macrocode}
+\newcommand\summaryPointTotal{\csname\thisexamlabel total\endcsname}
+\newcommand\summaryTotalsTxt{($\eqe@ptsFmt{\summaryPointTotal}\,\text{%
+ \@ifundefined{\thisexamlabel total}{\eqpointsLabel}%
+ {\ifnum\summaryPointTotal=1\relax\eqpointLabel\else
+ \eqpointsLabel\fi}}$)}
+\newcommand{\nQuesInExam}[1][\thisexamlabel]{%
+ \def\eqe@argi{#1}%
+ \ifx\thisexamlabel\@empty\ifx\eqe@argi\thisexamlabel
+ \PackageError{eqexam}{The optional argument for
+ \string\nQuesInExam\MessageBreak must be specified}{}\fi\fi
+ \csname#1nQuestions\endcsname}
+% \end{macrocode}
+% \end{environment}
+% Make this definition for \texttt{hyperref}, so its anchors will be unique. Useful
+% when there are multiple parts of the test.
+% \begin{macrocode}
+\ifx\hyper@anchor\@undefined\else
+ \renewcommand\theHeqquestionnoi
+ {\curr@quiz.\theeqquestionnoi\eqe@fpmrk}
+ \renewcommand\theHquizno{%
+ \if\probstar*\curr@quiz.%
+ \theeqquestionnoi.part\thepartno.\arabic{quizno}%
+ \else
+ \curr@quiz.%
+ \theeqquestionnoi.\arabic{quizno}%
+ \fi
+ }
+ \renewcommand\theHpartno{\curr@quiz.%
+ \theeqquestionnoi.part\thepartno}
+\fi
+% \end{macrocode}
+% \begin{environment}{eqComments}
+% Often, I want to make additional instructions between problems, you can use
+% this comment environment.
+% \begin{macrocode}
+\newcommand{\beforeCommentSkip}{1.25ex}
+\newcommand{\afterCommentSkip}{-1ex}
+\newcommand\hCommSpace{\ }
+\newcommand\styleComm{\bfseries}
+\newenvironment{eqComments}[1][\strut]{\removelastskip
+ \def\eqe@argi{#1}\def\eqe@Strut{\strut}\def\hsc{\styleComm}%
+ \@startsection{paragraph}{4}{\z@}%
+ {\beforeCommentSkip\space\@plus1ex \@minus.2ex}%
+ {\afterCommentSkip}{\normalfont\normalsize\styleComm}*%
+ {\textcolor{\@eqCommentsColor}{#1}}%
+ \ifx\eqe@argi\eqe@Strut\hskip\afterCommentSkip
+ \else\ifx\eqe@argi\@empty\hskip\afterCommentSkip\else
+ \hsc\strut\fi\fi\normalfont\normalsize
+ \color{\@eqCommentsColorBody}\ignorespaces
+}{\par\vskip\beforeCommentSkip\space\@plus1ex \@minus.2ex}
+% \end{macrocode}
+% \end{environment}
+% \subsection{The \texttt{exam} Environment}
+% Each part of the exam is enclosed in an \texttt{exam} environment. The environment is
+% a customized version of the \texttt{shortquiz} environment.
+% \begin{macro}{\exambegdef}
+% Some definitions that are executed at the beginning of each exam environment.
+% \begin{macrocode}
+\let\tb@beginexam@code\relax
+\def\partialspillovertotals{0}
+\def\exambegdef
+{%
+ \csname\thisexamlabel pagemark\endcsname
+ \@ifundefined{partialtotalpg}{}{%
+ \ifnum\partialtotalpg=\arabic{page}%
+ {\count0=\partialspillovertotals
+ \advance\count0by\partialtotaleoe
+ \xdef\partialspillovertotals{\the\count0}%
+ \eqe@IWO\@auxout{\string\csarg\string\gdef
+ {Page\partialtotalpg spilltotal}{\partialtotaleoe}}%
+ }%
+ \fi
+ }%
+ \csarg\ifx{\thisexamlabel pageno}\relax
+ \else
+ \csarg\ifx{pagenofirstprob\thisexamlabel}\relax
+ \else
+ \csarg\ifnum{\thisexamlabel pageno}
+ < \@nameuse{pagenofirstprob\thisexamlabel}%
+ \else
+ \csarg\ifx{\thisexamlabel pagemark}\relax
+ \else
+ \ifnum\value{page}=%
+ \csname\thisexamlabel pageno\endcsname
+ \eqe@IWO\@auxout{\string\csarg\string\gdef
+ {\thisexamlabel pagemark}{\string\newpage}}%
+ \fi
+ \fi
+ \fi
+ \fi
+ \fi
+ \setcounter{eqquestionnoi}{0}\setcounter{eqpointvalue}{0}%
+ \setcounter{eqpointsofar}{0}\setcounter{eqpointsthispage}{0}%
+ \setcounter{eq@count}{0}%
+% \end{macrocode}
+% We wrote \verb!\begin{eqequestions}! to the top of the solutions file (\cs{jobname.sol}.
+% \begin{macrocode}
+ \writeBeginEqeQuestions
+% \end{macrocode}
+% \begin{macrocode}
+ \label{\thisexamlabel PageBegin}%
+ \eqe@IWO\@auxout{\string\csarg\string\gdef
+ {\thisexamlabel pageno}{\thepage}}%
+% \let\sq@priorhook\@empty
+ \ifeqfortextbook
+ \global\examenvtrue\tb@beginexam@code
+ \fi
+}
+% \end{macrocode}
+% \end{macro}
+% \begin{macro}{\examenddef}
+% Some definitions that are executed at the end of each exam environment.
+% We place a totals box to report the total since the last page.
+% \begin{macrocode}
+\def\tb@insmargmark{\ifisinstred\ifismarginans
+ \insMidMarg{\mark{}}\fi\fi}
+\def\eqe@adjForSepRule{\if\eq@parttotals\eqe@YES
+ \eq@pointboxtotalheight\halfHtPtBox\relax
+ \advance\eq@pointboxtotalheight\dpPtBox\relax
+ \advance\eq@pointboxtotalheight\pointsmarginparpush
+ \vspace*{\eq@pointboxtotalheight}\fi}
+\def\eqe@afterexamsepcode{% dps7
+ \if\eq@parttotals\eqe@YES
+ \@actionsAtPageBreak{\global\let\@spacetobreak1}%
+ {\global\let\@spacetobreak0}%
+ \ifx\@spacetobreak0\relax
+ \bgroup\@tempdima=\pagetotal
+ \advance\@tempdima\eq@pointboxtotalheight
+ \ifdim\@tempdima>\pagegoal\aftergroup\newpage
+ \else\ifnum\arabic{eq@count}>0\relax
+ \removelastskip\vskip6pt\kern0pt %dps7
+ \if\@reportpoints\eqe@One\else\@checkSpacing{0}\fi
+ \textcolor{\endexamtotal@color}%
+ {\eqeomarginbox{\arabic{eq@count}}{0}}\fi
+ \ifx\eqx@separationrule\eqe@YES
+ \separationrule\eqe@adjForSepRule\fi
+ \fi\egroup
+ \fi
+ \else\ifx\eqx@separationrule\eqe@YES
+ \separationrule\eqe@adjForSepRule\fi
+ \fi
+}
+\def\examenddef
+{%
+ \global\let\partialtotaleoe\relax
+ \global\let\partialtotalpg\relax
+ \global\let\afterexamsepcode\relax
+ \csarg\ifx{NumberOfParts}\relax
+ \else
+ \ifnum\value{eq@numparts}<\NumberOfParts
+ \setcounter{eq@count}{\value{eqpointvalue}}%
+ \addtocounter{eq@count}{-\value{eqpointsofar}}%
+ \xdef\partialtotaleoe{\arabic{eq@count}}%
+ \xdef\partialtotalpg{\arabic{page}}%
+% \end{macrocode}
+% See if there is enough room at the bottom of the page to place the end of exam
+% totals and to start a new exam, if any. If not, forget it, and start a new page.
+% \begin{macrocode}
+ \global\let\afterexamsepcode\eqe@afterexamsepcode % dps7
+ \fi
+ \fi
+ \ifeqfortextbook\global\examenvfalse\fi
+% \end{macrocode}
+% (2011/05/08) Just before the file is closed and input, we write the end
+% of the \texttt{eqequestions} environment, \verb!\end{eqequestions}!.
+% \begin{macrocode}
+ \writeEndEqeQuestions
+% \end{macrocode}
+% \begin{macrocode}
+ \writetotalstoaux
+ \addtocounter{page}{-1}%
+ \writelastpage[\thisexamlabel]\addtocounter{page}{1}%
+ \ifeqfortextbook\tb@insmargmark\fi
+}
+\def\@actionsAtPageBreak#1#2{%
+ \bgroup\@tempdima\pagegoal\advance\@tempdima-\pagetotal
+ \@tempdimb\@fvsizeskip\vsize
+ \ifdim\@tempdima < \@tempdimb #1\else #2\fi\egroup
+}
+% \end{macrocode}
+% \end{macro}
+% \begin{macro}{\separationrule}
+% For an exam with multiple parts, a separation rule is created, unless absorbed
+% into a page break. The command \cs{separationrule} defines this separation rule,
+% it can be redefined as desired.
+% \changes{v1.7a}{2007/12/10}
+%{
+% Added \cs{separationrule} so user's can redesign the separation rule
+% that is created between two parts of an exam.
+%}
+% \begin{macrocode}
+\newcommand{\separationrule}{\makebox[\linewidth-\eqemargin][c]%
+ {\rule{.67\linewidth}{.4pt}}}
+% \end{macrocode}
+% \end{macro}
+% (2011/05/08) This is a new environment that makes an exam into a list of problems.
+% This is an attempt to expand the use of \textsf{eqexam} to {\LaTeX}
+% documents. We give control over the page layout so an eqexam document
+% can be used within a textbook.
+% \begin{macrocode}
+\def\eqe@hspannerPrb{\ }
+\@ifundefined{ifwithsoldoc}{\newif\ifwithsoldoc\withsoldocfalse}{}
+\newcommand{\eqequestopsep}[1]{\def\eqeques@topsep{#1}}
+\providecommand{\eqequesparsep}[1]{\def\eqeques@parsep{#1}}
+\newcommand{\eqequesitemsep}[1]{\def\eqeques@itemsep{#1}}
+\newcommand{\eqequeslistparindent}[1]{\def\eqeques@listparindent{#1}}
+\eqequestopsep{0pt}
+\eqequesparsep{0pt}
+\eqequesitemsep{0pt}
+\eqequeslistparindent{0pt}
+\newif\iffirstitem
+\def\eqeSolnItemMngt{\iffirstitem\global\firstitemfalse
+ \let\eqe@next\@empty\else\let\eqe@next\item\fi\eqe@next\relax}
+\newenvironment{eqequestions}{%
+ \begin{list}{}{%
+ \ifwithsoldoc\let\solnItemMngt\eqeSolnItemMngt\fi
+ \setlength{\labelwidth}{\eqemargin}%
+ \setlength{\parsep}{\eqeques@parsep}%
+ \setlength{\itemsep}{\eqeques@itemsep}%
+ \setlength{\topsep}{\eqeques@topsep}%
+ \setlength{\itemindent}{0pt}%
+ \setlength{\listparindent}{\eqeques@listparindent}%dps%
+ \ifwithsoldoc\settowidth{\labelsep}{\eqe@hspannerSoln}\else
+ \settowidth{\labelsep}{\eqe@hspannerPrb}\fi
+ \setlength{\leftmargin}{\labelwidth}%
+ }\ifwithsoldoc\global\firstitemtrue\fi\item\relax}{\end{list}}
+% \end{macrocode}
+% \begin{environment}{exam}
+% Each part of the exam is enclosed in an \texttt{exam} environment. The one
+% required parameter is the name of the part, for example, `Part1', `Part2'.
+% These should be one word, no white spaces, just letters and possibly numbers.
+% \begin{macrocode}
+\def\setDefaultfvsizeskip#1{\def\default@fvsizeskip{#1}%
+ \def\@fvsizeskip{#1}}
+\def\default@fvsizeskip{.3}
+\edef\@fvsizeskip{\default@fvsizeskip}
+\newcommand{\fvsizeskip}[1]{\def\@fvsizeskip{#1}}
+\def\autoExamName{exam\the\value{eq@numparts}}
+\def\nNumberOfP@rts{\csname NumberOfParts\endcsname}
+\abovesqskip{}
+\let\eqeWrtExamTitleToSolns\eqe@YES
+\def\wrtExamTitleInSolns{\let\eqeWrtExamTitleToSolns\eqe@YES}
+\def\noExamTitleInSolns{\let\eqeWrtExamTitleToSolns\eqe@NO}
+\let\thisexamlabel\@empty
+\let\isInExamEnv\eqe@NO
+\newenvironment{exam}[2][]
+{%
+ \makeRoomForProb{\@fvsizeskip\textheight}{0}%
+ \let\isInExamEnv\eqe@YES
+ \stepcounter{eq@numparts}%
+% \end{macrocode}
+% If \texttt{\#2} is empty, use \cs{autoExamName}
+% \begin{macrocode}
+ \def\eqexamargii{#2}\ifx\eqexamargii\@empty
+ \edef\eqexamargii{\autoExamName}\fi
+ \xdef\thisexamlabel{\eqexamargii}\xdef\curr@quiz{\eqexamargii}%
+ \def\eqexamargi{#1}\ifx\eqexamargi\@empty
+ \edef\eqexamargi{\eqexamargii}\fi
+ \expandafter\gdef\expandafter\thisUFexamlabel
+ \expandafter{\eqexamargi}%
+ \edef\eq@tmp{\the\partNames\string\\{\eqexamargii}}%
+ \global\partNames=\expandafter{\eq@tmp}%
+ \csarg\ifx{NumberOfParts}\relax\else
+\ifx\eqeWrtExamTitleToSolns\eqe@YES
+ \ifnum\nNumberOfP@rts=1\relax\else
+ \def\eqe@argi{#1}\ifx\eqe@argi\@empty
+ \eqe@writetoSolns{\eqexamargii}\eqe@writetoAux{\string
+ \csarg\string\gdef{userFriendly\eqexamargii}{\eqexamargii}}
+ \else
+ \eqe@writetoSolns{#1}\eqe@writetoAux{\string
+ \csarg\string\gdef{userFriendly#2}{#1}}
+ \fi
+ \fi\fi
+\fi
+ \exambegdef
+ \edef\temp@Exp{\noexpand\shortquiz\sqstar[\eqexamargii]}\temp@Exp
+% \expandafter\shortquiz\sqstar[\eqexamargii]%
+}{%
+ \examenddef
+% \end{macrocode}
+% \changes{v4.4}{2015/05/24}{Finish with a \cs{vskip} to clear the last
+% item or problem.}
+% \begin{macrocode}
+ \vskip\eqeques@parsep\relax\kern0pt %dps88
+ \endshortquiz
+ \aftergroup\afterexamsepcode % dps7
+ \par\penalty-100\vskip0pt
+}
+% \end{macrocode}
+% \end{environment}
+% \begin{macro}{\EQEcalculateAllTotals}
+% (4/22/11) Added the command \cs{EQEcalculateAllTotals}. The command is executed
+% as part of the \cs{maketitle} command. If \cs{maketitle} is not used for some reason
+% \cs{EQEcalculateAllTotals} can be executed just after \verb~\begin{document}~.
+% \begin{macrocode}
+\newcommand{\EQEcalculateAllTotals}{%
+ \begingroup
+% \end{macrocode}
+% We calculate the grand total of all the parts of the \texttt{exam} environments,
+% and we define \cs{eqeGrandTotal}, which contains the total.
+% \begin{macrocode}
+ \count\z@=0\relax
+ \def\\##1{\csarg\ifx{##1total}\relax\else
+ \advance\count\z@\csname##1total\endcsname
+% \end{macrocode}
+% \cs{thePartNames} list all named exam environments in the document, e.g.,
+%\begin{verbatim}
+% \\{Part1}\\{Part2}...\\{LastPart}
+%\end{verbatim}
+% \begin{macrocode}
+ \fi}\csname thePartNames\endcsname
+ \xdef\eqeGrandTotal{\the\count\z@}%
+ \ifnum\eqeGrandTotal=0 \else
+% \end{macrocode}
+% If there is a nonzero grandtotal, we move on to calculate
+% the percentages.
+% \begin{macrocode}
+ \def\\##1{\eqe@calc@percent{##1}}%
+ \csname thePartNames\endcsname\fi
+ \endgroup
+}
+% \end{macrocode}
+%
+% \begin{macro}{\eqe@calc@percent}
+% We go through the parts listed in \cs{thePartNames} and create a
+% calculation of the percentage for that part, and leave it in
+% \verb!\csname#1percent\endcsname!, which can be accessed
+% through the \cs{percentForPart} command, for example
+% \verb!\percentForPart{<part_name>}! might expand to \texttt{45.6\%}.
+% \begin{macro}{\nPctDecPts}
+% The number of decimal points to carry in the representation of the
+% percentage.
+% \begin{macrocode}
+\newcommand{\nPctDecPts}{1}
+\def\eqe@calc@percent#1{\@ifundefined{#1total}{%
+ \csarg\gdef{#1percent}{??}}{%
+% \end{macrocode}
+% If the \textsf{fp} package is not loaded, we use register arithmetic,
+% percentages are truncated to integers.
+% \begin{macrocode}
+ \csarg\ifx{FPdiv}\relax
+ \count2=\tot@lForPart{#1}%
+ \edef\expGT{\csname eqeGrandTotal\endcsname}%
+ \multiply\count2by100\relax\divide\count2by\expGT\relax
+ \csarg\xdef{#1percent}{\the\count2 }\else
+% \end{macrocode}
+% If the \textsf{fp} package is loaded, we use this package to calculate
+% the percentage, accurate to one decimal place.
+% \begin{macrocode}
+ \FPdiv{\eqe@pForPart}{\csname#1total\endcsname}%
+ {\csname eqeGrandTotal\endcsname}%
+ \FPmul{\eqe@pForPart}{\eqe@pForPart}{100}%
+ \FPround{\eqe@pForPart}{\eqe@pForPart}{\nPctDecPts}%
+ \csarg\xdef{#1percent}{\eqe@pForPart}\fi
+ }%
+}
+% \end{macrocode}
+% \end{macro}
+% \end{macro}
+% \end{macro}
+% \begin{macrocode}
+\def\writetotalstoaux{\eqe@IWO\@auxout{\string
+ \csarg\string\gdef{\thisexamlabel total}{\theeqpointvalue}}%
+ \eqe@IWO\@auxout{\string\csarg
+ \string\gdef{\thisexamlabel nQuestions}{\theeqquestionnoi}}%
+}
+\newcommand{\writelastpage}[1][]{\def\eqe@argi{#1}%
+ \ifx\eqe@argi\@empty\else\label{#1PageEnd}\fi
+ \eqe@IWO\@auxout{\string\csarg
+ \string\gdef{eqExamLastPage}{\arabic{page}}}%
+}
+\def\exlabel{}
+\def\sqlabel{}
+\def\exsolafter{\textit{Solution}:}
+\def\sqsolafter{\textit{Solution}:}
+% \end{macrocode}
+% The exercise labels in the body of the text. (2015/02/27) changed
+% the command \cs{exlabelformatwp} to incorporate other parameters.
+% \begin{macrocode}
+%\def\exlabelformat{\textbf{\theeqquestionnoi.\ }}
+\def\exlabelformat{\textbf{%
+ \theeqquestionnoi\eqe@decPointPrb\eqe@hspannerPrb}}
+\def\exlabelformatwp{\exlabelformat}
+% \end{macrocode}
+% The exercise labels for solutions at the end of the document
+% \begin{macrocode}
+\def\exsllabelformat
+ {\string\makebox[0pt][r]{\string\textbf{%
+ \theeqquestionnoi\eqe@decPointPrb\eqe@hspannerSoln}}}
+\def\exsllabelformatwp
+ {\string\makebox[0pt][r]{\string\textbf{%
+ \theeqquestionnoi\eqe@decPointPrb\eqe@hspannerSoln}}%
+ (\thepartno)\eqe@hspannerSoln}
+\ifanswerkey
+ \def\exrtnlabelformat{}
+ \def\exrtnlabelformatwp{}
+ \def\eq@sqslrtnlabel{}
+\else
+ \def\exrtnlabelformat{$\square$}
+ \def\exrtnlabelformatwp{$\square$}
+ \def\eq@sqslrtnlabel{$\square$}
+\fi
+\def\sqslrtnlabel{\eq@sqslrtnlabel}
+% \end{macrocode}
+% (2010/08/21) Enable some localizations of strings
+% \begin{macrocode}
+\newcommand{\exsectitletext}{Solutions to \webtitle}
+\def\exsectitle{\normalsize\exsectitletext}
+%\def\exsectitle{\normalsize\hspace*
+% {-\oddsidemargin}\exsectitletext}
+\@ifpackageloaded{exerquiz}{%{Solutions to \websubject}
+ \renewcommand{\exsecrunhead}{}}{\newcommand{\exsecrunhead}{}}
+%\providecommand{\exsecrunhead}{Solutions to \websubject}%
+\def\eq@sqslsectitle{}
+\def\eq@sqslsecrunhead{}
+\def\eq@sqsllabel{{\string\llap{\string\textbf{\theeqquestionnoi.\ }}}}
+\def\eq@sqlabel{}
+\let\include@quizsolutions\relax
+\let\solnhspace\@empty
+% \end{macrocode}
+% \subsection{\texttt{problem} Environments}
+% A single question is posed with the \texttt{problem} environment, and a question with
+% multiple parts with the \texttt{problem*} environment.
+% \begin{macro}{\fillin}
+% This macro is used for fill-in type questions. The first argument is the length
+% of the underline blank to leave to fill-in, the second argument is the correct answer.
+% \begin{macrocode}
+\newcommand{\optsFillIn}[1]{\def\eqe@optsFillIn{#1}}
+\let\eqe@optsFillIn\@empty
+\newcommand{\fillin}[3][u]{%
+ \ifx#1u\let\@fillinFmt\underbar
+ \else\ifx#1b\let\@fillinFmt\relax
+ \else\let\@fillinFmt\relax\fi\fi
+ \ifeq@proofing
+ \@fillinFmt{\makebox[#2]{%
+ \strut\hfil\bfseries\color{red}#3\hfil}}%
+ \else
+ \@fillinFmt{\makebox[#2]{\strut\hfil}}%
+ \@ifundefined{@quiz}{}{%
+ \if\eq@online\eqe@YES\relax
+ \ifeq@nosolutions
+ \ifeq@solutionsafter\else
+ \ifx\eq@insertverticalspace\eqe@YES\relax
+ \stepcounter{@cntfillin}%
+ \edef\fieldName{%
+ \if\probstar*eqexam.\curr@quiz.fillin.%
+ \theeqquestionnoi.part\thepartno.%
+ fi\the@cntfillin%
+ \else
+ eqexam.\curr@quiz.fillin.%
+ \theeqquestionnoi.fi\the@cntfillin%
+ \fi
+ }\makebox[0pt][r]{\textField[\BC{}
+ \presets{\eqe@optsFillIn}]{%
+ \fieldName}{#2}{11bp}}%
+ \fi
+ \fi
+ \fi
+ \fi
+ }%
+ \fi\space\ignorespaces}
+% \end{macrocode}
+% \end{macro}
+% \begin{macro}{\TF}
+% A specialized version of \cs{fillin} for True/False questions.
+% \begin{macrocode}
+\newcommand\defaultTFwidth{30pt}
+\newcommand\TF[2][\defaultTFwidth]{%
+ \def\eqe@next{\fillin{#1}{#2}}%
+ \ifdim\eq@extralabelsep=0pt\relax\else
+ \if\probstar*\relax\if\exerwparts@cols0
+ \def\eqe@next{\makebox[0pt][r]{%
+ \fillin{#1}{#2}}\ignorespaces}%
+ \fi\fi\fi
+\eqe@next}
+\def\fillinWidth#1{%
+ \if\probstar*
+ \settowidth{\eq@tmplengthA}{\normalfont\ }%
+ \addtolength{\eq@tmplengthA}{#1}%
+ \edef\eq@extralabelsep{\the\eq@tmplengthA}%
+ \fi
+}
+\let\fillInFormatDefault\@empty
+% \end{macrocode}
+% \end{macro}
+% \begin{macro}{\Do<num>}
+% The following commands supports the optional argument \texttt{{\string\Do<num>}}.
+% When I teach senior or graduate-level classes, I often give a problem with
+% multiple parts (each of equal value) and ask them to ``do 3 of the following 5''
+% parts.
+% \begin{macrocode}
+\def\eqe@DoWarning#1{\PackageWarning{eqexam}{\string#1\space
+ requires the first argument\MessageBreak of problem* to be <num>ea}}
+\def\eqe@DoNum{\textbf{??}\eqe@DoWarning{\DoNum}}
+\def\eqe@nDoNum{\textbf{??}\eqe@DoWarning{\nDoNum}}
+\let\DoNum\eqe@DoNum
+\let\nDoNum\eqe@nDoNum
+\def\makeDoNum#1{\xdef\nDoNum{#1}%
+ \def\ifc@sewrap{\ifcase#1??\or}%
+ \xdef\DoNum{\expandafter\ifc@sewrap\eqe@wordNums\else
+ \eqe@wordNumbsError\fi}}
+\def\makeOutOfNum#1{\xdef\nOutOfNum{#1}%
+ \def\ifc@sewrap{\ifcase#1??\or}%
+ \xdef\OutOfNum{\expandafter\ifc@sewrap\eqe@wordNums\else
+ \eqe@wordNumbsError\fi}}
+\def\eqe@OutOfNum{\textbf{??}\eqe@DoWarning{\OutOfNum}}
+\def\eqe@nOutOfNum{\textbf{??}\eqe@DoWarning{\nOutOfNum}}
+\let\OutOfNum\eqe@OutOfNum
+\let\nOutOfNum\eqe@nOutOfNum
+% \end{macrocode}
+% \DescribeMacro{\eqe@wordNums} is used to typeset the English word for
+% the numbers (1--10). This command may be redefined to other languages.
+% \begin{macrocode}
+\newcommand{\eqe@wordNums}{one\or two\or three\or
+ four\or five\or six\or seven\or eight\or nine\or ten}
+\newcommand{\eqe@wordNumbsError}{\noexpand\PackageError{eqexam}%
+ {Number out of range, 1--10}%
+ {Use a smaller number, or redefine the command
+ \string\eqe@wordNums.}}
+% \end{macrocode}
+% \end{macro}
+% \begin{macrocode}
+\def\makeRoomForProb#1#2{\par %\endgraf % dps 11/11/10
+ \bgroup\@nobreakfalse\addpenalty{-500}%
+ \setlength{\@tempdimb}{#1}%
+ \@tempdima \pagegoal \advance \@tempdima -\pagetotal
+ \ifdim \@tempdima<\@tempdimb\ifnum\col@number>\@ne\columnbreak
+ \else\newpage\fi\fi\egroup
+ \ifnum\@reportpoints>1
+ \ifx\eqe@prevProbZero\eqe@YES
+ \if\eqe@isPts0\else\vskip-\halfHtPtBox\relax\fi
+ \else
+ \ifl@stDispl@yPoints
+ \if\eqe@isPts0\@checkSpacing{1}\else
+ \if#21 \@checkSpacing{0}\fi
+ \fi\fi
+ \fi
+ \fi
+}
+% \end{macrocode}
+% \begin{macro}{\emitMessageNearBottom}
+% The syntax for this command is
+%\begin{verbatim}
+% \emitMessageNearBottom*[vspace]{msg}
+%\end{verbatim}
+% If there is less than \texttt{vspace} remaining on the page, a message,
+% \texttt{msg}, is emitted. Then the optional \texttt{*} appears, a
+% \cs{newpage} is also emitted just after the \texttt{msg} and
+% \cs{insertContAnnot} is expanded just after \cs{newpage}.
+% \begin{macrocode}
+\newcommand{\emitMessageNearBottom}{\@ifstar
+ {\def\eqe@emnb{\ifnum\col@number>\@ne\columnbreak
+ \else\newpage\fi\insertContAnnot}\eq@emitMessageNearBottom}
+ {\let\eqe@emnb\relax\eq@emitMessageNearBottom}}
+\newcommand{\eq@emitMessageNearBottom}[2][\iacvspace]{%
+ \eq@@emitMessageNearBottom{#1}{#2}}
+\def\eq@@emitMessageNearBottom#1#2{\par
+ \bgroup\@nobreakfalse\addpenalty{-500}%
+ \setlength{\@tempdimb}{#1}%
+ \@tempdima \pagegoal \advance \@tempdima -\pagetotal
+ \ifdim \@tempdima<\@tempdimb #2 \eqe@emnb\fi\egroup}
+% \end{macrocode}
+% \end{macro}
+% \DescribeMacro{\getSpaceLeftOnPage}\cmd{\getSpaceLeftOnPage} calculates
+% the amount of space left on the current page. It saves the calculation
+% in the text macro \DescribeMacro{\amtSpaceOnLeftOnPage}\cmd{\amtSpaceOnLeftOnPage}.
+% \begin{macrocode}
+\newcommand{\getSpaceLeftOnPage}{\par\bgroup
+ \@tempdima \pagegoal \advance \@tempdima -\pagetotal
+ \xdef\amtSpaceOnLeftOnPage{\the\@tempdima}\egroup}
+% \end{macrocode}
+% \begin{macro}{\promoteNewPage}
+%\changes{v2.0n}{2011/05/13}{%
+% A simple variation on \cs{makeRoomForProb} designed for user use.
+%}
+% A simple variation on \cs{makeRoomForProb} designed for user use.
+% \begin{macrocode}
+\newcommand{\pnpDflt}{\@fvsizeskip\textheight}
+\newcommand{\promoteNewPage}[1][\pnpDflt]{%
+ \makeRoomForProb{#1}{0}}
+% \end{macrocode}
+% \end{macro}
+% Used in \cmd{\makeRoomForProb} and elsewhere. \DescribeMacro{\pointsmarginparpush}
+% \cs{pointsmarginparpush} adds a little more separation between point
+% boxes. \DescribeMacro{\@checkSpacing}\cmd{\@checkSpacing} is the algorithm
+% for adjusting the vertical spaces between problems when points are on the
+% right.
+% \begin{macrocode}
+\def\pointsmarginparpush{3pt}
+\def\@checkSpacing#1{\bgroup\ifinner\else
+ \@tempdima\lastPageTotal
+ \@tempdimb\pagetotal
+% \end{macrocode}
+% If \cs{lastPageTotal} is less than \cs{pagetotal}, continue
+% \begin{macrocode}
+ \ifdim\@tempdima < \@tempdimb
+% \end{macrocode}
+% Compute \texttt{\cs{pagetotal} - \cs{lastPageTotal}}
+% \begin{macrocode}
+ \advance\@tempdimb by-\@tempdima
+ \ifdim\@tempdimb < \eq@pointboxtotalheight
+ \if#11%
+ \eq@pointboxtotalheight\halfHtPtBox\relax
+ \advance\eq@pointboxtotalheight\dpPtBox\relax
+ \fi
+ \@tempdima=\eq@pointboxtotalheight
+ \advance\@tempdima\pointsmarginparpush\relax
+ \advance\@tempdima by-\@tempdimb
+ \vspace*{\@tempdima}%
+ \fi
+ \fi\fi
+\egroup}
+\def\@checkSpacingi{\bgroup
+ \@tempdima = \lastPageTotal
+ \@tempdimb = \pagetotal
+ \ifdim\@tempdima < \@tempdimb
+ \advance\@tempdimb by-\@tempdima
+ \eq@pointboxtotalheight\halfHtPtBox\relax
+ \advance\eq@pointboxtotalheight\dpPtBox\relax
+ \ifdim\@tempdimb < \eq@pointboxtotalheight
+ \@tempdima=\eq@pointboxtotalheight
+ \advance\@tempdima\pointsmarginparpush\relax
+ \advance\@tempdima by-\@tempdimb
+ \vspace*{\@tempdima}%
+ \fi
+ \fi
+\egroup}
+% \end{macrocode}
+% \DescribeMacro{\default@nbaselineskip} is the default number of \cs{baselineskip}s needed to place
+% a new problem. While \DescribeMacro{\nbaselineskip}\cmd{\nbaselineskip} is the number
+% of \cs{baselineskip}s needed for a new \texttt{problem} (or \texttt{problem*}).
+% \begin{macrocode}
+\newcommand{\setDefaultnbaselineskip}[1]{\def\default@nbaselineskip{#1}}
+\setDefaultnbaselineskip{6}
+\def\nbaselineskip#1{\def\@nbaselineskip{#1}}
+\def\nbaselineskipReset{\edef\@nbaselineskip{\default@nbaselineskip}}
+\nbaselineskipReset
+% \end{macrocode}
+% \begin{environment}{problem}
+% The \texttt{problem} is used to pose a single---non-multi-part---question.
+% The optional argument is the number of points for this problem.
+% \begin{macrocode}
+\def\eqe@gobbletoend#1\end{}
+\def\eqe@grabarg#1\end{\def\numpoints{#1}}
+\def\eqe@isPts{1}
+% \end{macrocode}
+% We reset some \textsf{exerquiz} parameters for \textsf{eqexam}
+% \begin{macrocode}
+\aboveexskip{3pt}\belowexskip{3pt}
+\partstopsep{3pt}\partsitemsep{3pt}\partsparsep{0pt}
+\rowsepDefault{3pt}\partstabcolsep{1.5pt}%
+\partstabtopsep{3pt}\partstabrowsep{3pt}
+\renewcommand\belowexsolnskip{{}}%
+% \end{macrocode}
+% The \textsf{problem} environment now begins.
+% \begin{macrocode}
+\let\isProbEnv\eqe@NO
+\let\topofprobhook\relax
+\newenvironment{problem}[1][]{\let\isProbEnv\eqe@YES
+ \if\eqe@isPts0\global\let\eqe@prevProbZero\eqe@YES\else
+ \global\let\eqe@prevProbZero\eqe@NO\fi
+ \global\thereissolutionfalse
+ \def\numpointsEmpty{0}\def\numpoints{#1}%
+ \ifx\numpoints\@empty\def\numpoints{0}\def\numpointsEmpty{1}%
+ \gdef\eqe@isPts{0}\else\gdef\eqe@isPts{1}\fi
+ \makeRoomForProb{\@nbaselineskip\baselineskip}{\eqe@isPts}%
+ \gdef\probstar{x}\let\afterlabelhskip\@empty
+ \ifx\marginpoints\@empty\else %\def\numpoints{#1}%
+ \if\numpointsEmpty\eqe@One\let\marginpoints\@gobbletwo\fi
+% \end{macrocode}
+%\changes{v2.0n}{2011/05/13}{%
+% Added \texttt{*<num>} to signal in-line display of points.
+%}
+% (2011/5/13) We add a \texttt{*} feature. When the author types
+% \texttt{[*3]}, it is a three point problem, but the value is expressed
+% in-line, not in the margins.
+% \begin{macrocode}
+ \@ifstar{\let\@isitstar\eqe@One\eqe@grabarg}%
+ {\let\@isitstar\eqe@Zero\eqe@gobbletoend}#1\end
+ \if\@isitstar\eqe@One\addtocounter{eqpointvalue}{\numpoints}%
+ \@marktotalvalue
+ \ifdispl@yPoints
+ \def\marginparafterhook{\PTs{\numpoints}\space}\else
+ \def\marginparafterhook{\PTs*{\numpoints}\space}\fi\else
+ \def\marginparpriorhook{\noindent
+ \probvalue{\numpoints}{0}}\fi
+ \fi\setcounter{eq@count}{\value{eqquestionnoi}}%
+ \addtocounter{eq@count}{1}%
+ \ifnum\value{eq@count}=1\relax
+ \eqe@IWO\@auxout{\string
+ \csarg\string\gdef{pagenofirstprob\thisexamlabel}{\thepage}}%
+ \fi
+% \end{macrocode}
+% \changes{}{2015/06/01}{Added the hook \cs{topofprobstarhook}}
+% \DescribeMacro\topofprobhook is a general purpose hook at the top of the
+% \texttt{problem} environment, before the beginning of the nested
+% \texttt{eqequestions} environment.
+% \begin{macrocode}
+ \topofprobhook
+% \end{macrocode}
+% \changes{v3.1e}{2012/11/10}{Removed hard-wired \cs{proofingsymbol}}
+% \begin{macrocode}
+% \proofingsymbol{\ding{52}}%
+ \begin{eqequestions}%
+ \begin{exercise}[eqquestionnoi]%
+}{\end{exercise}%
+ \end{eqequestions}%
+ \ifeqlocalversion\ifeqglobalversion
+ \xdef\eqe@tmp{\noexpand\forVersion{\eq@selectedVersion}}%
+ \aftergroup\eqe@tmp
+ \fi\fi
+ \global\eqlocalversionfalse
+ \ifdispl@yPoints\global\l@stDispl@yPointstrue
+ \else\global\l@stDispl@yPointsfalse\fi
+ \global\let\eqe@fpmrk\@empty
+}
+% \end{macrocode}
+% \end{environment}
+% \begin{macro}{\PTs}
+% \begin{macro}{\itemPTsTxt}
+% \begin{macro}{\itemPTsFormated}
+% When you specify \cs{auto} for the optional argument of the \texttt{problem*}
+% environment, when each item must have the command \cs{PTs} to assign the
+% value of that question. The \cs{PTs} has one optional star-parameter, and one
+% required parameter. The required parameter is the number of points for this item,
+% if the \texttt{*} is specified, then the point value is not typeset in the document.
+%
+% The command \cs{itemPTsTxt} has one argument, the number of points for this item. This
+% argument is passed from the \cs{PTs} command. You can redefine the way the points appear
+% in the document using \cs{itemPTsTxt}. As separate command \cs{itemPTsFormated} is used to
+% put parentheses around \cs{itemPTsTxt}. If the \texttt{*} option is taken with \cs{PTs}, then
+% you are free to place \cs{itemPTsTxt} anywhere in the problem statement.
+% \changes{v1.6g}{2006/11/29}
+%{
+% Added \cs{itemPTsTxt} and \cs{itemPTsFormated} to work with \cs{PTs}.
+% Also added a \texttt{*} option, to \cs{PTs}, in this case the points
+% are not typeset.
+%}
+% \begin{macrocode}
+\newcommand\itemPTsTxt[1]{$\eqe@ptsFmt{#1}\,\text{%
+ \ifnum#1=1\relax\eqptLabel\else\eqptsLabel\fi}$}
+\newcommand\itemPTsEaTxt[1]{$\eqe@ptsFmt{#1}\,\text{%
+ \ifnum#1=1\relax\eqptLabel\else\eqptsLabel\fi\space\eqeachLabel}$}
+\newcommand{\itemPTsFormated}[1]{(#1)}
+% \end{macrocode}
+% (2013/12/04) Added \DescribeMacro{\obeyPTsStar}\cmd{\obeyPTsStar} and
+% \DescribeMacro{\ignorePTsStar}\cmd{\ignorePTsStar}. The former is the default.
+% if \cmd{\ignorePTsStar} is in effect, \cs{PTs*} is treated as \cs{PTs}. Useful
+% for assigning points to parts of a question, but not explicitly telling the student.
+% when you compile for the key (with \texttt{answerkey} option), you can include
+% \cmd{\ignorePTsStar} so the instructor can see the assigned points for each part.
+% \begin{macrocode}
+\newif\ifObeyPTsStar \ObeyPTsStartrue
+\def\obeyPTsStar{\global\ObeyPTsStartrue}
+\def\ignorePTsStar{\global\ObeyPTsStarfalse}
+\def\PTs{\leavevmode\@ifstar{\@PTs{*}}{\@PTs{x}}}
+\def\@PTs#1#2{%
+ \if\@reportpoints\eqe@Zero\ignorespaces\else
+ \if\eqe@pointsPartsId\eqe@One
+ \addtocounter{eqpointvalue}{#2}\@marktotalvalue
+ \addtocounter{eq@count}{#2}\fi
+% \end{macrocode}
+% If \DescribeMacro{\ignorePTsStar}\cmd{\ignorePTsStar} is in effect
+% (\cmd{\ObeyPTsStarfalse}), we gobble
+% the \cs{else} and let the code flow through.
+% \begin{macrocode}
+ \if#1*\ifObeyPTsStar\ignorespaces\else\expandafter\@gobble\fi
+ \else
+% \end{macrocode}
+% (2012/04/26) Wrapped |\itemPTsFormated{\itemPTsTxt{#2}}| as the argument
+% of \cs{eqe@movePTs}. \cs{eqe@movePTs} does nothing by default, but may be
+% redefined, for example, to place the value of each part on the margin.
+% The default definition of \cs{eqe@movePTs} follows.
+% \begin{macrocode}
+ \eqe@movePTs{\itemPTsFormated{\itemPTsTxt{#2}}}\fi
+ \fi
+}
+\def\eqe@movePTs#1{#1}
+% \end{macrocode}
+% \end{macro}
+% \end{macro}
+% \end{macro}
+% \DescribeMacro{\Do<num>} The \cs{isItD@} tests to see if the next token
+% is \cs{Do}, if yes, it marks it and calls \cs{y@st@Do}, which gets the argument
+% if the \cs{Do} token.
+% \begin{macrocode}
+\let\auto\relax
+\def\isItD@{\@ifnextchar\Do{\let\yest@D@\eqe@YES\y@st@Do}
+ {\let\yest@D@\eqe@NO\@gobblet@end}}
+\let\yest@D@\eqe@NO
+\let\D@Num\@empty
+\def\y@st@Do\Do#1\end{\gdef\D@Num{#1}}
+\def\@gobblet@end#1\end{}
+% \end{macrocode}
+% Test the argument to see if it is the \cs{auto} token
+% \begin{macrocode}
+\def\is@uto#1\auto#2\@nil{\def\eqe@argi{#1}\def\eqe@argii{#2}%
+ \ifx\eqe@argii\@empty\let\isit@uto\eqe@Zero\else
+ \let\isit@uto\eqe@One\fi
+}
+% \end{macrocode}
+%
+% \begin{environment}{problem*}
+%
+% The \texttt{problem*} environment is used to pose a multi-part question.
+% The \texttt{parts} environment is used to enumerate the parts.
+%\changes{v2.0c}{2011/01/11}{%
+% Changed \cs{@next} to \cs{eqe@next}. There was conflict in
+% the use of this command with one of the float environments. When user
+% used the table environment inside the problem* environment, the
+% compiled stopped because \cs{@next} was overwritten.
+%}
+% \begin{macrocode}
+% \end{macrocode}
+% We create a Id for the points specified by the first (and second) optional parameters:
+% 0 (total points specified); 1 (\cs{auto} specified); 2 (points each
+% specified); 4 (\cs{Do} second optional parameter); a value of \cs{relax} means
+% no points specified (the default).
+% \begin{macrocode}
+\let\eqe@pointsPartsId\relax
+% \end{macrocode}
+% \begin{macrocode}
+\def\leadinitemWarningStar{\PackageWarning{eqexam}
+ {Using the star (*) in front of the points\MessageBreak
+ designator is not allowed when there is a
+ \MessageBreak\string\leadinitem}}
+\def\tableadinWarningStar{\PackageWarning{eqexam}
+ {Using the star (*) in front of the points\MessageBreak
+ designator is not allowed when there is a
+ \MessageBreak\string\tableadin}}
+% \end{macrocode}
+% We now begin the code for the \texttt{problem*} environment.
+% \begin{macrocode}
+\let\isProbStarEnv\eqe@NO
+\let\topofprobstarhook\relax
+\csarg\def{problem*}{\let\isProbEnv\eqe@YES
+ \let\isProbStarEnv\eqe@YES
+ \global\thereissolutionfalse
+ \@ifnextchar[{\pr@bl@m@star}{\pr@bl@m@star[]}}
+\def\pr@bl@m@star[#1]{%
+ \@ifnextchar[{\pr@blem@star{#1}}{\pr@blem@star{#1}[]}}
+\def\pr@blem@star#1[#2]{%
+ \if\eqe@isPts0\global\let\eqe@prevProbZero\eqe@YES\else
+ \global\let\eqe@prevProbZero\eqe@NO\fi
+ \def\numpoints{#1}\ifx\numpoints\@empty
+ \gdef\eqe@isPts{0}\else\gdef\eqe@isPts{1}\fi
+ \makeRoomForProb{\@nbaselineskip\baselineskip}{\eqe@isPts}%
+% \end{macrocode}
+% Let the \cs{Do} commands to internal versions
+% \begin{macrocode}
+ \let\DoNum\eqe@DoNum\let\nDoNum\eqe@nDoNum
+ \let\OutOfNum\eqe@OutOfNum\let\nOutOfNum\eqe@nOutOfNum
+% \end{macrocode}
+% \changes{v3.1e}{2012/11/10}{Removed hard-wired \cs{proofingsymbol}}
+% \begin{macrocode}
+% \proofingsymbol{\ding{52}}%
+ \gdef\probstar{*}%
+ \gdef\pr@b@secondarg{#2}\setcounter{eq@count}{0}%
+ \let\afterlabelhskip\@empty
+ \global\let\probpointseach\@empty\def\numpoints{#1}%
+% \end{macrocode}
+% Determine if the argument begins with \texttt{*}
+% \begin{macrocode}
+ \@ifstar{\let\@isitstar\eqe@One\eqe@grabarg}%
+ {\let\@isitstar\eqe@Zero\eqe@gobbletoend}#1\end
+% \end{macrocode}
+% If this \texttt{problem*} environment has a \cs{leadinitem}, the \texttt{*}
+% option is not allowed
+% \begin{macrocode}
+ \if\@isitstar\eqe@One
+ \@tempcnta=\theeqquestionnoi\relax
+ \advance\@tempcnta1\relax
+ \@ifundefined{leadinitem\thisexamlabel-\the\@tempcnta}{}
+ {\leadinitemWarningStar\let\@isitstar\eqe@Zero}%
+ \@ifundefined{tableadin\thisexamlabel-\the\@tempcnta}{}
+ {\tableadinWarningStar\let\@isitstar\eqe@Zero}%
+ \fi
+% \end{macrocode}
+% Check for the \cs{auto} keyword
+% \changes{v3.1a}{2012/05/21}{Using a more robust method of detecting the
+% presence of \cs{auto}}.
+% There are problems when the first two digits are the same, the old comparison
+% would say that the first parameter is \cs{auto}, which is it not. Replace
+% the old comparison with a more robust method.
+% \begin{macrocode}
+ \expandafter\is@uto\numpoints\auto\@nil
+ \if\isit@uto\eqe@One\let\eqe@pointsPartsId\eqe@One
+ \global\let\probpointseach\relax
+% \end{macrocode}
+% The author has requested \cs{auto}
+% \begin{macrocode}
+ \def\eqe@next{\autocalcparts}%
+ \else
+ \ifx\pr@b@secondarg\@empty\else
+ \let\eqe@pointsPartsId\eqe@Four
+ \isItD@#2\end\fi
+% \end{macrocode}
+% Not \cs{auto} so either \texttt{<num>ea} or \texttt{<num>}
+% \begin{macrocode}
+ \def\eqe@next{\manualcalcparts{\numpoints}}%
+ \fi\eqe@next
+% \end{macrocode}
+% 2012/11/30 added \cs{leadinitem} defined \texttt{eqexam.def} as a dummy command, which we
+% the \cs{let} here to \cs{eqe@leadinitem}.
+% \begin{macrocode}
+ \let\leadinitem\eqe@leadinitem
+% \end{macrocode}
+% 2015/05/31 added \cs{tableadin} defined \texttt{eqexam.def} as a dummy command, which we
+% the \cs{let} here to \cs{eqe@leadinitem}.
+% \begin{macrocode}
+ \let\tableadin\eqe@tableadin
+% \end{macrocode}
+% \changes{}{2015/06/01}{Added the hook \cs{topofprobstarhook}}
+% \DescribeMacro\topofprobstarhook is a general purpose hook at the top of the
+% \texttt{problem*} environment, before the beginning of the nested
+% \texttt{eqequestions} environment.
+% \begin{macrocode}
+ \topofprobstarhook
+ \ifeqfortextbook
+ \writeToSolnFile{\protect\global\protect\frstProbNumShownfalse}\fi
+ \begin{eqequestions}%
+ \begin{exercise}[eqquestionnoi]*}%
+% \end{macrocode}
+% \begin{macrocode}
+\def\ftb@endprobstarCks{%
+ \ifWithinANSGrp
+ \PackageError{eqexam}{\string\bGrpANS\space is still open}
+ {You need to match it with an \string\bGrpANS,
+ or remove it.}%
+ \fi
+}
+% \end{macrocode}
+%\DescribeMacro{\endproblem*} begins here.
+% \begin{macrocode}
+\csarg\def{endproblem*}{%
+ \eqe@IWO\@auxout{\string
+ \csarg\string\gdef{nPartsThisProb\thisexamlabel.\theeqquestionnoi}%
+ {\arabic{partno}}}%
+ \ifx\probpointseach\@empty\else
+ \ifx\probpointseach\auto
+ \eqe@IWO\@auxout{\string
+ \csarg\string\gdef{prob\thisexamlabel.\theeqquestionnoi}%
+ {\theeq@count}}%
+ \else
+ \setcounter{eq@count}{\value{partno}}%
+ \ifx\pr@b@secondarg\@empty\else
+ \bgroup\toks0=\expandafter{\pr@b@secondarg}%
+ \expandafter\isItD@\the\toks0 \end
+% \end{macrocode}
+% If there is a |\Do|, we write this info to AUX.
+% \begin{macrocode}
+ \ifx\yest@D@\eqe@YES\ifx\eqe@pointsEach\eqe@YES
+ \eqe@IWO\@auxout{\string
+ \csarg\string\gdef{DoNumThisProb\thisexamlabel.%
+ \theeqquestionnoi}{\D@Num}}%
+ \@tempcnta = \value{eq@count}%
+ \advance\@tempcnta -\D@Num
+ \global\advance\value{eq@count}-\@tempcnta
+% 3.0k
+ \@tempcnta=\value{partno}%
+ \advance\@tempcnta -\D@Num
+ \multiply\@tempcnta by\argi
+ \addtocounter{eqpointvalue}{-\@tempcnta}%
+ \fi\fi
+ \egroup
+ \fi
+ \multiply\value{eq@count}\argi
+ \eqe@IWO\@auxout{\string
+ \csarg\string\gdef{prob\thisexamlabel.\theeqquestionnoi}%
+ {\theeq@count}}%
+ \fi\fi
+ \end{exercise}%
+ \end{eqequestions}%
+ \ifeqfortextbook\ftb@endprobstarCks\fi
+ \ifeqlocalversion\ifeqglobalversion
+ \xdef\eqe@tmp{\noexpand\forVersion{\eq@selectedVersion}}%
+ \aftergroup\eqe@tmp
+ \fi\fi
+ \global\eqlocalversionfalse
+% \end{macrocode}
+% \changes{}{2015/06/02}{Added \cs{@marktotalvalue} which seems to solve a problem
+% with \texttt{multicols}. Sometimes the totals are not correct, they do not `migrate' out
+% as they should.}
+% \begin{macrocode}
+ \@marktotalvalue
+ \ifdispl@yPoints\global\l@stDispl@yPointstrue
+ \else\global\l@stDispl@yPointsfalse\fi
+}
+% \end{macrocode}
+% \end{environment}
+% \begin{macro}{\leadinitem}
+%\changes{v3.1f}{2012/11/27}{Created \cs{leadinitem} command for a lead in question
+% for the \texttt{parts*} environment.}
+% Some authors, no me among them, want to post a question with parts (\texttt{problem*}) without
+% an introductory sentence. Scandalous!
+%\begin{verbatim}
+%\begin{problem*}\relax
+%\leadinitem Prove that $4x^2\ge (x+1)^2$ for $x\ge1$.
+%\begin{solution} soln\end{solution}
+%\begin{parts}
+%\item Use the principle of mathematical induction to prove that
+% $4^n\geq3n^2$ for all positive integers $n$.
+%\begin{solution} soln\end{solution}
+%\end{parts}
+%\end{problem*}
+%\end{verbatim}
+% Below is my solution to this problem. There were changes in both \textsf{eqexam} and
+% \textsf{exerquiz} (\texttt{eqexam.def}). Here are the listing of changes for my future
+% reference.
+%\begin{itemize}
+% \item Defined \cs{eqe@leadinitem}, \cs{eqe@@leadinitem}, and \cs{leadinitem} below.
+% The first one mostly tests whether we are permitted to use the \cs{leadinitem} command.
+% If \cs{solutionparshape} is empty, the command may be used. (This gives a restriction
+% of only one use per a single \texttt{problem*} environment.) Control is passed
+% to \cs{eqe@@leadinitem} which does all the work.
+% \item In the definition of \cs{pr@blem@star} (part of the startup for \texttt{problem*} we
+% say \verb!\let\leadinitem=\eqe@leadinitem!
+% \item In the startup code for \texttt{exercise@parts@list} (\texttt{exerquiz})
+% lines containing \cs{solutionparshape} and \verb!\let\leadinitem\eq@leadinitemparts!
+% are found. Also, when the \texttt{parts} environment is complete, we restore the
+% default definition of \cs{leadinitem}, \verb!\let\leadinitem\leadinitem@external!.
+% \item In the definition of \cs{eqe@@leadinitem}, we also define \cs{solutionparshape}
+% to help control the paragraphs for this delicate problem of a lead-in item. Its
+% normal definition is \cs{@empty}, and this fact used to detect whether the document
+% author is trying to use two \cs{leadinitem}s in one \texttt{problem*} environment.
+%\item At the beginning of the definition of the command \cs{@exercise} (in \textsf{exerquiz}
+% we \cs{let} \cs{solutionparshape} to \cs{@empty}.
+% \item So too does \cs{solutionparshape} appear in the definition of
+% \cs{vspaceFmt} (\textsf{exerquiz}).
+% \item \cs{solutionparshape} use used to correctly format in the \texttt{solutionsafter},
+% found in \cs{solnexer@@@woparts} (\textsf{exerquiz}).
+%\end{itemize}
+% As can be seen, this simple feature is not so simple.\par\medskip\noindent
+% Set the default value of \cs{solutionparshape}.
+% \begin{macrocode}
+\let\solutionparshape\@empty
+% \end{macrocode}
+% This is the beginning of \DescribeMacro{\leadinitem}\cs{leadinitem}, at least the
+% the active definition within the \texttt{problem*} environment, and outside
+% the \texttt{parts} environment.
+% \begin{macrocode}
+\def\eqe@leadinitem{%
+ \ifx\solutionparshape\@empty
+% \end{macrocode}
+% \cs{solutionparshape} empty means \cs{leadinitem} hasn't been used yet,
+% so we can use it here by passing control to \cs{eqe@@leadinitem}, otherwise,
+% we toss an exception.
+% \begin{macrocode}
+ \def\eqe@next{\eqe@@leadinitem}%
+ \ifeqfortextbook\writeToSolnFile{\protect\bpartsmrk}\fi
+ \else
+ \def\eqe@next{\PackageError{eqexam}
+ {The \string\leadinitem\space command may
+ only be used\MessageBreak once per problem* environment}
+ {Remove all but one of the \string\leadinitem\space
+ commands.}}%
+ \fi\eqe@next
+}
+\newif\ifisleadin \isleadinfalse
+\let\isparshapeExpanded\eqe@NO
+\def\eqe@@leadinitem{\if\itsforleadinitem\eqe@NO
+ \setcounter{partno}{0}\fi\refstepcounter{partno}%
+% \end{macrocode}
+% After initializing the counter, we make various calculations
+% \begin{macrocode}
+ \eq@initializeContAnnot
+ \isleadintrue\let\isitleadin\eqe@YES
+% \end{macrocode}
+% We signal a \cs{leadinitem} by writing a special command to the AUX file,
+% this is used to disallow the use of the \texttt{*} option of points.
+% \begin{macrocode}
+ \eqe@writetoAux{\string
+ \csarg\string\gdef{leadinitem\thisexamlabel-\theeqquestionnoi}{}}%
+ \settowidth{\eq@tmpdima}{\normalfont\parts@indent\eqe@prtsepPrb}%
+ \xdef\leadinIndentPrtSep{\the\eq@tmpdima}%
+ \setlength{\eq@tmpdima}{\eqemargin+\eq@tmpdima}%
+ \xdef\leadinIndent{\the\eq@tmpdima}%
+ \settowidth{\eq@tmplength}{\parts@indent}%
+ \edef\partsleadinIndent{\the\eq@tmplength}%
+ \setlength{\eq@tmplength}{\linewidth-\leadinIndentPrtSep}%
+ \edef\leadinIndentLength{\the\eq@tmplength}%
+% \end{macrocode}
+% \changes{v3.8}{2015/03/17}{Spacing is not correct with standard itemize and
+% enumerate environments, this is a fix.}
+% Modify \cs{@listii} from core LaTeX: Increase \cs{leftmarginii} and \cs{linewidth}
+% appropriately.
+% \begin{macrocode}
+\@ifundefined{@listii@SAVE}{\global\let\@listii@SAVE\@listii}{}%
+ \expandafter\def\expandafter\@listii\expandafter{\@listii@SAVE
+ \advance\leftmarginii\leadinIndentPrtSep\relax
+ \leftmargin\leftmarginii \labelwidth\leftmarginii
+ \advance\labelwidth-\labelsep
+% \advance\linewidth\leadinIndentPrtSep\relax
+ }%
+% \end{macrocode}
+% The \texttt{parshape} for the first paragraph of the \cs{leadinitem}.
+% \begin{macrocode}
+ \parshape=2 \eqemargin \linewidth \leadinIndent \leadinIndentLength
+% \end{macrocode}
+% Here is the definition of \cs{solutionparshape}, we use the shape of
+% subsequent paragraphs.
+% \begin{macrocode}
+ \xdef\solutionparshape{%\noexpand\linewidth\leadinIndentLength
+ \noexpand\parshape=1 \leadinIndent\space\leadinIndentLength}%
+% \end{macrocode}
+% After the current paragraph, we execute \cs{solutionparshape}, then
+% empty out \cs{everypar}. Seems to work.
+% \begin{macrocode}
+ \global\let\isparshapeExpanded\eqe@NO
+ \everypar{\solutionparshape
+ \global\let\isparshapeExpanded\eqe@YES\everypar{}}%
+% \end{macrocode}
+% These next lines were taken from \cs{eq@item@common} in \textsf{exerquiz}.
+% The command \cs{eq@insertContAnnot} was removed from the \cs{eq@item@common} code, it is not needed
+% here and caused trouble. We \cs{let} \cs{eq@item} to \cs{eq@leadin@item} to
+% continue the flow. \cs{@ckhide} checks for an optional argument (\texttt{h} or \texttt{H})
+% and sets switches as appropriate.
+% \begin{macrocode}
+ \let\eq@item\eq@leadin@item\eqp@rtc@lcm@rk
+ \def\currhideopt{x}\eq@hidesolutionfalse\eq@nolinkfalse
+ \@ifnextchar[{\@ckhide}{\eq@item}%
+}
+% \end{macrocode}
+% The final step. If the solution is hidden, we do not write the header.
+% \changes{v3.3a}{2013/05/03}{Changed name of \cs{eq@writeexheader} to \cs{eqExerSolnHeader}}
+% \begin{macrocode}
+\def\eq@leadin@item{\eq@ckglobalhide\ifeq@hidesolution\else
+ \global\let\eqExerSolnHeader\eq@@writeexheaderlist\fi
+ \ifeq@nosolutions\eq@nolinktrue\fi
+ \unskip\noindent\makebox[\partsleadinIndent]{\eqexlisttabheader}%
+ \eqe@prtsepPrb\ignorespaces
+}
+% \end{macrocode}
+% \end{macro}
+% \DescribeMacro{\tableadin}\cs{tableadin} is \cs{let} to \cs{eqe@tableadin} within
+% the \texttt{problem*} env. The switch \cs{if@tableadinitem} is defined in
+% \textsf{exerquiz}.
+% \begin{macrocode}
+\def\eqe@tableadin{\@tableadinitemtrue\eqe@writetoAux{\protect
+ \csarg\protect\gdef{tableadin\thisexamlabel-\theeqquestionnoi}{}}%
+}
+% \end{macrocode}
+% \begin{macro}{\pushProblem}
+% \begin{macro}{\popProblem}
+% There may be an occasion when a multi-part question needs to be broken between parts.
+% use the \cs{pushProblem} and \cs{popProblem} for this purpose. The push saves the
+% counter value, and ends the \texttt{parts} environment. The pop restarts the
+% \texttt{parts}, and resets the parts counter.
+% \changes{1.6b}{2006/3/12}
+% {
+% Added \cs{pushProblem} and \cs{popProblem} to grant the ability to interrupt
+% a parts environment for, for example, a multicolumn environment.
+% }
+%\par\medskip\noindent
+%In the example below, we have our parts in a \texttt{multicols} environment, we
+%\cs{pushProblem}, close \texttt{multicols}, \cs{popProblem} and continue with
+% the multi-parts in single column.
+%\begin{verbatim}
+%\item Compute $\lim_{x\to2^{\text{$-$}}} f(x)$
+%\begin{solution}[1in]\end{solution}
+%\pushProblem
+%\end{multicols}
+%\popProblem
+%\item What value(s) of $c$ make the function $f$
+%continuous at $x=2$?
+%\begin{solution}[.5in]\end{solution}
+%\end{parts}
+%\end{verbatim}
+% \begin{macrocode}
+\newcommand\pushProblem{\xdef\nlastItem{\arabic{partno}}\end{parts}}
+% \end{macrocode}
+% (2013/05/30) Adding an optional parameter to \cs{popProblem} to match
+% the option argument of the \texttt{parts} environment. This enables you
+% to push a \texttt{list} environment and push a \texttt{tabular} environment.
+% \begin{macrocode}
+\newcommand\popProblem[1][]{%
+ \def\@argi{#1}\ifx\@argi\@empty
+ \def\eqe@bParts{\begin{parts}}\else
+ \def\eqe@bParts{\begin{parts}[#1]}\fi
+ \eqe@bParts\setcounter{partno}{\nlastItem}}
+% \end{macrocode}
+% \end{macro}
+% \end{macro}
+% \begin{macrocode}
+\def\lastPageTotal{0pt}
+\def\marginparafterhook{\xdef\lastPageTotal{\the\pagetotal}}
+% \end{macrocode}
+% \DescribeMacro{\manualcalcparts} is the command calculates points
+% when the argument is \emph{not} \cs{auto}. The macro \cmd{\prob@Arg}
+% determines if the points argument passed is of the form \texttt{<num>ea}.
+% \begin{macrocode}
+\def\prob@Arg#1ea#2\end{\def\argi{#1}\def\argii{#2}}
+% \end{macrocode}
+% Now begin \cs{manualcalcparts}; \texttt{\#1} is the number of points, which may be
+% of the form \texttt{<num>ea}, or just \texttt{<num>}.
+% \begin{macrocode}
+\let\eqe@pointsEach\eqe@NO
+\def\manualcalcparts#1{%
+ \expandafter\prob@Arg#1ea\end
+ \ifx\argii\@empty\edef\numpoints{#1}%
+ \let\eqe@pointsEach\eqe@NO
+% \end{macrocode}
+% Argument form is \texttt{<num>} assumed: Total points specified, we
+% should ignore any \cs{PTs} commands.
+% \begin{macrocode}
+ \let\eqe@pointsPartsId\eqe@Zero
+ \else
+% \end{macrocode}
+% Argument form is \texttt{<num>ea} assumed: Again we
+% should ignore any \cs{PTs} commands.
+% \begin{macrocode}
+ \gdef\probpointseach{x}\let\eqe@pointsPartsId\eqe@Two
+ \let\eqe@pointsEach\eqe@YES
+% \end{macrocode}
+% Points each specified
+% \begin{macrocode}
+ \setcounter{eq@count}{\value{eqquestionnoi}}%
+ \addtocounter{eq@count}{1}\csarg
+ \ifx{prob\thisexamlabel.\theeq@count}\relax
+ \def\numpoints{\argi}\else
+ \def\numpoints{\expandafter
+ \csname prob\thisexamlabel.\theeq@count\endcsname}%
+ \fi
+% \end{macrocode}
+%\changes{v4.1}{2015/04/23}{Moved this segment of code to \cs{manualcalcparts},
+% it is taken from the main \texttt{problem*} env.}
+% \begin{macrocode}
+ \ifx\yest@D@\eqe@YES
+ \setcounter{eq@count}{\value{eqquestionnoi}}%
+ \addtocounter{eq@count}{1}%
+ \@ifundefined{nPartsThisProb\thisexamlabel.\theeq@count}
+ {\makeOutOfNum{0}\makeDoNum{0}}{%
+ \expandafter\makeOutOfNum{%
+ \csname nPartsThisProb\thisexamlabel.%
+ \theeq@count\endcsname}%
+ \expandafter\makeDoNum{%
+ \csname DoNumThisProb\thisexamlabel.%
+ \theeq@count\endcsname}}%
+ \fi
+ \fi
+% \end{macrocode}
+% If \cs{marginpoints} is \cs{@empty}, the author has chosen the \texttt{nopoints} option
+% or used the \cs{NoPoints} command.
+% \begin{macrocode}
+ \ifx\marginpoints\@empty
+% \end{macrocode}
+% No points for this exam
+% \begin{macrocode}
+ \else
+ \ifx\argi\@empty
+% \end{macrocode}
+% If \cs{argi} is empty, no points were specified, so we \cs{let}
+% \cs{marginpoints} to \cs{@empty}
+% \begin{macrocode}
+ \let\marginpoints\@empty
+ \else
+% \end{macrocode}
+% Points are displayed in margins or inline
+% \begin{macrocode}
+ \ifx\argii\@empty
+% \end{macrocode}
+% \paragraph*{Total points specified}
+% \begin{macrocode}
+ \ifx\marginpoints\@empty\else
+ \if\@isitstar\eqe@One
+% \end{macrocode}
+% Points to appear ``in-line'' rather than in the margins
+% \begin{macrocode}
+ \addtocounter{eqpointvalue}{#1}%
+ \@marktotalvalue\ifdispl@yPoints
+ \def\marginparafterhook{\itemPTsFormated{%
+ \itemPTsTxt{\numpoints}}\space}\fi
+ \else
+% \end{macrocode}
+% Points appear in the margins
+% \begin{macrocode}
+ \def\marginparpriorhook{\noindent
+ \probvalue{\numpoints}{0}}%
+ \fi
+ \fi
+ \else
+% \end{macrocode}
+% \paragraph*{Points each specified}
+% \begin{macrocode}
+ \ifx\marginpoints\@empty\else
+ \if\@isitstar\eqe@One\ifdispl@yPoints
+% \end{macrocode}
+% Points to appear ``in-line'' rather than in the margins
+% \begin{macrocode}
+ \def\marginparafterhook{%
+ \itemPTsFormated{\itemPTsEaTxt{\argi}}\space}\fi
+ \else
+% \end{macrocode}
+% Points appear in the margins
+% \begin{macrocode}
+ \ifdispl@yPoints
+ \def\marginparpriorhook{\noindent
+ \marginpoints{\numpoints}{\argi}}\fi
+ \fi
+% \end{macrocode}
+% Don't remember why I named this command the way I did, but it is use to pass
+% the number of points, when there is a \cs{leadinitem}.
+% \begin{macrocode}
+ \edef\eqp@rtc@lcm@rk{\noexpand
+ \addtocounter{eqpointvalue}{\argi}%
+ \noexpand\@marktotalvalue}%
+ \fi
+ \fi
+ \fi
+ \fi
+ \ifnum\value{eq@count}=1\relax
+ \eqe@IWO\@auxout{\string\csarg\string
+ \gdef{pagenofirstprob\thisexamlabel}{\thepage}}%
+ \fi
+}
+% \end{macrocode}
+% \DescribeMacro{\autocalcparts} is the command that computes the total points when
+% the author specifies \cs{auto} as the optional argument of \texttt{problem*}. The
+% commands \cmd{\acp@mpah} and \cmd{\acp@mpph} were recently (2012/04/21) separated
+% out to allow for additional customization, without re-defining the whole of
+% \cs{autocalcparts}.
+% \begin{macrocode}
+\def\acp@mpah{\itemPTsFormated{\itemPTsTxt{\numpoints}}\space}
+\def\acp@mpph{\noindent\marginpoints{\numpoints}{0}}
+\def\autocalcparts{%
+ \setcounter{eq@count}{\value{eqquestionnoi}}%
+ \addtocounter{eq@count}{1}%
+ \csarg\ifx{prob\thisexamlabel.\theeq@count}\relax
+ \def\numpoints{0}% assume zero points until we get the total
+ \else
+ \edef\numpoints{\@nameuse{prob\thisexamlabel.\theeq@count}}%
+ \fi
+% \addtocounter{eqpointvalue}{\numpoints}\@marktotalvalue
+ \ifx\marginpoints\@empty\else
+ \ifdispl@yPoints
+ \if\@isitstar\eqe@One
+% \end{macrocode}
+% If we have \texttt{*\cs{auto}}, the total is to appear inline.
+% \begin{macrocode}
+ \def\marginparafterhook{\acp@mpah}\else
+% \end{macrocode}
+% Otherwise, the total will appear in the margin.
+% \begin{macrocode}
+ \def\marginparpriorhook{\acp@mpph}\fi
+ \fi
+ \fi
+ \setcounter{eq@count}{0}%
+}
+% \end{macrocode}
+% \begin{macro}{\forproblem}
+% \begin{macro}{\foritem}
+% \begin{macro}{\forleadinitem}
+% When typing solutions from assigned problems in a textbook, the problems
+% assigned are not consecutive. You can set the problem number before the problem
+% environments by using the \cs{forproblem} command. The one required argument is
+% the problem number: \verb!\forproblem{10)!.
+% \changes{v1.6h}{2007/01/24}
+% {
+% Added \cs{forproblem}, \cs{foritem}, \cs{aNewPage}
+% }
+% \changes{v3.6a}{2015/01/31}{Added \cs{eqe@fpmrk} to add to the uniqueness
+% of \cs{theHeqquestionnoi}.}
+% \begin{macrocode}
+\let\eqe@fpmrk\@empty
+\newcommand{\forproblem}[1]{\def\eqe@fpmrk{-\the@exno}%
+ \setcounter{eqquestionnoi}{#1 - 1}}
+% \end{macrocode}
+% A similar comment for \cs{item}. These are useful for making out solution
+% sets to homework assignments where problems are assigned from the textbook
+% and you want to give a solution to problem 12, part (b), An example of usage is
+%\begin{verbatim}
+%\forproblem{12}
+%\begin{problem*}
+%Factor each.
+%\begin{parts}
+% \foritem{b} $ x^2 + 2x + 1 = ( x + 1 )^2 $
+% \item $ x^2 - x - 2 = ( x - 2 )( x + 1) $ % this is part (c)
+% \foritem{e} $ x^2 + 7x + 10 = ( x - 2 )( x + 7) $
+% \item ... % this will be part (f)
+%\end{parts}
+%\end{problem*}
+%\end{verbatim}
+% \begin{macrocode}
+\newcommand{\foritem}[2][]{%
+ \setcounter{partno}{0}\def\@rgi{#1}\ifx\@rgi\@empty
+ \def\eqe@nextitem{\item}\else
+ \def\eqe@nextitem{\item[#1]}\fi
+ \foritem@cont{#2}}
+\newcommand{\forleadinitem}[2][]{%
+ \setcounter{partno}{0}\def\@rgi{#1}\ifx\@rgi\@empty
+ \def\eqe@nextitem{\leadinitem}\else
+ \def\eqe@nextitem{\leadinitem[#1]}\fi
+ \foritem@cont{#2}}
+% \end{macrocode}
+% (2017/01/04) Modified \cs{foritem@cont} to allow for numbering parts.
+% \changes{v4.7}{2017/01/04}{Modified \cs{foritem@cont} to allow for numbering parts}
+% \begin{macrocode}
+\def\foritem@cont#1{\ifuseNumForParts
+ \edef\fliPartNo{#1}\setcounter{partno}{#1-1}\else
+ \lowercase{\def\eq@selectedItem{#1}}%
+ \let\eq@initLoop\eqe@NO
+ \loop
+ \stepcounter{partno}\expandafter
+ \if\alph{partno}\eq@selectedItem
+ \let\eq@initLoop\eqe@YES\fi
+ \ifx\eq@initLoop\eqe@NO\repeat
+ \edef\fliPartNo{\the\c@partno}%
+ \addtocounter{partno}{-1}\fi\let\itsforleadinitem\eqe@YES
+ \eqe@nextitem}
+% \end{macrocode}
+% \end{macro}
+% \end{macro}
+% \end{macro}
+% The command \cs{eqe@insertContAnnot} attempts to insert a string just prior
+% to a part, if that part begins a new page. To get it right, it promotes a new
+% page using the default of .25in. The optional parameter allows you to insert
+% a new value; this may be needed to get the string \cs{annotContStr} placed properly.
+% The commands
+% \begin{macro}{\annotContStr}
+% \changes{v3.0l}{2011/08/22}{Defined \cs{eqe@insertContAnnot} and related commands}
+% The string that is typeset by the \cs{eqe@insertContAnnot} command.
+% \begin{macro}{\acvspace}
+% User access to changing the vertical spacing \cs{promoteNewPage} uses within
+% \cs{eqe@insertContAnnot}.
+% \begin{macro}{\resetacvspace}
+% Resets the vertical spacing back to its default.
+% \begin{macrocode}
+\newcommand{\annotContStr}{%
+ \textbf{Problem~{\eqeCurrProb} continued\strut}}
+\newcommand{\acvspace}[1]{\def\ic@vspace{#1}\setlength\iacvspace{#1}}
+% \end{macrocode}
+% \DescribeMacro{\ic@vspacedefault} is the default vertical spacing used
+% by \cs{eqe@insertContAnnot}
+% \begin{macrocode}
+\newlength\iacvspace
+\newcommand{\ic@vspacedefault}{1in} % changed .25in to 1in 2012/12/04
+\newcommand{\resetacvspace}{\setlength\iacvspace{\ic@vspacedefault}}
+\resetacvspace
+% \end{macrocode}
+% \cs{eqe@insertContAnnot} promotes a new page, and if the current
+% page is different than the starting page, \cs{eq@currProbStartPage}, we
+% insert \cs{annotContStr}.
+% \begin{macrocode}
+%\newcommand{\priorAnnotInsert}[1]{\def\eq@priorAnnotInsert{#1}}
+%\let\eq@priorAnnotInsert\relax
+\newcommand{\eqe@insertContAnnot}[1][\iacvspace]{\promoteNewPage[#1]%
+ \ifnum\arabic{page}>\eq@currProbStartPage
+ \xdef\eq@currProbStartPage{\arabic{page}}%
+ {\settowidth{\eq@tmplength}{\parts@indent\eqe@prtsepPrb}%
+ \xdef\eqe@partsIndent{\the\eq@tmplength}}%
+ \ifwithinparts
+% \end{macrocode}
+% \cs{eq@item} is the \texttt{list} definition of \cs{item} which has been
+% \cs{let} to \cs{eq@item} within the \texttt{parts} environment.
+% \begin{macrocode}
+ \@ifundefined{eq@item@latex}{\item[]\hspace*{-\eqemargin}%
+ \ifx\solutionparshape\@empty\else\hspace*{-\eqe@partsIndent}\fi}
+ {\eq@item@latex[]\hspace*{-\eqemargin}%
+ \hspace{-\eqe@partsIndent}}\else
+% \end{macrocode}
+% If placed between problem sets, we indent as appropriate.
+% \begin{macrocode}
+ \hspace*{-\eqemargin}\fi\annotContStr
+ \fi
+}
+\edef\eq@currProbStartPage{\arabic{page}}
+% \end{macrocode}
+% \end{macro}
+% \end{macro}
+% \begin{macro}{\turnContAnnotOff}
+% \begin{macro}{\turnContAnnotOn}
+% Turn off and on this feature. The default is off.
+% \begin{macrocode}
+%\newcommand{\@gobbloptone}[1][]{}
+\newcommand{\turnContAnnotOff}{\global\let\eq@insertContAnnot\relax}
+\newcommand{\turnContAnnotOn}{%
+ \global\let\eq@insertContAnnot\eqe@insertContAnnot}
+\turnContAnnotOff
+% \end{macrocode}
+% Used for manually inserting annot
+% \begin{macrocode}
+\def\insertContAnnot{\eq@insertContAnnot}
+% \end{macrocode}
+% \end{macro}
+% \end{macro}
+% \end{macro}
+% \begin{macro}{\aNewPage}
+% \begin{macro}{\qNewPage}
+% A simple command for inserting \cs{newpage}, only if the \cs{answerkey}
+% option has been taken.
+% \changes{v1.6h}{2007/01/24}
+% {
+% Added \cs{aNewPage} and \cs{qNewPage}
+% }
+% \begin{macrocode}
+\newcommand\aNewPage{\ifanswerkey\newpage\fi}
+\newcommand\qNewPage{\ifanswerkey\else\newpage\fi}
+% \end{macrocode}
+% \end{macro}
+% \end{macro}
+% \begin{macro}{\OnBackOfPage}
+%
+% In an effort to make maximum use of the paper, I sometimes ask the
+% students to solve the problem on the back of a page. The following
+% command is an automated instruction. Generally, we work on the back
+% of the previous page, unless we are on page 1, in this case we work
+% on the back of page 1.
+%
+% \begin{macrocode}
+\newcounter{backofpage}
+\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
+% \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
+}
+% \end{macrocode}
+% \end{macro}
+%
+%\subsection{Vertical Space Filling Options}
+%
+% When the \texttt{nosolutions} or the \texttt{vspacewithsolns} is used, a
+% vertical space is generated by the \texttt{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.
+% \begin{macro}{\eqWriteLineColor}
+% The color of the rule to use.
+% \begin{macrocode}
+\newcommand{\eqWriteLineColor}[1]{\def\eq@WriteLineColor{#1}}
+\eqWriteLineColor{gray}
+% \end{macrocode}
+% \end{macro}
+% \begin{macro}{\eqWLSpacing}
+% The line spacing between the rules.
+% \begin{macrocode}
+\newlength\wlVspace
+\newcommand{\eqWLSpacing}[1]{\setlength\wlVspace{#1}}
+\eqWLSpacing{14pt}
+% \end{macrocode}
+% \end{macro}
+% \paragraph*{Fill Types.} We have three types of line fill:
+% \cs{hrulefill}, \cs{dotfill}, and a custom rule \cs{eqdashrulefill}.
+% The commands three \cs{eqWriteLineFill}, \cs{eqWriteLineDots}, and
+% \cs{eqWriteLineDashFill} implements these three types. They are
+% \cs{let} to \cs{eqWriteLine}, which is used in \cs{vspaceFillerLines}.
+% \begin{macrocode}
+\newcommand{\eqWriteLineFill}{%
+ \textcolor{\eq@WriteLineColor}{\hrulefill}}
+%\newcommand{\eqWriteLineDots}{%
+% \textcolor{\eq@WriteLineColor}{\dotfill}}
+\def\eqdotrulefile{\leavevmode
+ \cleaders\hb@xt@ .44em{\hbox to0pt{\hss.\hss}\hss}\hfill\kern\z@}
+\newcommand{\eqWriteLineDots}{%
+ \textcolor{\eq@WriteLineColor}{\eqdotrulefile}}
+%\def\eqdashrulefill{\leavevmode
+% \cleaders\hb@xt@ .44em{\hss\rule{.22em}{.4pt}\hss}\hfill\kern\z@}
+\def\eqdashrulefill{\leavevmode%\kern-.11em
+ \cleaders\hb@xt@ .44em{\rule{.22em}{.4pt}\hss}\hfill\kern\z@}
+\newcommand{\eqWriteLineDashFill}{%
+ \textcolor{\eq@WriteLineColor}{\eqdashrulefill}}
+\newcommand{\eqWriteLineBlankFill}{\hfill}
+% \end{macrocode}
+% Use \DescribeMacro{\fillerLinesAlignDef}\cs{fillerLinesAlignDef} and
+% \DescribeMacro{\fillerLinesOnLeftMargin}\cs{fillerLinesOnLeftMargin} to adjust
+% the alignment of the rule lines for this feature. The first is the default,
+% the second one aligns rule lines to the left margin.
+% \begin{macrocode}
+\newif\if@equsedim \@equsedimtrue
+\newcommand{\useVspaceDimen}{\@equsedimtrue}
+\newcommand{\usenLineDimen}{\@equsedimfalse}
+\newif\if@eqalignfilllinestoleft\@eqalignfilllinestoleftfalse
+\newcommand{\fillerLinesOnLeftMargin}{\@eqalignfilllinestolefttrue}
+\newcommand{\fillerLinesAlignDef}{\@eqalignfilllinestoleftfalse}
+\newcommand\priorPageBreakMsg[1]{\def\priorP@geBre@kMsg{#1}}
+\let\priorP@geBre@kMsg\@empty
+\newcommand{\flPageBreakMsg}[1]{%\acvspace{2\wlVspace}%
+ \priorPageBreakMsg{\emitMessageNearBottom[2\wlVspace]
+ {\eqfititin{{\Large\strut}#1}}}%
+}
+\newcommand{\vspaceFillerLines}[1]{\begingroup\offinterlineskip
+ \parindent0pt\relax\parskip0pt
+ \@tempdima\wlVspace\eqetmplengtha0pt
+ \def\eqe@fillwidth{\linewidth+\eqetmplengtha}%
+ \settowidth{\eqetmplengthb}{\eqe@decPointPrb}%
+ \@whiledim\@tempdima<#1\relax\do{\priorP@geBre@kMsg
+ \eq@insertContAnnot\vskip\wlVspace\eqe@wrtLineKernal
+ \makebox[0pt][l]{\makebox[\eqe@fillwidth]{\eqWriteLine}}%
+ \addtolength{\@tempdima}{.4pt+\wlVspace}\par
+ }\endgroup
+}
+\def\eq@linesXPgs{\begingroup\offinterlineskip
+ \parindent0pt\relax\parskip0pt
+ \@tempcnta=0 \eqetmplengtha0pt
+ \settowidth{\eqetmplengthb}{\eqe@decPointPrb}%
+ \def\eqe@fillwidth{\linewidth+\eqetmplengtha}%
+ \@whilenum\@tempcnta<\soln@keys@nLines\relax\do{\priorP@geBre@kMsg
+ \eq@insertContAnnot\vskip\wlVspace\eqe@wrtLineKernal
+ \makebox[0pt][l]{\makebox[\eqe@fillwidth]{\eqWriteLine}}%
+ \advance\@tempcnta1\relax}\par\endgroup
+}
+\def\eqe@wrtLineKernal{%
+ \ifx\solutionparshape\@empty
+ \if@eqalignfilllinestoleft
+ \setlength{\eqetmplengtha}{\labelwidth+\eqemargin}%
+ \setlength{\eqetmplengtha}
+ {\eqetmplengtha+\eqetmplengthb}%
+ \ifwithinparts
+ \setlength{\eqetmplengtha}{\labelwidth}%
+ \setlength{\eqetmplengtha}
+ {\eqetmplengtha+\eqetmplengthb}%
+ \ifx\eq@item\item@part@tabular
+ \hspace*{-\eqemargin}\eqetmplengtha\eqemargin\else
+ \hspace*{-\eqetmplengtha}\fi
+ \else
+ \hspace*{-\eqemargin}\eqetmplengtha\eqemargin
+ \fi
+ \else
+ \ifwithinparts
+ \setlength{\eqetmplengtha}{\labelwidth}%
+ \setlength{\eqetmplengtha}
+ {\eqetmplengtha-\eqetmplengthb}%
+ \setlength{\eqetmplengtha}{\labelwidth}%
+ \setlength{\eqetmplengtha}
+ {\eqetmplengtha+\eqetmplengthb}%
+ \ifx\eq@item\item@part@tabular
+ \hspace*{\eqetmplengtha}%
+ \settowidth{\eqetmplengthb}{\eqe@prtsepPrb}%
+ \setlength{\eqetmplengtha}
+ {-\labelwidth-\eqetmplengthb}\else
+ \eqetmplengtha0pt\fi
+ \else
+ \eqetmplengtha0pt
+ \fi
+ \fi
+ \else
+ \if@eqalignfilllinestoleft
+ \setlength{\eqetmplengtha}
+ {\eqemargin+\leadinIndentPrtSep}%
+ \hspace*{-\eqetmplengtha}\else\hspace*{0pt}\fi
+ \fi
+}
+% \end{macrocode}
+% \begin{macro}{\useFillerLines}
+% When used, the vertical space is written with lines (rules, dashes, dots).
+%\changes{v2.0e}{2011/03/07}
+%{%
+% Added the feature of filling the vertical space with ruled lines of
+% different types. This feature is available for paper options and for
+% \texttt{nosolutions} and \texttt{vspacewithsolution} options.
+%}
+% \begin{macrocode}
+\newcommand{\useFillerLines}{\let\vspaceFiller\vspaceFillerLines
+ \fillTypeDefault\@eqlinedfillertrue}
+% \end{macrocode}
+% \end{macro}
+% \begin{macro}{\useFillerDefault}
+% Resets the vertical space to the original white space.
+% \begin{macrocode}
+\newcommand{\useFillerDefault}{\let\vspaceFiller\vspaceFillerDefault
+ \let\eqWriteLine\hfill\@eqlinedfillerfalse}
+% \end{macrocode}
+% \end{macro}
+% \begin{macro}{\fillTypeHRule}
+% Writes the line as a solid line (\cs{hrulefill}).
+% \begin{macrocode}
+\newcommand{\fillTypeHRule}{\let\eqWriteLine\eqWriteLineFill}
+% \end{macrocode}
+% \end{macro}
+% \begin{macro}{\fillTypeDots}
+% Writes the line as a dotted line (\cs{dotfill}).
+% \begin{macrocode}
+\newcommand{\fillTypeDots}{\let\eqWriteLine\eqWriteLineDots}
+% \end{macrocode}
+% \end{macro}
+% \begin{macro}{\fillTypeDashLine}
+% Writes the line as a dotted line (\cs{eqdashrulefill}).
+% \begin{macrocode}
+\newcommand{\fillTypeDashLine}{\let\eqWriteLine\eqWriteLineDashFill}
+% \end{macrocode}
+% \end{macro}
+% \begin{macro}{\fillTypeBlankLine}
+% Fills the line
+% \begin{macrocode}
+\newcommand{\fillTypeBlankLine}{\let\eqWriteLine\eqWriteLineBlankFill}
+% \end{macrocode}
+% \end{macro}
+% \begin{macro}{\fillTypeDefault}
+% Resets fill type back to the default, \cs{hrulefill}.
+% \begin{macrocode}
+\newcommand{\fillTypeDefault}{\let\eqWriteLine\eqWriteLineFill}
+% \end{macrocode}
+% \end{macro}
+% Set the \textsf{eqexam} page style, if not otherwise indicated.
+% \begin{macrocode}
+\ifeqfortextbook\else
+ \if@bypasseqexamheading\else
+\pagestyle{eqExamheadings}\fi\fi
+% \end{macrocode}
+% \begin{macrocode}
+%</package>
+%<*textbook>
+\ProvidesFile{eqtextb.def}
+ [2016/01/18 v4.6 Cmds used by the fortextbook option (dps)]
+% \end{macrocode}
+%
+% \section{Concerning the \protect\texttt{fortextbook} option}\label{fortextbook}
+%
+% What are my goals/desired features? Modern (U.S.) textbooks---at least
+% the ones I'm familiar with---consist of some or all of the following
+% resources:
+% \begin{itemize}
+% \item \textbf{Student Edition}: Answers to odd-numbered problems
+% appear in the back of the text.
+% \item[] We need to have a scheme where odd-numbered problems, under suitable options,
+% are compiled. \textbf{Goal:} It does not need to be restricted to odd-numbered, however, need to latex only
+% those problems that meet the ``include'' criteria.
+% \item[] For chapter review problem sets, odd-number problems are have solutions in the
+% back of the book.
+% \item[] For chapter quizzes, odd-numbered (optionally all) solutions
+% are in the back of the book.
+%
+% \item \textbf{Instructor Edition}: Answers to all problems appear in
+% the back of the book. Answers may also appear in the body of the text,
+% in the margins of the text, or immediately after the statement of the
+% problem. If the answer is too long, there is a cross-reference to the
+% solution in the appendix.
+% \item[] Some publishers I've seen have wide margins where additional material can be inserted
+% (historical sketches, instructor notes, pictures, etc.). In these margins, the answers to the problems
+% can appear. Other publishers put answer immediately
+% following the questions. The latter is easy to do; just have a macro, say \verb!\ANS{$12.5$}!, which only
+% expands when the ``instructor'' option is used.
+% \item \textbf{Student Solution Manual}: Contains solutions to all
+% odd-problems, as well as any review problems and chapter quizzes.
+% Some publishers include all solutions to chapter quizzes.
+% \item[] A solution manual is a separate publication. This document would be
+% created by latexing one or more of the auxiliary file (\texttt{.sol})
+% These files might have to be edited before the final compile. We include only the solutions
+% that meet the include criteria (i.e., odd-numbered ones).
+% \item[] The current features of \textsf{eqexam} is what is needed here. The authors need only
+% include solutions to each problem in a \texttt{solution} environment. Now, I realize that often times
+% the authors create the solutions, but someone else, possibly a grade student or contractor, solves the problems.
+% In the latter case, the authors would probably not like to turn over the source files to the one solving and typesetting
+% the problems.
+% \item \textbf{Instructor Solution Manual}: Contains solutions to all
+% problems, review problems, chapter quizzes.
+% \item[] Similar comments for the instructor solution manual.
+% \end{itemize}
+% Some other thoughts by a contributor:
+% \begin{itemize}
+%\item Often there is a diagram or graphic within the problem -- this has
+% some figure caption and after the running counter of the figure it is
+% named the NUMBER of the problem (cross-reference to the problem number)
+%
+%\item Often the probs with soln are setup in two-column style.
+%
+%\item Often the PROBLEM NUMBER has a special formatting (not only bold and
+% black), maybe with a colorframebox around or some special formatting
+% from the author
+%
+%\item Of course I have seen in some EXAMPLES that there is a wide margin
+% to put in additional graphics etc. setup in two-side style -- wide left
+% margin on even pages, wide right margins on odd pages. Here as well
+% are captions setup and cross-references.
+%\end{itemize}
+%
+%\subsection{Setting options with \texorpdfstring{\cs{textbookOpts}}{\textbackslash{textbookOpts}}}
+% \begin{macro}{\textbookOpts}
+% \begin{macro}{marginans}
+% \begin{macro}{inlineans}
+% \begin{macro}{marginsonleft}
+% \begin{macro}{ssols}
+% \begin{macro}{lsols}
+% We set up a command for setting the options for the \texttt{fortextbook} option.
+% \begin{macrocode}
+\define@boolkey{eqe@tbopts}[is]{instred}[true]{}
+\define@boolkey{eqe@tbopts}[is]{studented}[true]{%
+ \ifisstudented
+% \end{macrocode}
+% Now let's try to filter out the even-numbered problems for the student edition.
+% \begin{macrocode}
+ \tbfilterOutEvenNums
+% \end{macrocode}
+% The above command is normally \cs{let} to \cs{@gobble}.
+% \begin{macrocode}
+ \fi
+}
+% \end{macrocode}
+% This code is executed in \cs{exambegdef}, the start up code of the \texttt{exam} environment.
+% This enables problems with fill-ins, true/false, or multiple choice, to have the answer appear
+% in the space provided.
+% \begin{macrocode}
+\def\tb@beginexam@code{%
+ \ifisinstred\answerkeytrue\eq@proofingtrue\fi}
+% \end{macrocode}
+% \verb!\eqEXt{\theeqquestionnoi}! and \verb!\endeqEXt\tok1\tok2! enclose each
+% solution, \cs{tbfilterOutEvenNums} redefines \cs{eqEXt} to gobble everything,
+% when the page number is even, through \cs{endeqEXt} and the two tokens it follows.
+% This leaves only the odd-numbered problems.
+% \begin{macrocode}
+\newcommand{\tbfilterOutEvenNums}{%
+% \end{macrocode}
+%\changes{v3.3}{2013/04/07}{\textsf{exerquiz} changed \cs{eqEXt} to two variables, so
+% we make the same change here.}
+% \textsf{exerquiz} changed \cs{eqEXt} to two variables, so
+% we make the same change here
+% \begin{macrocode}
+ \def\eqEXt##1##2{\ifodd##1\let\eqe@next\relax\else
+ \def\eqe@next{\gobbletoEndEXt}\fi\eqe@next}%
+}
+\newcommand{\tballowAllNums}{%
+% \end{macrocode}
+%\changes{v3.3}{2013/04/07}{\textsf{exerquiz} changed \cs{eqEXt} to two variables, so
+% we make the same change here.}
+% \textsf{exerquiz} changed \cs{eqEXt} to two variables, so
+% we make the same change here
+% \begin{macrocode}
+% \let\eqEXt\@gobble
+ \let\eqEXt\@gobbletwo
+ \let\endeqEXt\relax
+}
+\define@boolkey{eqe@tbopts}[is]{marginans}[true]{}
+\define@boolkey{eqe@tbopts}[is]{inlineans}[true]{}
+\define@boolkey{eqe@tbopts}[]{marginsonleft}[true]
+% \end{macrocode}
+% If margins are always on left, we turn off switching of margin notes
+% as placed by \cs{marginpar}, and use \cs{reversemarginpar} to get them
+% on the left.
+% \begin{macrocode}
+ {\@mparswitchfalse\reversemarginpar}
+\define@boolkey{eqe@tbopts}[show]{ssols}[true]{}
+\define@boolkey{eqe@tbopts}[show]{lsols}[true]{%
+ \ifshowlsols\let\tb@soln@choice\tb@showlsols\fi}
+% \end{macrocode}
+% \end{macro}
+% \end{macro}
+% \end{macro}
+% \end{macro}
+% \end{macro}
+% The default settings are \texttt{true} for \texttt{studented} and
+% \texttt{false} for \texttt{instred}.
+%
+% \begin{macrocode}
+\newcommand{\textbookOpts}[1]{\setkeys{eqe@tbopts}{#1}%
+% \end{macrocode}
+% We do not allow both \texttt{instred} and \texttt{studented} to be true.
+% \begin{macrocode}
+ \ifisinstred\global\isstudentedfalse\else
+ \ifisstudented\global\isinstredfalse
+ \fi\fi
+% \end{macrocode}
+% \changes{v3.0v}{2012/03/14}{Include \cs{tbMakeFinalCalcs} at end of
+% \cs{textbookOpts}}
+% Added this part in in case \cs{textbookOpts} comes after \cs{marparboxwidth}.
+% \begin{macrocode}
+ \ifdim\tbmarparboxwidth=1sp\else
+ \expandafter\tbMakeFinalCalcs\fi
+}
+% \end{macrocode}
+% As mentioned above, the default settings are \texttt{true} for \texttt{studented} and
+% \texttt{false} for \texttt{instred}.
+% \begin{macrocode}
+\isstudentedtrue
+\isinstredfalse
+\ismarginansfalse
+\isinlineansfalse
+% \end{macrocode}
+% The command is available only in the preamble.
+% \begin{macrocode}
+\@onlypreamble{\textbookOpts}
+% \end{macrocode}
+% \end{macro}
+% \begin{macro}{\turnOffMarAnsOnAnsInline}
+% \begin{macro}{\turnOnMarAnsOffAnsInline}
+% \begin{macro}{\toggleInstrAns}
+% These three command may not be useful in the creation of a textbook, but
+% you never know, I used them in my demo doc \texttt{fortextbook.tex} to turn
+% off and on the display of the answers (change margin to inline, change inline to margin,
+% and toggle margin and inline).
+% \begin{macrocode}
+\newcommand{\turnOffMarAnsOnAnsInline}{%
+ \global\ismarginansfalse\global\isinlineanstrue
+ \insMidMarg{\global\ismarginansfalse
+ \global\isinlineanstrue}%
+}
+\newcommand{\turnOnMarAnsOffAnsInline}{%
+ \global\ismarginanstrue\global\isinlineansfalse
+ \insMidMarg{\global\ismarginanstrue
+ \global\isinlineansfalse}%
+}
+\newcommand{\toggleInstrAns}{%
+ \ifisinstred\ifismarginans
+ \global\ismarginansfalse\global\isinlineanstrue
+ \insMidMarg{\global\ismarginansfalse
+ \global\isinlineanstrue}%
+ \else
+ \global\ismarginanstrue\global\isinlineansfalse
+ \insMidMarg{\global\ismarginanstrue
+ \global\isinlineansfalse}%
+ \fi\fi
+}
+% \end{macrocode}
+% \end{macro}
+% \end{macro}
+% \end{macro}
+%
+% \subsection{Macros to display answers/shortsolns}
+% In this section, we develop some commands to display answers or short solutions. These
+% would appear if \texttt{instred=true}, in-line, or in the margins.
+% \begin{macro}{\ANS}
+% Let us begin by creating a simple macro for saving an answer. The answer is displayed ``in-line.''
+% No verbatim-type text allowed, no unbalanced braces unless escaped. \cs{ANS} displays the answer
+% if the \texttt{instred} option of the \texttt{eqe@tbopts} family, i.e., by executing
+%
+% \begin{macro}{\bGrpANS}
+% \begin{macro}{\eGrpANS}
+% Two macros used to group answers in the margins.
+%\changes{v3.0q}{2011/14/22}{Added \cs{bGrpANS} and \cs{eGrpANS}}
+% \begin{macrocode}
+\newif\ifWithinANSGrp\WithinANSGrpfalse
+\newif\ifftb@isANSListOpen\ftb@isANSListOpenfalse
+\newcommand{\bGrpANS}{%
+ \if\probstar*\else
+ \PackageError{eqexam}{Use of \string\bGrpANS\space
+ only applies\MessageBreak to the problem* environment}{Please
+ remove this \string\bGrpANS.}%
+ \fi
+ \ifWithinANSGrp
+ \global\WithinANSGrpfalse
+ \let\tb@next\relax
+ \PackageError{eqexam}{\string\bGrpANS\space already open}
+ {You issued an earlier \string\bGrpANS,
+ but did not close it.}%
+ \else
+ \global\WithinANSGrptrue
+ \global\ftb@isANSListOpenfalse
+ \def\tb@next{\ANS}%
+ \fi
+ \tb@next
+}
+\newcommand{\eGrpANS}{%
+ \if\probstar*\else
+ \PackageError{eqexam}{Use of \string\eGrpANS\space
+ only applies\MessageBreak to the problem* environment}{Please
+ remove this \string\eGrpANS.}%
+ \fi
+ \ifWithinANSGrp
+ \global\WithinANSGrpfalse
+ \def\tb@next{\ANS}%
+ \else
+ \let\tb@next\relax
+ \PackageError{eqexam}{\string\eGrpANS\space already closed}
+ {You've issued two consecutive \string\eGrpANS\space
+ commands,\MessageBreak either remove this one
+ or the previous one.}%
+ \fi
+ \tb@next
+}
+% \end{macrocode}
+% \end{macro}
+% \end{macro}
+% \cs{ANS} begin by checking to see if there is a star that follows the command,
+% this is used for inline answers. If \texttt{*} is present, we do not put the
+% answer inline, but will put it in the margins if the option call for it.
+% \begin{macrocode}
+\newcommand{\ANS}{\@ifstar{\let\tb@istart=1\tb@ANS}
+ {\let\tb@istart=0\tb@ANS}}
+% \end{macrocode}
+% (10/13/2011) The following is the original definition of \cs{tb@ANS} before the creation of
+% the commands \cs{bGrpANS} and \cs{bGrpANS}. We keep this to revert to this definition
+% if this new feature causes problems.
+%\begin{verbatim}
+%\newcommand{\tb@ANS}[1]{%
+% \ifisinstred
+% \ifisinlineans\if\tb@istart0\ANSFmt{\theeqquestionnoi}{#1}\fi\fi
+% \ifismarginans
+% \edef\eqe@prehold{\noexpand\par\kern0pt\noindent
+% \if\probstar*%
+% \noexpand\begin{eqeList}[\tb@wparts@len]{%
+% \noexpand\eqedsplyOnlyFrst{\theeqquestionnoi}%
+% {\thepartno}\noexpand\eqe@hspannerMrg
+% \noexpand\makebox[\noexpand\tbmrgpartwdth]%
+% {\noexpand\tb@mrgPartFmt{\thepartno}}}%
+% \else
+% \noexpand\begin{eqeList}%
+% {\noexpand\tb@mrgDigitFmt{%
+% \theeqquestionnoi\eqe@decPointMrg}}%
+% \fi
+% }\expandafter\insMidMarg%
+% \expandafter{\eqe@prehold#1\end{eqeList}}%
+% \fi
+% \fi
+%}
+%\end{verbatim}
+% \DescribeMacro{\ftb@defineInsSpan} is used when there is an optional
+% argument for \cs{ANS}. It formats the range of parts,
+% for example, (a)--(c). This macro can be redefined, I suppose, to meet
+% the needs of the author.
+% \begin{macrocode}
+\def\ftb@defineInsSpan#1{\def\ftb@argi{#1}\ifx\ftb@argi\@empty
+ \def\ftb@InsSpan{}\else\ftb@spanPrts{#1}%
+ \def\ftb@InsSpan{\noexpand\hspace{-\labelsep}%
+ \noexpand\textcolor{MRGPARTcolor}{--}\noexpand
+ \makebox[\noexpand\tbmrgpartwdth]{\noexpand
+ \tb@mrgPartFmt{\ftb@EndSpanPrts}}\eqe@hspannerMrg}\fi
+}
+% \end{macrocode}
+% \DescribeMacro{\ftb@spanPrts} calculates the letter of the end of the
+% range. \texttt{\#1} is passed by \cs{ANS} (\cs{tb@ANS}, actually). For
+% example if we have \verb!\ANS[2]{...}!, \texttt{\#1=2}.
+% \begin{macrocode}
+\def\ftb@spanPrts#1{{%
+ \advance\value{partno}by#1\relax
+ \xdef\ftb@EndSpanPrts{\thepartno}}%
+}
+% \end{macrocode}
+% \DescribeMacro{\ftb@EqeListPrtsFmt} is the internal formatting used within the \texttt{eqeList} for the part letter.
+% \begin{macrocode}
+\def\ftb@EqeListPrtsFmt{\noexpand
+ \makebox[\noexpand\tbmrgpartwdth]{\noexpand
+ \tb@mrgPartFmt{\thepartno}}\nobreak
+}
+% \end{macrocode}
+% \DescribeMacro{\ftb@OpenEqeListPrts} opens an \texttt{eqeList} environment,
+% and displays the question number (optionally) and the part number.
+% \begin{macrocode}
+\def\ftb@OpenEqeListPrts{\noexpand
+ \begin{eqeList}[\tb@wparts@len]{\noexpand
+ \eqedsplyOnlyFrst{\theeqquestionnoi}%
+ {\thepartno}\noexpand\eqe@hspannerMrg\ftb@EqeListPrtsFmt}%
+}
+% \end{macrocode}
+% \DescribeMacro{\ftb@CloseEqeList} closes the \texttt{eqeList} after
+% inserting \cs{qe@prehold} and the content, \texttt{\#1}.
+% \begin{macrocode}
+\def\ftb@CloseEqeList#1{\expandafter\insMidMarg%
+ \expandafter{\eqe@prehold#1\end{eqeList}}%
+}
+% \end{macrocode}
+% \DescribeMacro{\grpANSDelimiter} delimits the parts
+% when \cs{bGrpANS}/\cs{eGrpANS} is used. May be redefined.
+% \begin{macrocode}
+\newcommand{\grpANSDelimiter}{\textcolor{MRGPARTcolor}{,}\space}
+% \end{macrocode}
+% \DescribeMacro{\tb@ANS} does the main work of \cs{ANS}.
+% \begin{macrocode}
+\newcommand{\tb@ANS}[2][]{%
+ \ifisinstred
+ \ifisinlineans
+ \if\tb@istart0\ANSFmt{\theeqquestionnoi}{#2}\fi
+ \fi
+ \ifismarginans
+ \ftb@defineInsSpan{#1}%
+% \end{macrocode}
+% We create the code that we will introduce into \cs{insMidMarg}, this will
+% be introduced prior to \texttt{\#2}.
+% \begin{macrocode}
+ \edef\eqe@prehold{%
+ \if\probstar*%
+% \end{macrocode}
+% If this question is one with parts...
+% \begin{macrocode}
+ \ifftb@isANSListOpen
+% \end{macrocode}
+% If the list is already open (\cs{ifftb@isANSListOpen}),
+% we just add content to the \texttt{eqeList} environment.
+% \begin{macrocode}
+ \ftb@EqeListPrtsFmt\noexpand\eqe@hspannerMrg
+ \else
+% \end{macrocode}
+% If the list is not open, we start the \texttt{eqeList} environment
+% in the usual way, this also includes the case where \cs{bGrpAns} is
+% not uses, which is normally the case.
+%
+% \begin{macrocode}
+ \noexpand\par\kern0pt\noindent
+ \ftb@OpenEqeListPrts\ftb@InsSpan
+ \fi
+ \else
+% \end{macrocode}
+% This is a question without parts.
+% \begin{macrocode}
+ \noexpand\begin{eqeList}%
+ {\noexpand\tb@mrgDigitFmt{%
+ \theeqquestionnoi\eqe@decPointMrg}}%
+ \fi
+ }%
+% \end{macrocode}
+% We have finished constructing \cs{eqe@prehold}. We next set
+% \cs{ftb@isANSListOpen} to \texttt{true}, if \cs{WithinANSGrp} is \texttt{true}.
+% \begin{macrocode}
+ \ifWithinANSGrp\global\ftb@isANSListOpentrue\fi
+% \end{macrocode}
+% If we are within an open group, we emit \cs{insMidMarg} with the
+% \cs{eqe@prehold}, followed by \texttt{\#2}, and a comma-space combo,
+% but \emph{we do not close} the \texttt{eqeList} environment.
+% \begin{macrocode}
+ \ifWithinANSGrp
+ \expandafter\insMidMarg\expandafter
+ {\eqe@prehold#2\grpANSDelimiter}%
+ \else
+% \end{macrocode}
+% This is the normal case, we insert \cs{eqe@prehold}, \texttt{\#2}, and
+% close the \texttt{eqeList} environment.
+%
+% \begin{macrocode}
+ \expandafter\insMidMarg%
+ \expandafter{\eqe@prehold#2\end{eqeList}}%
+ \global\ftb@isANSListOpenfalse
+ \fi
+ \fi % \ifismarginans
+ \fi %\ifisinstred
+}
+% \end{macrocode}
+% End (10/13)
+% \begin{environment}{eqeList}
+% An environment used to format the answers in the margins, when
+% \texttt{marginans} is in effect.
+% \begin{macrocode}
+\newenvironment{eqeList}[2][\tb@woparts@len]{\begin{list}{#2}{%
+ \def\argi{#1}\setlength{\labelwidth}{#1}%
+ \ifx\argi\tb@wparts@len
+ \settowidth{\labelsep}{\eqe@prtsepMrg}\else
+ \settowidth{\labelsep}{\eqe@hspannerMrg}\fi
+ \setlength{\leftmargin}{\labelwidth+\labelsep}%
+ \setlength{\parskip}{0pt}\setlength{\partopsep}{0pt}%
+ \setlength{\topsep}{1pt}\setlength{\parsep}{0pt}%
+ \setlength{\itemindent}{0pt}\setlength{\itemsep}{3pt}%
+}\item\relax}{\end{list}}
+% \end{macrocode}
+% \end{environment}
+% \paragraph*{Formatting Answers and Solutions}
+% \begin{macro}{\mrgDigitFmt}
+% Format of the digit (and the decimal point) for the answers in the margins.
+%\begin{verbatim}
+%\mrgDigitFmt{\textbf{#1}}
+%\mrgPartFmt{\textbf{(\hfil#1\hfil)}}
+%\setMarIndents[\bfseries\normalsize\normalfont]{00}{(d)}
+%\end{verbatim}
+% \begin{macrocode}
+\newcommand{\mrgDigitFmt}[1]{\def\tb@mrgDigitFmt##1{#1}}
+\mrgDigitFmt{#1}
+% \end{macrocode}
+% \begin{macro}{\mrgPartFmt}
+% Format of the part (including possibly the parentheses), example give above.
+% \begin{macrocode}
+\definecolor{MRGPARTcolor}{named}{black}
+\newcommand{\mrgPartFmt}[1]{\def\tb@mrgPartFmt##1{#1}}
+\mrgPartFmt{\textcolor{MRGPARTcolor}{(\hfil#1\hfil)}}
+% \end{macrocode}
+% \end{macro}
+% \end{macro}
+% \end{macro}
+% \begin{macro}{ANScolor}
+% The default color of the answers that appear in the margins or inline.
+% \begin{macrocode}
+\definecolor{ANScolor}{rgb}{0,0,.8}
+% \end{macrocode}
+% \end{macro}
+% \begin{macro}{\ANSFmt}
+% The command that sets the format, may be redefined as needed. Used in the
+% \cs{ANS} command above.
+% \begin{macrocode}
+\newcommand{\ANSFmt}[2]{\textcolor{ANScolor}{#2}}
+% \end{macrocode}
+% \end{macro}
+% We have two environments that we use in three different situations:
+%\begin{itemize}
+% \item \texttt{eqequestions} environment: (1) Used to control the display of the
+% \texttt{probset} environment within the body of the textbook; (2) used
+% to control the display of the solutions ``in the back of the book.''
+% \item \texttt{eqeList} environment: Used for displaying answers in the margin of
+% the book, when the appropriate options allow it.
+%\end{itemize}
+% We want to be able to manipulate some of the parameters of these three
+% situation, independently of each other. There are several issues, setting
+% what I have been calling the gutter width, and the display of the problem
+% numbers.
+%\par\medskip\noindent
+% We define four commands for each of the three situations described above. The names
+% have a pattern to them, and similarly named commands have the same use.
+%
+% The numbering of the problems has the pattern: \verb*!dd. (a) !
+% We provide convenience commands to give these internal macros values
+% \begin{macro}{\prbDecPt}
+% \begin{macro}{\prbPrtsep}
+% \begin{macro}{\prbNumPrtsep}
+% Basic parameters for the problems in the body of the text.
+% \begin{macrocode}
+\def\eqe@decPointPrb{.} % decimal point of prob number
+\def\eqe@prtsepPrb{\ } % prob with parts, space after part
+\def\eqe@hspannerPrb{\ } % space after prob number
+\providecommand{\prbDecPt}[1]{\def\eqe@decPointPrb{#1}}
+\providecommand{\prbPrtsep}[1]{\def\eqe@prtsepPrb{#1}}
+\providecommand{\exPrtsep}[1]{\def\eqe@prtsepPrb{#1}}
+\providecommand{\prbNumPrtsep}[1]{\def\eqe@hspannerPrb{#1}}
+% \end{macrocode}
+% \end{macro}
+% \end{macro}
+% \end{macro}
+% \begin{macro}{\solDecPt}
+% \begin{macro}{\solPrtsep}
+% \begin{macro}{\solNumPrtsep}
+% Basic parameters for the problems in the solution sets.
+% \begin{macrocode}
+\def\eqedecPointSoln{.} % decimal point of prob number
+\def\eqe@prtsepSoln{\ } % prob with parts, space after part
+\def\eqe@hspannerSoln{\ } % space after prob number
+\newcommand{\solDecPt}[1]{\def\eqedecPointSoln{#1}}
+\newcommand{\solPrtsep}[1]{\def\eqe@prtsepSoln{#1}}
+\providecommand{\solNumPrtsep}[1]{\def\eqe@hspannerSoln{#1}}
+% \end{macrocode}
+% \end{macro}
+% \end{macro}
+% \end{macro}
+% \begin{macro}{\mrgDecPt}
+% \begin{macro}{\mrgPrtsep}
+% \begin{macro}{\mrgNumPrtsep}
+% Basic parameters for the problems in the margins.
+% \begin{macrocode}
+\def\eqe@decPointMrg{.} % decimal point of prob number
+\def\eqe@prtsepMrg{\ } % prob with parts, space after part
+\def\eqe@hspannerMrg{\ } % space after prob number
+\newcommand{\mrgDecPt}[1]{\def\eqe@decPointMrg{#1}}
+\newcommand{\mrgPrtsep}[1]{\def\eqe@prtsepMrg{#1}}
+\newcommand{\mrgNumPrtsep}[1]{\def\eqe@hspannerMrg{#1}}
+% \end{macrocode}
+% \end{macro}
+% \end{macro}
+% \end{macro}
+% \begin{macro}{\setMarIndents}
+% Sets some dimensions used by the \texttt{eqeList} environment.
+% \cs{tb@woparts@len} is calculated and
+% is used as the default gutter width in \texttt{eqeList}. \cs{tb@wparts@len}
+% is used for the gutter width for the gutter width when there is a problem
+% with parts. Finally, \cs{tbmrgpartwdth} in \cs{ANS} and is used for the width
+% of a \cs{makebox} that enclosed the part letter.
+% \begin{macrocode}
+\newcommand{\setMarIndents}[3][\normalsize\normalfont]{{%
+ \settowidth{\@tempdima}{#1#2\eqe@decPointMrg}%
+ \xdef\tb@woparts@len{\the\@tempdima}%
+ \settowidth{\@tempdima}%
+ {#1#2\eqe@decPointMrg\eqe@hspannerMrg#3}%
+ \xdef\tb@wparts@len{\the\@tempdima}%
+ \settowidth{\@tempdima}{#1#3}%
+ \xdef\tbmrgpartwdth{\the\@tempdima}%
+}}
+\setMarIndents{00}{(d)}
+% \end{macrocode}
+% \end{macro}
+% \begin{macro}{\setSolnIndent}
+% Used to set the some parameters used by \texttt{eqequestions}, in the solutions file.
+% \begin{macrocode}
+\newdimen\solnGutter
+\newcommand{\setSolnIndent}[3][\normalsize\normalfont\bfseries]{%
+ {\settowidth{\@tempdima}{#1#2\eqedecPointSoln\eqe@hspannerSoln}%
+ \global\solnGutter\@tempdima
+ \settowidth{\@tempdima}{#1#3}%
+ \xdef\tbsolnpartwdth{\the\@tempdima}%
+}}
+\setSolnIndent{00}{(d)}
+% \end{macrocode}
+% \end{macro}
+% \begin{macro}{\setSolnMargins}
+% This command is written to the solution file, and expanded when that file
+% is input back in. If \cs{solnGutter} is not \texttt{0pt}, we set the length
+% of \cs{eqemargin} using the current value; otherwise, we use the value
+% determined by \cs{setSolnIndent}, above.
+% \begin{macrocode}
+\renewcommand{\setSolnMargins}[1]{%
+ \ifdim\solnGutter=0pt \setlength\eqemargin{#1}\else
+ \setlength\eqemargin{\solnGutter}\fi}
+%\newcommand{\defaultSolnIndent}{\gdef\solnGutter{0pt}}
+\newcommand{\defaultSolnIndent}{\global\solnGutter=0pt}
+\defaultSolnIndent
+% \end{macrocode}
+% \end{macro}
+% \begin{macro}{\prbNumFmt}
+% \begin{macro}{\solWoPrtsFmt}
+% \begin{macro}{\solWPrtsFmt}
+% We redefine \cs{exlabelformat}, \cs{exsllabelformat}, and
+% \cs{exsllabelformatwp}. They are defined in such a way as
+% to simply their modification through a series of simple
+% formatting commands. The defaults are
+%\begin{verbatim}
+%\prbNumFmt{\textbf{#1}}
+%\solWoPrtsFmt{\textbf{#1}}
+%\solWPrtsFmt{\textbf{#1}}{(\hfil#2\hfil)}
+%\end{verbatim}
+% \begin{macrocode}
+\renewcommand{\exlabelformat}{%
+ \tbprbNumFmt{\theeqquestionnoi\eqe@decPointPrb}}
+% \end{macrocode}
+% \cs{prbNumFmt} is the format for the number of the problems
+% in the body of the text. The argument \texttt{\#1} is a symbolic
+% argument for the question number.
+% \begin{macrocode}
+\newcommand{\prbNumFmt}[1]{\def\tbprbNumFmt##1{#1\eqe@hspannerPrb}}
+\prbNumFmt{\textbf{#1}}
+% \end{macrocode}
+% Redefine \cs{exsllabelformat}, and \cs{exsllabelformatwp}
+% \begin{macrocode}
+\renewcommand{\exsllabelformat}{\string\tbsolWoPrtsFmt{%
+ \theeqquestionnoi\string\eqedecPointSoln}}
+\renewcommand{\exsllabelformatwp}{\string\tbsolWPrtsFmt%
+ {\string\eqedsplyOnlyFrst{\theeqquestionnoi}{\thepartno}}%
+ {\thepartno}%
+}
+% \end{macrocode}
+% \cs{solWoPrtsFmt} is the format for the number of the problems
+% in the solution set. The argument \texttt{\#1} is a symbolic
+% argument for the question number. \cs{solWPrtsFmt} is the format
+% for a problem with parts in the solution file. \texttt{\#1} is
+% symbolically the question number, and \texttt{\#2} is a
+% symbolic for the part letter.
+% \begin{macrocode}
+\newcommand{\solWoPrtsFmt}[1]{\def\tbsolWoPrtsFmt##1{%
+ \makebox[0pt][r]{#1\eqe@hspannerSoln}}}
+\solWoPrtsFmt{\textbf{#1}}
+\newcommand{\solWPrtsFmt}[2]{\def\tbsolWPrtsFmt##1##2{%
+ \makebox[0pt][r]{#1\eqe@hspannerSoln}%
+ \makebox[\tbsolnpartwdth][l]{#2}\eqe@prtsepSoln%
+}}
+\solWPrtsFmt{\textbf{#1}}{(\hfil#2\hfil)}
+% \end{macrocode}
+% An alternate definition for \cs{solWPrtsFmt}, used by \cs{hangSolWPrtsFmt}.
+% \begin{macrocode}
+\newcommand{\solWPrtsFmt@hang}[2]{%
+ \def\tbsolWPrtsFmt##1##2{%
+ \makebox[0pt][r]{#1\eqe@prtsepSoln%
+ \makebox[\tbsolnpartwdth][l]{#2}\eqe@hspannerSoln}%
+}}
+% \end{macrocode}
+% \end{macro}
+% \end{macro}
+% \end{macro}
+% \begin{macro}{\hangSolWPrtsFmt}
+% The command takes two arguments, the same as \cs{solWPrtsFmt}. When this
+% command is executed in the preamble, we get hanging indentation for problems
+% with parts.
+%\changes{v3.0g}{2011/08/15}{Use this to use ``hanging indentation'' for the
+% parts for problems with parts in the solutions file.}
+% \begin{macrocode}
+\let\bpartsmrk\relax
+\let\epartsmrk\relax
+\newcommand{\hangSolWPrtsFmt}[2]{%
+% \end{macrocode}
+% At the beginning and ending of a parts environment, we begin and end
+% a special \texttt{eqepartsquestions} environment, designed to give
+% the desired indentation.
+% \begin{macrocode}
+ \def\prior@parts@hook{%
+ \ifisleadin\else
+ \writeToSolnFile{^^J\protect\bpartsmrk}\fi}%
+ \def\post@parts@hook{%
+ \writeToSolnFile{\protect\epartsmrk^^J}}%
+ \def\bpartsmrk{\global\firstitemtrue\begin{eqepartsquestions}}%
+ \def\epartsmrk{\end{eqepartsquestions}\global\firstitemfalse}%
+% \end{macrocode}
+% We must also redefine \cs{solWPrtsFmt} by letting it to
+% \cs{solWPrtsFmt@hang}, then executing it using the parameters passed.
+% \begin{macrocode}
+ \let\solWPrtsFmt\solWPrtsFmt@hang
+ \solWPrtsFmt{#1}{#2}%
+}
+%\@onlypreamble\hangSolWPrtsFmt
+% \end{macrocode}
+% \end{macro}
+% Define some switches, token registers, and boxes for managing
+% the answers and marginal notes.
+% \begin{macrocode}
+\newif\ifexamenv \examenvfalse
+\newif\iffirstemit \firstemittrue
+\newtoks\txtbkt@ks \txtbkt@ks={}
+\newtoks\txtbkt@ksi \txtbkt@ksi={}
+\newbox\txtbkb@xb@t
+\newbox\txtbkb@xt@p
+\newbox\txtbkb@xh@ld
+\let\tbTopMargin\relax
+\let\tbBotMargin\relax
+\long\def\tb@addtoTopMargin#1{\txtbkt@ksi={#1}%
+ \edef\eqe@tmphold{\the\txtbkt@ksi\the\txtbkt@ks}%
+ \global\txtbkt@ks=\expandafter{\eqe@tmphold}%
+}
+\newcommand{\tb@addtoMargin}[1]{%
+ \edef\eqe@tmphold{\the\txtbkt@ks}%
+ \global\txtbkt@ks=\expandafter{\eqe@tmphold#1}%
+}
+% \end{macrocode}
+% As my first attempt, let's create two comment environmets to be used within
+% the \texttt{solution} environment.
+%\begin{verbatim}
+%\begin{solution}
+%\begin{ssol}
+% <short solution/answer>
+%\end{ssol}
+%\begin{lsol}
+% <long solution>
+%\end{lsol}
+%\end{solution}
+%\end{verbatim}
+% The control of these environments are made through
+% \begin{environment}{lsol}
+% \begin{macro}{\tb@showlsols}
+% Place full (or long) solutions in this environment.
+% \begin{macrocode}
+\newcommand{\tb@showlsols}{\includecomment{lsol}\excludecomment{ssol}}
+% \end{macrocode}
+% \end{macro}
+% \end{environment}
+% \begin{environment}{ssol}
+% \begin{macro}{\tb@showssols}
+% Place short solutions in this environment.
+% \begin{macrocode}
+\newcommand{\tb@showssols}{\includecomment{ssol}\excludecomment{lsol}}
+% \end{macrocode}
+% \end{macro}
+% \end{environment}
+% The default is to show the short solutions.
+% \begin{macrocode}
+\let\tb@soln@choice\tb@showssols
+%\let\tb@sols@choice\tb@showssols
+% \end{macrocode}
+% \subsection{Marginal Matter.} There are three levels in the margins:
+% \begin{enumerate}
+% \item \textbf{Top level}: This is a command \cs{tbTopMargin} with may be
+% redefined between pages. It should have the width of the \cs{parbox}
+% that contains all the content of the margin, this width is \cs{tb@marparboxwidth}
+% (\texttt{\cs{oddsidemargin}-\cs{marginparsep}}). The content \emph{must} be
+% unbreakable across pages. The content of \cs{tbTopMargin} will appear \emph{on
+% every page subsequent to its definition}.
+% \item[] \DescribeMacro{\clearTopMargin} We can clear the top level using the following command
+% \begin{macrocode}
+\newcommand{\clearTopMargin}{\global\let\tbTopMargin\relax}
+% \end{macrocode}
+% \item[] Clearing will take effect on the following page.
+% \item[] \DescribeMacro{\setTopMargin} As a convenience macro, we can create top margin content.
+% Redefinitions will appear on the next page from where the definition was made.
+% \begin{macrocode}
+\newcommand{\setTopMargin}[1]{%
+ \gdef\tbTopMargin{\color@begingroup\normalcolor
+ #1\color@endgroup}%
+ \gdef\tbSaveTopMargin{\color@begingroup\normalcolor
+ #1\color@endgroup}}
+\let\tbTopMargin\@empty
+\let\tbSaveTopMargin\@empty
+% \end{macrocode}
+% \item \textbf{Middle level}: The middle level is the most interesting. You write to it
+% using \cs{insMidMarg}. Normally, this is text. If there is too much text,
+% it will be split off and placed in the middle level of the next page. The command
+% \cs{ANS} also writes to the middle level when the \texttt{instred} and \texttt{marginans} options are
+% taken.
+% \item \textbf{Bottom level}: This is similar to the top level, but on the bottom. The
+% command is named \cs{tbBotMargin} and follows the same rules as \cs{tbTopMargin}.
+% Again, the content of \cs{tbBotMargin} will appear \emph{on every
+% page subsequent to its definition}.
+% \item[] \DescribeMacro{\clearBotMargin} We can clear the bottom level using the following command
+% \begin{macrocode}
+\newcommand{\clearBotMargin}{\global\let\tbBotMargin\relax}
+% \end{macrocode}
+% \item[] Clearing will take effect on the following page.
+% \item[] \DescribeMacro{\setBotMargin} As a convenience macro, we can create bottom margin content.
+% Redefinitions will appear on the next page from where the definition was made.
+% \begin{macrocode}
+\newcommand{\setBotMargin}[1]{\gdef\tbBotMargin{#1}%
+ \gdef\tbSaveBotMargin{#1}}
+\let\tbBotMargin\@empty
+\let\tbSaveBotMargin\@empty
+% \end{macrocode}
+% \begin{macrocode}
+\newcommand{\restoreLastTopMargin}{\expandafter\setTopMargin
+ \expandafter{\tbSaveTopMargin}}
+\newcommand{\restoreLastBotMargin}{\expandafter\setBotMargin
+ \expandafter{\tbSaveBotMargin}}
+% \end{macrocode}
+% \end{enumerate}
+%
+% \begin{macro}{\insMidMarg}
+% \cs{insMidMarg} is a \cs{parbox} that will hold the material in the margin.
+% \begin{macro}{\MarParBoxFmt}
+% The formatting for the marginal \cs{parbox}
+% \begin{macrocode}
+\newcommand{\MarParBoxFmt}{\normalsfcodes
+ \normalfont\normalsize\normalbaselines\parindent0pt
+ \vbadness\@Mi \hbadness5000 \tolerance9999
+ \parskip0pt\raggedright %\spaceskip=0pt\xspaceskip=0pt
+ \setlength{\linewidth}{\tbmarparboxwidth}%
+}
+% \end{macrocode}
+% \end{macro}
+% \begin{macro}{\tbmarparboxwidth}
+% The width of the margin box. Initial value of \texttt{1sp}, if the user does not
+% reset the value, it is a package error.
+% \begin{macrocode}
+\newlength\tbmarparboxwidth
+\setlength\tbmarparboxwidth{1sp}
+% \end{macrocode}
+% \end{macro}
+% \begin{macro}{MidMargcolor}
+% The default color of text of the middle level
+% \begin{macrocode}
+\definecolor{MidMargcolor}{rgb}{0,0,.8}
+\newcommand{\midMargFmt}[1]{%
+ \def\tb@midMargFmt{\normalfont\normalsize\normalcolor#1}}
+\midMargFmt{\color{MidMargcolor}}
+% \end{macrocode}
+% \end{macro}
+% \begin{macro}{\eqe@MarParBox}
+% This is the actual \cs{parbox} that holds the marginal material. I have two versions
+% of this box, the first one has height \cs{textheight}, the second one has height
+% \texttt{\cs{textheight}+\cs{footskip}}.
+% \begin{macrocode}
+%\def\eqe@MarParBox#1{\parbox[b][\textheight][t]%
+% {\tbmarparboxwidth}{\color{MidMargcolor}#1}}
+\def\eqe@MarParBox#1{\lower\footskip\hbox{%
+ \leavevmode\parbox[b][\textheight+\footskip][t]%
+ {\tbmarparboxwidth}{\tb@midMargFmt#1}}} %
+% \end{macrocode}
+% \end{macro}
+% Finally, we get to the \cs{insMidMarg}, this is used to write to the middle
+% level.
+% \begin{macrocode}
+\newcommand{\insMidMarg}[1]{%
+ \let\eqe@margininsert\@empty
+ \expandafter\tb@addtoMargin\expandafter{\eqe@margininsert#1}%
+}
+% \end{macrocode}
+% \end{macro}
+% \begin{macro}{\tbPreMarginHeader}
+% Executed prior to the marginal heading
+% \begin{macro}{\tbPostMarginHeader}
+% Executed after the marginal heading
+% \begin{macro}{HEADERcolor}
+% Default color of a marginal header
+% \begin{macro}{\cngMargHeadColorTo}
+% Changes the marginal header to a named color
+%\changes{v3.0o}{2011/09/20}{Added \cs{cngMargHeadColorTo} and
+% \cs{resetMargHeadColor} to make it easier to change the color
+% of the header globally, or just once.}
+% \begin{macro}{\resetMargHeadColor}
+% Reset the marginal header color to the default, \texttt{HEADERcolor}
+% \begin{macro}{\tbMarginHeaderFmt}
+% Formatting for a marginal header.
+% Format the marginal header, the default is \texttt{HEADERcolor} in bold
+% \begin{macrocode}
+\newcommand{\tbPreMarginHeader}{\par\penalty0 \kern3pt}
+\newcommand{\tbPostMarginHeader}{\par\nobreak}
+\definecolor{HEADERcolor}{named}{black}
+\newcommand{\cngMargHeadColorTo}[1]{\insMidMarg{\gdef\tb@MHC{#1}}}
+\newcommand{\resetMargHeadColor}{\insMidMarg{\gdef\tb@MHC{HEADERcolor}}}
+\resetMargHeadColor
+\newcommand{\tbMarginHeaderFmt}[1]{\textcolor{\tb@MHC}{\textbf{#1}}}
+% \end{macrocode}
+% \end{macro}
+% \end{macro}
+% \end{macro}
+% \end{macro}
+% \end{macro}
+% \end{macro}
+% \begin{macro}{\insMargHead}
+% Used to insert a general marginal heading into the middle level. The
+% optional parameter allows you to set a mark.
+%
+% \begin{macro}{\insProbHead}
+% Used to insert a marginal heading for a problem set into the middle level.
+% The optional parameter allows you to insert a mark, the default mark is
+% \verb!#1 \tbcontinued!.
+% \begin{macrocode}
+\newcommand{\insMargHead}[2][]{% dps
+ \insMidMarg{\tb@marginHeader{#1}{#2}}}
+\newcommand{\insProbHead}[2][]{%
+ \def\tb@argi{#1}\ifx\tb@argi\@empty
+ \protected@xdef\currProbHead{#2 \tbcontinued}\else
+ \protected@xdef\currProbHead{#1}\fi
+ \ifisinstred\ifismarginans
+ \insMidMarg{\tb@marginProbHeader{#1}{#2}}\fi\fi
+}
+\newcommand{\tb@marginProbHeader}[2]{%
+ \def\tb@argi{#1}\ifx\tb@argi\@empty
+ \tb@marginHeader{#2 \tbcontinued}{#2}\else
+ \tb@marginHeader{#1}{#2}\fi
+}
+\newcommand{\tb@marginHeader}[2]{\tbPreMarginHeader
+ \tbMarginHeaderFmt{#2}\def\tb@argi{#1}\ifx\tb@argi\@empty
+ \mark{#2}\else\mark{#1}\fi\tbPostMarginHeader
+}
+% \end{macrocode}
+% \end{macro}
+% \end{macro}
+% \begin{macro}{\tbcontinued}
+% The continue annot that appear when a problem set flows over to the next page.
+% \begin{macrocode}
+\newcommand{\tbcontinued}{(cont.)}
+% \end{macrocode}
+% \end{macro}
+% \begin{macro}{\tbplaceMargins}
+% Redefine this macro to set the locations of the margins we are writing to.
+% \begin{macrocode}
+\newcommand{\marparboxwidth}[1]{%
+ \setlength\tbmarparboxwidth{#1}%
+ \setlength{\marginparwidth}{\tbmarparboxwidth}%
+ \tbMakeFinalCalcs
+}
+\@onlypreamble\marparboxwidth
+\newcommand{\chkmarginboxwidth}{%
+ \ifdim\tbmarparboxwidth=1sp \PackageError{eqexam}%
+ {You have not set the value of\MessageBreak
+ \string\marparboxwidth}%
+ {Define the \string\marparboxwidth\space command}\fi
+}
+% \end{macrocode}
+% \begin{macro}{\ifmarginsonleft}
+% A Boolean switch, if true, all margins are on the left; otherwise, they alternate
+% \begin{macrocode}
+\newif\ifmarginsonleft \marginsonleftfalse
+% \end{macrocode}
+% \end{macro}
+% \begin{macro}{\tbSetupForMargins}
+% We compute \cs{oddsidemargin}, \cs{evensidemargin}, and \cs{textwidth}
+% \begin{macrocode}
+\newcommand{\tbSetupForMargins}{%
+ \ifmarginsonleft
+ \setlength{\oddsidemargin}{\tbmarparboxwidth+\marginparsep}%
+ \setlength{\evensidemargin}{\oddsidemargin}%
+ \setlength{\textwidth}{\paperwidth-2in-\oddsidemargin}%
+ \else
+ \setlength{\oddsidemargin}{0pt}%
+ \setlength{\evensidemargin}{\tbmarparboxwidth+\marginparsep}%
+ \setlength{\textwidth}{%
+ \paperwidth-2in-\oddsidemargin-\evensidemargin}%
+ \fi
+}
+% \end{macrocode}
+% \end{macro}
+% \begin{macro}{\tbplaceMargins}
+% We calculate the coordinates of the lower left hand corner of the margin \cs{parbox}
+% depending on the value of \cs{ifmarginsonleft}.
+% \begin{macrocode}
+\newcommand{\tbplaceMargins}{{%
+ \setlength{\@tempdima}{%
+ \paperheight-1in-\topmargin-\headheight-\headsep-\textheight}%
+ \xdef\@evenlly{\strip@pt\@tempdima}%
+ \xdef\@oddlly{\@evenlly}%
+ \setlength{\@tempdima}{1in}%
+ \xdef\@evenllx{\strip@pt\@tempdima}%
+ \ifmarginsonleft\else
+ \setlength{\@tempdima}{1in+\textwidth+\marginparsep}\fi
+ \xdef\@oddllx{\strip@pt\@tempdima}%
+}}
+% \end{macrocode}
+% \end{macro}
+% \end{macro}
+% \begin{macro}{\tbMakeFinalCalcs}
+% Executed by \cs{marparboxwidth}
+% \begin{macrocode}
+\newcommand{\tbMakeFinalCalcs}{%
+ \tbSetupForMargins
+ \tbplaceMargins
+}
+% \end{macrocode}
+% \end{macro}
+% \begin{macro}{\tbminskipbtnlayers}
+% \cs{tbminskipbtnlayers} is the minimum skip between layers (top, middle, bottom)
+% Executed by \cs{marparboxwidth}
+% \begin{macrocode}
+\newlength\tbminskipbtnlayers
+\setlength{\tbminskipbtnlayers}{6pt}
+% \end{macrocode}
+% \end{macro}
+% \begin{macrocode}
+\newif\ifiscarryover \iscarryoverfalse
+% \end{macrocode}
+% \begin{environment}{carryoverFmt}
+% is a work-around for the color problem
+% experienced with carry over text: Suppose there is a change of
+% color of the text on the previous page, the carry over text will naturally be
+% colored the default color, \texttt{MidMargcolor}. To continue the text with the same color
+% as the one the previous page, we enclose the text in the
+% \texttt{carryoverFmt} environment.
+% \begin{macrocode}
+\newenvironment{carryOverFmt}[1]{#1\let\tb@carryoverFmt\@empty
+ \c@rryoverFmt{#1}}{}
+% \end{macrocode}
+% \end{environment}
+% This command is called by the \texttt{carryOverFmt} environment.
+% it takes its argument, which is a change in color or style, and
+% defines \cs{tb@carryoverFmt}, which will be executed on the next page.
+% \begin{macrocode}
+\def\c@rryoverFmt#1{%
+ \ifx\tb@carryoverFmt\@empty
+ \global\let\tb@carryoverFmt\@empty
+ \xdef\tb@co@page{\thepage}%
+ \gdef\tb@carryoverFmt{\ifnum\thepage>\tb@co@page\relax
+ #1\global\let\tb@carryoverFmt\@empty\fi}%
+ \fi
+}
+\let\tb@carryoverFmt\@empty
+% \end{macrocode}
+% \cs{tb@insertCarryOver} takes its argument, that is always
+% \verb!\unvbox\txtbkb@xb@t}!, and if there is any carryover
+% content, will insert its argument followed by a copy,
+% \cs{tb@rest@reMarginFmt} of the default margin format. This seems
+% to work for recovering from a change of text or style over a page
+% boundary.
+% \begin{macrocode}
+\let\tb@rest@reMarginFmt\relax
+\def\tb@insertCarryOver#1{%
+ \let\tb@rest@reMarginFmt\relax
+ \ifiscarryover\ifx\tb@carryoverFmt\@empty\else
+ \let\tb@rest@reMarginFmt\tb@midMargFmt
+ \tb@carryoverFmt\fi\fi
+ #1 \tb@rest@reMarginFmt
+}
+% \end{macrocode}
+% \begin{macro}{\eqe@tb@shipout}
+% We define the shipout to the margins.\par\medskip\noindent
+% \textbf{Bug:} When I use \textsf{graphicxsp}, embed the picture (such as a logo),
+% and use that picture as the \cs{setTopMargin}, the shipout routine is executed
+% twice for each page. I haven't figured out what causes this, but here is a
+% work around. We record the most recent page number, if it equals the page number
+% of the last iteration of \cs{eqe@tb@shipout}, we do nothing; otherwise,
+% execute the shipout code.
+% \begin{macrocode}
+\newif\iftb@shipoutPermitted \tb@shipoutPermittedtrue
+\newcommand{\turnOnFTBShipout}{\global\tb@shipoutPermittedtrue}
+\newcommand{\turnOffFTBShipout}{\global\tb@shipoutPermittedfalse}
+% \end{macrocode}
+%\changes{v3.7a}{2015/02/26}{Added a new Boolean switch \cs{iftb@shipoutPermitted}
+% to turn off the shipout. Two convenience commands in support are also added,
+% \cs{turnOffFTBShipout} and \cs{turnOffFTBShipout}.}
+% \DescribeMacro{\turnOnFTBShipout}\cmd{\turnOnFTBShipout} turns on the shipout,
+% the default, and \DescribeMacro{\turnOffFTBShipout}\cmd{\turnOffFTBShipout}
+% turns it off.
+% \begin{macrocode}
+\newcommand{\eqe@tb@shipout}{\iftb@shipoutPermitted
+ \ifnum\arabic{page}=\tblastpageshipped
+ \let\tb@so@next\relax\else
+ \xdef\tblastpageshipped{\arabic{page}}%
+ \def\tb@so@next{\eqe@tb@ship@ut}\fi
+ \expandafter\tb@so@next\fi
+}
+\def\tblastpageshipped{-100}
+% \end{macrocode}
+% Here is the actual shipout code for writing to the margins.
+% \begin{macrocode}
+\newcommand{\eqe@tb@ship@ut}{%
+ \fboxsep=0pt\setlength{\unitlength}{1pt}%
+ \global\setbox\txtbkb@xb@t=\vbox\bgroup
+ \color@begingroup
+ \hsize=\tbmarparboxwidth
+ \vsize=\textheight
+ \MarParBoxFmt
+ \csname tbTopMargin\endcsname
+ \vskip\tbminskipbtnlayers
+\set@typeset@protect
+ \the\txtbkt@ks
+ \color@endgroup\vfil
+ \egroup
+ \global\setbox\txtbkb@xt@p=\vsplit\txtbkb@xb@t to\textheight
+ \ifvoid\txtbkb@xb@t\global\iscarryoverfalse
+ \else\global\iscarryovertrue\fi
+% \end{macrocode}
+% We have three levels the top (\cs{tbTopMargin}), the bottom (\cs{tbBotMargin}),
+% and the middle (\cs{txtbkt@ks}). \cs{tbTopMargin} is no problem but \cs{tbBotMargin}
+% requires some special attention.
+% \begin{macrocode}
+ \ifx\tbBotMargin\relax\else
+% \end{macrocode}
+% If \cs{tbBotMargin} is not \cs{relax}, we begin by putting \cs{tbBotMargin}
+% into a \cs{vbox} under the same assumptions, and get its height.
+% \begin{macrocode}
+ \bgroup\setbox2=\vbox{%
+ \color@begingroup\normalcolor
+ \hsize=\tbmarparboxwidth\kern0pt
+ \MarParBoxFmt\csname tbBotMargin\endcsname
+ \color@endgroup
+ \kern0pt
+ }%
+% \end{macrocode}
+% We reduce \cs{textheight} by the height of \cs{tbBotMargin}
+% \begin{macrocode}
+ \dimen0=\textheight
+ \advance\dimen0-\ht\txtbkb@xh@ld
+ \advance\dimen0-\tbminskipbtnlayers
+% \end{macrocode}
+% We split off the top material by this amount, the new bottom
+% is in \cs{txtbkb@xt@p} the new top is in \cs{box0}
+% \begin{macrocode}
+ \setbox0=\vsplit\txtbkb@xt@p to \dimen0
+% \end{macrocode}
+% The new bottom (which will overflow to the next page) is the content
+% we clipped off bottom of \cs{txtbkb@xt@p} and the original overflow
+% material still in \cs{txtbkb@xb@t}.
+% \changes{v4.6}{2016/01/18}{Removed \cs{vfil} between unboxing, this allows
+% correct breaking of margin content across pages.}
+% \begin{macrocode}
+ \global\setbox\txtbkb@xb@t=\vbox{%
+ \unvbox\txtbkb@xt@p\unvbox\txtbkb@xb@t}%
+% \end{macrocode}
+% We then patch everything together the new top
+% is in \cs{txtbkb@xt@p} the new top is in \cs{@tempboxa} followed by
+% \cs{tbBotMargin} (in \cs{box}\cs{txtbkb@xh@ld}).
+% \begin{macrocode}
+ \global\setbox\txtbkb@xt@p=\vbox{\unvbox0
+ \vfill\vskip\tbminskipbtnlayers
+ \vfil\unvbox2\relax}\egroup
+ \fi
+ \ifodd\value{page}%
+ \put(\@oddllx,\@oddlly){%
+ \eqe@MarParBox{\unvbox\txtbkb@xt@p}}\else
+ \put(\@evenllx,\@evenlly){%
+ \eqe@MarParBox{\unvbox\txtbkb@xt@p}}\fi
+% \end{macrocode}
+% We see if there is any carry over, if yes, we insert into
+% \cs{txtbkt@ks} for use on the next page, along with a heading,
+% if any.
+% \begin{macrocode}
+ \global\txtbkt@ks={}\ifvoid\txtbkb@xb@t\else
+% \end{macrocode}
+% We test whether these is a \cs{splitbotmark}, if yes, then we will
+% insert it at the top of the next page with formatting.
+% \begin{macrocode}
+ \if!\splitbotmark!\global\let\tb@sbm@exp\relax\else
+ \xdef\tb@sbm@exp{\noexpand\tbPreMarginHeader
+ \noexpand\tbMarginHeaderFmt{\splitbotmark}%
+ \noexpand\tbPostMarginHeader
+ \noexpand\par\kern3pt}%
+ \fi
+% \end{macrocode}
+% Here is the content that will be carried over to the next page,
+% we insert a \cs{splitbotmark} if it is non-empty (\cs{tb@tmp@exp}).
+% \begin{macrocode}
+ \global\txtbkt@ks=\expandafter{\tb@sbm@exp
+ \tb@insertCarryOver{\unvbox\txtbkb@xb@t}}%
+ \fi
+}
+% \end{macrocode}
+% \end{macro}
+% \begin{macro}{\insertpageifcarryover}
+% This macro is use to generate a blank page if there is carry over from the
+% previous page. It is place just after the exercises, and before a new chapter of section.
+% The optional argument allows you to insert something into the new page, if one is
+% automatically created. The default is \cs{null}.
+% \begin{macrocode}
+\newcommand{\insertpageifcarryover}[1][\null]{%
+% \end{macrocode}
+% We begin by starting a new page, the shipout routine of previous page
+% will be initialized and can then get an accurate result for
+% \cs{ifiscarryover}.
+% \begin{macrocode}
+ \newpage
+% \end{macrocode}
+% If there is carryover, we create a new page by inserting
+% a content into the page. If there is no carry over, we do
+% now insert any content, and the page will not be created.
+% \begin{macrocode}
+ \ifiscarryover\def\eqeifnext{\csname iftrue\endcsname}%
+ \PackageInfo{eqexam}{Carry over of content in margin
+ from page \thepage.\MessageBreak Creating a blank page}\else
+ \def\eqeifnext{\csname iffalse\endcsname}\fi\eqeifnext#1\fi}
+% \end{macrocode}
+% \end{macro}
+% \begin{macro}{\setFullWidthHeader}
+% Makes the running header full width.
+% \begin{macrocode}
+\newcommand{\setFullWidthHeader}{%
+ \setlength{\@tempdima}{%
+ \evensidemargin+\tbmarparboxwidth+\marginparsep}%
+ \edef\@headoffset{\the\@tempdima}%
+ \def\@evenhead{\makebox[0pt]{\makebox[0pt][l]
+ {\thepage}\hspace{\@headoffset}}\hfil\slshape\leftmark}%
+ \ifmarginsonleft
+ \def\@oddhead{\makebox[0pt]{\makebox[0pt][l]
+ {\slshape\rightmark}\hspace{\@headoffset}}\hfil\thepage}%
+ \else
+ \def\@oddhead{{\slshape\rightmark}\hfil\makebox[0pt]
+ {\hspace{\@headoffset}\makebox[0pt][r]{\thepage}}}%
+ \fi
+}
+% \end{macrocode}
+% \end{macro}
+%
+% \subsection{In support of solutions at end of document and chapter}
+%
+% A feature that may not be used much is to have solutions at the end of each chapter.
+% \begin{macro}{\chaptersolutions}
+% If \cs{tb@EndOfChapterExercises} is executed, and
+% \cs{chaptersolutions} is placed between chapters, we can generate
+% solutions at the end of the chapters, instead of at the end of the book.
+% \cs{chaptersolutions} is \cs{let} to \cs{relax} unless
+% \cs{tb@EndOfChapterExercises} is executed. In this case
+% \cs{chaptersolutions} inputs the the \texttt{.sol} file, then
+% then opens it
+% \begin{macrocode}
+\newif\ifchapterexercises \chapterexercisesfalse
+\let\chaptersolutions\relax
+\def\tb@EndOfChapterExercises{%
+ \let\include@solutions@chapter\include@solutions
+ \def\includeexersolutions{%
+ \include@solutions@chapter
+ \global\let\include@solutions\relax
+ }%
+% \end{macrocode}
+% \cs{chaptersolutions} is redefined from \cs{relax}. Input current solutions,
+% close stream, open stream.
+% \begin{macrocode}
+ \def\chaptersolutions{%
+ \includeexersolutions
+ \immediate\closeout\ex@solns
+ \newwrite \ex@solns \global\let\quiz@solns\ex@solns
+ \immediate\openout \ex@solns \jobname.sol
+ \ifvspacewithsolns\writeAllAnsAtEnd\fi
+ }%
+}
+% \end{macrocode}
+% \end{macro}
+% \begin{macrocode}
+\def\writeallsolutions{\let\chaptersolutions\relax}
+% \end{macrocode}
+% \begin{macro}{\exercisesAtEndOfChapter}
+% If you want solutions at the end of each chapter, you'll have to
+% execute this command in the preamble. See \cs{initChapAfterSolns} for an
+% example of usage.
+% \begin{environment}{afterChapSolns}
+% This comment environment is a convenience for placing content between
+% chapters.
+% \begin{macrocode}
+\excludecomment{afterChapSolns}
+%\includecomment{solnsAtEnd}
+% \end{macrocode}
+% (2014/05/08) There is a problem with nested comment environments when \texttt{solnsAtEnd}
+% contains within it the \cs{includeexersolutions} command, especially when
+% \texttt{multicols} is used. The fix seems to redefine things so that
+% \texttt{solnsAtEnd} writes to a different CUT file
+% \begin{macrocode}
+\def\NewCommentCutFile{\def\CommentCutFile{solnsAtEnd.cut}}
+\def\RestoreCommentCutFile{\def\CommentCutFile{comment.cut}}
+\@ifundefined{BeforeIncludedComment}{%
+\long\def\solnsAtEndcomment
+ #1{\message{Special comment '#1'}%
+ \csarg\def{#1}{\endgroup \message{Processing '#1' comment.}%
+ \NewCommentCutFile\SetUpCutFile
+ % #2 before SetUp, so we can do renaming.
+ \message{Comment '#1' writing to \CommentCutFile.}%
+ \ProcessComment{#1}}%
+ \csarg\def{After#1Comment}{\immediate\closeout\CommentStream
+ \RestoreCommentCutFile\input{solnsAtEnd.cut}\relax}%
+ \CommentEndDef{#1}}
+}{\long\def\solnsAtEndcomment
+ #1{\message{Special comment '#1'}%
+ \csarg\def{After#1Comment}{\immediate\closeout\CommentStream
+ \RestoreCommentCutFile\input{solnsAtEnd.cut}\relax}%
+ \csarg\def{#1}{\NewCommentCutFile\BeforeIncludedComment\relax
+ \ProcessComment{#1}}%
+ \CommentEndDef{#1}}
+ }
+\solnsAtEndcomment{solnsAtEnd}
+\newcommand{\exercisesAtEndOfChapter}{%
+ \ifeq@nosolutions\else
+ \typeout{^^J!!!!!Executing in chapter solutions!!!!!^^J}
+ \chapterexercisestrue\tb@EndOfChapterExercises
+ \ifchapterexercises
+ \csarg\let{solnsAtEnd}\@gobble
+ \excludecomment{solnsAtEnd}%
+ \csarg\let{AftersolnsAtEndComment}\relax
+ \includecomment{afterChapSolns}\else
+ \excludecomment{afterChapSolns}\fi
+ \fi
+}
+\@onlypreamble\exercisesAtEndOfChapter
+% \end{macrocode}
+% \end{environment}
+% \end{macro}
+% \subsection{Modifying and restoring the Layout}
+% The book may need a wide page format and use multi-columns to display homework sets, or
+% solutions at the end if the book.
+% \begin{macro}{\setFullWidthLayout}
+% A command to set the page layout for the solutions in the back of the book. Typically,
+% we do away with the wide margins. We also save the current values of the parameters
+% we are changing so we can restore them later.
+% \begin{macrocode}
+\newcommand{\setFullWidthLayout}{%
+ \saveBasicLayoutParams
+ \setlength{\oddsidemargin}{0in}%
+ \setlength{\evensidemargin}{\oddsidemargin}%
+ \setlength{\textwidth}{\paperwidth-2in}%
+ \setlength{\linewidth}{\paperwidth-2in}%
+ \setlength{\columnseprule}{0pt}%
+ \def\@evenhead{\thepage\hfil\slshape\leftmark}%
+ \def\@oddhead{{\slshape\rightmark}\hfil\thepage}%
+}
+% \end{macrocode}
+% \begin{environment}{fullwidthtext}
+% When \cs{setFullWidthLayout} is in effect, we have the problem of writing text.
+% Originally, I used a \cs{parbox} with width of \cs{linewidth}, but this has it problems
+% when breaking across pages. We have instead an environment for writing; the list environment
+% obeys the current \cs{linewidth}, which is set to \cs{paperwidth-2in}, this latter value
+% may not always be correct (especially when the margins are smaller than 2in.
+% \begin{macrocode}
+\newenvironment{fullwidthtext}{%
+\begin{list}{}{%
+ \setlength{\labelwidth}{0pt}\setlength{\labelsep}{0pt}%
+ \setlength{\itemindent}{0pt}\setlength{\itemsep}{0pt}%
+ \setlength{\topsep}{0pt}\setlength{\parsep}{0pt}%
+ \setlength{\listparindent}{\parindent}%
+ \setlength{\leftmargin}{0pt}\setlength{\rightmargin}{0pt}
+}\item\relax}{\end{list}}
+% \end{macrocode}
+% \begin{macro}{\restorePageLayout}
+% Restore the last saved page parameters.
+% \begin{macrocode}
+\newcommand{\restorePageLayout}{\newpage
+ \setlength{\oddsidemargin}{\tb@osms}
+ \setlength\evensidemargin{\tb@esms}
+ \setlength{\textwidth}{\tb@tws}
+ \setlength{\linewidth}{\tb@lws}
+ \setlength{\columnseprule}{\tb@csr}
+}
+% \end{macrocode}
+% Used by \cs{setFullWidthLayout} just before the page layout parameters are changed.
+% \begin{macrocode}
+\newcommand{\saveBasicLayoutParams}{%
+ \xdef\tb@osms{\the\oddsidemargin}%
+ \xdef\tb@esms{\the\evensidemargin}%
+ \xdef\tb@tws{\the\textwidth}%
+ \xdef\tb@lws{\the\linewidth}%
+ \xdef\tb@csr{\the\columnseprule}%
+}
+% \end{macrocode}
+% \begin{macro}{\initChapAfterSolns}
+% Initializes the environment when solutions appear after each chapter.
+% Example of usage, taken from fortextbook.ltx,
+%\begin{verbatim}
+%\begin{afterChapSolns}
+%\initChapAfterSolns
+%\section{Solutions to Chapter Exercises}
+%\begin{fullwidthtext}
+%We present short solutions to the problems.
+%We present short solutions to the problems.
+%We present short solutions to the problems.
+%We present short solutions to the problems.
+%\end{fullwidthtext}
+%\bigskip
+%\begin{multicols}{2}\forceNoColor
+%\chaptersolutions
+%\end{multicols}
+%\restoreFromChapAfterSolns
+%\end{afterChapSolns}
+%\end{verbatim}
+% \begin{macrocode}
+\newcommand{\initChapAfterSolns}{\newpage
+ \clearTopMargin\clearBotMargin
+ \setFullWidthLayout
+}
+% \end{macrocode}
+% \begin{macro}{\restoreFromChapAfterSolns}
+% Restores the saved parameters at the end of the chapter solutions, see
+% above for an example.
+% \begin{macrocode}
+\newcommand{\restoreFromChapAfterSolns}{\newpage
+ \restorePageLayout\setFullWidthHeader
+}
+% \end{macrocode}
+% \end{macro}
+% \end{macro}
+% \end{macro}
+% \end{environment}
+% \end{macro}
+% \begin{macrocode}
+%</textbook>
+%<*package>
+% \end{macrocode}
+% \subsection{We shipout in support of \texttt{fortextbook}}
+% We shipout \cs{eqe@tb@shipout} to be placed in the margins on every page.
+% \begin{macrocode}
+\ifeqfortextbook
+\AtBeginDocument{\tb@soln@choice
+ \ifeqwritetomargins\chkmarginboxwidth
+ \AddToShipoutPicture{\eqe@tb@shipout}\fi}
+\fi
+%</package>
+%<*textbook>
+% \end{macrocode}
+%
+% \subsection{Modify \texttt{eqequestions} environment}
+%
+% We adjust the \texttt{eqequestions} environment to minimize spacing between problems.
+% \begin{macrocode}
+\eqequestopsep{0pt}
+\eqequesparsep{0pt}
+\eqequesitemsep{0pt}
+\eqequeslistparindent{0pt}
+\renewenvironment{eqequestions}{%
+ \begin{list}{}{%
+ \ifwithsoldoc\let\solnItemMngt\eqeSolnItemMngt\fi
+ \setlength{\labelwidth}{\eqemargin}%
+ \setlength{\parsep}{\eqeques@parsep}%
+ \setlength{\itemsep}{\eqeques@itemsep}
+ \setlength{\topsep}{\eqeques@topsep}%
+ \setlength{\itemindent}{0pt}%
+ \setlength{\listparindent}{\eqeques@listparindent}%dps%
+ \ifwithsoldoc\settowidth{\labelsep}{\eqe@hspannerSoln}\else
+ \settowidth{\labelsep}{\eqe@hspannerPrb}\fi
+ \setlength{\leftmargin}{\labelwidth}%
+ }\ifwithsoldoc\global\firstitemtrue\fi\item\relax}{\end{list}}
+% \end{macrocode}
+% \begin{environment}{eqepartsquestions}
+% This environment is used in the SOL file with problems with parts to hang indent
+% the solutions with parts.
+% \begin{macrocode}
+\newcommand{\eqepquestopsep}[1]{\def\eqepques@topsep{#1}}
+\newcommand{\eqepquesparsep}[1]{\def\eqepques@parsep{#1}}
+\newcommand{\eqepquesitemsep}[1]{\def\eqepques@itemsep{#1}}
+\eqepquestopsep{\eqeques@itemsep}
+\eqepquesparsep{\eqeques@parsep}
+\eqepquesitemsep{\eqeques@itemsep}
+\newenvironment{eqepartsquestions}{%
+ \begin{list}{}{%
+ \settowidth{\labelwidth}{\eqe@prtsepSoln\hspace{\tbsolnpartwdth}}
+ \setlength{\parsep}{\eqepques@parsep}%
+ \setlength{\itemsep}{\eqepques@itemsep}%
+ \setlength{\topsep}{\eqepques@topsep}%
+ \setlength{\itemindent}{0pt}%
+ \settowidth{\labelsep}{\eqe@hspannerSoln}
+ \setlength{\leftmargin}{\labelwidth}%
+ }\item\relax}{\end{list}}
+% \end{macrocode}
+% \end{environment}
+%
+% \subsection{Modifications for solutions page}
+%
+% \DescribeMacro{\gobbletoEndEXt} is a command to gobble all content from the current position \cs{eqEXt}
+% down to \cs{endeqEXt}. In the solutions file ends with \cs{par}\cs{medskip}, which
+% we gobble up too. We define \DescribeMacro{\eqExtArg}\cs{eqExtArg} to \cs{thequestionno} so we can use the problem
+% number to filter out the even-problems.
+% \begin{macrocode}
+\long\def\gobbletoEndEXt#1\endeqEXt{\@gobbletwo}
+\def\eqExtArg{\theeqquestionnoi}
+% \end{macrocode}
+% \begin{macrocode}
+\if\load@exerquiz\eqe@NO\DoNotFitItIn\fi
+\let\fillInFormatDefault\@empty
+\def\exerSolnsHeadnToc{}
+\renewcommand{\exerSolnInput}{%
+ \let\webnewpage\relax
+ \ifsolutionsonly\else\immediate\closeout\ex@solns\fi
+ \ifeq@nosolutions\else\newpage % 2012-03-14
+ \iftherearesolutions\eq@solutionshook\eqsolutionshook
+ \ifsolutionsonly\else\newpage\eq@solutionshook
+ \eqsolutionshook\fi
+ \ifx\webnewpage\relax
+ \def\webnewpage{\let\webnewpage\newpage}%
+ \fi
+ \priorexsectitle\exerSolnsHeadnToc\priorexslinput
+ \InputIfFileExists{\jobname.sol}{}{\PackageWarning{exerquiz}
+ {!!! Solutions to exercises not found}}%
+ \fi
+ \fi
+}
+% \end{macrocode}
+% \begin{macro}{\eqedsplyOnlyFrst}
+% The default listing of a problem with multiple parts is to typeset
+% \texttt{<num>.}~\texttt{(<part>)}. Here, we do not typeset the number after
+% the first time.
+% \begin{macrocode}
+\setcounter{partno}{1}\edef\firstPartLtr{\thepartno}
+% \end{macrocode}
+% ???? 6/2/11 When part (a) is hidden we need to generate the questions number
+% for the the first non-hidden part. Created \cs{iffrstProbNumShown} to help
+% but it not working yet.
+% \begin{macrocode}
+\newif\iffrstProbNumShown\frstProbNumShownfalse
+\def\tb@insertDecPoint{\ifwithsoldoc\eqedecPointSoln\else
+ \eqe@decPointMrg\fi}
+\newcommand{\eqedsplyOnlyFrst}[2]{\def\thisPart{#2}%
+ \ifx\thisPart\firstPartLtr\global\frstProbNumShowntrue
+ \tb@mrgDigitFmt{#1}\tb@insertDecPoint\else
+ \iffrstProbNumShown\tb@GenProbNum{#1}\else
+ \global\frstProbNumShowntrue\tb@mrgDigitFmt{#1}%
+ \tb@insertDecPoint\fi\fi\global\eqeGenProbNumfalse
+}
+% \end{macrocode}
+% \end{macro}
+% \begin{macro}{\displayProbNumOnce}
+% If a part is carried over to the next page, it may be necessary to manually
+% force the display of the first digit.
+%\begin{verbatim}
+%\insMidMarg{\displayProbNumOnce}
+%\end{verbatim}
+% \begin{macrocode}
+\newif\ifeqeGenProbNum \eqeGenProbNumfalse
+\newcommand{\displayProbNumOnce}{\global\eqeGenProbNumtrue} %
+%\def\tb@GenProbNum#1{\ifeqeGenProbNum#1\eqe@decPointMrg\else
+\def\tb@GenProbNum#1{\ifeqeGenProbNum#1\tb@insertDecPoint\else
+ \phantom{#1\tb@insertDecPoint}\fi}%
+% \end{macrocode}
+% \end{macro}
+% \begin{macrocode}
+\def\sq@priorhook{\medskip}
+% \end{macrocode}
+% Adjustments of spacing between problems \cs{eqexerskip}, and the check for enough
+% room for the next problem.
+% \begin{macrocode}
+\def\default@fvsizeskip{.1}
+% \end{macrocode}
+% The skip prior to the beginning of an exercise
+% \begin{macrocode}
+\aboveexskip{0pt}
+% \end{macrocode}
+% The skip after the end of an exercise
+% \begin{macrocode}
+\belowexskip{0pt}
+% \end{macrocode}
+% The skip in the solutions file following an exercise OR a part of an exercise
+% The text of this command should be a single token, that's why I've enclosed
+% it in braces. (There is a \cs{@gobbletwo} that gobbles it up for the \texttt{studented} option.)
+% \begin{macrocode}
+\renewcommand\belowexsolnskip{{}}
+% \end{macrocode}
+% We remove the \cs{mark} from this definition, see original definition in \texttt{eqexam.def}
+% \begin{macrocode}
+\renewcommand\exerSolnHeader[3]{%
+ \ifeqforpaper\else\webnewpage\fi%\par
+ \noindent\@ifundefined{hypertarget}
+ {#3}{\hypertarget{#2}{#3}\relax}\solnhspace
+}
+% \end{macrocode}
+% This causes the \texttt{eqexam} environment to write the user friendly name of the exam
+% even if there is only one exam.
+% \begin{macrocode}
+\def\nNumberOfP@rts{0}
+% \end{macrocode}
+%
+% \subsection{Some Convenience/Formatting Commands}
+%
+% \begin{macro}{\preExamSolnHead}
+% \begin{macro}{\examSolnHeadFmt}
+% \begin{macro}{\postExamSolnHead}
+% These are redefinitions of commands defined in \texttt{eqexam},
+% They control the vertical spacing before and after a heading in the
+% solutions at the end of the book, as well as the formatting.
+% \begin{macrocode}
+\renewcommand{\preExamSolnHead}{\medbreak\noindent}
+\renewcommand{\examSolnHeadFmt}[1]{\textbf{#1}}
+\renewcommand{\postExamSolnHead}{\smallskip}
+% \end{macrocode}
+% \end{macro}
+% \end{macro}
+% \end{macro}
+% \begin{macro}{\wrtChapSolnHead}
+% Writes a chapter heading to the solution file, usage,
+%\begin{verbatim}
+%\wrtChapSolnHead{The New {\eqexam}}
+%\end{verbatim}
+% \begin{macrocode}
+\newcommand{\wrtChapSolnHead}[1]{%
+ \writeToSolnFile{%
+ \protect\preChapSolnHead
+ \protect\chapHeadSolnFmt{\protect\ftbFmtChapter{\thechapter}#1}%
+ \protect\postChapSolnHead
+}}
+% \end{macrocode}
+% \begin{macro}{\preChapSolnHead}
+% \begin{macro}{\chapHeadSolnFmt}
+% \begin{macro}{\postChapSolnHead}
+% Same as above, except for chapter headings.
+% \begin{macrocode}
+\newcommand{\preChapSolnHead}{\bigbreak\noindent}
+\newcommand{\chapHeadSolnFmt}[1]{{\large\textbf{#1}}}
+\newcommand{\postChapSolnHead}{\medbreak}
+% \end{macrocode}
+% \begin{macro}{\ftbFmtChapter}
+% This command may (optionally) insert the chapter number into the chapter title passed
+% to \cs{wrtChapSolnHead}. The default is to pass the chapter name (``Chapter'') and chapter number.
+% If you say \verb!\let\ftbFmtChapter\@gobble!, the chapter name and number will not appear.
+% You can redefine this command as desired.
+% \begin{macrocode}
+\newcommand{\ftbFmtChapter}[1]{\chaptername\space#1.\space\ignorespaces}
+% \end{macrocode}
+% In the solution manual, all these
+%chapter commands may be redefined like so
+%\begin{verbatim}
+%\let\preChapSolnHead\relax
+%\let\chapHeadSolnFmt\chapter
+%\let\ftbFmtChapter\@gobble
+%\let\postChapSolnHead\relax
+%\end{verbatim}
+% In fact, let's make this into a command.
+% \begin{macro}{\convertChapHeadToChapters}
+%In the solutions manual, the chapter headings will become chapters of the manual, rather than
+%just a bold faced heading.
+% \begin{macrocode}
+\newcommand{\convertChapHeadToChapters}{%
+ \let\preChapSolnHead\relax
+ \let\chapHeadSolnFmt\chapter
+ \let\ftbFmtChapter\@gobble
+ \let\postChapSolnHead\relax
+}
+% \end{macrocode}
+% \end{macro}
+% \end{macro}
+% \end{macro}
+% \end{macro}
+% \end{macro}
+% \end{macro}
+% \begin{macro}{\probSet}
+% A simple command to announce the problem set.
+%\begin{verbatim}
+%\subsection*{\probSet{\thesection}}
+%\end{verbatim}
+% See also the definition for the \texttt{probset} environment below.
+% \begin{macrocode}
+\newcommand{\probSet}[1]{Problem Set #1}
+% \end{macrocode}
+% \end{macro}
+% \begin{macro}{\annotPage}
+% Use to annotation the page number onto a solution heading, for example,
+%\begin{verbatim}
+%\begin{exam}[\thesection. Another Section\annotPage]{\autoExamName}
+%\end{verbatim}
+% or using the \texttt{probset} environment defined below
+%\begin{verbatim}
+%\begin{probset}{{\thesection} Setting the page layout\annotPage}
+%\end{verbatim}
+% \begin{macrocode}
+\newcommand{\annotPage}{\protect\annotThePage{\thepage}}
+\newcommand{\annotThePage}[1]{\space(page\protect~#1)}
+% \end{macrocode}
+% \end{macro}
+% \subsection{The \texttt{probset} and \texttt{example} environments}
+% We define two environments based. The first (\texttt{probset}) is based on the
+% \texttt{exam} environment; the second (example) is based on the \texttt{exercise} environment.
+% \begin{environment}{probset}
+% A convenience environment, it is the \texttt{exam} environment, renamed, with
+% different arguments. \texttt{\#1} is the heading that will appear in the margins,
+% and \texttt{\#2} is the heading to appear in the back of the book.
+%\changes{v3.0n}{2011/09/18}{Added an \cs{edef} in case \cs{thesection} does not get
+% expanded early enough to display correctly in the margins.}
+% \begin{macrocode}
+\def\noProbHeader{NPH}
+\newenvironment{probset}[2][\probSet{\thesection}]{%
+ \exam[#2]{\autoExamName}\ifx#1\noProbHeader\else
+ \protected@edef\ftb@tmp@exp{\noexpand\insProbHead{#1}}%
+ \ftb@tmp@exp\fi}{\endexam}
+% \end{macrocode}
+% \end{environment}
+% \begin{macrocode}
+\newcounter{exampleno}[section]
+\renewcommand{\theexampleno}{\arabic{section}.\arabic{exampleno}}
+% \end{macrocode}
+% \textbf{Note:} The counter is \texttt{exampleno} and is designed to show the section
+% number and example number, and to reset at each section. To change the definition
+% of \cs{theexampleno} to reflect the chapter number followed by the example number, and
+% resetting at the beginning of each new chapter, the following code is needed.
+%\begin{verbatim}
+%\usepackage{remreset}
+%\@removefromreset{exampleno}{section}
+%\renewcommand{\theexampleno}{\arabic{chapter}.\arabic{exampleno}}
+%\@addtoreset{exampleno}{chapter}
+%\end{verbatim}
+%\DescribeMacro{\examplenoname} is the label placed on the example.
+% \begin{macrocode}
+\newcommand{\examplenoname}{Example}
+% \end{macrocode}
+% \begin{environment}{example}
+% A simple example environment, based on the \texttt{exercise} environment.
+% \begin{macrocode}
+\newenvironment{example}{%\medskip
+ \belowexskip{\medskipamount}\aboveexskip{\medskipamount}%
+ \makeRoomForProb{\@nbaselineskip\baselineskip}{}%
+ \renewcommand\exlabel{Example}%
+ \renewcommand\exlabelformat{\textbf{\exlabel~\theexampleno.}}%
+ \let\eq@fititin\eqfititin
+ \renewcommand\exrtnlabelformat{$\square$}%
+ \def\eqexheader@wrapper{\eqexheader}%
+ \SolutionsAfter
+ \begin{exercise}[exampleno]}{\end{exercise}}
+% \end{macrocode}
+% \end{environment}
+% \begin{environment}{example*}
+% An example environment with parts.
+% \begin{macrocode}
+\newenvironment{example*}{%\medskip
+ \belowexskip{\medskipamount}\aboveexskip{\medskipamount}%
+ \makeRoomForProb{\@nbaselineskip\baselineskip}{}%
+ \renewcommand\exlabel{Example}%
+ \renewcommand\exlabelformat{\textbf{\exlabel~\theexampleno.}}%
+ \let\eq@fititin\eqfititin
+ \renewcommand\exrtnlabelformat{$\square$}%
+ \def\eqexheader@wrapper{\eqexheader}%
+ \SolutionsAfter
+ \begin{exercise*}[exampleno]}{\end{exercise*}}
+% \end{macrocode}
+% \end{environment}
+% We set some parameters, to values better suited for the option.
+% \begin{macrocode}
+\setDefaultfvsizeskip{.1}
+\nbaselineskip{4}
+% \end{macrocode}
+% \subsection{Commands in support of Solution Manuals}
+% Generally, the solution manual source file should have the same
+% packages as the source file for the book itself, perhaps with a few exceptions,
+% but definitely the \textsf{eqexam} package is required with its \texttt{fortextbook} option.
+%
+% At this time, we provide only two commands, these are \cs{ftbInputBookAux} and
+% \cs{ftbInputSolnFiles}.
+% \begin{macro}{\ftbInputBookAux}
+% This command is used to input the auxiliary files of the master source file. It takes
+% one argument, the name of the master source file (\texttt{myBook.ltx} or \texttt{myBook.tex}).
+% If the extension is not present, it is assumed to be \texttt{.tex}.
+%\changes{v3.0f}{2011/08/13}{Added \cs{ftbInputBookAux} to support solution manual}
+% \begin{macrocode}
+\newcommand{\ftbInputBookAux}[1]{%
+ \filename@parse{#1}\@ifundefined{filename@ext}%
+ {\def\filename@ext{tex}}{}%
+ \xdef\tbBaseName{\filename@base}%
+ \xdef\tbSourceFile{\filename@base.\filename@ext}%
+% \end{macrocode}
+% In the next 4 lines, we save \cs{@writefile} and \cs{@setckpt}, and \cs{let}
+% them to \cs{@gobbletwo}. We restore their definitions after we input the aux files.
+% We include the aux files of the source file in case there are some cross references
+% in the solution files, or the body of the text would like to refer back to the
+% original book. (Seems unlikely.)
+% \begin{macrocode}
+ \let\save@writefile\@writefile
+ \let\@writefile\@gobbletwo
+ \let\save@setckpt\@setckpt
+ \let\@setckpt\@gobbletwo
+ \makeatletter
+ \InputIfFileExists{\tbBaseName.aux}{%
+ \PackageInfo{eqexam}
+ {Inputting auxiliary files of\MessageBreak\tbSourceFile}%
+ }{%
+ \PackageError{eqexam}
+ {Auxiliary files for \tbSourceFile\space were not found}
+ {Compile the source file \tbSourceFile\space
+ three times\MessageBreak%
+ to create the required auxiliary files.}%
+ }%
+ \makeatother
+% \end{macrocode}
+% The solution files really shouldn't have a label, but if we do
+% we'll save the {\LaTeX} definition of \cs{label}, and \cs{let}
+% it two \cs{@gobble}. Within the body of the solutions, the
+% command \cs{ftblabel} may be used to cross reference, if needed.
+%
+% \begin{macrocode}
+ \global\let\ftblabel\label
+ \let\label\@gobble
+ \let\@writefile\save@writefile
+ \let\@setckpt\save@setckpt
+}
+\@onlypreamble\ftbInputBookAux
+% \end{macrocode}
+% \begin{macro}{\restorelabel}
+% \begin{macro}{\gobblelabel}
+% These two are used to restore the usual definition of \cs{label}, and to
+% cancel it out by letting it to \cs{@gobble}.
+% \begin{macrocode}
+\newcommand{\restorelabel}{\global\let\label\ftblabel}
+\newcommand{\gobblelabel}{\let\label\@gobble}
+% \end{macrocode}
+% \end{macro}
+% \end{macro}
+% \end{macro}
+% \begin{macro}{\ftbInputSolnFiles}
+% In the body of the text, place \cs{ftbInputSolnFiles} in vertical mode.
+% This will input the \texttt{.sol} file of the master source document.
+% The optional argument is the name of the solution file. The default name
+% is \verb!\tbBaseName.sol!, where \cs{tbBaseName} was defined in
+% \cs{ftbInputBookAux}. If no extension is specified, an extension of \texttt{.sol}
+% is assumed. The original \texttt{.sol} may have changed its name, if someone
+% renamed it (to keep it from being overwritten). The solution file may be editing (by hand)
+% as needed.
+%\changes{v3.0f}{2011/08/13}{Added \cs{ftbInputSolnFiles} to support solution manual}
+% \begin{macrocode}
+\newcommand{\ftbInputSolnFiles}[1][\tbBaseName.sol]{%
+ \filename@parse{#1}\@ifundefined{filename@ext}%
+ {\def\filename@ext{sol}}{}%
+ \xdef\tbBaseName{\filename@base}%
+ \xdef\tbSourceFile{\filename@base.\filename@ext}%
+ \InputIfFileExists{\tbBaseName.sol}{%
+ \PackageInfo{eqexam}
+ {Inputting solutions file \tbBaseName.sol\MessageBreak}%
+ }{%
+ \PackageError{eqexam}
+ {Solutions file for \tbSourceFile\space was not found}%
+ {Compile the source files three times}%
+ }%
+}
+% \end{macrocode}
+% \end{macro}
+% \begin{macrocode}
+%</textbook>
+%<*ftbsty>
+% \end{macrocode}
+% \section{\textsf{fortextbook} Style File}\label{fortextbookstyle}
+% One person said it would be nice to separate \textsf{eqexam} from the \texttt{fortextbook} option, and
+% have \textsf{fortextbook} as a \texttt{separate} style (package). Rather than spending tens of hours separating them
+% I create a simple ``wrapper'' package, which simply calls \textsf{eqexam} with the \texttt{fortextook} option along
+% with all the recommended options.
+%\changes{v3.0p}{2011/09/22}{Added the wrapper package fortextbook.}
+%\par\medskip\noindent
+% \textbf{Usage:}
+%\begin{verbatim}
+%\documentclass[twoside,letterpaper]{book}
+%\usepackage[fleqn]{amsmath}
+%\usepackage{fortextbook}
+%...
+%\end{verbatim}
+% Below is the style.
+% \begin{macrocode}
+\NeedsTeXFormat{LaTeX2e}
+\ProvidesPackage{fortextbook}
+ [2012/03/14 v1.0 A fortextbook Package (dps)]
+\DeclareOption*{\PassOptionsToPackage{\CurrentOption}{eqexam}}
+\ProcessOptions
+\RequirePackage[%
+ ftbsolns,fortextbook,usecustomdesign,
+ forcolorpaper,noseparationrule,usexkv
+]{eqexam}
+% \end{macrocode}
+% In support of this style, I've also defined \cs{NoSolutions} to compile the document
+% without creating the solutions at the end of the file (this reduces the amount if IO
+% when compiling). I've also defined a special option \texttt{nocustomdesign} which
+% cancels out the \texttt{usecustomdesign} option.
+% \begin{macrocode}
+%</ftbsty>
+%<*package>
+% \end{macrocode}
+% \begin{center}
+% \rule{.67\linewidth}{.4pt}
+% \end{center}
+% \paragraph*{Input \texttt{eqtextb.def}.}
+% Back in the main package, we choose this point to input the
+% \texttt{fortextbook} code (\texttt{eqtextb.def}) if the
+% \texttt{fortextbook} option is taken.
+% \begin{macrocode}
+\edef\ftbInputEqTextb{\ifeqfortextbook\noexpand
+ \InputIfFileExists{eqtextb.def}{}{}\fi}
+\ftbInputEqTextb
+% \end{macrocode}
+% \begin{center}
+% \rule{.67\linewidth}{.4pt}
+% \end{center}
+%
+% \section{\textsf{xkeyval} Extensions}
+%
+% We load this material if \textsf{xkeyval} exists, and if the document author has specified
+% the \texttt{usexkv} option.
+%
+% \texttt{2014/12/19} Now, the \texttt{usexkeys} is on by default.
+% \begin{macrocode}
+%\IfFileExists{xkeyval}{%
+% \if\eq@usexkeys\eqe@YES\RequirePackage{xkeyval}\else
+% \endinput\fi}{\endinput}
+% \end{macrocode}
+% We redefine selected commands if the user has specified the \texttt{usexkv} option.
+%
+%\paragraph*{New options for \cs{fillin}}
+% \begin{macro}{underline}
+% Underline the fillin
+% \begin{macro}{u,b}
+% Legacy parameters, underlines (\texttt{u}) or leaves a blank space (\texttt{b})
+% \begin{macro}{boxed}
+% Boxes in the response region
+% \begin{macro}{boxpretext}
+% When boxed is use, use this to insert text in front of the answer, for example, \texttt{x=}
+% \begin{macro}{boxsize}
+% When boxed is taken, use boxsize to set the size of the box; permissible choices are
+% tiny, scriptsize, footnotesize, small, normalsize, large, Large, LARGE, huge, Huge
+% \begin{macro}{align}
+% Align the answer within the response region, permissible values are \texttt{l}, \texttt{c}, \texttt{r}.
+% \begin{macro}{color}
+% The color of the response (named color)
+% \begin{macro}{format}
+% Special formatting for the answer, the default is \cs{bfseries}
+% \begin{macro}{enclosesoln}
+% This Boolean key only takes effect when the
+% \texttt{boxed} key is used, and when either the \texttt{nosolutions} or the
+% \texttt{vspacewithsolns} option is taken. When these conditions are
+% met, a box is created around the solution (the third parameter of \cs{fillin}); the solution
+% is enclosed in a \cs{phantom} so it is not seen, but the dimensions of the solution are used.
+% This key allows you to create a box or arbitrary dimension.
+%\changes{v2.0j}{2011/04/19}{added the \texttt{enclosesoln} key to \texttt{eqFillin} family.}
+% \begin{macro}{fitwidth}
+%\changes{v3.0i}{2011/08/18}{added the \texttt{fitwidth} key to \texttt{eqFillin} family.}
+% The \texttt{fitwidth} option uses the natural width of the answer to create the fillin
+% when the \texttt{answerkey} option is in effect; otherwise it uses the second parameter \texttt{\#2}.
+% \begin{macro}{parbox}
+% The \texttt{parbox} parameter may be used to create a multiline \cs{fillin}
+% box. The value of \texttt{parbox} is the same as the first three parameters
+% of the {\LaTeX} command \cs{parbox}, e.g., \verb!parbox={[t][.5in][t]}!.
+% The value needs to be enclosed in braces.
+% \changes{v3.0w}{2012/03/27}{Added \texttt{parbox}}%
+% \begin{macro}{hiddenbox}
+% When the \texttt{boxed} option is used, this option resets the \cs{fbox}
+% parameters to \texttt{0pt}, making the box ``hidden.''
+%\changes{v3.0w}{2012/03/27}{Added \texttt{hiddenbox} options}
+%\par\medskip\noindent
+% Below are the \textsf{xkeyval} definitions of the keys recognized by \cs{fillin}.
+%\changes{v4.5a}{2015/11/10}{Added some logic to the underline key}
+% Add some logic to the \texttt{underline} key, now it is equivalent to the
+% \texttt{b} key.
+% \begin{macrocode}
+\define@boolkey{eqFillin}{underline}[true]{}
+\define@key{eqFillin}{u}[]{\KV@eqFillin@underlinetrue}
+\define@key{eqFillin}{b}[]{\KV@eqFillin@underlinefalse}
+\define@boolkey{eqFillin}{boxed}[true]{}
+\define@key{eqFillin}{boxpretext}[]{\def\eq@fillintext{#1}}
+\let\eq@fillintext\@empty
+% \end{macrocode}
+% If the user just says \texttt{parbox,...} the value of
+% \cs{eq@fillinparbox} is \cs{relax}. If \texttt{parbox}
+% does not appear in the option list, \cs{eq@fillinparbox}
+% has a default value of \cs{@empty}. In this way, we can
+% distinguish between \texttt{parbox} with the empty value,
+% and \texttt{parbox} not present at all.
+% \begin{macrocode}
+\define@key{eqFillin}{parbox}[\relax]{\def\eq@fillinparbox{#1}}
+\let\eq@fillinparbox\@empty
+\define@key{eqFillin}{hiddenbox}[]{%
+ \def\eq@fillinhiddenbox{%
+ \setlength{\fboxrule}{0pt}\setlength{\fboxsep}{0pt}}}
+\let\eq@fillinhiddenbox\@empty
+\define@boolkey{eqFillin}{enclosesoln}[true]{}
+\define@choicekey+{eqFillin}{boxsize}{tiny,scriptsize,footnotesize,%
+ small,normalsize,large,Large,LARGE,huge,Huge}[normalsize]{%
+ \def\eq@eqFillin@boxsize{\text{\csname#1\endcsname\strut}}%
+}{\PackageWarning{eqexam}{Bad choice for boxsize, permissible values
+ are tiny, scriptsize, footnotesize, small, normalsize,
+ large, Large, LARGE, huge and Huge. Try again}}
+\def\eq@eqFillin@boxsize{\text{\normalsize\strut}}
+\define@key{eqFillin}{color}[\eq@fillinColor]{\edef\eq@fillin@color{#1}}
+% \end{macrocode}
+% \changes{v3.0x}{2012/04/03}{Added \cs{eqe@align@hfill} to \texttt{align} property.
+% used to set position of content when \texttt{parbox} is used.}
+% \begin{macrocode}
+\define@choicekey+{eqFillin}{align}[\val\nr]%
+ {l,r,c}[\eq@eqFillin@align@default]{%
+ \def\eq@eqFillin@align{#1}%
+ \ifcase\nr\relax
+ \def\eqe@align@hfill{}\or
+ \def\eqe@align@hfill{\hfill}\or
+ \def\eqe@align@hfill{\hfil}\fi
+ }{%
+ \PackageWarning{eqexam}{Bad choice for align, permissible values
+ are l, r, and c. Try again}}
+\let\eqe@align@hfill\relax
+% \end{macrocode}
+% \DescribeMacro{defaultalign} is used to change the values of the default macros
+% \cs{eq@eqFillin@align@default} and \cs{eqe@align@hfill@default} for the \texttt{align} key together.
+% \begin{macrocode}
+\define@choicekey+{eqFillin}{defaultalign}[\val\nr]{l,r,c}[c]{%
+ \def\eq@eqFillin@align@default{#1}%
+ \ifcase\nr\relax
+ \def\eqe@align@hfill@default{}\or
+ \def\eqe@align@hfill@default{\hfill}\or
+ \def\eqe@align@hfill@default{\hfil}\fi
+ }{%
+ \PackageWarning{eqexam}{Bad choice for defaultalign, permissible
+ values are l, r, and c. Try again}}
+\setkeys{eqFillin}{defaultalign=c}
+% \end{macrocode}
+% \DescribeMacro{\fillInFormatDefault} is the default fill-in format
+% \begin{macrocode}
+\renewcommand{\fillInFormatDefault}{\normalfont}
+\define@key{eqFillin}{format}[\fillInFormatDefault]{%
+ \def\eq@fillin@format{#1}}
+\def\eq@fillin@format{\bfseries}
+\def\eqe@fbox@corr#1{#1-2\fboxsep-2\fboxrule}
+\define@boolkey{eqFillin}{fitwidth}[true]{} %
+% \end{macrocode}
+% \begin{macro}{boxcmd}
+% The \texttt{boxcmd} key is used to define a boxing command. The default
+% is either \cs{boxed} or \cs{fbox}. You can say
+% |boxcmd={\fboxcolor{blue}{yellow}}| to obtain a box with a blue frame
+% and yellow background.
+%\changes{v3.1c}{2012/07/30}{Added boxcmd to \cs{fillin}}
+% \begin{macrocode}
+\@ifundefined{boxed}{%
+ \def\eq@fillin@defaultbox{\fbox}%
+ \def\eq@fillin@boxcmd{\fbox}%
+ }{%
+ \def\eq@fillin@defaultbox{\boxed}%
+ \def\eq@fillin@boxcmd{\boxed}%
+ }
+% \end{macrocode}
+% \begin{macro}{ulcmd}
+% The \texttt{ulcmd} key is used to define a underlining command. The default
+% is either \texttt{underline} or \texttt{underbar}. You can say
+% |ulcmd=underline| to obtained an underline using \cs{underline}.
+%\changes{v3.1c}{2012/07/30}{Added ulcmd to \cs{fillin}}
+% \begin{macrocode}
+\define@key{eqFillin}{boxcmd}%
+ [\eq@fillin@defaultbox]{\def\eq@fillin@boxcmd{#1}}
+\@ifundefined{underbar}{%
+ \def\eq@fillin@defaultul{underline}%
+ \def\eq@fillin@ulcmd{\underline}%
+ }{%
+ \def\eq@fillin@defaultul{underbar}%
+ \def\eq@fillin@ulcmd{\underbar}%
+ }
+% \end{macrocode}
+% (2017/01/28) Added custom underline option, the author must define \cs{ulcustom} and specify
+% \texttt{ulcmd=custom}.
+% \changes{v4.6c}{2017/01/28}{added custom underline option}
+% \begin{macrocode}
+\edef\ulcustom{\expandafter\noexpand\eq@fillin@ulcmd}
+\edef\temp@exp{\noexpand
+\define@choicekey+{eqFillin}{ulcmd}
+ {underbar,underline,custom}[\eq@fillin@defaultul]}
+\temp@exp{\def\@rgi{#1}\def\eq@custom{custom}\ifx\@rgi\eq@custom
+ \def\eq@fillin@ulcmd{\@nameuse{ulcustom}}\else
+ \def\eq@fillin@ulcmd{\@nameuse{#1}}\fi
+}{\PackageWarning{aeb}{Bad choice for ulcmd, permissible values
+ are underbar and underline. Try again}}
+% \end{macrocode}
+% (2013/02/16) \DescribeMacro{lift}\texttt{lift} lifts (actually lowers) the underline by the amount specified.
+% \DescribeMacro{autolift}\texttt{autolift} measures the depth of the content and lifts
+% (actually lowers) the underline by that amount. \DescribeMacro{addtoautolift}\texttt{addtoautolift}
+% works with \texttt{autolift} to add the specified amount to the amount of lift as calculated
+% by \texttt{autolift}.
+% \begin{macrocode}
+\define@key{eqFillin}{lift}[-1sp]{\def\eq@fillin@lift{#1}}
+\define@boolkey{eqFillin}{autolift}[true]{} %
+\define@key{eqFillin}{addtoautolift}[0pt]{%
+ \def\eq@fillin@addtoautolift{#1}}
+% \end{macrocode}
+% \end{macro}
+% \end{macro}
+% \end{macro}
+% \end{macro}
+% \end{macro}
+% \end{macro}
+% \end{macro}
+% \end{macro}
+% \end{macro}
+% \end{macro}
+% \end{macro}
+% \end{macro}
+% \end{macro}
+% \end{macro}
+% The macro \cs{eqe@getiiiOpts} is based on early parsing code of \cs{parbox}.
+% It picks up three optional parameters and saves their values under the
+% commands \cs{eqe@opts@argi}, \cs{eqe@opts@argii}, \cs{eqe@opts@argiii}.
+% We are interested in \cs{eqe@opts@argiii}, which specifies the depth of
+% the \cs{parbox}. If the \texttt{boxed} option is taken, we reduce the value
+% of \cs{eqe@opts@argiii} by \texttt{2\string\fboxsep+2\string\fboxrule} so
+% that the height will be exactly as specified. The macro \cs{eqe@getiiiOpts}
+% is used with the \texttt{parbox} option of \cs{fillin}.
+% The macro \cs{eqe@getiiiOpts} has syntax:
+%\begin{quote}
+% \cs{eqe@getiiiOpts[\meta{pos}][\meta{height}][\meta{inner-pos}]}
+%\end{quote}
+% \begin{macrocode}
+\def\eqe@getiiiOpts{%
+ \@ifnextchar[%]
+ \i@eqe@getiiiOpts
+ {\iii@eqe@getiiiOpts{c}{\relax}[s]}}
+% \end{macrocode}
+% Get \meta{pos}
+% \begin{macrocode}
+\def\i@eqe@getiiiOpts[#1]{%
+ \@ifnextchar[%]
+ {\ii@eqe@getiiiOpts{#1}}%
+ {\iii@eqe@getiiiOpts{#1}{\relax}[s]}}
+% \end{macrocode}
+% Get \meta{height}
+% \begin{macrocode}
+\def\ii@eqe@getiiiOpts#1[#2]{%
+ \@ifnextchar[%]
+ {\iii@eqe@getiiiOpts{#1}{#2}}%
+ {\iii@eqe@getiiiOpts{#1}{#2}[#1]}}
+% \end{macrocode}
+% Get \meta{inner-pos}
+% \begin{macrocode}
+\def\iii@eqe@getiiiOpts#1#2[#3]{%
+ \def\eqe@opts@argi{#1}%
+ \def\eqe@opts@argii{#2}%
+ \def\eqe@opts@argiii{#3}}
+% \end{macrocode}
+% \paragraph*{Redefine the \cs{fillin} command}
+% \begin{macro}{\fillin}
+% Re-worked \cs{fillin} to have \textsf{xkeyval} in the optional first parameter.
+% The syntax is illustrated below.
+%\begin{verbatim}
+% \fillin[
+% underline=true|false,u,b,boxed=true|false,boxpretext=<text>,
+% align=l|r|c,boxsize=\tiny|..\normalsize|\large|...|\Huge,
+% color=<namedcolor>,format=<\bfseries|\ttfamily|\Large|whatever>
+% ]{<width>}{<ans>}
+%\end{verbatim}
+% \changes{v4.5}{2015/11/10}{Added \cs{setfillinDefaults}}
+% \DescribeMacro{\setfillinDefaults}\cmd{\setfillinDefaults} sets any default
+% options for \cs{fillin} the document author wants.
+% \begin{macrocode}
+\newcommand{\setfillinDefaults}[1]{\def\eqe@argi{#1}\ifx\eqe@argi\@empty
+ \let\eqe@setfillinDefaults\@empty\else
+ \def\eqe@setfillinDefaults{#1}\fi}
+\let\eqe@setfillinDefaults\@empty
+% \end{macrocode}
+% \begin{macrocode}
+\renewcommand{\fillin}[3][]{\begingroup%
+% \end{macrocode}
+% \cs{ifsp@expand} is defined in \textsf{spdef} package. This is a version
+% if \cs{ifsp} that expands correctly in an \cs{edef}.
+% \begin{macrocode}
+ \expandafter\let\expandafter\ifsp\csname ifsp@expand\endcsname
+% \end{macrocode}
+% Get the keys indicated by the document author.
+% \begin{macrocode}
+ \setkeys{eqFillin}{boxsize,underline=true,boxed=false,%
+ boxpretext,color,format,enclosesoln=false,fitwidth=false,lift,%
+ autolift=false,addtoautolift}%
+ \ifx\eqe@setfillinDefaults\@empty\else
+ \protected@edef\eq@temp@exp{\noexpand
+ \setkeys{eqFillin}{\eqe@setfillinDefaults}}%
+ \eq@temp@exp
+ \fi
+ \protected@edef\eq@temp@exp{\noexpand\setkeys{eqFillin}{#1}}%
+ \eq@temp@exp
+% \end{macrocode}
+% If boxed, we turn underlining off
+% \begin{macrocode}
+ \ifKV@eqFillin@boxed\KV@eqFillin@underlinefalse\fi
+% \end{macrocode}
+% Put \cs{eq@fillin@lift} to \texttt{-2sp} as a signal not to use
+% the \texttt{lift} value in the case the author specified \texttt{autofill}
+% and \texttt{lift}.
+% \begin{macrocode}
+ \ifKV@eqFillin@autolift\def\eq@fillin@lift{-2sp}\fi
+% \end{macrocode}
+% Get the second parameter.
+% \begin{macrocode}
+ \edef\eqe@argii{#2}%
+% \end{macrocode}
+% We reset \cs{fboxrule} and \cs{fboxsep} as needed.
+% \begin{macrocode}
+ \eq@fillinhiddenbox
+% \end{macrocode}
+% If the document author uses the \texttt{hiddenbox} option,
+% this option assumes the \texttt{boxed} option as well so we'll
+% set \cs{KV@eqFillin@boxedtrue} to signal the \texttt{boxed} option.
+% \begin{macrocode}
+ \ifx\eq@fillinhiddenbox\@empty\else
+ \KV@eqFillin@boxedtrue\fi
+% \end{macrocode}
+% If the \texttt{parbox} option is taken, we define the third parameter
+% to be wrapped in a \cs{parbox}.
+% \begin{macrocode}
+ \ifx\eq@fillinparbox\@empty\def\eqe@argiii{#3}\else
+% \end{macrocode}
+% If \texttt{parbox} is specified, we make \texttt{align=l} the default.
+% \begin{macrocode}
+ \ifx\eqe@align@hfill\relax
+ \def\eq@eqFillin@align{l}\def\eqe@align@hfill{}\fi
+% \end{macrocode}
+% If \texttt{parbox} is specified, we get its three optional
+% parameters so we can manipulate the width parameter.
+% \begin{macrocode}
+ \expandafter\eqe@getiiiOpts\eq@fillinparbox\relax
+% \end{macrocode}
+% Now, if this is to be \texttt{boxed}, we reduce the height
+% of the box (\cs{boxed} increases the height by
+% \texttt{2\string\fboxrule+2\string\fboxrule}
+% \begin{macrocode}
+ \ifKV@eqFillin@boxed
+% \end{macrocode}
+% \cs{eqe@opts@argii} has a value of \cs{relax} if the document author
+% did not specify a height for the box.
+% \begin{macrocode}
+ \expandafter\ifx\eqe@opts@argii\relax\else
+ \edef\eqe@opts@argii{\expandafter
+ \eqe@fbox@corr\expandafter{\eqe@opts@argii}}\fi
+ \fi
+% \end{macrocode}
+% We need to feed \cs{parbox} the parameters it expects, so, if the
+% height parameter is not given, we just pass the first argument;
+% otherwise, we pass all three parameters.
+% \begin{macrocode}
+ \edef\eqe@parboxOptArgs{[\eqe@opts@argi]%
+ \expandafter\ifx\eqe@opts@argii\relax\else
+ [\eqe@opts@argii][\eqe@opts@argiii]\fi}%
+% \end{macrocode}
+% Now we build the third parameter, \cs{eqe@argiii}.
+% \begin{macrocode}
+ \def\eqe@argiii{\expandafter\parbox\eqe@parboxOptArgs{\eqe@bw}%
+% \end{macrocode}
+% We insert \cs{eqe@align@hfill}, which is synchronized to the value of
+% the \texttt{align} key to move the \cs{parbox} contents to left aligned, centered,
+% or right aligned. \cs{eqe@align@hfill} will only be effective if \texttt{\#3} is
+% enclosed in a narrower box.
+% \begin{macrocode}
+ {\eqe@align@hfill\ifKV@eqFillin@boxed\eq@fillintext\fi#3}}%
+ \fi
+% \end{macrocode}
+% If \cs{eqe@align@hfill} is still equal to \cs{relax}, give it the default
+% value.
+% \begin{macrocode}
+ \ifx\eqe@align@hfill\relax
+ \def\eq@eqFillin@align{c}%
+ \edef\eqe@align@hfill{\eqe@align@hfill@default}\fi
+ \ifmmode\let\@eqmath\ensuremath\else\let\@eqmath\text\fi
+% \end{macrocode}
+% We re-calculate the width of the formatted box
+% \begin{macrocode}
+ \ifx\eq@fillinparbox\@empty
+ \ifx\eqe@argii\@empty
+% \end{macrocode}
+% If no \texttt{parbox} option and if the second argument is empty,
+% we set width based on the natural width of \texttt{\#3}
+% \begin{macrocode}
+ \settowidth{\eqetmplengthb}{\@eqmath{\eq@fillin@format
+ \ifKV@eqFillin@boxed\eq@fillintext\fi\eqe@argiii}}%
+ \ifKV@eqFillin@boxed
+ \setlength{\eqetmplengthb}{%
+ \eqetmplengthb+2\fboxsep+2\fboxrule}%
+ \fi
+ \else
+% \end{macrocode}
+% If \texttt{\#2} is nonempty, we use this value.
+% \begin{macrocode}
+ \setlength{\eqetmplengthb}{#2}%
+ \fi
+ \else
+% \end{macrocode}
+% \texttt{parbox} option with empty second argument, use \cs{linewidth}.
+% for width
+% \begin{macrocode}
+ \ifx\eqe@argii\@empty
+ \setlength{\eqetmplengthb}{\linewidth}%
+ \PackageWarning{eqexam}{Parameter \#2
+ is empty with parbox option,\MessageBreak
+ using \string\linewidth\space for width%
+ }%
+ \else
+% \end{macrocode}
+% \texttt{parbox} option with second argument, use \texttt{\#2}
+% for width
+% \begin{macrocode}
+ \setlength{\eqetmplengthb}{#2}%
+ \fi
+ \fi
+% \end{macrocode}
+% Return \cs{ifsp} to its default definition.
+% \begin{macrocode}
+ \expandafter\let\expandafter\ifsp\csname ifsp@default\endcsname
+% \end{macrocode}
+% Save the final calculated width as \cs{eqe@bw}.
+% \begin{macrocode}
+ \edef\eqe@bw{\the\eqetmplengthb}%
+% \end{macrocode}
+% Set the underline option, \dots
+% \begin{macrocode}
+ \ifKV@eqFillin@underline\let\@fillinFmt\eq@fillin@ulcmd
+ \else\let\@fillinFmt\relax\fi
+% \end{macrocode}
+% however, if \texttt{parbox} is specified, we remove the underlining,
+% if any.
+% \begin{macrocode}
+ \ifx\eq@fillinparbox\@empty\else
+ \ifKV@eqFillin@underline\let\@fillinFmt\relax
+% \ifx\@fillinFmt\underbar\let\@fillinFmt\relax
+ \PackageInfo{eqexam}{Removing underline option, not permissible
+ \MessageBreak with parbox option}%
+ \fi\fi
+% \end{macrocode}
+% \paragraph*{Build the \cs{fillin} box.} After the preliminaries, we
+% create the requested answer field. We begin by building the answer
+% field for the case of \cs{ifeq@proofing} is true (which occurs when
+% the \texttt{answerkey} is used.
+% \begin{macrocode}
+ \ifeq@proofing
+ \ifKV@eqFillin@fitwidth
+% \end{macrocode}
+% If the \texttt{fitwidth} option is taken, we measure the width
+% of the box. Ignored when the \texttt{parbox} option is used.
+% \begin{macrocode}
+ \settowidth{\eqetmplengthb}{\@eqmath{\eq@fillin@format
+ \ifx\eq@fillinparbox\@empty\ifKV@eqFillin@boxed
+ \eq@fillintext\fi\fi\eqe@argiii}}%
+% \end{macrocode}
+% If boxed, we increase the width by
+% \texttt{2\string\fboxsep+2\string\fboxrule}; when content is \cs{boxed},
+% the dimensions are reduced.
+% \begin{macrocode}
+ \ifKV@eqFillin@boxed
+ \setlength{\eqetmplengthb}{%
+ \eqetmplengthb+2\fboxsep+2\fboxrule}%
+ \fi
+ \edef\eqe@bw{\the\eqetmplengthb}%
+ \fi
+% \end{macrocode}
+% We build the fill-in field for the case of \texttt{boxed}.
+% \begin{macrocode}
+ \ifKV@eqFillin@boxed
+ \ifmmode\let\@eqmath\ensuremath\else\let\@eqmath\text\fi
+% \mbox{\eq@fillin@format\ensuremath{\boxed{%
+ \setbox\z@\hbox{\@eqmath{\eq@fillin@boxcmd{%
+% \eq@fillin@format\ensuremath{\eq@fillin@boxcmd{%
+ \eq@eqFillin@boxsize
+ \@fillinFmt{%
+ \ifKV@eqFillin@boxed
+ \edef\eqe@bw{\eqe@fbox@corr{\eqe@bw}}%
+ \fi
+% \end{macrocode}
+% \changes{v2.0h}{2011/04/14}{Modified the calculation of the width
+% of \cs{fillin}, the width of enclosing box now equals the requested
+% width}
+% When the boxed option is taken, we adjust the width of the \cs{makebox}
+% to get the desired width \texttt{\#2}.
+% \begin{macrocode}
+ \makebox[\eqe@bw][\eq@eqFillin@align]{\strut
+ \@eqmath{\eq@fillin@format\color{\eq@fillin@color}%
+ \ifx\eq@fillinparbox\@empty
+ \eq@fillintext\fi\eqe@argiii}}%
+ }% end \@fillinFmt
+ }}}% end \mbox
+ \setlength{\@tempdima}{\ht0+\dp0}%
+ \xdef\fillinTotalHeight{\the\@tempdima}%
+ \mbox{\unhbox\z@}%
+ \else
+% \end{macrocode}
+% The content is not to be boxed.
+% \begin{macrocode}
+ \ifmmode\let\@eqmath\ensuremath\else\let\@eqmath\relax\fi
+ \setbox\z@\hbox{%
+% \end{macrocode}
+% A value of \texttt{-1sp} signals that \texttt{lift} has not been specified,
+% nor has \texttt{autofill} been specified. So we use the usual code for underlining.
+% \begin{macrocode}
+ \ifdim\eq@fillin@lift=-1sp\relax
+ \@fillinFmt{\makebox[\eqe@bw][\eq@eqFillin@align]{\strut
+ \color{\eq@fillin@color}%
+ \@eqmath{\eq@fillin@format\eqe@argiii}}}%
+ \else
+% \end{macrocode}
+% (2014/02/16) The \texttt{autolift} or \texttt{lift} keys are specified.
+% If \texttt{autofill}, put contents in a box. Set \cs{@tempdima} to
+% \texttt{\cs{dp2}+\cs{eq@fillin@addtoautolift}}, the latter normally has
+% a value of \texttt{0pt} unless specified on the option list.
+% \begin{macrocode}
+ \ifKV@eqFillin@autolift
+ \setbox2=\hbox{\@eqmath{\eq@fillin@format\eqe@argiii}}%
+ \setlength{\@tempdima}{\dp2+\eq@fillin@addtoautolift}%
+ \edef\eq@fillin@lift{\the\@tempdima}\fi
+% \end{macrocode}
+% (2014/02/16) We lower by an amount of \cs{eq@fillin@lift}, but raise the context
+% by that same amount.
+% \begin{macrocode}
+ \raisebox{-\eq@fillin@lift}{\@fillinFmt{%
+ \makebox[\eqe@bw][\eq@eqFillin@align]{\strut
+ \color{\eq@fillin@color}%
+ \raisebox{\eq@fillin@lift}{\@eqmath{\eq@fillin@format
+ \eqe@argiii}}}}}%
+ \fi
+ }\setlength{\@tempdima}{\ht0+\dp0}%
+ \xdef\fillinTotalHeight{\the\@tempdima}%
+ \mbox{\unhbox\z@}%
+ \fi
+ \else
+% \end{macrocode}
+% We begin the case of not \cs{ifeq@proofing}, that is, the document author
+% is not compiling with the \texttt{answerkey} option.
+% \begin{macrocode}
+ \ifKV@eqFillin@boxed
+% \mbox{\eq@fillin@format\ensuremath{\boxed{%
+% \eq@fillin@format\ensuremath{\eq@fillin@boxcmd{%
+ \setbox\z@\hbox{\@eqmath{\eq@fillin@format
+ \eq@fillin@boxcmd{\eq@eqFillin@boxsize\ifeq@nosolutions
+ \rlap{\@eqmath{\eq@fillintext}}\fi
+ \ifvspacewithsolns\rlap{\@eqmath{\eq@fillintext}}\fi
+ \@fillinFmt{%
+% \end{macrocode}
+% We do a similar thing if proofing is not active (\texttt{nosolutions} is taken).
+% \begin{macrocode}
+ \makebox[\eqe@fbox@corr{\eqe@bw}]{%
+ \ifKV@eqFillin@enclosesoln\phantom
+ {\setlength\eqetmplengthb{\eqe@bw-2\fboxsep}%
+ \edef\eqe@bw{\the\eqetmplengthb}%
+ \@eqmath{\eqe@argiii}}\else
+ \strut\hfill\fi
+ }%
+ }%end \@fillinFmt
+ }}}% end \hbox
+ \setlength{\@tempdima}{\ht0+\dp0}%
+ \xdef\fillinTotalHeight{\the\@tempdima}%
+ \mbox{\unhbox\z@}%
+ \else
+% \end{macrocode}
+% This is the case where the field is \emph{not} boxed.
+% \begin{macrocode}
+ \setbox\z@\hbox{%
+ \ifdim\eq@fillin@lift=-1sp\relax
+ \@fillinFmt{\makebox[\eqe@bw]{%
+% \phantom{\@eqmath{\eqe@argiii}}
+ \strut\hfil}}%
+ \else
+ \ifKV@eqFillin@autolift
+ \setbox2=\hbox{\@eqmath{\eq@fillin@format
+ \eqe@argiii}}%
+ \setlength{\@tempdima}%
+ {\dp2+\eq@fillin@addtoautolift}%
+ \edef\eq@fillin@lift{\the\@tempdima}\fi
+ \raisebox{-\eq@fillin@lift}{\@fillinFmt{%
+ \makebox[\eqe@bw]{\raisebox{\eq@fillin@lift}
+ {\phantom{\@eqmath{\eq@fillin@format
+ \eqe@argiii}}\strut\hfil}}}}%
+ \fi
+ }\setlength{\@tempdima}{\ht0+\dp0}%
+ \xdef\fillinTotalHeight{\the\@tempdima}%
+ \mbox{\unhbox\z@}%
+ \fi
+% \end{macrocode}
+% \paragraph*{Online Code.} If the \texttt{quiz} environment is defined,
+% and the user has asked for \texttt{online} option we build a text field.
+% \begin{macrocode}
+ \@ifundefined{@quiz}{}{%
+ \if\eq@online\eqe@YES\relax
+ \ifeq@nosolutions
+ \ifeq@solutionsafter\else
+ \ifx\eq@insertverticalspace\eqe@YES\relax
+% \end{macrocode}
+% OK, we get this far if we choose \texttt{online} (or higher) and
+% if \texttt{nosolutions} (which includes the \texttt{vspacewithsolns}
+% option). We require \cs{eq@insertverticalspace} to be \texttt{y}.
+% This last value is the default (\cs{SpaceToWork}).
+% \begin{macrocode}
+ \stepcounter{@cntfillin}%
+ \edef\fieldName{%
+ \if\probstar*eqexam.\curr@quiz.fillin.%
+ \theeqquestionnoi.part\thepartno.%
+ fi\the@cntfillin%
+ \else
+ eqexam.\curr@quiz.fillin.%
+ \theeqquestionnoi.fi\the@cntfillin%
+ \fi
+ }\ifx\eq@fillinparbox\@empty
+% \end{macrocode}
+% If the \texttt{parbox} option is not taken, we build a text field with height \texttt{11bp}
+% \begin{macrocode}
+ \raisebox{-1bp}{\makebox[0pt][r]{%
+ \textField[\BC{}\presets{\eqe@optsFillIn}]
+ {\fieldName}{#2}{\fillinTotalHeight}}}\else
+% \end{macrocode}
+% If the user has taken the \texttt{parbox} option, then the text field becomes a multiline
+% field, with height equal to the requested height.
+% \begin{macrocode}
+ \setlength{\@tempdima}%
+ {\eqe@opts@argii+2\fboxrule+2\fboxsep}%
+ \raisebox{-1bp}{\makebox[0pt][r]{%
+ \textField[\BC{}\presets{\eqe@optsFillIn}
+ \Ff{\FfMultiline}]{\fieldName}{#2}
+ {\fillinTotalHeight}}}\fi
+ \fi
+ \fi
+ \fi
+ \fi
+ }%
+ \fi\endgroup\space\ignorespaces}
+% \end{macrocode}
+% \end{macro}
+% \begin{macro}{\TF}
+% The \cs{TF} command depends on \cs{fillin}, so we make the appropriate changes.
+% \begin{macrocode}
+\renewcommand\TF[2][\defaultTFwidth]{%
+ \def\eqe@next{\fillin[underline]{#1}{#2}}%
+ \ifdim\eq@extralabelsep=0pt\relax\else
+ \if\probstar*\relax\if\exerwparts@cols0
+ \def\eqe@next{\makebox[0pt][r]{%
+ \fillin[underline]{#1}{#2}}\ignorespaces}%
+ \fi\fi\fi\eqe@next
+}
+% \end{macrocode}
+% \end{macro}
+% This marks the end of the \textsf{eqexam} package. dps
+% \begin{macrocode}
+%</package>
+% \end{macrocode}
+\endinput
diff --git a/texmf-dist/source/latex/eqexam/eqexam.ins b/texmf-dist/source/latex/eqexam/eqexam.ins
new file mode 100644
index 00000000..531d24ca
--- /dev/null
+++ b/texmf-dist/source/latex/eqexam/eqexam.ins
@@ -0,0 +1,62 @@
+%%
+%% This file will generate fast loadable files and documentation
+%% driver files from the doc files in this package when run through
+%% LaTeX or TeX.
+%%
+%% Copyright 1999-2006 D. P. Story
+%%
+%% This file is part of the `AcroTeX eDucation Bundle'.
+%% -------------------------------------------
+%%
+%% It may be distributed under the conditions of the LaTeX Project Public
+%% License, either version 1.2 of this license or (at your option) any
+%% later version. The latest version of this license is in
+%% http://www.latex-project.org/lppl.txt
+%% and version 1.2 or later is part of all distributions of LaTeX
+%% version 1999/12/01 or later.
+%%
+%% --------------- start of docstrip commands ------------------
+%%
+\def\filedate{2001/01/22}
+\def\batchfile{eqexam.ins}
+\input docstrip
+
+\ifx\generate\undefined
+ \Msg{**********************************************}
+ \Msg{*}
+ \Msg{* This installation requires docstrip}
+ \Msg{* version 2.4 or later.}
+ \Msg{*}
+ \Msg{* An older version of docstrip has been input}
+ \Msg{*}
+ \Msg{**********************************************}
+ \errhelp{Move or rename old docstrip.tex and get a newer one.}
+ \errmessage{Old docstrip in input path}
+ \batchmode
+ \csname @@end\endcsname\end
+\fi
+
+\keepsilent
+\askforoverwritefalse
+%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
+
+\preamble
+\endpreamble
+
+\generate{%
+ \file{eqexam.sty}{\from{eqexam.dtx}{copyright,package}}
+ \file{eqalone.def}{\from{eqexam.dtx}{copyright,standalone}}
+ \file{eqtextb.def}{\from{eqexam.dtx}{copyright,textbook}}
+ \file{fortextbook.sty}{\from{eqexam.dtx}{copyright,ftbsty}}
+ \file{eqexam.drv}{\from{eqexam.dtx}{copyright,driver}}
+}
+\Msg{***************************************************************}
+\Msg{*}
+\Msg{* \space To finish the installation you have to copy the files }
+\Msg{*}
+\Msg{* \space *.sty, *.cfg and *.def into a directory searched by TeX}
+\Msg{*}
+\Msg{***************************************************************}
+
+%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
+\endinput
diff --git a/texmf-dist/source/latex/eqexam/script/eqAttach.asp b/texmf-dist/source/latex/eqexam/script/eqAttach.asp
new file mode 100644
index 00000000..f87f8b47
--- /dev/null
+++ b/texmf-dist/source/latex/eqexam/script/eqAttach.asp
@@ -0,0 +1,202 @@
+<%@ LANGUAGE = VBScript%>
+<%
+' Copyright 2005 D. P. Story
+' All Rights Reserved
+' See eqexamman.pdf for some documentation
+
+' NOTICE: This program can redistributed and/or modified under
+' the terms of the LaTeX Project Public License
+' Distributed from CTAN archives in directory
+' macros/latex/base/lppl.txt; either version 1 of the
+' License, or (at your option) any later version.
+
+' This script is offered "as is", no guarantees are extended.
+' eqRecord should be extensively tested on your own system
+' until you are satisfied with its functionality and
+' reliability.
+'
+' Note: You need to edit one line below. Search this file for the line that
+' contains the string "mySMTP". Replace this string with your SMTP server.
+
+Response.buffer = True
+
+Dim DebugTxt, DebugFDF
+Dim ErcStatus : ErcStatus = "Problems Reported: "
+DebugTxt = False
+DebugFDF = False
+
+' Send FDF file
+If DebugTxt Then
+ Response.ContentType = "text/html"
+ Response.Write "Debug Info" & "<br>"
+Else
+ Response.ContentType = "application/vnd.fdf"
+End If
+
+On error Resume Next
+
+Dim silentMode : silentMode = False
+Dim stripPath : stripPath = False
+
+If Request.QueryString("silent").Count > 0 Then silentMode = True
+If Request.QueryString("nopath").Count > 0 Then stripPath = True
+
+Rem Create an FDF object
+Set FdfAcx = Server.CreateObject("FdfApp.FdfApp")
+Set FDFout = FdfAcx.FDFCreate
+
+Rem Parse Incoming Data
+Set FDFin = FdfAcx.FDFOpenFromBuf (Request.BinaryRead(Request.TotalBytes))
+
+Dim cPDFPath, pos
+
+If stripPath Then
+ If DebugTxt Then Response.Write "stripPath is true " & "<br>"
+ cPDFPath = FDFin.FDFGetFile
+ pos = InStrRev( cPDFPath, "/")
+ If pos <> 0 Then
+ If DebugTxt Then Response.Write "pos = " & pos & "<br>"
+ cPDFPath = Mid(cPDFPath, pos + 1, Len(cPDFPath) - pos )
+ If DebugTxt Then Response.Write "cPDFPath = " & cPDFPath & "<br>"
+ FDFin.FDFSetFile cPDFPath
+ End If
+End If
+
+Rem Declare some variables
+Dim cBuf
+Dim cTime : cTime = Now
+Dim eqMail, cMailTo, cMailFrom, cMailSubject
+Dim cCourseName, cExam, cStudent, cSID, strMessage, cRetnMsg, eqTab, eqCR
+eqTab = chr(9)
+eqCR = chr(10)
+
+' Get Required Info -------------------
+' The only thing we really need is the email address to send this data to
+cMailTo = FDFin.FDFGetValue("IdInfo.mailTo")
+' cMailFrom = cMailTo
+
+' Get Optional Info ------
+
+On error Resume Next
+cCourseName = "" : cCourseName = Trim(FDFin.FDFGetValue("IdInfo.courseName"))
+
+On error Resume Next
+cExam = "" : cExam = Trim(FDFin.FDFGetValue("IdInfo.examName"))
+
+On error Resume Next
+cStudent = "" : cStudent = Trim(FDFin.FDFGetValue("IdInfo.Name"))
+
+On error Resume Next
+cSID = "" : cSID = Trim(FDFin.FDFGetValue("IdInfo.SID"))
+
+On error Resume Next
+cMailFrom = "" : cMailFrom = Trim(FDFin.FDFGetValue("IdInfo.email"))
+If Trim(cMailFrom) = "" Then cMailFrom = cMailTo
+
+On error Resume Next
+cMailSubject = "" : cMailSubject = FDFin.FDFGetValue("IdInfo.subject")
+If Trim(cMailSubject) = "" Then cMailSubject = "Exam Results: " & cExam & " of " & cCourseName
+
+On error Resume Next
+cRetnMsg = "" : cRetnMsg = Trim(FDFin.FDFGetValue("IdInfo.retnmsg"))
+
+strMessage = "Summary Information:"
+If cCourseName <> "" Then strMessage = strMessage & eqCR & eqTab & "Subject: " & cCourseName
+If cExam <> "" Then strMessage = strMessage & eqCR & eqTab & "Title: " & cExam
+If cStudent <> "" Then strMessage = strMessage & eqCR & eqTab & "Name: " & cStudent
+strMessage = strMessage & eqCR & eqTab & "TimeOfQuiz: " & cTime
+
+If Trim(cRetnMsg) = "" Then
+ cBuf = "Exam results successfully sent to your instructor!"
+Else
+ cBuf = cRetnMsg
+End If
+
+If DebugFDF Then cBuf = cBuf & " " & ErcStatus
+
+If Not silentMode Then FDFout.FDFSetStatus cBuf
+
+' Construct and send e-mail
+
+'CDONTS
+' Set eqMail = CreateObject("CDONTS.NewMail") 'cdots
+
+' CDOSYS
+Set eqMail = Server.CreateObject("CDO.Message")
+eqMail.Configuration.Fields.Item("http://schemas.microsoft.com/cdo/configuration/sendusing") = 2
+eqMail.Configuration.Fields.Item("http://schemas.microsoft.com/cdo/configuration/smtpserver") = "mySMTP"
+eqMail.Configuration.Fields.Item("http://schemas.microsoft.com/cdo/configuration/smtpserverport") = 25
+eqMail.Configuration.Fields.Item("http://schemas.microsoft.com/cdo/configuration/smtpconnectiontimeout") = 60
+' eqMail.Configuration.Fields.Item("http://schemas.microsoft.com/cdo/configuration/smtpauthenticate") = 0
+eqMail.Configuration.Fields.Update
+
+eqMail.To = cMailTo
+' See if there is a comma in the cMailFrom string, if yes, then we have multiple addresses
+' that we are sending to. We extract the first e-mail address as the one we will put in
+' the eqMail.From address.
+position = InStr(1,cMailFrom,",",0)
+If position <> 0 Then cMailFrom = Trim(Mid(cMailFrom,1,position-1))
+eqMail.From = cMailFrom
+eqMail.Subject = cMailSubject
+
+' CDOSSYS or CDONTS
+eqMail.TextBody = strMessage
+' eqMail.Body = strMessage 'cdots
+
+Dim strTempFile
+Dim strTempFolder
+Dim strTemp
+Dim fso
+
+Set fso = CreateObject("Scripting.FileSystemObject")
+Set strTempfolder = fso.GetSpecialFolder(2)
+strTempFile = fso.GetTempName()
+strTempFile = left(strTempFile, len(strTempFile)-4)
+strTemp = strTempFolder & "\" & strTempFile & ".fdf"
+FDFin.FDFSaveToFile strTemp
+
+If DebugTxt Then Response.Write "strTemp = " & strTemp & "<br>"
+
+' CDOSSYS or CDONTS
+eqMail.AddAttachment strTemp
+' eqMail.AttachFile strTemp 'cdots
+
+eqMail.Send
+Set eqMail = Nothing
+' Send back to the browser
+Response.BinaryWrite FDFout.FDFSaveToBuf
+
+' Delete temporary file
+fso.DeleteFile strTemp
+Set fso = nothing
+
+FDFin.FDFClose
+FDFout.FDFClose
+Set FdfAcx = Nothing
+Set FDFin = Nothing
+Set FDFout = Nothing
+
+If DebugTxt Then
+ Response.Write strMessage
+End If
+
+Sub RecordError(field)
+ If Err.Number <> 0 And DebugFDF Then
+ ErcStatus = ErcStatus & " "&field&": " & Err.Description
+ End If
+ If Err.Number <> 0 And DebugTxt Then
+ Response.Write "Set Error: "&field&": " & Err.Description & "<br>"
+ End If
+ Err.Clear
+End Sub
+
+Sub ReportError(ByRef localErr)
+ DebugMsg "Err.Description: ", localErr.Description
+ DebugMsg "Err.Number: ", localErr.Number
+ localErr.Clear
+End Sub
+
+Sub DebugMsg(myText, myEval)
+ If DebugTxt Then Response.Write myText & myEval &"<br>"
+End Sub
+%>