summaryrefslogtreecommitdiff
path: root/Master/texmf-dist/source
diff options
context:
space:
mode:
authorKarl Berry <karl@freefriends.org>2009-09-30 00:05:07 +0000
committerKarl Berry <karl@freefriends.org>2009-09-30 00:05:07 +0000
commitab32512d3febc3b84765830b7a8a33a29e2c4e42 (patch)
treeca56bca1dc841402ec5213d0add8261074857208 /Master/texmf-dist/source
parent2315b3cb5d99fbbf5379973f08d9c6e25d0c5c0e (diff)
new latex package eqexam (29sep09)
git-svn-id: svn://tug.org/texlive/trunk@15565 c570f23f-e606-0410-a88d-b1316a301751
Diffstat (limited to 'Master/texmf-dist/source')
-rw-r--r--Master/texmf-dist/source/latex/eqexam/eqexam.drv37
-rw-r--r--Master/texmf-dist/source/latex/eqexam/eqexam.dtx3049
-rw-r--r--Master/texmf-dist/source/latex/eqexam/eqexam.ins63
3 files changed, 3149 insertions, 0 deletions
diff --git a/Master/texmf-dist/source/latex/eqexam/eqexam.drv b/Master/texmf-dist/source/latex/eqexam/eqexam.drv
new file mode 100644
index 00000000000..04cd89e6348
--- /dev/null
+++ b/Master/texmf-dist/source/latex/eqexam/eqexam.drv
@@ -0,0 +1,37 @@
+%%
+%% This is file `eqexam.drv',
+%% generated with the docstrip utility.
+%%
+%% The original source files were:
+%%
+%% eqexam.dtx (with options: `copyright,driver')
+%%
+%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
+%% eqExam.sty package, 2005-02-05 %%
+%% Copyright (C) 2005 D. P. Story %%
+%% dpstory@uakron.edu %%
+%% %%
+%% 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. %%
+%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
+\documentclass{ltxdoc}
+\usepackage[colorlinks,hyperindex]{hyperref}
+\RecordChanges
+\begin{document}
+ \GetFileInfo{eqexam.sty}
+ \title{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}
+\PrintIndex
+\end{document}
+\endinput
+%%
+%% End of file `eqexam.drv'.
diff --git a/Master/texmf-dist/source/latex/eqexam/eqexam.dtx b/Master/texmf-dist/source/latex/eqexam/eqexam.dtx
new file mode 100644
index 00000000000..6faa7208bd6
--- /dev/null
+++ b/Master/texmf-dist/source/latex/eqexam/eqexam.dtx
@@ -0,0 +1,3049 @@
+% \iffalse
+%<*copyright>
+%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
+%% eqExam.sty package, 2005-02-05 %%
+%% Copyright (C) 2005 D. P. Story %%
+%% dpstory@uakron.edu %%
+%% %%
+%% 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. %%
+%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
+%</copyright>
+%<package>\NeedsTeXFormat{LaTeX2e}
+%<package>\ProvidesPackage{eqexam}
+%<package> [2009/09/28 v1.9a An Exam Construction Package (dps)]
+%<*driver>
+\documentclass{ltxdoc}
+\usepackage[colorlinks,hyperindex]{hyperref}
+%\pdfstringdefDisableCommands{\let\\\textbackslash}%
+%\EnableCrossrefs
+%\CodelineIndex
+\RecordChanges
+\begin{document}
+ \GetFileInfo{eqexam.sty}
+ \title{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}
+\PrintIndex
+\end{document}
+%</driver>
+% \fi
+%
+% \MakeShortVerb{|}
+% \StopEventually{}
+%
+% \DoNotIndex{\def,\edef,\gdef,\xdef,\global,\long,\let}
+% \DoNotIndex{\expandafter,\string,\the,\ifx,\else,\fi}
+% \DoNotIndex{\csname,\endcsname,\relax,\begingroup,\endgroup}
+% \DoNotIndex{\DeclareTextCommand,\DeclareTextCompositeCommand}
+% \DoNotIndex{\space,\@empty,\special}
+% \newpage
+% \section{Change History}
+%
+% \makeatletter
+% \renewenvironment{theglossary}{%
+% \let\efill=\relax
+% \begin{itemize}}%
+% {\end{itemize}}
+% \global\c@GlossaryColumns = 1
+% \makeatother
+% \PrintChanges
+% \section{Introduction}
+% This package is my attempt at writing a set of macros for creating exams.
+% The package can be used with our 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.
+%
+% \newpage
+% \section{Package options and Process Options}
+% Let us catalog the options of this package.
+%
+% \subsection{Options New to eqExam}
+%
+% Here are some options unique to this package.
+% \begin{macrocode}
+%<*package>
+% \end{macrocode}
+% \begin{macrocode}
+\usepackage{keyval}
+% \end{macrocode}
+% \begin{macro}{myconfig}
+% \begin{macro}{myconfigi}
+% \begin{macro}{myconfigii}
+% \begin{macro}{pointsonleft}
+% \begin{macro}{pointsonright}
+% \begin{macro}{nopoints}
+% \begin{macro}{totalsonleft}
+% \begin{macro}{totalsonright}
+% \begin{macro}{pointsonboth}
+% \begin{macro}{nototals}
+% \begin{macro}{noparttotals}
+% \begin{macro}{noseparationrule}
+% \begin{macro}{nosummarytotals}
+% \begin{macro}{coverpage}
+% \begin{macro}{nospacetowork}
+% \begin{macro}{answerkey}
+% \begin{macro}{useforms}
+% \begin{macro}{online}
+% \begin{macro}{pdf}
+% \begin{macro}{links}
+% \begin{macro}{email}
+% \begin{macro}{obeylocalversions}
+% The following is the list of options that control the behavior of \textsf{eqExam}.
+% \begin{macrocode}
+\DeclareOption{myconfig}{\AtEndOfPackage{\eqemyconfig}}
+\DeclareOption{myconfigi}{\AtEndOfPackage{\eqemyconfigi}}
+\DeclareOption{myconfigii}{\AtEndOfPackage{\eqemyconfigii}}
+\DeclareOption{pointsonleft}{\AtEndOfPackage{\PointsOnLeft}}
+\DeclareOption{pointsonright}{\AtEndOfPackage{\PointsOnRight}}
+\DeclareOption{nopoints}{\AtEndOfPackage{\NoPoints}}
+\DeclareOption{totalsonleft}{\AtEndOfPackage{\TotalsOnLeft}}
+\DeclareOption{totalsonright}{\AtEndOfPackage{\TotalsOnRight}}
+\DeclareOption{pointsonboth}{\AtEndOfPackage{\PointsOnBothSides}}
+\DeclareOption{nototals}{\AtEndOfPackage{\NoTotals}}
+\DeclareOption{noparttotals}{\AtEndOfPackage{\let\eq@parttotals=n}}
+\DeclareOption{noseparationrule}{%
+ \AtEndOfPackage{\let\separationrule\relax}}
+\DeclareOption{nosummarytotals}{\let\eq@nosummarytotals=y}
+\DeclareOption{coverpage}{\def\eqex@coverpage{\eqexcoverpage}}
+\DeclareOption{nospacetowork}{%
+ \AtEndOfPackage{\let\eq@insertverticalspace=n}}
+\newif\ifanswerkey \answerkeyfalse
+\DeclareOption{answerkey}{\answerkeytrue\eq@proofingtrue
+ \eq@solutionsaftertrue}
+\DeclareOption{useforms}{\AtEndOfPackage{\def\sqstar{*}}}
+\DeclareOption{online}{\let\eq@online=y\ExecuteOptions{links}}
+\DeclareOption{pdf}{\let\load@web=y}
+\DeclareOption{links}{\let\load@web=y\let\load@exerquiz=y}
+\DeclareOption{email}{\let\use@email=y\ExecuteOptions{online}}
+\newif\ifeqobeylocalversion\eqobeylocalversionfalse
+\DeclareOption{obeylocalversions}{\eqobeylocalversiontrue}
+\DeclareOption{usexkv}{\let\eq@usexkeys=y}
+\let\eq@usexkeys=n
+% \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}
+% \end{macro}
+% \end{macro}
+% \end{macro}
+% \end{macro}
+% \end{macro}
+% \end{macro}
+% \end{macro}
+% \end{macro}
+% \begin{macro}{allowrandomize}
+% Use this option to randomize the choices of a multiple choice question.
+% \begin{macrocode}
+\DeclareOption{allowrandomize}{\AtEndOfPackage{\inputRandomizeChoices}}
+\def\inputRandomizeChoices{\InputIfFileExists{aebrandom.def}
+ {\typeout{inputting aebrandom.def}}{cannot find aebrandom.def}}
+% \end{macrocode}
+% \end{macro}
+% \begin{macrocode}
+\let\eq@online=n
+\let\use@email=n
+\let\load@web=n
+\let\load@exerquiz=n
+\def\sqstar{}
+\def\sqLinks{\def\sqstar{}}
+\def\sqForms{\def\sqstar{*}}
+\def\NoSpaceToWork{\let\eq@insertverticalspace=n}
+\def\SpaceToWork{\let\eq@insertverticalspace=y}
+\let\eq@nototals=n
+\let\eq@nosummarytotals=n
+\let\eq@parttotals=y
+\let\eqx@separationrule=y
+\let\eq@insertverticalspace=y
+\let\eqex@coverpage=\relax
+\def\@reportpoints{0}
+\let\marginpoints=\@empty
+\let\totalsbox=\hfil
+% \end{macrocode}
+%
+% \subsection{Options from Exerquiz}
+%
+% Options from \textsf{exerquiz} that are useful for this package.
+% \begin{macro}{forpaper}
+% \begin{macro}{forcolorpaper}
+% \begin{macro}{preview}
+% \begin{macro}{nosolutions}
+% \begin{macro}{nohiddensolutions}
+% \begin{macro}{noHiddensolutions}
+% \begin{macro}{solutionsafter}
+% \begin{macro}{solutionsonly}
+%\changes{v1.7b}{2007/21/07}{Added a \texttt{solutionsonly} option}
+% \begin{macro}{proofing}
+% Here is the list of options of \textsf{exerquiz} we plan to recognize.
+% \begin{macrocode}
+\DeclareOption{forpaper}{\eqforpapertrue
+ \PassOptionsToPackage{monochrome}{\eq@ColorPackage}}
+\DeclareOption{forcolorpaper}{\eqforpapertrue} % for print
+\DeclareOption{preview}{\previewtrue}
+\DeclareOption{nosolutions}{\eq@nolinktrue\eq@nosolutionstrue}
+\DeclareOption{nohiddensolutions}{\eq@globalshowsolutionstrue}
+\DeclareOption{noHiddensolutions}%
+ {\eq@globalshowsolutionstrue\AtBeginDocument{\def\Hidesymbol{h}}}
+\DeclareOption{solutionsafter}{\eq@solutionsaftertrue}
+\DeclareOption{solutionsonly}{\solutionsonlytrue\answerkeytrue
+ \AtEndOfPackage{\therearesolutionstrue\let\exerSolnsHeadnToc\relax}}
+\DeclareOption{proofing}{\eq@proofingtrue}
+% \end{macrocode}
+% \end{macro}
+% \end{macro}
+% \end{macro}
+% \end{macro}
+% \end{macro}
+% \end{macro}
+% \end{macro}
+% \end{macro}
+% \end{macro}
+% \begin{macro}{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
+\DeclareOption{showgrayletters}%
+ {\AtEndOfPackage{\aebshowgrayletterstrue}}
+% \end{macrocode}
+% \end{macro}
+% Set the driver dependent code, these are passed to web/exerquiz.
+% \begin{macrocode}
+\IfFileExists{xcolor.sty}%
+{\def\eq@ColorPackage{xcolor}\PassOptionsToPackage{xcolor}{table}}
+{\def\eq@ColorPackage{color}}
+\DeclareOption{noxcolor}{\def\eq@ColorPackage{color}}
+\def\eq@drivernum{5}
+\def\eqDriverName{dvipsone}
+% \end{macrocode}
+%
+% \subsection{Drivers Recognized}
+%
+% \begin{macro}{dvipsone}
+% \begin{macro}{dvips}
+% \begin{macro}{pdftex}
+% \begin{macro}{dvipdfm}
+% \begin{macro}{textures}
+% A list of recognized drivers.
+% \begin{macrocode}
+\DeclareOption{dvipsone}{\def\eq@drivernum{0}\def\eqDriverName{dvipsone}
+ \PassOptionsToPackage{\eq@ColorPackage}{dvipsone}}
+\DeclareOption{dvips}{\def\eq@drivernum{0}\def\eqDriverName{dvips}
+ \PassOptionsToPackage{\eq@ColorPackage}{dvips}}
+\DeclareOption{pdftex}{\def\eq@drivernum{1}\def\eqDriverName{pdftex}
+ \PassOptionsToPackage{\eq@ColorPackage}{pdftex}}
+\DeclareOption{dvipdfm}{\def\eq@drivernum{2}\def\eqDriverName{dvipdfm}
+ \PassOptionsToPackage{\eq@ColorPackage}{dvipdfm}}
+\DeclareOption{textures}{\def\eq@drivernum{3}\def\eqDriverName{textures}
+ \PassOptionsToPackage{\eq@ColorPackage}{textures}}
+\DeclareOption*{\PassOptionsToPackage{\CurrentOption}{\eq@ColorPackage}}
+% \end{macrocode}
+% \end{macro}
+% \end{macro}
+% \end{macro}
+% \end{macro}
+% \end{macro}
+% \begin{macrocode}
+\@ifpackageloaded{xcolor}%
+{%
+ \@ifpackagelater{xcolor}{2004/07/04}{}
+ {%
+ \PackageError{eqexan}{%
+ *************************************************\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 \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
+\newif\ifpreview \previewfalse
+\newif\ifeqforpaper \eqforpaperfalse
+\def\eqemyconfig{\InputIfFileExists{eqexam.cfg}{}{}}
+\def\eqemyconfigi{\InputIfFileExists{eqexami.cfg}{}{}}
+\def\eqemyconfigii{\InputIfFileExists{eqexamii.cfg}{}{}}
+% \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}
+%\DeclareOption{atbdbopts}
+%{%
+% \ExecuteOptions{online}
+% \ExecuteOptions{forcolorpaper}
+% \ExecuteOptions{nosolutions}
+% \ExecuteOptions{nopoints}
+% \ExecuteOptions{nototals}
+% \ExecuteOptions{nospacetowork}
+% \ExecuteOptions{obeylocalversions}
+% \ExecuteOptions{myconfig}
+%}
+%\end{verbatim}
+% \begin{macrocode}
+\InputIfFileExists{web.cfg}{}{}
+\InputIfFileExists{eqecus.opt}{}{}
+% \end{macrocode}
+%
+% \subsection{Process Options}
+%
+% Now process the options.
+% \begin{macrocode}
+\ProcessOptions
+% \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 \texttt{eqExam}.
+% \begin{macrocode}
+\RequirePackage{amstext,amssymb}
+% \end{macrocode}
+% Bring the \texttt{comment} package in early, before \texttt{verbatim}, these two
+% clash a bit.
+% \begin{macrocode}
+\RequirePackage{comment}
+% \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=y}
+{%
+ \ifx\load@web y
+ \ifnum\eq@drivernum=5
+ \PackageError{eqexam}{****You have not selected a driver %
+ for eqExam****}{Specify dvipsone, dvips, pdftex, %
+ dvipdfm or textures in option list.}
+ \fi
+ \RequirePackage[\eqDriverName]{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=y}
+{%
+ \ifx\load@exerquiz y
+ \RequirePackage[nodljs]{exerquiz}[2005/1/23]
+% \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=y
+ \let\execjs=y
+ \fi
+}
+% \end{macrocode}
+% Here is a fix to a problem I've been having previewing in dviwindo. I've traced
+% the problem down to \cs{@pdfviewparams}, and changing the the following. Hope it
+% causes no more problems.
+% \begin{macrocode}
+\def\eqDvipsone{dvipsone}
+\ifx\eqDriverName\eqDvipsone
+\@ifpackageloaded{hyperref}
+ {\renewcommand\@pdfviewparams{ null null null}}{}
+\fi
+% \end{macrocode}
+% Now that we have possibly input web or 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{\eq@ColorPackage}
+\RequirePackage{calc}
+\RequirePackage{pifont}
+% \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
+% \end{macrocode}
+% \section{Page Layout}
+% Here we provide a simple page layout, which yields a ``maximum'' amount of space for the test.
+% \begin{macrocode}
+\setlength{\headsep}{0pt}
+\settowidth{\oddsidemargin}{\normalsize\normalfont\bfseries00.\ }
+\setlength{\evensidemargin}{0pt}
+\setlength{\marginparsep}{11pt}
+\setlength{\marginparwidth}{35pt}
+\setlength{\headheight}{12pt}
+\setlength{\topmargin}{-.5in}
+%\setlength{\topmargin}{0pt}
+\setlength{\headsep}{20pt}
+\setlength{\footskip}{\marginparsep}
+% \end{macrocode}
+% \begin{macro}{\eqExamPageLayout}
+% Set the basic parameters of this exam page package
+% \begin{macrocode}
+\def\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}
+}
+\eqExamPageLayout
+% \end{macrocode}
+% \end{macro}
+% A simple page layout scheme for this exam.
+% \begin{macrocode}
+\newcommand{\ps@eqExamheadings}
+{%
+ \renewcommand{\@oddhead}{%
+ {%
+ \normalfont\normalsize
+ \ifnum\value{page}=1 \hfil
+ \else
+ \ifx\eqex@coverpage\relax
+ \eqExamRunHead
+ \else
+ \ifnum\value{page}=2 \hfil
+ \else
+ \eqExamRunHead
+ \fi
+ \fi
+ \fi
+ }%
+}
+\renewcommand{\@evenhead}{\@oddhead}
+\renewcommand{\@oddfoot}{\settotalsbox}
+\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\eqbothmargins#1#2{\eqleftmargin{#1}{#2}\eqrightmarginbox{#1}{#2}}
+\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}
+\def\NoPoints{\def\@reporttotals{0}\let\totalsbox=\hfil
+ \let\marginpoints=\@empty\let\eq@nosummarytotals=y}
+\def\TotalsOnLeft{\def\@reporttotals{1}\def\totalsbox{\totalsboxleft}}
+\def\TotalsOnRight{\def\@reporttotals{2}\def\totalsbox{\totalsboxright}}
+\def\NoTotals{\def\@reporttotals{0}\let\totalsbox=\hfil}
+\def\eoeTotalOff{\let\eq@parttotals=n}
+\def\eoeTotalOn{\let\eq@parttotals=y}
+\def\separationruleOn{\let\eqx@separationrule=y}
+\def\separationruleOff{\let\eqx@separationrule=n}
+% \end{macrocode}
+% \begin{macro}{\encloseProblemsWith}
+%\changes{v1.7b}{2007/21/07}{Added \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}
+% 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{\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{blue}
+% \end{macrocode}
+% \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 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.
+% \begin{macrocode}
+\def\longTitleText
+{%
+ \setcounter{eq@count}{0}
+ \eqtemptokena={}
+ \let\endtitleMarker\endlongTitleText
+ \@gatherTitleText{\Exam}
+}
+\def\endlongTitleText{l}
+\def\shortTitleText
+{%
+ \setcounter{eq@count}{0}
+ \eqtemptokena={}
+ \let\endtitleMarker\endshortTitleText
+ \@gatherTitleText{\sExam}
+}
+\def\endshortTitleText{s}
+% \end{macrocode}
+% \end{macro}
+% \end{macro}
+% \end{macro}
+% \end{macro}
+% \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\eq@next\relax
+ \else\def\eq@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\eq@next{\@gatherTitleText{#1}}%
+ \else
+ \def\eq@next{%
+ \if\endtitleMarker\endlongTitleText
+ \expandafter\eqe@absorbTokensLong
+ \else
+ \expandafter\eqe@absorbTokensShort
+ \fi
+ }%
+ \fi
+ \fi
+ \eq@next
+}
+\long\def\eqe@absorbTokensLong#1\endlongTitleText{}
+\long\def\eqe@absorbTokensShort#1\endshortTitleText{}
+% \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 for the number of versions declared in
+ \string\numVersions. 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}
+\def\forVersion#1%
+{%
+ \eqe@initializeMultiVersions
+ \global\eqglobalversiontrue
+ \setcounter{eq@count}{0}
+ \uppercase{\def\eq@selectedVersion{#1}}
+ \@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}
+ \expandafter
+ \let\csname After\Alph{eq@count}Comment\endcsname\relax
+ \lowercase
+ {%
+ \if#1\alph{eq@count}
+ \expandafter\let
+ \csname v\Alph{eq@count}\endcsname\@empty
+ \else
+ \expandafter\let
+ \csname v\Alph{eq@count}\endcsname\@gobble
+ \fi
+ \if#1\alph{eq@count}
+ \edef\eq@next
+ {\noexpand\includecomment{ver\Alph{eq@count}}}
+ \else
+ \edef\eq@next
+ {\noexpand\excludecomment{ver\Alph{eq@count}}}
+ \fi
+ }\eq@next
+ \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}}
+% \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, fixed \cs{forVersion} so that it can be changed
+% within the document, added switches to control new selection.
+% Added option \texttt{ignorelocalversions}
+% }
+% \begin{macrocode}
+\def\selectVersion#1#2% 1 \le #1 \le #2
+{%
+ \gdef\nLocalSelection{#1}%
+ \gdef\nLocalVersions{#2}%
+% \end{macrocode}
+% If \cs{eqglobalversion} is 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}
+ \ifeqglobalversion\ifnum\eq@nSelectedVersion>\nLocalVersions
+ {\count0=\eq@nSelectedVersion \count2=\count0
+ \advance\count0by-1 \divide\count0by\nLocalVersions
+ \multiply\count0by\nLocalVersions \count2=\eq@nSelectedVersion
+ \advance\count2by-\count0
+ \xdef\nLocalSelection{\the\count2\relax}%
+ \ifeqobeylocalversion\else
+ \global\@templocalversiontrue
+ \global\eqobeylocalversiontrue
+ \fi}%
+ \fi\fi
+ \ifeqobeylocalversion
+ \global\eqlocalversiontrue
+ \setcounter{eq@count}{0}
+ \ifx\nLocalSelection\@empty\def\nLocalSelection{1}\fi
+ \let\save@message\message\let\message\@gobble
+ \loop
+ \stepcounter{eq@count}\expandafter
+ \let\csname Afterver\Alph{eq@count}Comment\endcsname\relax
+ \lowercase
+ {%
+ \ifnum\value{eq@count}=\nLocalSelection
+ \expandafter\let
+ \csname v\Alph{eq@count}\endcsname\@empty
+ \else
+ \expandafter\let
+ \csname v\Alph{eq@count}\endcsname\@gobble
+ \fi
+ \ifnum\value{eq@count}=\nLocalSelection
+ \edef\eq@next{%
+ \noexpand\includecomment{ver\Alph{eq@count}}}
+ \else
+ \edef\eq@next{%
+ \noexpand\excludecomment{ver\Alph{eq@count}}}
+ \fi
+ }\eq@next
+ \ifnum\value{eq@count}<\nLocalVersions\repeat
+ \let\message\save@message
+ \fi
+ \if@templocalversion\global\eqobeylocalversionfalse\fi
+}
+% \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}{}
+{
+ \def\title{\@ifnextchar[{\@title}{\@title[\@empty]}}
+ \def\@title[#1]#2{\gdef\webtitle{#2}%
+ \ifx#1\@empty\gdef\shortwebtitle{#2}%
+ \else\gdef\shortwebtitle{#1}\fi}
+ \def\subject{\@ifnextchar[{\@subject}{\@subject[\@empty]}}
+ \def\@subject[#1]#2{\gdef\websubject{#2}%
+ \ifx#1\@empty\gdef\shortwebsubject{#2}%
+ \else\gdef\shortwebsubject{#1}\fi}
+ \def\author#1{\gdef\webauthor{#1}}
+ \def\email#1{\gdef\webemail{#1}}
+ \def\keywords#1{\gdef\webkeywords{#1}}
+ \def\university#1{\gdef\webuniversity{#1}}
+ \def\web@versionlabel{Version}
+ \def\web@toc{Table of Contents}
+ \def\web@continued{cont.}
+% set some defaults
+ \title{}\author{}\email{}\subject{}\keywords{}\university{}
+ \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
+{%
+ \ifnum\the\month<6
+ Spring%
+ \else
+ \ifnum\the\month<8
+ Summer%
+ \else
+ % August or later
+ \ifnum\the\month>8
+ % September or later
+ Fall%
+ \else
+ % month of August
+ \ifnum\the\day>25
+ Fall%
+ \else
+ 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\examNameLabel[1]{\gdef\@examNameLabel{#1}}
+\examNameLabel{Name:}
+\newcommand\eqExamName[2][]{\gdef\eq@ExamName{%
+ \bgroup\settowidth\eq@tmplengthA{\@examNameLabel\ }%
+ \@tempdima=#2 \advance\@tempdima by-\eq@tmplengthA
+ \underbar{\makebox[#2][l]{\@examNameLabel}}%
+ \insTxtFieldIdInfo[#1]{\@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][]{\gdef\eq@SID{%
+ \bgroup\settowidth\eq@tmplengthA{\@examSIDLabel\ }%
+ \@tempdima=#2 \advance\@tempdima by-\eq@tmplengthA
+ \underbar{\makebox[#2][l]{\@examSIDLabel}}%
+ \insTxtFieldIdInfo[#1]{\@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][]{\gdef\eq@Email{%
+ \bgroup\settowidth\eq@tmplengthA{\@examEmailLabel\ }%
+ \@tempdima=#2 \advance\@tempdima by-\eq@tmplengthA
+ \underbar{\makebox[#2][l]{\@examEmailLabel}}%
+ \insTxtFieldIdInfo[#1]{\@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}{}{\ifx\eq@online y\relax
+ \ifeq@nosolutions\ifeq@solutionsafter\else
+ \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 y\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*\arabic{quizno}\else\alph{quizno}\fi}
+\def\linkContentFormat{%
+ \if\probstar*\arabic{quizno}\else\alph{quizno}\fi}
+\def\linkContentWrapper{(\hfil\linkContentFormat\hfil)}%
+\def\eqExam@Ans@sq@l{%
+ \leavevmode\stepcounter{quizno}\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\alph{partno}\else
+ eqexam.\curr@quiz.\theeqquestionnoi\fi
+ }%
+ \ifx\eq@online y\relax
+ \makebox[0pt][l]{\radio@@Button{}{\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}%
+}
+\def\eqExam@Ans@sq@f{%
+ \stepcounter{quizno}\PBS\raggedright
+ \settowidth{\eq@tmplength}{\eq@lw@f}%
+ \eq@tmpdima=\wd\eq@tmpbox%
+ \hangindent=\eq@tmplength\hangafter=1\relax
+ \ifx\eq@online n\previewtrue
+ \Ans@sq@f@driver
+ \else
+ \edef\fieldName{%
+ \if\probstar*eqexam.\curr@quiz.\theeqquestionnoi.%
+ part\alph{partno}
+ \else
+ eqexam.\curr@quiz.\theeqquestionnoi
+ \fi
+ }\insertGrayLetters
+ \radio@@Button{}{\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
+ \Ans@proofing{\RadioFieldSize}%
+}
+\def\eqExam@Ans@ck@sq@l{%
+ \leavevmode\stepcounter{quizno}\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\alph{partno}.\alph{quizno}
+ \else
+ eqexam.\curr@quiz.\theeqquestionnoi.\alph{quizno}
+ \fi
+ }%
+ \ifx\eq@online y\relax
+ \makebox[0pt][l]{\check@@Box{}{\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
+ \def\@linkcolor{blue}%
+ \fi
+ \ifeq@nosolutions\def\@linkcolor{blue}\fi
+ \textcolor{\@linkcolor}{\makebox[\eq@tmpdima]{\link@@Content}}%
+ \Ans@proofing{\eq@tmpdima}%
+}
+\def\eqExam@Ans@ck@sq@f{%
+ \stepcounter{quizno}\PBS\raggedright
+ \settowidth{\eq@tmplength}{\eq@lw@f}%
+ \eq@tmpdima=\wd\eq@tmpbox%
+ \hangindent=\eq@tmplength\hangafter=1\relax
+ \ifx\eq@online n\previewtrue
+ \Ans@sq@f@driver
+ \else
+ \edef\fieldName{%
+ \if\probstar*eqexam.\curr@quiz.\theeqquestionnoi.%
+ part\alph{partno}.\alph{quizno}
+ \else
+ eqexam.\curr@quiz.\theeqquestionnoi.\alph{quizno}
+ \fi
+ }%
+ \check@@Box{}{\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
+ \Ans@proofing{\RadioFieldSize}%
+}
+\def\eqExamPriorVspace#1{\edef\fieldName{%
+ \if\probstar*eqexam.\curr@quiz.%
+ \theeqquestionnoi.part\alph{partno}.solution
+ \else
+ eqexam.\curr@quiz.\theeqquestionnoi.solution
+ \fi
+ }%
+ \nobreak\textField[\Ff\FfMultiline\BC{}]
+ {\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}}}
+ \ifx\eq@online y\relax
+ \newcounter{@cntfillin}
+ \let\eqPriorVspace=\eqExamPriorVspace
+ \fi
+}%
+{%
+ \input{eqalone.def}
+ \input{eqexam.def}
+ \def\eqexheader@wrapper{\makebox[0pt][r]{\eqexheader}}
+}
+% \end{macrocode}
+% We define the appearance of the \texttt{partno} counter, defined in \texttt{eqexam.def}
+% to include the question number and the part number. May be redefined.
+% \begin{macrocode}
+\renewcommand{\thepartno}{\theeqquestionnoi (\alph{partno})}
+\newcommand{\defaultthepartno}{%
+ \renewcommand{\thepartno}{\theeqquestionnoi (\alph{partno})}%
+}
+%</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
+% \texttt{exerquiz} has not been loaded.
+%
+% Many of the following definitions are given in \texttt{eqforms}, which was recently separated
+% from \texttt{exerquiz} and is now maintained as a separate package.
+% \begin{macrocode}
+\@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}
+% The macro \cs{include@solutions} is defined in \texttt{eqexam.def}
+% \begin{macrocode}
+\AtEndDocument{\include@solutions}
+% \end{macrocode}
+% When the \texttt{preview} option has been used, draw a frame box
+% around the bounding rectangle.
+% \begin{macrocode}
+\def\Bbox#1#2{\vbox{\hrule width #1
+ \hbox to#1{\vrule height#2\hfill\vrule height#2}\vfill\hrule}}
+% \end{macrocode}
+% \begin{macrocode}
+\def\Rect#1{\textcolor{\@linkcolor}{#1}}
+\def\ReturnTo#1#2{\eq@fititin{#2}}
+\newcommand{\proofingsymbol}[1]{%
+ \def\@proofingsymbol{\textcolor{\@proofingsymbolColor}{#1}}}
+\proofingsymbol{$\bullet$}
+% \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}
+% \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\Ans@sq@l@driver{%
+ \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
+ {\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}
+% We will right all solutions to the \texttt{.sol} auxiliary file.
+% \begin{macrocode}
+\let\quiz@solns=\ex@solns
+\def\writetoSolns#1{%
+ \immediate\write\quiz@solns{\string\goodbreak\noindent
+ \string\hspace*{-\string\oddsidemargin}%
+ \string\textbf{#1}\par\string\medskip}%
+}
+% \end{macrocode}
+% 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 \texttt{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}
+% \end{macrocode}
+% \subsection{Running Heads, \cs{maketitle} and Cover Pages}
+% We develop a series of macros for creating a running header for the exam, and a cover page, if
+% desired.
+%
+% \begin{macro}{\lhead}
+% \begin{macro}{\chead}
+% \begin{macro}{\rhead}
+% \begin{macro}{\runExamHeader}
+% \begin{macro}{\eqExamRunHead}
+% The running header of the exam, may be redefined.
+% \begin{macrocode}
+\newcommand{\lhead}[1]{\def\eq@lhead{#1}}
+\lhead{\shortwebsubject/\shortwebtitle}
+\newcommand{\chead}[1]{\def\eq@chead{#1}}
+\chead{-- Page \arabic{page}\space of \eq@ExamLastPage\space--}
+\newcommand{\rhead}[1]{\def\eq@rhead{#1}}
+\rhead{\eq@ExamName}
+\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}
+% \end{macro}
+% \end{macro}
+% \end{macro}
+% \begin{macro}{\lheadSol}
+% \begin{macro}{\cheadSol}
+% \begin{macro}{\rheadSol}
+% \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}\space of \eq@ExamLastPage\space--}
+\newcommand{\rheadSol}[1]{\def\eq@rheadSol{#1}}
+\rheadSol{SOLUTIONS}
+\newcommand\runExamHeaderSol
+ {\eq@lheadSol\hfill\eq@cheadSol\hfill\eq@rheadSol}
+\def\eqsolutionshook
+{%
+ \gdef\eqExamRunHead{\addtolength\textwidth{\oddsidemargin}%
+ \noindent\hspace*{-\oddsidemargin}\makebox[\textwidth]
+ {\runExamHeaderSol}}%
+}
+% \end{macrocode}
+% \end{macro}
+% \end{macro}
+% \end{macro}
+% \end{macro}
+% \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\maketitle
+{%
+ \begingroup
+ \addtolength\textwidth{\oddsidemargin}%
+ \noindent\hspace*{-\oddsidemargin}%
+ \raisebox{.7in}[0pt][0pt]{\SubmitButton}%
+ \maketitledesign
+ \endgroup
+}
+% \end{macrocode}
+% \end{macro}
+% \end{macro}
+% \end{macro}
+% \begin{macro}{\eqexcoverpage}
+% The \texttt{eqExam} package allows for the possibility of a cover page, if the \texttt{coverpage}
+% option is taken.
+% \begin{macrocode}
+\def\eqexcoverpage
+{%
+ \begingroup
+ \eqexcoverpagedesign
+ \endgroup\newpage
+}
+% \end{macrocode}
+% \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{coverpagesubject} 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}
+% \end{macrocode}
+% \end{macro}
+% \end{macro}
+% \end{macro}
+% \end{macro}
+% Now we present the definition of \cs{eqexcoverpagedesign}.
+% \begin{macrocode}
+\newcommand{\eqexcoverpagedesign}
+{%
+ \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}}\parindent0pt
+ \eq@ExamName\\[2ex]\eq@SID\\[2ex]
+ \ifx\use@email y\eq@Email\\[2ex]\fi
+ \textcolor{\webauthor@color}{\webauthor}, \@date\par\vfill
+}
+% \end{macrocode}
+% \end{macro}
+% 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 quiz, 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\probvalue#1#2{%
+ \addtocounter{eqpointvalue}{#1}%
+ \marginpoints{#1}{#2}%
+ \mark{\theeqpointvalue\csname eqExam\endcsname\theeq@numparts}%
+}
+% \end{macrocode}
+% \end{macro}
+% \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.
+% \begin{macrocode}
+\def\eqleftmarginbox#1#2{\makebox[0pt][r]{%
+ \setlength\tabcolsep{0pt}%
+ \raisebox{-.5\height}[0pt][0pt]{\parbox{\marginparwidth}{%
+ \tabcolsep=0pt\relax
+ \begin{tabular}{|c|}\hline
+ \vrule height15pt width0pt\\\hline
+ \makebox[\marginparwidth]{%
+ \marginpointsboxtext{#1}{#2}}\\\hline
+ \end{tabular}%
+ }}%
+ \hspace*{\oddsidemargin}\hspace*{\marginparsep}}%
+}
+% \end{macrocode}
+% \end{macro}
+% \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\eq@eachLabel{#1}}\eachLabel{ea.}
+\newcommand{\pointsLabel}[1]{%
+ \def\eq@pointsLabel{#1}}\pointsLabel{points}
+\newcommand{\pointLabel}[1]{%
+ \def\eq@pointLabel{#1}}\pointLabel{point}
+% \end{macrocode}
+% \end{macro}
+% \end{macro}
+% \end{macro}
+% \begin{macro}{\marginpointtext}
+% Creates the text for \cs{eqleftmargin} to use. Use can see from the macro,
+% if \texttt{\#2} is 0, then we write the points for the problem, else, we write
+% the points each for the problem.
+% \begin{macrocode}
+\newcommand\leftmarginPtsTxt[1]{(\small$#1^{\text{%
+ \ifnum#1=1\relax\eqptLabel\else\eqptsLabel\fi}}$)}
+\newcommand\leftmarginPtsEaTxt[1]{(\small$#1_{\text{%
+ \eq@eachLabel}}^{\text{\ifnum#1=1\relax
+ \eqptLabel\else\eqptsLabel\fi}}$)}
+\def\marginpointtext#1#2{\ifnum#2=0\leftmarginPtsTxt{#1}\else
+ \leftmarginPtsEaTxt{#2}\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.
+% \begin{macrocode}
+\def\eqleftmargin#1#2{\makebox[0pt][r]{\marginpointtext{#1}{#2}%
+ \hspace*{\oddsidemargin}\hspace*{\marginparsep}}%
+}
+% \end{macrocode}
+% \end{macro}
+% \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$#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{macrocode}
+\def\@insertPointsBoxPDF
+{
+ \def\fieldName{pointsgiven.\curr@quiz.page\thepage.%
+ \theeqquestionnoi}%
+ \calcTextField[\F\FHidden\BC{}\Q1\textColor{1 0 0 rg}]
+ {\fieldName}{\marginparwidth}{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}{\marginparwidth}{15pt}%
+}
+\ifx\use@email y
+ \let\insertPointsBoxPDF=\@insertPointsBoxPDF
+ \let\insertTotalsBoxPDF=\@insertTotalsBoxPDF
+\else
+ \let\insertPointsBoxPDF=\@empty
+ \let\insertTotalsBoxPDF=\@empty
+\fi
+\def\eqrightmarginbox#1#2{%
+ \makebox[0pt][l]{%
+ \setlength\tabcolsep{0pt}%
+ \hspace*{\textwidth}\hspace*{\marginparsep}%
+ \raisebox{-.5\height}[0pt][0pt]{%
+ \parbox{\marginparwidth}{%
+ \tabcolsep=0pt\relax
+ \begin{tabular}{|c|}\hline
+ \vrule height15pt width0pt\insertPointsBoxPDF\\\hline
+ \makebox[\marginparwidth]{%
+ \marginpointsboxtext{#1}{#2}}\\\hline
+ \end{tabular}%
+ }%
+ }\hfil
+ }%
+}
+\def\eqeomarginbox#1#2{%
+ \makebox[0pt][l]{%
+ \setlength\tabcolsep{0pt}%
+ \hspace*{\textwidth}\hspace*{\marginparsep}%
+ \raisebox{-.5\height}[0pt][0pt]{%
+ \parbox{\marginparwidth}{%
+ \tabcolsep=0pt\relax
+ \begin{tabular}{|c|}\hline
+ \vrule height15pt width0pt\insertTotalsBoxPDF\\\hline
+ \makebox[\marginparwidth]{%
+ \marginpointsboxtext{#1}{#2}}\\\hline
+ \end{tabular}%
+ }%
+ }\hfil
+ }%
+}
+\setbox\eq@pointbox=\hbox{%
+ \parbox{\marginparwidth}{%
+ \tabcolsep=0pt\relax
+ \begin{tabular}{|c|}\hline
+ \vrule height15pt width0pt\\\hline
+ \makebox[\marginparwidth]{%
+ \marginpointsboxtext{00}{0}}\\\hline
+ \end{tabular}%
+ }%
+}
+\setlength\eq@pointboxtotalheight{\dp\eq@pointbox+\ht\eq@pointbox}
+% \end{macrocode}
+% \end{macro}
+% 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 text 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 to 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{eqpointsfofar}, 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}%
+ \immediate\write\@auxout{\string\expandafter\string\gdef
+ \string\csname\space Page\thepage total\string\endcsname
+ {\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$\theeqpointsthispage\,\text{%
+ \ifnum\theeqpointsthispage=1\relax
+ \eqptLabel\else\eqptsLabel\fi}$}
+% \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\totalsboxleft{%
+ \makebox[0pt][r]{\setlength\tabcolsep{0pt}%
+ \raisebox{-\height-\marginparsep}[0pt][0pt]{%
+ \parbox{\marginparwidth}{%
+ \begin{tabular}{|c|}\hline
+ \vrule height15pt width0pt\insertTotalsBoxPDF\\\hline
+ \parbox{\marginparwidth}{%
+ \strut\centering\totalsboxtext\strut}\\\hline
+ \end{tabular}%
+ }}\hspace*{\oddsidemargin}\hspace*{\marginparsep}%
+ \hspace*{\parindent}}\hfil
+}
+\def\totalsboxright
+{%
+ \makebox[0pt][l]{\setlength\tabcolsep{0pt}%
+ \hspace*{\textwidth}\hspace*{\marginparsep}%
+ \raisebox{-\height-\marginparsep}[0pt][0pt]{%
+ \parbox{\marginparwidth}{%
+ \begin{tabular}{|c|}\hline
+ \vrule height15pt width0pt\insertTotalsBoxPDF\\\hline
+ \parbox{\marginparwidth}{%
+ \strut\centering\totalsboxtext\strut}\\\hline
+ \end{tabular}%
+ }%
+ }%
+ }\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}
+\AtBeginDocument{\mark{0\csname eqExam\endcsname0}}
+% \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{%
+ \immediate\write\@auxout{\string\expandafter\string\gdef
+ \string\csname\space NumberOfParts\string\endcsname
+ {\arabic{eq@numparts}}}%
+ \immediate\write\@auxout{\string\expandafter\string\gdef
+ \string\csname\space thePartNames\string\endcsname
+ {\the\partNames}}%
+ \clearpage\addtocounter{page}{-1}\writelastpage
+ \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}
+\def\theGrandTotal{%
+ \begingroup
+ \count0=0\relax
+ \def\\##1{\advance\count0by\csname##1total\endcsname}%
+ \csname thePartNames\endcsname
+ \xdef\eqeGrandTotal{\the\count0 }%
+ \endgroup
+ \csname eqeGrandTotal\endcsname
+}
+% \end{macrocode}
+% \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{%
+ \immediate\write\@auxout{\string\expandafter\string\gdef
+ \string\csname\space#1SaveTotalHere\string\endcsname
+ {\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
+ \setcountertotalHereCnt{-\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{ (\themarkerCnt\space points)}
+% \end{macrocode}
+% \end{macro}
+% \subsection{Useful Commands to Write Problems}
+% \begin{macrocode}
+\def\placeAtxy#1#2#3{%
+ \par\nointerlineskip
+ \ifeq@nosolutions\ifx\eq@insertverticalspace y%
+ \ifvmode
+ \makebox[0pt][l]{\hspace*{-\parindent}\hspace*{#1}%
+ \raisebox{#2}[0pt][0pt]{#3}}
+ \fi
+ \fi
+ \fi
+}
+\newsavebox{\workareasb}
+\newenvironment{workarea}[2][\linewidth]
+{%
+ \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}%
+% \par\nointerlineskip\vspace{-\baselineskip}%
+ \par\ifeq@nosolutions\ifx\eq@insertverticalspace y%
+ \vspace{-\baselineskip}\fi\fi%\nointerlineskip
+ \ifeq@nosolutions\ifx\eq@insertverticalspace y%
+ \if\currhideopt H\else
+ \noindent\strut\smash{\usebox{\workareasb}}%
+ \fi\fi\fi
+}
+% \end{macrocode}
+% \begin{environment}{splitsolution}
+% This is a special solution environment designed for use with the \texttt{online} or \texttt{email}
+% options.
+% \begin{macrocode}
+\newcommand\panelgap{3pt}
+\newsavebox{\eqpanelbox}
+\def\panelwidth{\the\wd\eqpanelbox}\def\panelheight{\the\ht\eqpanelbox}%
+\newcounter{panel@cnt}
+\newwrite\panel@write
+\let\usepanelwidth=\relax
+\makeatletter
+\newenvironment{panel}[2][l]
+{%
+ \gdef\ss@Argi{#1}\gdef\ss@Argiii{#2}% #1 r or l #2 width of panel
+ \stepcounter{panel@cnt}%
+ \immediate\openout \panel@write panel\thepanel@cnt.cut
+ % need to manage the h, H, and global overrides.
+ \if\currhideopt H%
+ \immediate\write\panel@write{\vfill}%
+ \immediate\closeout\panel@write
+ \gdef\ss@Argii{0pt}%
+ \else
+ \if\currhideopt h\ifeq@solutionsafter\else
+ \ifeq@globalshowsolutions\else
+ \immediate\write\panel@write{\vfill}%
+ \immediate\closeout\panel@write
+ \gdef\ss@Argii{0pt}%
+ \fi\fi
+ \fi
+ \fi
+ \begingroup
+ \let\verbatim@out=\panel@write
+ \verbatimwrite
+}
+{%
+ \endverbatimwrite
+ \immediate\closeout\panel@write
+ \endgroup
+ \xdef\mp@Width{\ifeq@solutionsafter\noexpand\linewidth
+ \else\noexpand\linewidth-\ss@Argiii-\panelgap\fi}%
+}
+\long\def\eqe@IW#1{%
+ \ifeq@solutionsafter
+ \let\eq@next=\@empty
+ \else
+ \def\eq@next{\immediate\write\verbatim@out{#1}}%
+ \ifeq@nosolutions\else
+ \if\currhideopt H%
+ \gdef\ss@Argii{0pt}\let\eq@next=\@empty
+ \else
+ \if\currhideopt h%
+ \ifeq@globalshowsolutions\else
+ \gdef\ss@Argii{0pt}\let\eq@next=\@empty
+ \fi
+ \fi
+ \fi
+ \fi
+ \fi
+ \eq@next
+}
+\newenvironment{@ssSolution}[1][\ss@Argii]%
+{%
+ \xdef\eqe@depth{\ifeq@nosolutions\ss@Argii\else
+ \ifeq@solutionsafter\ss@Argii\else0pt\fi\fi}%
+ \xdef\mp@Width{\ifeq@solutionsafter\noexpand\linewidth\else
+ \noexpand\linewidth-\ss@Argiii-\panelgap\fi}%
+ \if\ss@Argi l%
+ \ifeq@solutionsafter
+ \def\eqe@lPanel{\parbox[b][\eqe@depth][t]{\ss@Argiii}
+ {\input{panel\thepanel@cnt.cut}\vfill}\hfill}%
+ \def\eqe@rPanel{\@empty}%
+ \else
+ \def\eqe@lPanel{\string\parbox[b][\string\eqe@depth]%
+ {\ss@Argiii}%
+ {\string\input{panel\thepanel@cnt.cut}\vfill}\hfill^^J}%
+ \def\eqe@rPanel{\@empty}%
+ \fi
+ \else
+ \ifeq@solutionsafter
+ \def\eqe@lPanel{\@empty}%
+ \def\eqe@rPanel{\hfill\parbox[b][\eqe@depth][t]{\ss@Argiii}
+ {\hfill\input{panel\thepanel@cnt.cut}\vfill}}%
+ \else
+ \def\eqe@lPanel{\@empty}%
+ \def\eqe@rPanel{\hfill\string\parbox[b][\string\eqe@depth]%
+ {\ss@Argiii}%
+ {\endgraf\string\noindent\hfill%
+ \string\input{panel\thepanel@cnt.cut}\vfill}}%
+ \fi
+ \fi
+ \let\verbatim@out=\ex@solns
+ \par\ifeq@solutionsafter\smallskip\fi\noindent\minipage{\linewidth}%
+ \if\ss@Argi l\noindent\parbox[b][\eqe@depth][t]{\ss@Argiii}%
+ {\vfill}\hfill\fi
+ \minipage[b][\eqe@depth][t]{\mp@Width}%
+ {\lccode`C=`\%\lowercase{\eqe@IW{\def\string\panelgap{\panelgap}%
+ \edef\string\eqe@depth
+ {\ifeq@nosolutions\ss@Argii\else\ss@Argii\fi}C}}}%
+ {\lccode`C=`\%\lowercase{\eqe@IW{%
+ \string\strut\string\par\string\nobreak\string\noindent%
+ \string\hbox\space to\string\linewidth\bgroup^^J%
+ \eqe@lPanel\string\minipage[b][\string\eqe@depth][t]%
+ {\string\linewidth-\ss@Argiii-\panelgap}C
+ }}}%
+ \ifeq@solutionsafter
+ \noindent\strut\hbox to\linewidth\bgroup
+ \eqe@lPanel
+ \minipage[b][\eqe@depth][t]{\linewidth-\ss@Argiii-\panelgap}%
+ \def\solutionsafterSkip{}%
+ \fi
+ \@sssolution[#1]%
+}{%
+ \eqe@IW{\noexpand\endminipage\eqe@rPanel\egroup}%
+ \ifeq@solutionsafter\endminipage\eqe@rPanel\egroup\fi
+ \end@sssolution
+ \endminipage\endminipage
+}
+\newenvironment{splitsolution}[1] % #1 depth
+{%
+ \gdef\ss@Argii{#1}%
+ \let\@sssolution = \solution
+ \let\end@sssolution = \endsolution
+ \let\solution = \@ssSolution
+ \let\endsolution = \end@ssSolution
+ \par\noindent\ignorespaces
+}{%
+ \ifeq@solutionsafter\strut\par\fi
+ \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]{\eqe@depth}%
+ \eqe@workfill\input{panel\thepanel@cnt.cut}%
+ \end{workarea}
+ \strut\par
+}
+% \end{macrocode}
+% \end{environment}
+% 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}
+\newenvironment{instructions}[1][\eq@default@Instructions]
+{%
+ \leftskip-\oddsidemargin \rightskip-\evensidemargin
+ \def\eq@argi{#1}%
+ \paragraph*{\textcolor{\@instructionsColor}{#1}\normalcolor%
+ \ifx\eq@nosummarytotals y\else\ifx\eq@argi\@empty\else\ \fi
+ {\normalfont\summaryTotalsTxt}\ \fi}\hskip-\lastskip
+ \ifx\eq@nosummarytotals y\ifx\eq@argi\@empty\else\ \fi\fi
+ \ignorespaces
+}{\par\vskip\medskipamount}
+\newcommand\summaryPointTotal{\csname\thisexamlabel total\endcsname}
+\newcommand\summaryTotalsTxt{($\summaryPointTotal\,\text{%
+ \@ifundefined{\thisexamlabel total}{\eq@pointsLabel}%
+ {\ifnum\summaryPointTotal=1\relax
+ \eq@pointLabel\else\eq@pointsLabel\fi}}$)}
+% \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}
+ \renewcommand\theHquizno{%
+ \if\probstar*\curr@quiz.%
+ \theeqquestionnoi.part\alph{partno}.\arabic{quizno}%
+ \else
+ \curr@quiz.%
+ \theeqquestionnoi.\arabic{quizno}%
+ \fi
+ }
+\fi
+% \end{macrocode}
+% \begin{environment}{eqComments}
+% Often, I want to make additional instructions between problems, you can use
+% this comment environment.
+% \begin{macrocode}
+\newenvironment{eqComments}[1][\strut]
+{%
+ \removelastskip\removelastskip
+ \vskip\medskipamount\leftskip-\oddsidemargin
+ \rightskip-\evensidemargin
+ \noindent\textbf{\textcolor{\@eqCommentsColor}{#1}}%
+}{%
+ \vskip\medskipamount
+}
+% \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}
+\def\exambegdef
+{%
+ \csname\thisexamlabel pagemark\endcsname
+ \expandafter
+ \ifx\csname\thisexamlabel pageno\endcsname\relax
+ \else
+ \expandafter
+ \ifx\csname pagenofirstprob\thisexamlabel\endcsname\relax
+ \else
+ \ifnum\csname\thisexamlabel pageno\endcsname
+ <\csname pagenofirstprob\thisexamlabel\endcsname
+ \else
+ \expandafter
+ \ifx\csname\thisexamlabel pagemark\endcsname\relax
+ \else
+ \ifnum\value{page}=%
+ \csname\thisexamlabel pageno\endcsname
+ \immediate\write\@auxout{%
+ \string\expandafter\string\gdef
+ \string\csname\space
+ \thisexamlabel pagemark\string\endcsname
+ {\string\newpage}}%
+ \fi
+ \fi
+ \fi
+ \fi
+ \fi
+ \setcounter{eqquestionnoi}{0}%
+ \setcounter{eqpointvalue}{0}%
+ \setcounter{eqpointsofar}{0}%
+ \setcounter{eqpointsthispage}{0}%
+ \setcounter{eq@count}{0}%
+ \stepcounter{eq@numparts}%
+ \immediate\write\@auxout{\string\expandafter\string\gdef
+ \string\csname\space\thisexamlabel pageno\string\endcsname
+ {\thepage}}%
+ \let\sq@priorhook=\@empty
+ \settowidth{\labelwidth}{\normalfont\bfseries00.\ }%
+}
+% \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\examenddef
+{%
+ \expandafter\ifx\csname NumberOfParts\endcsname\relax
+ \else
+ \ifnum\value{eq@numparts}<\NumberOfParts
+ \setcounter{eq@count}{\value{eqpointvalue}}%
+ \addtocounter{eq@count}{-\value{eqpointsofar}}%
+ \ifx\eq@parttotals y\relax
+% \makeRoomForProb{0pt}{1}%
+% \end{macrocode}
+% See if there is enough room at the bottom of the page to place the end of exam
+% totals, if not, forget it, and start a new page.
+% \begin{macrocode}
+ \@actionsAtPageBreak{\global\let\@spacetobreak1}
+ {\global\let\@spacetobreak0}%
+ \ifx\@spacetobreak0\relax
+ \bgroup\@tempdima=\pagetotal
+ \advance\@tempdima32pt\relax
+ \ifdim\@tempdima>\pagegoal\aftergroup\newpage
+ \else
+ \ifnum\arabic{eq@count}>0
+ \ifx\@reportpoints1\else\@checkSpacing\fi
+ \raisebox{0pt}[0pt][0pt]{%
+ \hspace*{-\parindent}%
+ \textcolor{blue}{\eqeomarginbox
+ {\arabic{eq@count}}{0}}}%
+ \fi
+ \ifx\eqx@separationrule y\separationrule\fi
+ \fi\egroup
+ \fi
+ \else\ifx\eqx@separationrule y\separationrule\fi
+ \fi
+ \fi
+ \fi
+ \writetotalstoaux
+ \writelastpage
+}
+\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]%
+ {\centering\rule{.67\linewidth}{.4pt}}}
+% \end{macrocode}
+% \end{macro}
+% \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}
+\def\fvsizeskip#1{\def\@fvsizeskip{#1}}
+\newenvironment{exam}[2][\@empty]
+{%
+ \makeRoomForProb{\@fvsizeskip\vsize}{0}%
+ \xdef\@fvsizeskip{\default@fvsizeskip}%
+ \gdef\thisexamlabel{#2}\gdef\curr@quiz{#2}%
+ \edef\eq@tmp{\the\partNames}%
+ \global\partNames=\expandafter{\eq@tmp\\{#2}}%
+ \expandafter\ifx\csname NumberOfParts\endcsname\relax\else
+ \ifnum\csname NumberOfParts\endcsname=1\else
+ \ifx#1\@empty\writetoSolns{#2}\else\writetoSolns{#1}\fi\fi\fi
+ \exambegdef
+ \expandafter\shortquiz\sqstar[#2]%
+}{%
+ \examenddef
+ \endshortquiz
+}
+% \end{macrocode}
+% \end{environment}
+% \begin{macrocode}
+\def\writetotalstoaux{%
+ \immediate\write\@auxout{\string\expandafter\string\gdef
+ \string\csname\space\thisexamlabel total\string\endcsname
+ {\theeqpointvalue}}%
+}
+\def\writelastpage{%
+ \immediate\write\@auxout{\string\expandafter\string\gdef
+ \string\csname\space eqExamLastPage\string\endcsname{\arabic{page}}}%
+}
+\def\exlabel{}
+\def\sqlabel{}
+\def\exsolafter{\textit{Solution}:}
+\def\sqsolafter{\textit{Solution}:}
+\def\exlabelformat{\textbf{\theeqquestionnoi.\ }}
+\def\exlabelformatwp{\exlabelformat}%
+\def\exsllabelformat
+ {\string\llap{\string\textbf{\theeqquestionnoi.\ }}}
+\def\exsllabelformatwp{\string\llap{%
+ \string\textbf{\theeqquestionnoi.\ }}\eq@partsformat\ }%
+\ifeq@solutionsafter
+ \def\exrtnlabelformat{}
+ \def\exrtnlabelformatwp{}
+ \def\eq@sqslrtnlabel{}
+\else
+ \def\exrtnlabelformat{$\square$}
+ \def\exrtnlabelformatwp{$\square$}
+ \def\eq@sqslrtnlabel{$\square$}
+\fi
+\def\sqslrtnlabel{\eq@sqslrtnlabel}
+\def\exsectitle{\normalsize\hspace*
+ {-\oddsidemargin}Solutions to \webtitle}
+\def\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{\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}{}{%
+ \ifx\eq@online y\relax
+ \ifeq@nosolutions
+ \ifeq@solutionsafter\else
+ \ifx\eq@insertverticalspace y\relax
+ \stepcounter{@cntfillin}%
+ \edef\fieldName{%
+ \if\probstar*eqexam.\curr@quiz.fillin.%
+ \theeqquestionnoi.part\alph{partno}.%
+ fi\the@cntfillin
+ \else
+ eqexam.\curr@quiz.fillin.%
+ \theeqquestionnoi.fi\the@cntfillin
+ \fi
+ }\makebox[0pt][r]{\textField[\BC{}]{%
+ \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\TF[1]{\fillin{30pt}{#1}}
+\newcommand\defaultTFwidth{30pt}
+\newcommand\TF[2][\defaultTFwidth]{%
+ \def\eq@next{\fillin{#1}{#2}}%
+ \ifdim\eq@extralabelsep=0pt\relax\else
+ \if\probstar*\relax\if\exerwparts@cols x
+ \def\eq@next{\makebox[0pt][r]{%
+ \fillin{#1}{#2}}\ignorespaces}%
+ \fi\fi\fi
+\eq@next}
+\def\fillinWidth#1{%
+ \if\probstar*
+ \settowidth{\eq@tmplengthA}{\normalfont\ }%
+ \addtolength{\eq@tmplengthA}{#1}%
+ \edef\eq@extralabelsep{\the\eq@tmplengthA}%
+ \fi
+}
+% \end{macrocode}
+% \end{macro}
+% \begin{macro}{\Do..\of..}
+% 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\makeDoNum#1{\xdef\nDoNum{#1}%
+ \xdef\DoNum{\ifcase#1??\or one\or two\or three\or
+ four\or five\or six\or seven\or eight\or nine\or ten\fi}}
+\def\makeOutOfNum#1{\xdef\nOutOfNum{#1}%
+ \xdef\OutOfNum{\ifcase#1??\or one\or two\or three\or
+ four\or five\or six\or seven\or eight\or nine\or ten\fi}}
+% \end{macrocode}
+% \end{macro}
+% \begin{macrocode}
+\def\prob@Arg#1ea#2\end{\def\argi{#1}\def\argii{#2}}
+\def\makeRoomForProb#1#2{%
+ \bgroup\@nobreakfalse\addpenalty{-500}%
+ \@tempdima \pagegoal \advance \@tempdima -\pagetotal
+ \ifdim \@tempdima < #1 \newpage\fi \egroup
+ \ifx1#2\ifnum\@reportpoints>1 \@checkSpacing\fi\fi
+}
+\def\@checkSpacing{\bgroup
+%\typeout{\theeqquestionnoi : \the\pagetotal}%
+ \@tempdima = \lastPageTotal
+ \@tempdimb = \pagetotal
+ \ifdim\@tempdima < \@tempdimb
+ \advance\@tempdimb by-\@tempdima
+% \typeout{difference: \the\@tempdimb}
+% \ifdim\@tempdimb < 36pt\relax
+% \@tempdima = 39pt\relax
+ \ifdim\@tempdimb < \eq@pointboxtotalheight
+ \@tempdima=\eq@pointboxtotalheight
+ \advance\@tempdima3pt\relax
+ \advance\@tempdima by-\@tempdimb
+ \vspace*{\@tempdima}%
+%\typeout{\theeqquestionnoi : issuing vspace}%
+ \fi
+ \fi
+\egroup}
+\def\default@nbaselineskip{6}
+\edef\@nbaselineskip{\default@nbaselineskip}
+\def\nbaselineskip#1{\def\@nbaselineskip{#1}}
+% \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}
+\newenvironment{problem}[1][]{%
+ \makeRoomForProb{\@nbaselineskip\baselineskip}{1}%
+ \xdef\@nbaselineskip{\default@nbaselineskip}%
+ \gdef\probstar{x}%
+ \let\afterlabelhskip=\@empty
+ \ifx\marginpoints\@empty
+ \else
+ \def\numpoints{#1}%
+ \ifx\numpoints\@empty
+ \let\marginpoints\@empty
+ \else
+ \def\marginparpriorhook{\noindent\probvalue{#1}{0}}%
+ \fi
+ \fi
+ \setcounter{eq@count}{\value{eqquestionnoi}}%
+ \addtocounter{eq@count}{1}%
+ \ifnum\value{eq@count}=1\relax
+ \immediate\write\@auxout{\string\expandafter\string\gdef\string
+ \csname\space pagenofirstprob\thisexamlabel\string\endcsname
+ {\thepage}}%
+ \fi
+ \proofingsymbol{\ding{52}}%
+% \renewcommand\proofingsymbol
+% {\textcolor{\@proofingsymbolColor}{\ding{52}}}%
+ \begin{exercise}[eqquestionnoi]%
+}{\end{exercise}%
+ \ifeqlocalversion\ifeqglobalversion
+ \xdef\eqe@tmp{\noexpand\forVersion{\eq@selectedVersion}}%
+ \aftergroup\eqe@tmp
+ \fi\fi
+ \global\eqlocalversionfalse
+}
+% \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]{$#1\,\text{%
+ \ifnum#1=1\relax\eqptLabel\else\eqptsLabel\fi}$}
+\newcommand{\itemPTsFormated}[1]{(#1)}
+\def\PTs{\@ifstar{\@PTs{*}}{\@PTs{x}}}
+\def\@PTs#1#2{%
+ \if\@reportpoints0\else
+ \addtocounter{eq@count}{#2}\if#1*\else
+ \itemPTsFormated{\itemPTsTxt{#2}}\fi
+ \fi
+}
+% \end{macrocode}
+% \end{macro}
+% \end{macro}
+% \end{macro}
+% \begin{macrocode}
+\let\auto=\relax
+\def\isItD@{\@ifnextchar\Do{\let\yest@D@=y\y@st@Do}
+ {\let\yest@D@=n\@gobblet@end}}
+\let\yest@D@=n
+\def\y@st@Do\Do#1\end{\gdef\D@Num{#1}}
+\def\@gobblet@end#1\end{}
+% \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.
+% \begin{macrocode}
+\expandafter\def\csname problem*\endcsname{%
+ \@ifnextchar[{\pr@bl@m@star}{\pr@bl@m@star[\@empty]}}
+\def\pr@bl@m@star[#1]{%
+ \@ifnextchar[{\pr@blem@star{#1}}{\pr@blem@star{#1}[\@empty]}}
+\def\pr@blem@star#1[#2]{%
+ \makeRoomForProb{\@nbaselineskip\baselineskip}{1}%
+ \xdef\@nbaselineskip{\default@nbaselineskip}%
+ \proofingsymbol{\ding{52}}%
+ \gdef\probstar{*}%
+ \gdef\pr@b@secondarg{#2}%
+ \setcounter{eq@count}{0}%
+ \let\afterlabelhskip=\@empty
+ \global\let\probpointseach=\@empty
+ \ifx#1\auto\global\let\probpointseach\relax
+ \def\@next{\autocalcparts}%
+ \else
+ \ifx#2\@empty\else
+ \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
+ \def\@next{\manualcalcparts{#1}}%
+ \fi\@next
+ \begin{exercise}[eqquestionnoi]*}%
+\expandafter\def\csname endproblem*\endcsname{%
+ \immediate\write\@auxout{\string\expandafter\string\gdef\string
+ \csname\space nPartsThisProb\thisexamlabel.\theeqquestionnoi
+ \string\endcsname{\arabic{partno}}}%
+ \ifx\probpointseach\@empty\else
+ \ifx\probpointseach\auto
+ \immediate\write\@auxout{%
+ \string\expandafter\string\gdef\string
+ \csname\space prob\thisexamlabel.\theeqquestionnoi
+ \string\endcsname{\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
+ \ifx\yest@D@ y
+ \immediate\write\@auxout{%
+ \string\expandafter\string\gdef\string
+ \csname\space DoNumThisProb\thisexamlabel.%
+ \theeqquestionnoi\string\endcsname{\D@Num}}%
+ \@tempcnta = \value{eq@count}%
+ \advance\@tempcnta -\D@Num
+ \global\advance\value{eq@count}-\@tempcnta
+ \fi
+ \egroup
+ \fi
+ \multiply\value{eq@count}\argi
+ \immediate\write\@auxout{%
+ \string\expandafter\string\gdef\string
+ \csname\space prob\thisexamlabel.\theeqquestionnoi
+ \string\endcsname{\theeq@count}}%
+ \fi\fi
+ \end{exercise}%
+ \ifeqlocalversion\ifeqglobalversion
+ \xdef\eqe@tmp{\noexpand\forVersion{\eq@selectedVersion}}%
+ \aftergroup\eqe@tmp
+ \fi\fi
+ \global\eqlocalversionfalse
+}
+% \end{macrocode}
+% \end{environment}
+% \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}
+\def\pushProblem{\xdef\nlastItem{\arabic{partno}}\end{parts}}
+\def\popProblem{\begin{parts}\setcounter{partno}{\nlastItem}}
+% \end{macrocode}
+% \end{macro}
+% \end{macro}
+% \begin{macrocode}
+\def\lastPageTotal{0pt}
+\def\marginparafterhook{\xdef\lastPageTotal{\the\pagetotal}}
+\def\manualcalcparts#1{%
+ \expandafter\prob@Arg#1ea\end
+ \ifx\argii\@empty\def\numpoints{#1}%
+ \else
+ \gdef\probpointseach{x}%
+ \setcounter{eq@count}{\value{eqquestionnoi}}%
+ \addtocounter{eq@count}{1}%
+ \expandafter
+ \ifx\csname prob\thisexamlabel.\theeq@count\endcsname\relax
+ \def\numpoints{\argi}%
+ \else
+ \def\numpoints{\expandafter
+ \csname prob\thisexamlabel.\theeqquestionnoi\endcsname}%
+ \fi
+ \fi
+ \ifx\marginpoints\@empty
+ % no points for this problem specified
+ \else
+ \ifx\argi\@empty
+ \let\marginpoints\@empty
+ \else
+ \ifx\argii\@empty
+ \ifx\marginpoints\@empty\else
+ \def\marginparpriorhook{%
+ \noindent\probvalue{\numpoints}{0}%
+ }%
+ \fi
+ \else
+ \ifx\marginpoints\@empty\else
+ \def\marginparpriorhook{%
+ \noindent\probvalue{\numpoints}{\argi}%
+ }%
+ \fi
+ \fi
+ \fi
+ \fi
+ \ifnum\value{eq@count}=1\relax
+ \immediate\write\@auxout{\string\expandafter\string\gdef\string
+ \csname\space pagenofirstprob\thisexamlabel\string\endcsname
+ {\thepage}}%
+ \else
+ \goodbreak
+ \fi
+}
+\def\autocalcparts{%
+ \setcounter{eq@count}{\value{eqquestionnoi}}%
+ \addtocounter{eq@count}{1}%
+ \expandafter
+ \ifx\csname prob\thisexamlabel.\theeq@count\endcsname\relax
+ \def\numpoints{0}% assume zero points until we get the total
+ \else
+ \edef\numpoints{\expandafter
+ \csname prob\thisexamlabel.\theeq@count\endcsname}%
+ \fi
+ \ifx\marginpoints\@empty\else
+ \def\marginparpriorhook{\noindent\probvalue{\numpoints}{0}}%
+ \fi
+ \setcounter{eq@count}{0}%
+}
+% \end{macrocode}
+% \begin{macro}{\forproblem}
+% \begin{macro}{\foritem}
+% 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}
+% }
+% \begin{macrocode}
+\newcommand{\forproblem}[1]{\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}[1]{%
+ \setcounter{partno}{0}%
+ \lowercase{\def\eq@selectedItem{#1}}%
+ \let\eq@initLoop=0
+ \loop
+ \stepcounter{partno}%
+ \expandafter\if\alph{partno}\eq@selectedItem
+ \let\eq@initLoop=1
+ \fi
+ \if\eq@initLoop0\repeat
+ \addtocounter{partno}{-1}%
+ \item
+}
+% \end{macrocode}
+% \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{\space(the cover page)}
+\newcommand\OnBackOfPage[1][\bopText]{%
+ \refstepcounter{backofpage}\label{bop\thebackofpage}
+ \begingroup
+ \expandafter\ifx\csname r@bop\thebackofpage\endcsname\relax
+ \def\boPage{??}%
+ \else
+ \edef\temp{\csname r@bop\thebackofpage\endcsname}%
+ \ifx\hyper@anchor\@undefined
+ \edef\boPage{\expandafter\@secondoftwo\temp}%
+ \else
+ \edef\boPage{\expandafter\@secondoffive\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
+ \expandafter\ifnum\value{eq@count}=0\relax
+ 1%
+ \else
+ {\theeq@count}%
+ \fi
+ \else
+ \ifnum\value{eq@count}=1\relax
+ {\theeq@count}\bopCoverPageText
+ \else
+ {\theeq@count}%
+ \fi
+ \fi
+ }%
+ \fi
+ #1%
+ \endgroup
+}
+% \end{macrocode}
+% \end{macro}
+% \begin{macrocode}
+\pagestyle{eqExamheadings}
+% \end{macrocode}
+% \newpage
+% \subsection{\texttt{xkeyval} Extensions}
+%
+% We load this material if \texttt{xkeyval} exists, and if the document author has specified
+% the \texttt{usexkv} option.
+%
+% \begin{macrocode}
+\IfFileExists{xkeyval}{%
+ \if\eq@usexkeys y\RequirePackage{xkeyval}\else
+ \endinput\fi}{\endinput}
+% \end{macrocode}
+% We redefine selected commands if the user has \texttt{xkeyval}.
+%\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}
+% \DescribeMacro{underline}\DescribeMacro{u}\DescribeMacro{b}
+% \DescribeMacro{boxed}\DescribeMacro{boxpretext}\DescribeMacro{boxsize}
+% \DescribeMacro{align}\DescribeMacro{color}\DescribeMacro{format}
+% Below are the \texttt{xkeyval} definitions of the keys recognized by \texttt{fillin}.
+% \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
+\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}[red]{\def\eq@fillin@color{#1}}
+\define@choicekey+{eqFillin}{align}{l,r,c}[c]{%
+ \def\eq@eqFillin@align{#1}}{%
+ \PackageWarning{eqexam}{Bad choice for align, permissible values
+ are l, r, and c. Try again}}
+\define@key{eqFillin}{format}[\bfseries]{\def\eq@fillin@format{#1}}
+% \end{macrocode}
+% \begin{macro}{\fillin}
+% I've re-worked \cs{fillin} to have \texttt{xkeyval} in the optional first parameter.
+% The syntax is illustrated above.
+% \begin{macrocode}
+\renewcommand{\fillin}[3][]{\begingroup%
+ \setkeys{eqFillin}{boxsize,underline=false,boxed=false,%
+ boxpretext,color,align,format}%
+ \protected@edef\eq@temp@exp{\noexpand\setkeys{eqFillin}{#1}}%
+ \eq@temp@exp
+ \ifKV@eqFillin@underline\let\@fillinFmt\underbar
+ \else\let\@fillinFmt\relax\fi
+ \ifeq@proofing
+ \ifKV@eqFillin@boxed
+ \ensuremath{\boxed{\eq@eqFillin@boxsize\eq@fillintext
+ \@fillinFmt{\makebox[#2][\eq@eqFillin@align]{%
+ \strut\eq@fillin@format\color{\eq@fillin@color}%
+ \ensuremath{#3}}}}}%
+ \else
+ \ifmmode\let\@eqmath\ensuremath\else\let\@eqmath\relax\fi
+ \@fillinFmt{\makebox[#2][\eq@eqFillin@align]{%
+ \strut\eq@fillin@format\color{\eq@fillin@color}%
+ \@eqmath{#3}}}%
+ \fi
+ \else
+ \ifKV@eqFillin@boxed
+ \ensuremath{\boxed{\eq@eqFillin@boxsize\eq@fillintext
+ \@fillinFmt{\makebox[#2]{\strut\hfil}}}}%
+ \else
+ \@fillinFmt{\makebox[#2]{\strut\hfil}}%
+ \fi
+ \@ifundefined{@quiz}{}{%
+ \ifx\eq@online y\relax
+ \ifeq@nosolutions
+ \ifeq@solutionsafter\else
+ \ifx\eq@insertverticalspace y\relax
+ \stepcounter{@cntfillin}%
+ \edef\fieldName{%
+ \if\probstar*eqexam.\curr@quiz.fillin.%
+ \theeqquestionnoi.part\alph{partno}.%
+ fi\the@cntfillin
+ \else
+ eqexam.\curr@quiz.fillin.%
+ \theeqquestionnoi.fi\the@cntfillin
+ \fi
+ }\makebox[0pt][r]{\textField[\BC{}]{%
+ \fieldName}{#2}{11bp}}%
+ \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\eq@next{\fillin[underline]{#1}{#2}}%
+ \ifdim\eq@extralabelsep=0pt\relax\else
+ \if\probstar*\relax\if\exerwparts@cols x
+ \def\eq@next{\makebox[0pt][r]{%
+ \fillin[underline]{#1}{#2}}\ignorespaces}%
+ \fi\fi\fi
+\eq@next}
+% \end{macrocode}
+% \end{macro}
+% \begin{macrocode}
+%</package>
+% \end{macrocode}
+\endinput
diff --git a/Master/texmf-dist/source/latex/eqexam/eqexam.ins b/Master/texmf-dist/source/latex/eqexam/eqexam.ins
new file mode 100644
index 00000000000..3abfe28968c
--- /dev/null
+++ b/Master/texmf-dist/source/latex/eqexam/eqexam.ins
@@ -0,0 +1,63 @@
+%%
+%% 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
+%\askonceonly
+%\usedir{tex/latex/hyperref}
+%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
+
+\preamble
+\endpreamble
+
+\generate{%
+ \file{eqexam.sty}{\from{eqexam.dtx}{copyright,package}}
+ \file{eqalone.def}{\from{eqexam.dtx}{copyright,standalone}}
+ \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