%%
%% This is file `eqexam.def',
%% generated with the docstrip utility.
%%
%% The original source files were:
%%
%% exerquiz.dtx  (with options: `eqexam')
%% 
\ProvidesFile{eqexam.def}
 [2014/11/05 v7.0 %
  Exerquiz support file for eqexam (dps)]
\let\eq@YES=y \let\eq@NO=n
\let\eq@One=1 \let\eq@Zero=0
\newif\ifeq@noforms \eq@noformsfalse
\newif\ifeq@noquizsolutions \eq@noquizsolutionsfalse % dps new
\newif\ifnocorrections \nocorrectionsfalse
\newif\ifkeepdeclaredvspacing \keepdeclaredvspacingfalse
\newif\ifeq@nolink \eq@nolinkfalse
\def\eq@ckglobalhide{\ifeq@globalshowsolutions\eq@hidesolutionfalse\fi}
\def\hidesymbol{h}\def\Hidesymbol{H}
\newif\iftherearesolutions \therearesolutionsfalse
\newif\ifIsRespBox \global\IsRespBoxfalse
\def\SolutionsAfter{\eq@solutionsaftertrue\eq@nolinktrue}
\def\SolutionsAtEnd{\eq@solutionsafterfalse\eq@nolinkfalse}
\def\NoSpaceToWork{\let\eq@insertverticalspace\eq@NO}
\def\SpaceToWork{\let\eq@insertverticalspace\eq@YES}
\SpaceToWork
\def\ifNoSolutions#1#2{%
    \ifeq@nosolutions\expandafter#1\else
    \expandafter#2\fi
}
\newif\ifeq@randomizeChoices \eq@randomizeChoicesfalse
\newif\ifeq@randomizeallChoices \eq@randomizeallChoicesfalse
\def\turnOnRandomize{\eq@randomizeallChoicestrue}
\def\obeyLocalRandomize{\eq@randomizeallChoicesfalse}
\let\saveRandomSeed\relax
\let\inputRandomSeed\relax
\newcommand{\exsolafter}{\eq@exsolafterDefault}
\newcommand{\resetSolnAfterToDefault}{%
    \def\exsolafter{\eq@exsolafterDefault}}
\newcommand{\exsolafterDefault}[1]{\def\eq@exsolafterDefault{#1}%
    \def\exSolafterDefault{#1}\resetSolnAfterToDefault}
\exsolafterDefault{\textit{Solution}:}
\newcommand{\renameSolnAfterTo}[1]{\def\exsolafter{#1}}
\def\adjDisplayBelow{%
    \vskip-\lastskip\vskip-\baselineskip}
\newcommand\setDefShortQuizLabelName[1]%
    {\def\eq@defaultShortQuizLabelName{#1}}
\setDefShortQuizLabelName{Quiz}
\ifsolutionsonly
\InputIfFileExists{\jobname_xdefs.cut}{%
    \typeout{^^JExerquiz|Eqexam: Reading \jobname_xdefs.cut^^J}}
    {\PackageWarningNoLine{exerquiz|eqexam}{%
    \jobname_xdefs.cut not found.\MessageBreak
     Recompile file under the vspacewithsolns\MessageBreak
     option, then compile with the solutionsonly\MessageBreak
     option}}
\else
\newwrite\ex@solns \immediate\openout \ex@solns \jobname.sol
\newcommand{\writeToExSolns}[1]{%
    \set@display@protect
    \immediate\write\ex@solns{#1}%
    \set@typeset@protect
}
\newwrite\eq@xrefdefns \immediate\openout\eq@xrefdefns\jobname_xdefs.cut
\fi
\newwrite\quiz@solns \immediate\openout \quiz@solns \jobname.qsl
\newcommand{\writeToQzSolns}[1]{%
    \set@display@protect
    \immediate\write\quiz@solns{#1}%
    \set@typeset@protect
}
\def\eq@IWAuxOut#1{\immediate\write\@auxout{#1}}
\def\eq@IWDefs#1{\immediate\write\eq@xrefdefns{#1}}
\newcounter{eqexno} \setcounter{eqexno}{0}
\newcounter{@exno} \setcounter{@exno}{0}  % running exno
\newcounter{quizno} \setcounter{quizno}{0}
\renewcommand\thequizno{\alph{quizno}}
\newcounter{eqpointvalue} \setcounter{eqpointvalue}{0}
\newlength\eq@tmplength
\newlength\eqtmplength
\newcounter{questionno}
\newcounter{eqquestionnoi}
\newcounter{eqquestionnoii}
\newcounter{eqquestionnoiii}
\newcount\@eqquestiondepth \@eqquestiondepth=0
\newcounter{partno}
\renewcommand\thepartno{\alph{partno}}
\newtoks\eq@scratchtoks
\def\verbatimwrite{\@bsphack
  \let\do\@makeother\dospecials
  \catcode`\^^M\active \catcode`\^^I=12
  \def\verbatim@processline{%
    \immediate\write\verbatim@out
      {\the\verbatim@line}}%
  \verbatim@start}
\def\endverbatimwrite{\@esphack}
\providecommand\PBS[1]{\let\temp=\\#1\let\\=\temp}
\newcommand{\belowexskip}[1]{\def\eq@exerskip{\vspace{#1}}}
\let\eqexerskip\belowexskip
\belowexskip{\medskipamount}
\newcommand{\aboveexskip}[1]{\def\eq@priorexskip{\vspace{#1}}}
\let\priorexskip\aboveexskip
\aboveexskip{\medskipamount}
\let\eq@postexerciseHook\relax
\newcommand\belowexsolnskip{\protect\medskip}
\let\marginparpriorhook\@empty % used to material before the exercise
\let\marginparafterhook\@empty % used to material after the exercise
\let\afterlabelhskip\space
\let\exersolnheadhook\@empty
\let\exer@solnheadhook\@empty
\newcommand{\eqexheader}
{%
        \mbox{\color{\@nolinkcolor}\if\exerstar*\exlabelformatwp\else
        \exlabelformat\fi}%
}
\def\eqexheader@wrapper{\hypertarget{qex.\the@exno}{\eqexheader}}
\newcommand{\partsformat}[1]{\def\eq@partsformat{#1}}
\partsformat{(\hfil\alph{partno}\hfil)}
\newcommand{\defaultpartsformat}{%
    \partsformat{(\hfil\alph{partno}\hfil)}}
\let\exlisttabheaderpriorhook\@empty
\let\exlisttabheaderafterhook\@empty
\newcommand{\eqexlisttabheader}
{%
    \exlisttabheaderpriorhook
      \color{\@nolinkcolor}\eq@partsformat
}
\newcommand{\eq@CommonCmd}[1]{\def\eq@@CommonCmd{#1}#1}
\let\eq@@CommonCmd\@empty
\newcommand\gExCommonCmd[1]{\gdef\gEx@CommonCmd{\eq@CommonCmd{#1}}}
\let\gEx@CommonCmd\@empty
\let\endexerhook\@empty
\newenvironment{exercise}
{%
    \let\eqCommonCmd\eq@CommonCmd
    \par\eq@priorexskip\noindent
    \def\eq@argi{eqexno}%% use eqexno counter
    \if\eq@exerstarEnv*\def\exerstar{*}\else\def\exerstar{x}\fi
    \def\currhideopt{x}%
    \@ifnextchar[{\exercise@}%
        {\if\exerstar*\def\eq@next{\@exercise}\else
         \def\eq@next{\exercise@@}\fi\eq@next}%
}{\eq@postexerciseHook\endexerhook\par
    \global\eq@exerciseheadingtrue\eq@exerskip}
\def\exercise@[#1]{\edef\eq@arg{#1}%
    \if\eq@arg h\def\currhideopt{h}%
        \eq@hidesolutiontrue\eq@nolinktrue%
        \ifeq@globalshowsolutions
            \eq@hidesolutionfalse\eq@nolinkfalse\fi
        \def\eq@next{\@exercise}%   h, no *, no counter
    \else
        \if\eq@arg H%
            \edef\currhideopt{\Hidesymbol}%
            \eq@hidesolutiontrue\eq@nolinktrue%
            \ifeq@globalshowsolutions
                \eq@hidesolutionfalse\eq@nolinkfalse
            \fi
            \def\eq@next{\@exercise}%   H, no *, no counter
        \else
            \def\currhideopt{x}%
            \ifx\eq@arg\@empty\else\def\eq@argi{#1}\fi
            \if\exerstar*\def\eq@next{\@exercise}\else
            \def\eq@next{\exercise@@}\fi
        \fi
    \fi
\eq@next}
\def\exercise@@{\@ifstar{\def\exerstar{*}\@exercise}{\exercise@@@}}
\def\exercise@@@{\@ifnextchar[{\exercise@@@@}{\@exercise}}
\def\exercise@@@@[#1]{\edef\eq@arg{#1}%
    \if\eq@arg h\def\currhideopt{h}%
        \eq@hidesolutiontrue\eq@nolinktrue
        \ifeq@globalshowsolutions
            \eq@hidesolutionfalse\eq@nolinkfalse\fi
        \def\eq@next{\@exercise}%   h, no *, no counter
    \else
        \if\eq@arg H\edef\currhideopt{\Hidesymbol}%
            \eq@hidesolutiontrue\eq@nolinktrue%
            \def\eq@next{\@exercise}%   h, no *, no counter
        \else
            \def\currhideopt{x}%
            \PackageWarning{exerquiz}{The option #1 is not recognized}
            \let\eq@next\relax
        \fi
    \fi
\eq@next}
\newif\ifeq@exerciseheading \eq@exerciseheadingtrue
\let\prior@exerSolnHeaderHook\@empty
\newcommand\exerSolnHeader[3]{%
    \prior@exerSolnHeaderHook
    \ifeqforpaper\else\webnewpage\fi\markright{#1}\par\noindent%
    #3%
    \solnhspace
}
\let\eqEXt\@gobbletwo
\let\endeqEXt\relax
\let\eqExtArg\@empty
\let\eqFilterArg\@empty
\let\eqExerSolnHeader\@empty
\let\solutionparshape\@empty
\def\@exercise{%
    \global\let\solutionparshape\@empty
    \let\verbatim@out=\ex@solns
    \if\eq@argi0\else\refstepcounter{\eq@argi}\fi\stepcounter{@exno}%
    \if\exerstar*% if exercise with parts
        \eq@nolinktrue
    \else
        \if\currhideopt H%
        \else
            \ifeq@solutionsafter
                \eq@nolinktrue  % no link to solution
            \else
                \eq@ckglobalhide %
                \ifeq@hidesolution\else
                   \global\let\eqExerSolnHeader\eq@@writeexheader
                \fi
            \fi
        \fi
    \fi
    \ifvmode\ifdim\lastskip>\z@
        \vskip-\lastskip
    \fi\fi
    \if\exerstar*%
        \let\solution\solnexer@woparts
        \let\endsolution\endsolnexer@woparts
        \let\parts\exercise@parts
        \let\endparts\endexercise@parts
    \else
        \let\solution\solnexer@woparts
        \let\endsolution\endsolnexer@woparts
        \let\parts\relax
        \let\endparts\relax
        \if\Hidesymbol h\eq@nolinkfalse\ifeq@solutionsafter
            \eq@nolinktrue\fi\fi
    \fi
    \ifeq@exerciseheading
    \prior@questionsHook\marginparpriorhook\noindent\eqexheader@wrapper
    \afterlabelhskip\marginparafterhook\gEx@CommonCmd\ignorespaces\fi
}
\def\eq@@writeexheader{\set@display@protect
    \immediate\write\verbatim@out{%
    \protect\eqEXt{\eqExtArg}{\eqFilterArg}\protect
    \exerSolnHeader{\exsecrunhead}{ex.\the@exno}%
    {\exsllabelformat}\exer@solnheadhook
    \exersolnheadhook\protect\relax}%\space
    \set@typeset@protect
}
\def\eq@@writeexheaderlist{\set@display@protect
    \immediate\write\verbatim@out{%
    \protect\eqEXt{\eqExtArg}{\eqFilterArg}\protect
    \exerSolnHeader{\exsecrunhead}%
    {ex.\the@exno\alph{partno}}{\exsllabelformatwp}%
    \exer@solnheadhook\exersolnheadhook\relax}%
    \set@typeset@protect
}
\long\def\setsolnspace#1{\def\newsolnspace{#1}%
    \let\solnspace\newsolnspace}
\newif\ifeq@ckSolnVspace \eq@ckSolnVspacetrue
\def\ckSolnOpt{\global\eq@ckSolnVspacetrue}
\def\noSolnOpt{\global\eq@ckSolnVspacefalse}
\let\solnhspace\space
\let\solnspace\space
\def\solnexer@woparts{\def\bLeaveVspace{x}% = no vertical space added
    \ifeq@ckSolnVspace
        \def\eq@next{\@ifnextchar[{\solnexer@@woparts}%
        {\solnexer@@woparts[\null]}}\else
        \def\eq@next{\solnexer@@woparts[\null]}\fi
    \eq@next
}
\let\eqPriorVspace\@gobble
\newcommand{\vspaceFiller}[1]{\vfill}
\newcommand{\vspaceFillerDefault}[1]{\vfill}
\def\eqWriteLine{\hfill}
\def\eq@linesXPgs{%
    \begingroup\offinterlineskip\parskip0pt
    \@tempcnta=0
    \@whilenum\@tempcnta<\soln@keys@nLines\relax\do
    {\vskip0pt\penalty-50\vglue\eq@WLSpacing\eqWriteLine
        \advance\@tempcnta1\relax}\par\endgroup
}
\newcommand{\vspaceFmt}[1]{%
    \ifx\solutionparshape\@empty\else
        \advance\linewidth-\leadinIndentPrtSep\fi %%dps
    \ifdim\sameVspace>0pt
        \let\bLeaveVspace\@empty
        \def\leavevspace{%
            \ifx\eq@insertverticalspace\eq@YES\par\eqPriorVspace{#1}%
                {\nobreak\noindent
                 \ifx\soln@keys@nLines\@empty
                     \def\eq@lines@next{%
                     \parbox[b][#1][t]{\linewidth}{\vspaceFiller{#1}}}%
                 \else
                     \let\eq@lines@next\eq@linesXPgs
                 \fi\eq@lines@next
                 }%
            \fi
        }%
    \fi
}
\define@key{soln@keys}{nLines}[]{\def\soln@keys@nLines{#1}}
\let\soln@keys@nLines\@empty
\def\solnexer@@woparts[#1]{%
    \def\eq@argi{#1}\def\eq@null{\null}%
    \ifx\eq@argi\eq@null\gdef\sameVspace{0pt}%
    \else
        \setkeys*{soln@keys}{#1}%
        \ifx\soln@keys@nLines\@empty
            \xdef\sameVspace{\XKV@rm}%
            \ifx\sameVspace\@empty\gdef\sameVspace{0pt}\fi
        \else
            \ifx\XKV@rm\@empty\else
                \PackageWarning{exerquiz}{Do not specify nLines and
                a vspace.\MessageBreak Setting vspace to 0pt}%
            \fi\gdef\sameVspace{1sp}%must be positive for \cs{vspaceFmt}
        \fi
        \ifvspacewithsolns\vspaceFmt{\sameVspace}\fi
        \ifeq@nosolutions\ifeq@solutionsafter\else
            \vspaceFmt{\sameVspace}\fi\fi
    \fi
    \solnexer@@@woparts
}
\def\solutionsafterSkip{\vskip\smallskipamount}
\def\eqe@debugVertSkip#1{}
\def\eqe@showEndHere#1{#1}
\def\eqe@setStartSolns{%
    \xdef\eq@startSoln{\the\pagetotal}%
    \eqe@debugVertSkip{\marginpar{\smash{b[\sameVspace]}}}%
}
\let\eqSavedComment\comment
\let\eqSavedEndCommet\endcomment
\def\solnexer@@@woparts
{%
    \def\exerwparts@cols{0}%
    \let\verbatim@out\ex@solns
    \if\currhideopt H%
        \let\procsoln\eqSavedComment
        \let\endprocsoln\eqSavedEndCommet
        \def\eq@next{\procsoln}%
    \else
        \eq@ckglobalhide
        \ifeq@hidesolution
            \let\procsoln\eqSavedComment
            \let\endprocsoln\eqSavedEndCommet
        \else
            \ifx\bLeaveVspace\@empty\leavevspace\fi
            \ifeq@solutionsafter\else
                \ifx\eq@@CommonCmd\@empty\else
                    \set@display@protect
                    \immediate\write\verbatim@out{\eq@@CommonCmd}%
                    \set@typeset@protect
                \fi
            \fi
            \let\procsoln\verbatimwrite
            \let\endprocsoln\endverbatimwrite
        \fi
        \def\eq@next{%
            \ifeq@solutionsafter%\par
                \ifx\exsolafter\@empty
                    \ifdim\sameVspace=0pt\eqe@setStartSolns
                    \else
                        \solutionsafterSkip
                        \eqe@setStartSolns
                    \fi
                \else\par\kern0pt
                    \solutionsafterSkip
                    \noindent\strut\eqe@setStartSolns
                    \ifx\endparts\endexercise@parts@tabular
                    \hangindent=\partshangamount\relax
                        \hangafter=0\relax\fi
                        \exsolafter\space\ignorespaces
                \fi
                \solutionparshape
            \else
                \eqExerSolnHeader
                \global\let\eqExerSolnHeader\@empty
                \global\therearesolutionstrue\expandafter\procsoln
            \fi
        }%
    \fi
\eq@next}
\let\endsolnexerhook\@empty
\let\endsolnexerhookaux\@empty
\def\eq@fititin#1{\noindent\unskip\nobreak\hfill\penalty100
    \hskip1em\hbox{}\nobreak\hfill#1}%
\let\eqfititin\eq@fititin
\newcommand\eqExerSolnTrailer
{%
    \protect\ReturnTo{page.\the\c@page}%
    {\protect\mbox{\if\exerstar*\exrtnlabelformatwp\else
        \exrtnlabelformat\fi}}%
    \protect\endeqEXt\ifeqforpaper\protect\par{\belowexsolnskip}\fi^^J%
}
\def\endsolnexer@woparts{%
    \if\currhideopt H%
        \ifkeepdeclaredvspacing\vskip\sameVspace\fi
        \csname endprocsoln\endcsname
    \else
        \ifeq@solutionsafter
            \if\exerstar*%
            \eq@fititin{\hbox{\exrtnlabelformatwp}}\else
            \eq@fititin{\hbox{\exrtnlabelformat}}\fi\par\kern0pt
            \ifkeepdeclaredvspacing
                \@tempdima\pagetotal
                \advance\@tempdima-\eq@startSoln
                \@tempdimb\sameVspace\relax
                \ifdim\@tempdimb>1sp\relax
                    \advance\@tempdimb-\@tempdima
                    \ifdim\@tempdimb>0pt\vglue\@tempdimb\kern0pt
                        \let\eqe@showEndHere\@gobble
                        \edef\tmp@exp{\noexpand\marginpar{%
                        \noexpand\smash{e: adj \the\@tempdimb}}}%
                        \eqe@debugVertSkip{\tmp@exp}%
                    \fi
                \fi
            \fi
            \eqe@showEndHere{\eqe@debugVertSkip{\marginpar{\smash{e}}}}%
        \else
            \endprocsoln
            \eq@ckglobalhide
            \ifeq@hidesolution\else
                \endsolnexerhookaux
                \set@display@protect
                \immediate\write\verbatim@out{\eqExerSolnTrailer}%
                \set@typeset@protect
            \fi
        \fi
    \fi
\endsolnexerhook}
\let\eq@exerstarEnv\relax
\newenvironment{exercise*}{\def\eq@exerstarEnv{*}\exercise}
{\endexercise}
\def\exerwparts@cols{0}
\def\exercise@parts{\@@par\ifdim\parskip>\z@\vskip-\parskip\fi
  \def\exerwparts@cols{0}\@ifnextchar[%
  {\let\endparts\endexercise@parts@tabular\exercise@parts@tabular@}%
  {\let\endparts\endexercise@parts@list\exercise@parts@list}}
\def\eq@extralabelsep{0pt}
\newcommand{\setPartsWidth}[1]{\def\parts@indent{\normalfont#1}}
\setPartsWidth{(d)}
\def\eqe@prtsepPrb{\ }
\providecommand{\prbPrtsep}[1]{\def\eqe@prtsepPrb{#1}}
\providecommand{\exPrtsep}[1]{\def\eqe@prtsepPrb{#1}}
\let\prior@parts@hook\@empty
\let\post@parts@hook\@empty
\let\abovepartshook\@empty
\let\belowpartshook\@empty
\let\eqp@rtc@lcm@rk\relax
\let\eq@insertContAnnot\relax
\def\eq@item@common{\eq@insertContAnnot\eqp@rtc@lcm@rk
    \def\currhideopt{x}\eq@hidesolutionfalse\eq@nolinkfalse
    \@ifnextchar[{\@ckhide}{\eq@item}}
\newcommand{\partsitemsep}[1]{\def\eqparts@itemsep{#1}}
\let\eqpartsitemsep\partsitemsep
\partsitemsep{0pt}
\newcommand\partsparsep[1]{\def\eqparts@parsep{#1}}
\partsparsep{0pt}
\def\eqpartstabrowsep#1{\def\eqparts@tabrowsep{#1}}
\eqpartstabrowsep{0pt}
\newcommand{\leadinitem@external}{\PackageError{exerquiz/eqexam}
    {The \string\leadinitem\space command is designed to be\MessageBreak
     the first item in the problem*\MessageBreak
     environment above the parts environment}
     {Use \string\leadinitem\space in the problem* environment.}%
}
\let\leadinitem\leadinitem@external
\newcommand{\eq@leadinitemparts}{\item\relax
    \PackageError{exerquiz/eqexam}{The \string\leadinitem\space
        command is not allowed in the\MessageBreak
        parts environment}
     {Use \string\leadinitem\space in the problem* environment.}%
}
\def\eq@handleOptArg[#1]{\def\eq@optArg{[#1]}\eq@handleOptArgi}
\def\eq@handleOptArgi{\expandafter
    \eq@item@latex\eq@optArg\exlisttabheaderafterhook}
\newenvironment{exercise@parts@list}
{\settowidth{\eq@tmplength}{\parts@indent}%
\eq@initializeContAnnot\eq@nolinkfalse\prior@parts@hook\abovepartshook
\list{\normalfont
    \if\Hidesymbol h\eq@nolinkfalse\ifeq@solutionsafter
        \eq@nolinktrue\fi\fi
    \if\currhideopt H%
    \else
        \ifeq@solutionsafter
            \eq@nolinktrue  % no link to solution
        \else
            \ifeq@nosolutions
                \eq@nolinktrue  % no link to solution
            \else
                \eq@ckglobalhide
                \ifeq@hidesolution\eq@nolinktrue\else
                    \global\let\eqExerSolnHeader\eq@@writeexheaderlist
                \fi
            \fi
        \fi
    \fi
    \makebox[\eq@tmplength][r]{\eqexlisttabheader}%
}{%
    \usecounter{partno}%
    \ifx\solutionparshape\@empty\else
        \setcounter{partno}{1}\fi
    \let\leadinitem\eq@leadinitemparts
    \global\let\solutionparshape\@empty %%dps
    \setlength{\topsep}{3pt}%
    \ifdim\parskip>\z@
        \addtolength{\topsep}{-\parskip}\fi
    \setlength{\parskip}{0pt}%
    \setlength{\partopsep}{0pt plus 1pt minus 1pt}%
    \setlength{\parsep}{\eqparts@parsep}\setlength{\itemindent}{0pt}%
    \setlength{\listparindent}{\parindent}%
    \setlength{\itemsep}{\eqparts@itemsep}%
    \settowidth{\labelsep}{\normalfont\eqe@prtsepPrb}%
    \addtolength{\labelsep}{\eq@extralabelsep}%
    \settowidth{\labelwidth}{\parts@indent}%
    \setlength{\leftmargin}{\labelwidth}%
    \addtolength{\leftmargin}{\labelsep}%
    \let\eq@item@latex\item
    \def\eq@item{\@ifnextchar[{\eq@handleOptArg}
        {\eq@item@latex\exlisttabheaderafterhook}}
    \def\eqthisenv{parts}%
    \def\item{\ifx\@currenvir\eqthisenv
        \def\eq@next{\eq@item@common}\else
        \def\eq@next{\eq@item}\fi
    \eq@next}%
}}{\endlist\global\let\leadinitem\leadinitem@external
    \post@parts@hook\belowpartshook}
\def\eq@initializeContAnnot{\@ifundefined{eqequestions}
    {\global\let\eqeCurrProb\relax}
    {\xdef\eqeCurrProb{\theeqquestionnoi}}%
    \xdef\eq@currProbStartPage{\arabic{page}}%
}
\def\exercise@parts@tabular@[#1]{%
  \inittabMark
  \let\eq@insertContAnnot\relax
  \def\exerwparts@cols{#1}%
  \@tempcnta\exerwparts@cols\relax
  \ifnum\@tempcnta<2
        \PackageError{exerquiz}{%
        The number of columns for parts\MessageBreak
        needs to be an integer greater than 1}
        {Enter an integer, 2 or larger}\fi
  \exercise@parts@tabular}
\newcount\eq@extabColCnt
\def\autotabOn{\let\eq@tabMarkChk\relax%
    \PackageInfo{exerquiz/eqexam}{Executing \string\autotabOn}}
\def\autotabOff{\let\eq@tabMarkChk\@gobble
    \PackageInfo{exerquiz/eqexam}{Executing \string\autotabOff}}
\autotabOff
\def\inittabMark{\global\eq@extabColCnt=0 }
\def\resettabMark{\global\eq@extabColCnt=1 }
\newcommand\autotabnewline[1][\@rowskip]{%
    \ifx\eq@tabMarkChk\@gobble
        \def\eq@atnext{\expandafter\\\expandafter[#1]}\else
        \def\eq@atnext{\resettabMark\\\noalign{\expandafter\kern#1}}\fi
    \eq@atnext}
\def\eq@tabMark{%
    \ifnum\eq@extabColCnt=0
        \global\advance\eq@extabColCnt1
        \let\eq@next\relax
    \else
        \ifnum\eq@extabColCnt=1
            \let\eq@next\relax
        \else
            \ifnum\eq@extabColCnt>\exerwparts@cols
                \let\eq@next\autotabnewline
            \else\def\eq@next{&}\fi
        \fi
    \fi
    \eq@next
    \global\advance\eq@extabColCnt1
}
\newcommand\partstabcolsep{1.5pt}
\newenvironment{exercise@parts@tabular}
{%
    \ifx\eq@tabMarkChk\@gobble
        \eqpartstabrowsep{\@rowskip}\fi % detecting autotab off or on
    \setcounter{partno}{0}%
    \settowidth{\eq@tmplength}{\parts@indent\eqe@prtsepPrb}%
    \sbox{\eq@tmpbox}{\parts@indent}%
    \let\eq@item@latex\item
    \let\eq@item\item@part@tabular
    \def\eqthisenv{parts}%
    \def\item{\ifx\@currenvir\eqthisenv
        \def\eq@next{\eq@tabMarkChk\eq@tabMark\eq@item@common}\else
        \def\eq@next{\eq@item@latex}\fi
    \eq@next}\eq@nolinkfalse
    \@ifundefined{@xtabularcr}{\let\@xarraycr\eq@xtabularcr}
    {\let\@xtabularcr\eq@xtabularcr}
    \eq@tmpdima=\linewidth %\divide\eq@tmpdima by\exerwparts@cols
    \@tempcnta\exerwparts@cols\relax
    \advance\@tempcnta-1\relax
    \multiply\@tempcnta by2
    \@tempdima\partstabcolsep\relax
    \multiply\@tempdima\@tempcnta
    \advance\eq@tmpdima-\@tempdima
    \divide\eq@tmpdima by\exerwparts@cols
    \vskip\partopsep\noindent\normalbaselines
    \tabcolsep\partstabcolsep\relax
    \prior@parts@hook\abovepartshook
    \tabular{@{}*{\exerwparts@cols}{p{\eq@tmpdima}}@{}}%
}{\endtabular\post@parts@hook\belowpartshook}
\def\item@part@tabular{\leavevmode\refstepcounter{partno}%
  \global\let\eqExerSolnHeader\@empty
  \ifeq@solutionsafter
    \eq@nolinktrue  % no link to solution
  \else\ifeq@nosolutions
    \eq@nolinktrue  % no link to solution
  \else
      \eq@ckglobalhide
      \ifeq@hidesolution\eq@nolinktrue\else
      \gdef\eqExerSolnHeader{%
        \set@display@protect
        \immediate\write\verbatim@out{%
        \protect\eqEXt{\eqExtArg}{\eqFilterArg}\protect
            \exerSolnHeader{\exsecrunhead}%
            {ex.\the@exno\alph{partno}}{\exsllabelformatwp}\relax}%
        \set@typeset@protect
      }%
  \fi\fi\fi
  \PBS\raggedright
  \settowidth{\eq@tmplength}{\parts@indent\eqe@prtsepPrb}%
  \sbox{\eq@tmpbox}{\parts@indent}%
  \eq@tmpdima=\wd\eq@tmpbox
  \addtolength\eq@tmplength{\eq@extralabelsep}%
  \xdef\partshangamount{\the\eq@tmplength}%
  \hangindent=\eq@tmplength\hangafter=1\relax
  \makebox[\eq@tmpdima][r]{\eqexlisttabheader}\eqe@prtsepPrb
    \exlisttabheaderafterhook\ignorespaces
}
\def\@ckhide[#1]{\edef\eq@arg{#1}%
    \def\currhideopt{x}%
    \ifx\eq@arg\@empty\else
    \if\eq@arg H%
        \eq@hidesolutiontrue\eq@nolinktrue%
        \edef\currhideopt{\Hidesymbol}%
    \else
        \ifeq@globalshowsolutions\else
            \if\eq@arg h%
                \eq@hidesolutiontrue\eq@nolinktrue%
                \def\currhideopt{h}%
            \fi
        \fi
    \fi\fi
    \eq@item
}
\def\tabControlOn{\@ifundefined{@xtabularcr}
    {\let\save@@xtabularcr\@xarraycr}
    {\let\save@@xtabularcr\@xtabularcr}}
\def\tabControlOff{\@ifundefined{@xtabularcr}
    {\let\@xarraycr\save@@xtabularcr}
    {\let\@xtabularcr\save@@xtabularcr}}
\AtBeginDocument{\tabControlOn}
\def\eq@xtabularcr{\@ifnextchar[{\save@@xtabularcr}
    {\eqe@tab@parts@rowsep}}%
\def\eqe@tab@parts@rowsep{\save@@xtabularcr
    \noalign{\expandafter\kern\eqparts@tabrowsep}}%
\def\includeexersolutions{\@ifstar
    {\let\resetEXsolns\relax\includeexersolutionsi}
    {\def\resetEXsolns{\global\let\include@solutions\relax}%
     \includeexersolutionsi}%
}
\newcommand{\includeexersolutionsi}[1][]{%
    \filterFor{#1}\includeexersolutionsii
}
\def\includeexersolutionsii{%
        \include@solutions
        \resetEXsolns
        \let\eqFilterArg\@empty
}
\long\def\gobbleToEndEXt#1\endeqEXt{%
    \ifeqforpaper\expandafter\@gobbletwo\fi}
\newcommand\filterFor[1]{\def\eqFilterArg{#1}}
\newcommand\inclEXtFilter[2]{\def\eqargii{#2}\ifx\eqargii\eqFilterArg
    \else\expandafter\gobbleToEndEXt\fi}
\newcommand\useEXtFilter{\let\eqEXt\inclEXtFilter}
\let\eqsolutionshook\@empty
\let\priorexsectitle\@empty
\let\priorexslinput\@empty
\def\exerSolnsHeadnToc{\section*{\exsectitle}%
    \addcontentsline{toc}{section}{%
    \@ifundefined{web@latextoc}{}{%
    \ifx\web@latextoc y\else
    \protect\numberline{}\fi}\exsectitle}}
\@ifpackageloaded{web}{\def\eq@normallheader{\lheader{\rightmark}}}
    {\let\eq@normallheader\relax}
\@ifpackageloaded{web}{\def\eq@defaultlheader{\lheader{\aeb@setmarks}}}
    {\let\eq@defaultlheader\relax}
\newif\ifExSolutionsSet \ExSolutionsSetfalse
\newcommand{\exerSolnInput}
{%
    \let\webnewpage\relax
    \ifsolutionsonly\else\immediate\closeout\ex@solns\fi
    \ifeq@nosolutions\else
        \iftherearesolutions
            \ifsolutionsonly\eqsolutionshook
        \else
            \newpage\eqsolutionshook\markright{}\eq@normallheader
        \fi
        \markright{\exsectitle}%
            \ifx\webnewpage\relax
                \def\webnewpage{\let\webnewpage\newpage}%
            \fi
            \priorexsectitle\exerSolnsHeadnToc\priorexslinput
            \InputIfFileExists{\jobname.sol}
            {\global\ExSolutionsSettrue}{\PackageWarning{exerquiz}
            {!!! Solutions to exercises not found}}%
            \global\ExSolutionsSetfalse
            \newpage\eq@defaultlheader
        \fi
    \fi
}
\def\include@solutions{%
        \exerSolnInput
}
\newcommand{\prior@questionsHook}{}
\let\qMark@Hook\@empty
\let\aebtitleQuiz\@empty
\newcommand{\post@questionsHook}{}
\newcommand{\quesNumColor}[1]{\def\eq@quesNumCol{#1}}
\quesNumColor{blue}
\renewcommand{\theeqquestionnoi}{\arabic{eqquestionnoi}}
\newcommand{\labeleqquestionnoi}{%
    \color{\eq@quesNumCol}\bfseries\theeqquestionnoi.}
\renewcommand\theeqquestionnoii{(\alph{eqquestionnoii})}
\newcommand{\labeleqquestionnoii}{%
    \color{\eq@quesNumCol}\bfseries\theeqquestionnoii}
\renewcommand\theeqquestionnoiii{(\roman{eqquestionnoiii})}
\newcommand{\labeleqquestionnoiii}{%
    \color{\eq@quesNumCol}\bfseries\theeqquestionnoiii}
\define@key{props@ques}{labelwidthTo}%
    [\normalsize\normalfont\bfseries00.]%
    {\def\propQ@labelwidthTo{#1}}
\define@key{props@ques}{labelwidth}[]{\def\propQ@labelwidth{#1}}
\let\propQ@labelwidth\@empty
\define@key{props@ques}{topsep}[\the\topsep]{\edef\propQ@topsep{#1}}
\define@key{props@ques}{partopsep}[\the\partopsep]%
    {\edef\propQ@partopsep{#1}}
\define@key{props@ques}{parsep}[\the\parsep]{\edef\propQ@parsep{#1}}
\define@key{props@ques}{itemsep}[\the\itemsep]{\edef\propQ@itemsep{#1}}
\define@key{props@ques}{labelsepTo}[\normalsize\normalfont\ ]%
    {\def\propQ@labelsepTo{#1}}
\define@key{props@ques}{labelsep}[\@empty]{\def\propQ@labelsep{#1}}
\let\propQ@labelsep\@empty
\define@key{props@ques}{color}[blue]{\quesNumColor{#1}}
\setkeys{props@ques}{labelwidthTo,topsep,partopsep,parsep,%
    itemsep,labelsepTo,color}%
\newenvironment{questions}[1][]
{%
    \ifnum\@eqquestiondepth>\tw@\@toodeep\else
    \advance\@eqquestiondepth\@ne\fi
    \def\@quesctr{eqquestionno\romannumeral\the\@eqquestiondepth}%
    \toks@=\expandafter\expandafter\expandafter{#1}\expandafter
    \xdef\csname quesOpts\@quesctr\endcsname{\the\toks@}%
    \edef\tempexp{\noexpand\setkeys{props@ques}{\the\toks@}}\tempexp
    \list{\qMark@Hook\prior@questionsHook\gdef\eqPTs{1}%
    \global\let\eqQT\eq@na%
    {\@tempcnta=0 \let\@thispr@b\@empty
     \@whilenum\@tempcnta<\@eqquestiondepth\do{\advance\@tempcnta\@ne
     \ifx\@thispr@b\@empty\edef\@thispr@b{%
     \csname theeqquestionno\romannumeral\the\@tempcnta\endcsname}\else
     \edef\@thispr@b{\@thispr@b%
     \csname theeqquestionno\romannumeral\the\@tempcnta\endcsname}\fi
    }\xdef\@currentQues{\@thispr@b}}%
    \makebox[\labelwidth][r]{\normalfont\@nameuse{label\@quesctr}}%
    \xdef\eq@pageThisQ{\the\c@page}%
    \post@questionsHook}{\usecounter{\@quesctr}%
    \ifx\propQ@labelsep\@empty
        \settowidth{\labelsep}{\propQ@labelsepTo}\else
        \setlength{\labelsep}{\propQ@labelsep}\fi
    \ifx\propQ@labelwidth\@empty
        \settowidth{\labelwidth}%
            {\propQ@labelwidthTo\hspace{\labelsep}}\else
        \settowidth{\labelwidth}{\hspace{\propQ@labelwidth}%
            \hspace{\labelsep}}\fi
    \setlength{\topsep}{\propQ@topsep}%
    \setlength{\partopsep}{\propQ@partopsep}%
    \ifdim\parskip>\z@\addtolength{\topsep}{-\parskip}\fi
    \setlength{\parsep}{\propQ@parsep}%
    \setlength{\itemsep}{\propQ@itemsep}%
    \setlength{\itemindent}{0pt}%
    \setlength{\leftmargin}{\labelwidth}%
    }%
}{\endlist}
\def\pushquestions{\expandafter\xdef\csname save\@quesctr\endcsname
    {\expandafter\the\csname c@\@quesctr\endcsname}\end{questions}}
\def\popquestions{%
    \begin{questions}[\csname quesOpts\@quesctr\endcsname]%
    \setcounter{\@quesctr}{\csname save\@quesctr\endcsname}%
    \@ifnextchar\popquestions{\item[]}{\@ifnextchar\begin{\item[]}{}}}
\newcommand{\priorsqhook}[1]{\def\sq@priorhook{#1}}
\priorsqhook{}
\newcommand{\abovesqskip}[1]{\def\sq@aboveskip{#1}}
\abovesqskip{\par\medskip}
\long\def\endsqhook#1{\def\sq@afterhook{#1}}
\endsqhook{}
\def\@shortquizCnt{0}
\def\@sqGenBaseName{eqSqBn\@shortquizCnt}
\let\sqhspace\space
\newenvironment{shortquiz}
{%
    \xdef\eq@pageThisQ{\the\c@page}%
    \let\@currentQues\@empty
    {\count0=\@shortquizCnt \advance\count0by1\relax
        \xdef\@shortquizCnt{\the\count0}}%
    \goodbreak\@ifstar{\sqForms\@shortquiz}%
        {\if\aeb@FLOverride f\def\sqstar{*}\else
          \def\sqstar{}\sqLinks\fi\@shortquiz}%
}{\aeb@endshortquiz}
\newenvironment{shortquiz*}
{%
    \xdef\eq@pageThisQ{\the\c@page}%
    {\count0=\@shortquizCnt\advance\count0by1\relax
        \xdef\@shortquizCnt{\the\count0 }}%
    \sqForms\@shortquiz
}{\aeb@endshortquiz}
\def\@shortquiz{\@ifnextchar[%
    {\@@shortquiz}{\@@shortquiz[\@sqGenBaseName]}}
\def\sq@setCLN#1{\ifx\aebTitleQuiz\@empty
    \protected@edef\@currentlabelname{#1}\else
    \protected@edef\@currentlabelname{\@currentlabelname}\fi
}
\let\isQZ=q \let\isSQZ=s
\def\@@shortquiz[#1]{%\begingroup
  \gdef\oField{#1}\gdef\curr@quiz{#1}\gdef\currQuiz{#1}%
    \global\let\eqQzQuesList\@empty
    \let\eq@AddProbToQzQuesList\relax
    \edef\@currentlabel{\@shortquizCnt}%
    \edef\@currentHref{shortquiz.\@shortquizCnt}%
  \global\let\eqQuizType\isSQZ\let\@qzsolndest\@empty
  \if\sqstar*\relax
    \let\@Ans\Ans@sq@f
    \ifx\oField\@empty
        \typeout{^^JExerquiz: Base field name required when using
                shortquiz with '*' option}%
        \typeout{Exerquiz: Assuming link style^^J}%
        \let\@Ans\Ans@sq@l
    \fi
  \else
     \let\@Ans\Ans@sq@l
  \fi
  \setcounter{questionno}{0}%
  \let\answers\answers@sq
  \let\endanswers\endanswers@sq
  \let\manswers\manswers@sq
  \let\endmanswers\endmanswers@sq
  \let\solution\solution@sq
  \let\endsolution\endsolution@sq
  \sq@aboveskip\sq@priorhook\ignorespaces
}
\newcommand\belowsqskip[1]{\def\aftershortquizskip{#1}}
\belowsqskip{\medskip}
\def\aeb@endshortquiz{\setcounter{quizno}{0}%
    \sq@afterhook
    \global\let\sqlabel\eq@sqlabel
    \global\let\sqslrtnlabel\eq@sqslrtnlabel
    \global\let\sqsllabel\eq@sqsllabel
    \par\aftershortquizskip
}
\def\sqLinks{\def\sqstar{}}\sqLinks
\def\sqForms{\def\sqstar{*}}
\let\eq@tq@star\relax
\def\qzPriorSolutionAfterHook{\smallskip}
\let\sqPostHeaderHook\@empty
\let\qPostHeaderHook\@empty
\let\eq@sqPostHeaderHook\@empty
\let\eq@qPostHeaderHook\@empty
\let\prior@eqQt\@empty
\let\prior@eqSQt\@empty
\def\sqsolafterhspace{\space}
\def\solution@sq{\let\eq@next\relax
  \ifx\@qzsolndest\@empty
    \PackageWarning{exerquiz}%
    {* Solutions unexpected here, will *\MessageBreak
     * assume solutionsafter option *}%
    \eq@solutionsaftertrue
  \fi
  \ifeq@solutionsafter
    \par\qzPriorSolutionAfterHook\noindent
    \if!\sqsolafter!\else
    \sqsolafter\sqsolafterhspace\fi\ignorespaces
  \else
    \global\therearequizsolutionstrue\let\verbatim@out=\quiz@solns
    \set@display@protect
    \immediate\write\verbatim@out{%
      \if\eqQuizType\isQZ
            \ifx\prior@eqQt\@empty\else\prior@eqQt\fi
            \protect\eqQt{\eqFilterArg}\else
            \ifx\prior@eqSQt\@empty\else\prior@eqSQt\fi
            \protect\eqSQt{\eqFilterArg}\fi
      \protect\quizSolnHeader\if\eqQuizType\isQZ\ifx\allow@peek\eq@NO
        [{\curr@quiz}{\currQuizStartPage}]\fi\fi
        {\@qzsolndest}{\sqsllabel}\protect\relax
        \if\eqQuizType\isQZ\expandafter\eq@qPostHeaderHook
        \expandafter\qPostHeaderHook\else
        \expandafter\eq@sqPostHeaderHook
        \expandafter\sqPostHeaderHook\fi}%
    \set@typeset@protect
    \expandafter\verbatimwrite\fi
}
\let\qzSolutionsAfterHook\@empty
\def\endsolution@sq
{%
    \ifeq@solutionsafter
        \eq@fititin{\mbox{\sqslrtnlabel}}\par\qzSolutionsAfterHook
        \aftergroup\ignorespaces
    \else
        \endverbatimwrite
        \ifx\@qzsolndest\@empty\else\set@display@protect
            \immediate\write\verbatim@out{\eqSqSolnTrailer}%
         \set@typeset@protect
        \fi
    \fi
    \global\let\@qzsolndest\@empty
}
\def\fpAfterSolutionsSkip{\par\medskip}
\let\eqSqSolnTrailerHook\@empty
\let\eqQzSolnTrailerHook\@empty
\newcommand\eqSqSolnTrailer{%
    \if\eqQuizType\isQZ
        \eqQzSolnTrailerHook
        \protect\ReturnTo{page.\eq@pageThisQ}%
            {\protect\mbox{\sqslrtnlabel}}\string\endeqQt
    \else
        \eqSqSolnTrailerHook
        \protect\ReturnTo{page.\eq@pageThisQ}%
            {\protect\mbox{\sqslrtnlabel}}\string\endeqSQt%
    \fi
    \ifeqforpaper\protect\fpAfterSolutionsSkip\fi^^J%
}
\let\eqSQt\@gobble
\let\endeqSQt\relax
\let\eqQt\@gobble
\let\endeqQt\relax
\let\prior@quizSolnHeaderHook\@empty
\newcommand\quizSolnHeader[3][]{%
    \prior@quizSolnHeaderHook
    \ifeqforpaper\else\webnewpage\fi\noindent
    #2%
    \solnspace
}
\newif\iftherearequizsolutions \therearequizsolutionsfalse
\let\aeb@FLOverride\relax
\def\includequizsolutions{\@ifstar
    {\let\resetQZtsolns\relax\includequizsolutionsi}
    {\def\resetQZtsolns{\global\let\include@quizsolutions\relax}%
     \includequizsolutionsi}%
}
\newcommand{\includequizsolutionsi}[1][]{%
    \filterFor{#1}\includequizsolutionsii
}
\def\includequizsolutionsii{%
    \include@quizsolutions
    \resetQZtsolns
    \let\eqFilterArg\@empty
}
\let\aebtitleQuiz\@empty
\let\aebTitleQuiz\@empty
\def\pushEnvir{\xdef\eq@currenvir{\@currenvir}\endgroup}
\def\popEnvir{\begingroup\@endpefalse
    \edef\@currenvir{\eq@currenvir}%
    \edef\@currenvline{\on@line}%
}
\def\answers@sq{%
    \ifx\solutionparshape\@empty\else
        \pushEnvir\par\noindent\expandafter\popEnvir\fi
    \stepcounter{questionno}%
    \if\sqstar*\relax
        \if\aeb@FLOverride l%
            \let\@Ans\Ans@sq@l\else
            \let\@Ans\Ans@sq@f\fi
    \else
        \if\aeb@FLOverride f%
            \let\@Ans\Ans@sq@f\else
            \let\@Ans\Ans@sq@l\fi
    \fi
    \def\aeb@answerType{r}\@ifnextchar[{\answers@@sq}%
    {\@ifstar{\answers@@sq[\curr@quiz.\thequestionno]}{\answers@@sq[]}}}
\def\manswers@sq{%
    \ifx\solutionparshape\@empty\else
        \pushEnvir\par\noindent\expandafter\popEnvir\fi
    \stepcounter{questionno}%
    \if\sqstar*\relax
        \if\aeb@FLOverride l%
        \let\@Ans\Ans@ck@sq@l\else
        \let\@Ans\Ans@ck@sq@f\fi
    \else
        \if\aeb@FLOverride f%
            \let\@Ans\Ans@ck@sq@f\else
            \let\@Ans\Ans@ck@sq@l\fi
    \fi
    \def\aeb@answerType{c}\@ifnextchar[{\answers@@sq}%
    {\@ifstar{\answers@@sq[\curr@quiz.\thequestionno]}{\answers@@sq[]}}}
\let\sq@hwdest\@empty % hard-wired destination
\def\answers@@sq[#1]#2{%
    \xdef\aeb@numCols{#2}%
    \ifx\sq@hwdest\@empty
        \xdef\@qzsolndest{#1}\else
        \gdef\@qzsolndest{\sq@hwdest}\fi
    \if\aeb@numCols1\gdef\eq@listType{1}\expandafter\answers@sq@list
    \else
        \gdef\eq@listType{0}\expandafter\answers@@sq@tabular
    \fi{\aeb@numCols}%
}
\def\setMClabelsepDefault#1{\def\eq@hspanner@default{#1}}
\def\setMClabelsep#1{\def\eq@hspanner{#1}}
\setMClabelsep{\ }\setMClabelsepDefault{\ }
\def\resetMClabelsep{\expandafter\setMClabelsep\expandafter
    {\eq@hspanner@default}}
\def\eq@lw@l{\eq@l@l\eq@hspanner}
\def\eq@l@l{\normalsize\normalfont(d)}
\def\eq@lw@f{\kern\RadioFieldSize\eq@hspanner}
\newcommand\Ans@list[2][0]{\gdef\eq@pPTs{#1}%
    \xdef\Ans@choice{#2}\item\relax\noindent\if\eq@listType1%
    \addtocounter{quizno}{-1}\refstepcounter{quizno}\fi
    \ignorespaces}
\newenvironment{answers@sq@list}[1]
{%
    \if\aeb@answerType r%
        \let\endanswers\endanswers@sq@list\else
        \let\endmanswers\endanswers@sq@list\fi
    \list{\strut\@Ans}{%
        \if\sqstar*\relax
            \settowidth{\labelwidth}{\eq@lw@f}\else
            \settowidth{\labelwidth}{\eq@lw@l}\fi
        \setlength{\topsep}{-\parskip+\aboveanswersSkip}%
        \setlength{\parsep}{0pt}\setlength{\itemindent}{0pt}%
        \setlength{\itemsep}{0pt}\setlength{\partopsep}{0pt}%
        \setlength{\listparindent}{\parindent}%
        \ifnum\exerwparts@cols>1
            \setlength{\leftmargin}{\labelwidth+\eqemargin}\else
        \ifx\solutionparshape\@empty
            \setlength{\leftmargin}{\labelwidth}\else
            \setlength{\leftmargin}{\labelwidth+\eqemargin}\fi\fi
        \setlength{\labelsep}{0pt}%
        \def\Ans{\Ans@list}%
    }%
}%
{\endlist\setcounter{quizno}{0}}
\newcommand\Ans@tabular[2][0]{\gdef\eq@pPTs{#1}%
    \xdef\Ans@choice{#2}\leavevmode\@Ans
}
\newcommand\sqtabsep[1]{\def\eq@argi{#1}\ifx\eq@argi\@empty
    \def\sq@tabsep{1.5pt}\else\def\sq@tabsep{#1}\fi}
\sqtabsep{1.5pt}
\def\sqTabPos#1{\def\sq@TabPos{[#1]}}\sqTabPos{}
\def\answers@@sq@tabular#1{%
    \ifinner\else\par\vskip-\parskip\vspace{\aboveanswersSkip}\fi
    \noindent\ifnum\exerwparts@cols>1\relax
        \hspace*{\eqemargin}\fi
    \tabcolsep=0pt
    \setlength{\linewidth}{\linewidth-\eqemargin}%
    \eq@tmpdima=\linewidth
    \@tempcnta#1\relax
    \advance\@tempcnta-1\relax
    \multiply\@tempcnta by2
    \@tempdima\sq@tabsep\relax
    \multiply\@tempdima\@tempcnta
    \advance\eq@tmpdima-\@tempdima
    \divide\eq@tmpdima by#1
    \def\Ans{\Ans@tabular}%
    \tabcolsep\sq@tabsep\relax
    \expandafter\tabular\sq@TabPos{@{}*{#1}{p{\eq@tmpdima}}@{}}}%
\def\endanswers@sq{\endtabular\setcounter{quizno}{0}}%
\def\endmanswers@sq{\endtabular\setcounter{quizno}{0}}%
\def\popiiictm{\special{CTM: pop pop pop}}
\def\aebChoiceAltFmt{\noexpand\ifaebshowgrayletters
    \Alph{quizno}\noexpand\else\alph{quizno}\noexpand\fi}
\def\linkContentFormat{%
    \if\probstar*\Alph{quizno}\else\alph{quizno}\fi}
\def\linkContentWrapper{(\hfil\linkContentFormat\hfil)}%
\def\Ans@sq@l{%
    \leavevmode\if\eq@listType1\stepcounter{quizno}%
    \else\refstepcounter{quizno}\fi\PBS\raggedright
    \settowidth{\eq@tmplength}{\eq@lw@l}\sbox{\eq@tmpbox}{\eq@l@l}%
    \eq@tmpdima=\wd\eq@tmpbox
    \def\link@@Content{\linkContentWrapper}%
    \hangindent=\eq@tmplength\hangafter=1\relax
    \Ans@sq@l@driver
\eq@hspanner\ignorespaces}
\let\Ans@ck@sq@l\Ans@sq@l
\let\rbf@Opts\@empty
\def\Ans@sq@f{%
    \if\eq@listType1\stepcounter{quizno}%
    \else\refstepcounter{quizno}\fi\PBS\raggedright
    \settowidth{\eq@tmplength}{\eq@lw@f}%
    \eq@tmpdima=\wd\eq@tmpbox%
    \hangindent=\eq@tmplength\hangafter=1\relax
    \insertGrayLetters % 6.3d
    \Ans@sq@f@driver
\eq@hspanner\ignorespaces}
\let\Ans@ck@sq@f\Ans@sq@f
\newskip\aboveanswersSkip
\setlength\aboveanswersSkip{3pt}
\def\insertGrayLetters{\ifaebshowgrayletters
    \rlap{\makebox[\RadioFieldSize]%
        {\textcolor{gray}{\Alph{quizno}}}}\else\relax\fi}
\newcount\eq@tabColCnt
\define@key{bchoice}{nCols}{\def\bChoiceNumCols{#1}}
\@for\eqi:=1,2,3,4,5,6,7,8,9,10 \do{\edef\temp@expand@def{%
    \noexpand\define@key{bchoice}{\eqi}[\eqi]{%
        \noexpand\def\noexpand\bChoiceNumCols{\eqi}}%
    }\temp@expand@def
}
\def\bChoiceNumCols{\aeb@numCols}
\define@key{bchoice}{random}[true]{%
    \csname if#1\endcsname\eq@randomizeChoicestrue
        \else\eq@randomizeChoicesfalse\fi
}
\define@key{bchoice}{label}[]{\xdef\bChoiceLabel{#1}}
\def\bChoices{\@ifnextchar[{\@ansChoices}{\@ansChoices[\aeb@numCols]}}
\def\@ansChoices[#1]%
{%
    \global\let\@tempholdSaveAns\@empty %4/5
    \global\let\@tempholdSaveChoice\@empty %4/5
    \global\let\bChoiceLabel\@empty %4/5
    \setkeys{bchoice}{#1}%
    \global\eq@tabColCnt=0
    \ifnum\aeb@numCols=1 % list mode
        \def\eq@next{\@layoutListAns}%
    \else % tabular mode
         \def\eq@next{\@layoutTabularAns{\bChoiceNumCols}}%
    \fi
    \eq@next
}
\let\eChoices\relax
\def\@layoutListAns{\@ifnextchar\Ans{\@getListAns}%
    {\@lookforendansChoices{\@layoutListAns}}%
}
\newcommand{\eq@saveAns}[2][]{%
    \let\eq@next\@@@SaveAnsGobbleAns
    \ifx\bChoiceLabel\@empty\else
    \def\eq@savedAnsOpt{#1}\def\eq@savedAnsZO{#2}%
    \if\eq@savedAnsZO1 \let\eq@next\@@@SaveAns\fi
    \fi\eq@next
}
\long\def\@@@SaveAns#1\eAns{% 4/5
    \g@addto@macro\@tempholdSaveAns{\\{\ignorespaces#1}}%
    \addtocounter{quizno}{1}%
    \edef\temp@expand{\noexpand\g@addto@macro\noexpand
    \@tempholdSaveChoice{%
        \noexpand\\{\ifx\sqstar\@empty\aebChoiceAltFmt\else
        \ifaebshowgrayletters\Alph{quizno}\else
        \thequizno\fi\fi}}}\temp@expand
    \addtocounter{quizno}{-1}%
}
\def\eq@insertComma{\ifx\eq@comma\@empty\def\eq@comma{,}\else
    \eq@comma\space\fi}
\long\def\eq@displayAns#1{\eq@insertComma#1} % 4/5
\def\eq@displayAlts#1{\eq@insertComma(#1)} % 4/5
\newcommand{\useSavedAns}[2][]{% 4/5
    \bgroup\let\label\@gobble
        \def\eq@argi{#1}\ifx\eq@argi\@empty
            \let\eq@comma\@empty
            \let\\\eq@displayAns\csname SavedAns#2\endcsname\else
            \csname SavedAns#2-Idx#1\endcsname\fi
    \egroup
} % 4/5
\newcommand{\useSavedAlts}[2][]{%
    \bgroup
        \def\eq@argi{#1}\ifx\eq@argi\@empty
            \let\eq@comma\@empty
            \let\\\eq@displayAlts\csname SavedAlts#2\endcsname\else
            (\csname SavedAlts#2-Idx#1\endcsname)\fi
    \egroup
} % 4/5
\newcommand{\useSavedAltsAns}[2][]{%
    \bgroup\let\label\@gobble
        \def\eq@argi{#1}\ifx\eq@argi\@empty
            \csname SavedAltsAns#2\endcsname\else
            (\csname SavedAlts#2-Idx#1\endcsname)
            \csname SavedAns#2-Idx#1\endcsname\fi
    \egroup
} %4/5
\newcommand{\useSavedNumAns}[1]{\csname NumAns#1\endcsname}
\long\def\@@@SaveAnsGobbleAns#1\eAns{} % 4/5
\long\def\@getListAns\Ans#1\eAns{%\@@par %start new paragraph
    \eq@saveAns#1\eAns % 4/5
    \Ans#1\vspace{\@rowskip}%
    \@layoutListAns
}
\long\def\@lookforendansChoices#1{%
    \@ifnextchar\eChoices{\rowsep{\rowsep@default}%
        \expandafter\@findendans\@gobble}{\expandafter#1\@gobble}%
}
\def\@layoutTabularAns#1{%
    \let\eq@tabSep\@empty
    \xdef\numShortCols{#1}%
    \ifnum#1>\aeb@numCols \xdef\numShortCols{\aeb@numCols}\fi
    \@@layoutTabularAns
}
\def\@@layoutTabularAns{%
    \@ifnextchar\Ans{\@getTabAns}%
        {\@lookforendansChoices{\@@layoutTabularAns}}%
}
\def\rowsep#1{\gdef\@rowsep{[#1]}\gdef\@rowskip{#1}}%
\rowsep{\rowsep@default}
\def\rowsepDefault#1{\def\rowsep@default{#1}}
\def\rowsep@default{0pt}
\long\def\@getTabAns\Ans#1\eAns{%
    \eq@saveAns#1\eAns
    \global\advance\eq@tabColCnt1
    \let\@save@tabSep=\eq@tabSep
    \ifnum\eq@tabColCnt=\numShortCols
        \global\eq@tabColCnt=0
            \xdef\eq@tabSep{\noexpand\\\noalign{\kern\@rowskip\relax}}%
    \else
        \gdef\eq@tabSep{&}%
    \fi
    \@ifnextchar\eChoices{\@save@tabSep\Ans#1\rowsep{\rowsep@default}
        \expandafter\@findendans\@gobble}%
        {\@save@tabSep\Ans#1\@@layoutTabularAns}%
}
\def\@findendans{\@ifnextchar\end{% 4/5
    \ifx\bChoiceLabel\@empty\else
    \processLabeledAns\fi
    }{\expandafter\@findendans\@gobble}}%
\def\defineEachAns#1{\advance\count0by1\relax
    \@temptokena={#1}\expandafter\xdef
    \csname SavedAns\bChoiceLabel-Idx\the\count0\endcsname
        {\the\@temptokena}\ifsolutionsonly\else
        {\let\\\relax\eq@IWDefs{%
    \string\expandafter\string\gdef\string\csname\space
    SavedAns\bChoiceLabel-Idx\the\count0%
    \string\endcsname{\the\@temptokena}}}\fi
}
\def\defineEachChoice#1{\advance\count0by1\relax
    \@temptokena={#1}\expandafter\xdef
    \csname SavedAlts\bChoiceLabel-Idx\the\count0\endcsname
        {\the\@temptokena}\ifsolutionsonly\else
        {\let\\\relax\eq@IWDefs{%
    \string\expandafter\string\gdef\string\csname\space
    SavedAlts\bChoiceLabel-Idx\the\count0%
    \string\endcsname{\the\@temptokena}}}\fi
}
\def\processLabeledAns{% 4/5 \@tempholdSaveAns \@tempholdSaveChoice
    \bgroup
        \let\label\@gobble
        \toks@=\expandafter{\@tempholdSaveAns}\expandafter
        \xdef\csname SavedAns\bChoiceLabel\endcsname{\the\toks@}%
        \ifsolutionsonly\else{\let\\\relax\eq@IWDefs{%
        \string\expandafter\string\gdef\string\csname\space
        SavedAns\bChoiceLabel\string\endcsname{\the\toks@}}}\fi
        \count0=0\relax\let\\\defineEachAns\the\toks@
        \xdef\@currNCntAns{\the\count0 }\expandafter
        \xdef\csname NumAns\bChoiceLabel\endcsname{\@currNCntAns}%
        \ifsolutionsonly\else{\eq@IWDefs{%
        \string\expandafter\string\gdef\string\csname\space
        NumAns\bChoiceLabel\string\endcsname{\the\count0 }}}\fi
        \toks@=\expandafter{\@tempholdSaveChoice}\expandafter
        \xdef\csname SavedAlts\bChoiceLabel\endcsname{\the\toks@}%
        \ifsolutionsonly\else{\let\\\relax\eq@IWDefs{%
        \string\expandafter\string\gdef\string\csname\space
        SavedAlts\bChoiceLabel\string\endcsname{\the\toks@}}}\fi
        \count0=0\relax\let\\\defineEachChoice\the\toks@
        \count0=1\relax\toks@={\ignorespaces\@gobble}%
        \loop
            \edef\temp@exp{\the\toks@, %
            \noexpand\useSavedAlts[\the\count0]{\bChoiceLabel}
            \noexpand\useSavedAns[\the\count0]{\bChoiceLabel}}%
            \toks@=\expandafter{\temp@exp}%
            \ifnum\count0<\@currNCntAns
            \advance\count0by1
        \repeat
        \expandafter
        \xdef\csname SavedAltsAns\bChoiceLabel\endcsname{\the\toks@}%
        \ifsolutionsonly\else{\let\\\relax\eq@IWDefs{%
        \string\expandafter\string\gdef\string\csname\space
        SavedAltsAns\bChoiceLabel\string\endcsname{\the\toks@}}}\fi
    \egroup
}
\def\graylettersOn{\aebshowgrayletterstrue}
\def\graylettersOff{\aebshowgraylettersfalse}
\def\aeb@exiii{\expandafter\expandafter\expandafter}
\def\REF{\@ifstar{\let\isREFstar=1\aeb@REFstar}
    {\let\isREFstar=0\aeb@REF}}
\def\aeb@REFstar#1{\@ifundefined{r@#1}{\hbox{\reset@font\bfseries ??}}
    {\ifaebshowgrayletters\aeb@buildUpperCaseRef{#1}%
     \else\ref*{#1}\fi}%
}
\def\aeb@REF#1{\@ifundefined{r@#1}{\hbox{\reset@font\bfseries ??}}
    {\ifaebshowgrayletters\aeb@buildUpperCaseRef{#1}%
     \else\ref{#1}\fi}%
}
\def\aeb@buildUpperCaseRef#1{%
    \xdef\tmp@expand{\aeb@exiii\@firstoftwo\csname r@#1\endcsname}%
    \xdef\tmp@expand{\uppercase{\tmp@expand}}\tmp@expand
}
\endinput
%%
%% End of file `eqexam.def'.
