From ab32512d3febc3b84765830b7a8a33a29e2c4e42 Mon Sep 17 00:00:00 2001
From: Karl Berry <karl@freefriends.org>
Date: Wed, 30 Sep 2009 00:05:07 +0000
Subject: new latex package eqexam (29sep09)

git-svn-id: svn://tug.org/texlive/trunk@15565 c570f23f-e606-0410-a88d-b1316a301751
---
 Master/texmf-dist/tex/latex/eqexam/eqexam.def | 774 ++++++++++++++++++++++++++
 1 file changed, 774 insertions(+)
 create mode 100644 Master/texmf-dist/tex/latex/eqexam/eqexam.def

(limited to 'Master/texmf-dist/tex/latex/eqexam/eqexam.def')

diff --git a/Master/texmf-dist/tex/latex/eqexam/eqexam.def b/Master/texmf-dist/tex/latex/eqexam/eqexam.def
new file mode 100644
index 00000000000..273115a8f72
--- /dev/null
+++ b/Master/texmf-dist/tex/latex/eqexam/eqexam.def
@@ -0,0 +1,774 @@
+%%
+%% This is file `eqexam.def',
+%% generated with the docstrip utility.
+%%
+%% The original source files were:
+%%
+%% exerquiz.dtx  (with options: `eqexam')
+%% 
+\newif\ifeq@noforms \eq@noformsfalse
+\newif\ifeq@noquizsolutions \eq@noquizsolutionsfalse % dps new
+\newif\ifeq@nocorrections \eq@nocorrectionsfalse
+\newif\ifeq@nolink \eq@nolinkfalse
+\def\eq@ckglobalhide{\ifeq@globalshowsolutions\eq@hidesolutionfalse\fi}
+\def\hidesymbol{h}\def\Hidesymbol{H}
+\newif\iftherearesolutions \therearesolutionsfalse
+\def\SolutionsAfter{\eq@solutionsaftertrue\eq@nolinktrue}
+\def\SolutionsAtEnd{\eq@solutionsafterfalse\eq@nolinkfalse}
+\def\NoSpaceToWork{\let\eq@insertverticalspace=n}
+\def\SpaceToWork{\let\eq@insertverticalspace=y}
+\SpaceToWork
+\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{\eq@exsolafterDefault}{\textit{Solution}:}
+\newcommand{\renameSolnAfterTo}[1]{\def\exsolafter{#1}}
+\newcommand{\resetSolnAfterToDefault}{%
+    \def\exsolafter{\eq@exsolafterDefault}}
+\ifsolutionsonly\else
+\newwrite \ex@solns \immediate\openout \ex@solns \jobname.sol
+\fi
+\newwrite \quiz@solns \immediate\openout \quiz@solns \jobname.qsl
+\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
+\newcounter{eqquestionnoi}
+\newcounter{eqquestionnoii}
+\newcounter{eqquestionnoiii}
+\newcount\@eqquestiondepth \@eqquestiondepth=0
+\newcounter{questionno}
+\newcounter{partno}
+\renewcommand\thepartno{\alph{partno}}
+\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{\eqexerskip}[1]{\def\eq@exerskip{\vskip#1}}
+\eqexerskip{\medskipamount}
+\newcommand{\priorexskip}[1]{\def\eq@priorexskip{\vspace{#1}}}
+\priorexskip{\medskipamount}
+\let\eq@postexerciseHook\relax
+\newcommand\eqafterexersolnskip{\string\medskip}
+\def\marginparpriorhook{} % used to material before the exercise
+\def\marginparafterhook{} % used to material after the exercise
+\let\afterlabelhskip=\space
+\let\exersolnheadhook=\@empty
+\newcommand{\eqexheader}
+{%
+        \hbox{\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)}}
+\newcommand{\eqexlisttabheader}
+{%
+      \color{\@nolinkcolor}\eq@partsformat
+}
+\newenvironment{exercise}
+{%
+    \par\eq@priorexskip\noindent%\begingroup % set defaults
+    \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\par\global\eq@exerciseheadingtrue\eq@exerskip}
+\def\exercise@[#1]{\def\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}%
+            \if\exerstar*%
+                \def\eq@next{\def\eq@argi{#1}\@exercise}%
+            \else
+                \def\eq@next{\def\eq@argi{#1}\exercise@@}%
+            \fi
+        \fi
+    \fi
+\eq@next}
+\def\exercise@@{\@ifstar{\def\exerstar{*}\@exercise}% was \exercise@@@
+   {\exercise@@@}}%
+\def\exercise@@@{%
+\@ifnextchar[{\exercise@@@@}{\@exercise}}
+\def\exercise@@@@[#1]{\def\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}%
+            \typeout{The option #1 is not recognized}
+            \let\eq@next=\relax
+        \fi
+    \fi
+\eq@next}
+\newif\ifeq@exerciseheading \eq@exerciseheadingtrue
+\newcommand\exerSolnHeader[3]
+{%
+    \ifeqforpaper\else\webnewpage\fi\markright{#1}\par\noindent%
+    #3%
+    \solnhspace
+}
+\let\eqEXt=\relax
+\let\endeqEXt=\relax
+\let\eq@writeexheader\@empty
+\def\@exercise
+{%
+    \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
+                   \gdef\eq@writeexheader{%
+                   \set@display@protect
+                   \immediate\write\verbatim@out{\protect\eqEXt
+                   \protect\exerSolnHeader{\exsecrunhead}{ex.\the@exno}%
+                   {\exsllabelformat}\exersolnheadhook\protect\relax}%
+                   \set@typeset@protect}%
+                \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\ignorespaces
+    \fi
+}
+\long\def\setsolnspace#1{%
+    \def\newsolnspace{#1}%
+    \let\solnhspace\newsolnspace
+}
+\let\solnhspace\space
+\def\solnexer@woparts{\def\bLeaveVspace{x}% = no vertical space added
+    \def\next{\@ifnextchar[{\solnexer@@woparts}%
+        {\solnexer@@woparts[\null]}}%
+    \ifx\endparts\endexercise@parts@tabular
+        \def\next{\solnexer@@@woparts}%
+    \fi
+    \next}
+\let\eqPriorVspace\@gobble
+\def\solnexer@@woparts[#1]{%
+    \ifx#1\null
+    \else
+        \xdef\sameVspace{#1}%
+        \ifeq@nosolutions
+            \ifeq@solutionsafter\else
+                \let\bLeaveVspace=\@empty
+                \def\leavevspace{%
+                    \ifx\eq@insertverticalspace y\par\eqPriorVspace{#1}%
+                        {\nobreak\parbox[b][#1][t]{\linewidth}{\vfill}}%
+                    \fi
+                }%
+            \fi
+        \fi
+    \fi
+    \solnexer@@@woparts
+}
+\def\solutionsafterSkip{\smallskip}
+\def\solnexer@@@woparts
+{%
+    \def\exerwparts@cols{x}%
+    \let\verbatim@out=\ex@solns
+    \if\currhideopt H%
+        \let\procsoln=\comment
+        \let\endprocsoln=\endcomment
+        \def\eq@next{\procsoln}%
+    \else
+        \eq@ckglobalhide
+        \ifeq@hidesolution
+            \let\procsoln=\comment
+            \let\endprocsoln=\endcomment
+        \else
+            \ifx\bLeaveVspace\@empty\leavevspace\fi
+            \let\procsoln=\verbatimwrite
+            \let\endprocsoln=\endverbatimwrite
+        \fi
+        \def\eq@next{%
+            \ifeq@solutionsafter
+                \ifx\exsolafter\@empty\else
+                \par\solutionsafterSkip
+                \noindent\exsolafter\space\ignorespaces\fi
+            \else
+                \eq@writeexheader % write the solution header 11/03/05
+                \global\let\eq@writeexheader\@empty
+                \global\therearesolutionstrue\expandafter\procsoln
+            \fi
+        }%
+    \fi
+\eq@next}
+\def\endsolnexerhook{}
+\def\endsolnexerhookaux{}
+\def\eq@fititin{\noindent\unskip\nobreak\hfill\penalty50
+    \hskip2em\hbox{}\nobreak\hfill}
+\let\eqfititin=\eq@fititin
+\newcommand\eqExerSolnTrailer
+{%
+    \string\ReturnTo{page.\the\c@page}%
+    {\hbox{\if\exerstar*\exrtnlabelformatwp\else\exrtnlabelformat\fi}}%
+    \string\endeqEXt\ifeqforpaper\string\par\eqafterexersolnskip\fi^^J
+}
+\def\endsolnexer@woparts
+{%
+    \if\currhideopt H%
+        \csname endprocsoln\endcsname
+    \else
+        \ifeq@solutionsafter
+            \eq@fititin\hbox{\exrtnlabelformat}%
+        \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\exercise@parts{\@@par\ifdim\parskip>\z@\vskip-\parskip\fi
+  \def\exerwparts@cols{x}\@ifnextchar[%
+  {\let\endparts=\endexercise@parts@tabular\exercise@parts@tabular@}%
+  {\let\endparts=\endexercise@parts@list\exercise@parts@list}}
+\def\eq@extralabelsep{0pt}
+\newenvironment{exercise@parts@list}
+{\settowidth{\eq@tmplength}{\normalfont(d)}%
+\eq@nolinkfalse
+\begin{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
+                    \gdef\eq@writeexheader{%
+                    \set@display@protect
+                    \immediate\write\verbatim@out{\protect\eqEXt
+                    \protect\exerSolnHeader{\exsecrunhead}%
+                    {ex.\the@exno\alph{partno}}{\exsllabelformatwp}\relax}%
+                    \set@typeset@protect
+                    }%
+                \fi
+            \fi
+        \fi
+    \fi
+    \makebox[\eq@tmplength]{\eqexlisttabheader}%
+}{%
+    \usecounter{partno}%
+    \setlength{\topsep}{3pt}%
+    \setlength{\partopsep}{0pt plus 1pt minus 1pt}%
+    \setlength{\parsep}{0pt}\setlength{\itemindent}{0pt}%
+    \setlength{\listparindent}{\parindent}%
+    \settowidth{\labelsep}{\normalfont\ }%
+    \addtolength{\labelsep}{\eq@extralabelsep}%
+    \settowidth{\labelwidth}{\normalfont(d)}%
+    \setlength{\leftmargin}{\labelwidth}%
+    \addtolength{\leftmargin}{\labelsep}%
+    \let\eq@item=\item
+    \def\item{\def\currhideopt{x}\eq@hidesolutionfalse\eq@nolinkfalse%
+    \@ifnextchar[\@ckhide\eq@item}}%
+}{\end{list}}
+\def\exercise@parts@tabular@[#1]{%
+  \def\exerwparts@cols{#1}\exercise@parts@tabular}
+\newenvironment{exercise@parts@tabular}
+{%
+    \setcounter{partno}{0}%
+    \settowidth{\eq@tmplength}{\normalfont(d)\ }\sbox{\eq@tmpbox}{(d)}%
+    \let\eq@item=\item@part@tabular
+    \def\item{\eq@hidesolutionfalse\eq@nolinkfalse
+        \@ifnextchar[\@ckhide\eq@item}\eq@nolinkfalse
+    \eq@tmpdima=\linewidth \divide\eq@tmpdima by\exerwparts@cols
+    \vskip\partopsep\noindent\normalbaselines\tabcolsep=0pt
+    \begin{tabular}{*{\exerwparts@cols}{p{\eq@tmpdima}}}%
+}{\end{tabular}}
+\def\item@part@tabular{\leavevmode\refstepcounter{partno}%
+  \eq@solutionsafterfalse % no solutionsafter are allowed
+  \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\eq@writeexheader{%
+        \set@display@protect
+        \immediate\write\verbatim@out{%
+        \protect\eqEXt\string\exerSolnHeader{\exsecrunhead}%
+            {ex.\the@exno\alph{partno}}{\exsllabelformatwp}\relax}%
+        \set@typeset@protect
+      }%
+  \fi\fi\fi
+  \PBS\raggedright
+  \settowidth{\eq@tmplength}{\normalfont(d)\ }%
+  \sbox{\eq@tmpbox}{\normalfont(d)}%
+  \eq@tmpdima=\wd\eq@tmpbox
+  \addtolength\eq@tmplength{\eq@extralabelsep}%
+  \hangindent=\eq@tmplength\hangafter=1\relax
+  \makebox[\eq@tmpdima]{\eqexlisttabheader}\ \ignorespaces
+}
+\def\@ckhide[#1]{\def\eq@arg{#1}%
+    \def\currhideopt{x}%
+    \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
+    \eq@item
+}
+\def\includeexersolutions
+{%
+       \include@solutions\let\include@solutions\relax
+}
+\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}}
+\newcommand{\exerSolnInput}
+{%
+    \let\webnewpage=\relax
+    \ifsolutionsonly\else\immediate\closeout\ex@solns\fi
+    \ifeq@nosolutions\else
+        % changed from \exsecrunhead, 6/1/05
+        \iftherearesolutions\ifsolutionsonly\else\newpage\fi
+        \markright{\exsectitle}%
+            \ifx\webnewpage\relax
+                \def\webnewpage{\let\webnewpage\newpage}%
+            \fi
+            \priorexsectitle\exerSolnsHeadnToc\priorexslinput
+            \InputIfFileExists{\jobname.sol}{}{\PackageWarning{exerquiz}
+            {!!! Solutions to exercises not found}}%
+            \eqsolutionshook
+        \fi
+    \fi
+}
+\def\include@solutions
+{%
+        \exerSolnInput
+}
+\newcommand{\prior@questionsHook}{}
+\let\qMark@Hook\@empty
+\let\aeb@titleQuiz\@empty
+\newcommand{\post@questionsHook}{}
+\renewcommand{\theeqquestionnoi}{\arabic{eqquestionnoi}}
+\newcommand{\labeleqquestionnoi}{%
+    \color{blue}\bfseries\theeqquestionnoi.}
+\renewcommand{\theeqquestionnoii}{\alph{eqquestionnoii}}
+\newcommand{\labeleqquestionnoii}{%
+    \color{blue}\bfseries(\theeqquestionnoii)}
+\renewcommand{\theeqquestionnoiii}{\roman{eqquestionnoiii}}
+\newcommand{\labeleqquestionnoiii}{%
+    \color{blue}\bfseries(\theeqquestionnoiii)}
+\newenvironment{questions}
+{%
+    \ifnum\@eqquestiondepth>\tw@\@toodeep\else
+    \advance\@eqquestiondepth\@ne\fi
+    \def\@quesctr{eqquestionno\romannumeral\the\@eqquestiondepth}%
+    \begin{list}{\qMark@Hook\prior@questionsHook\gdef\eqPTs{1}%
+    \global\let\eqQT=\eq@na\makebox[\labelwidth][r]{\normalfont\bfseries
+    \csname label\@quesctr\endcsname}%
+        \post@questionsHook}%
+    {\usecounter{\@quesctr}%
+    \settowidth{\labelwidth}{\normalfont\bfseries00.\ }%
+    \setlength{\topsep}{3pt}\setlength{\parsep}{0pt}%
+    \setlength{\itemindent}{0pt}\setlength{\itemsep}{3pt}%
+    \setlength{\leftmargin}{\labelwidth}%
+    \settowidth{\labelsep}{\ }}%
+}{\end{list}}
+\def\pushquestions{%
+    \expandafter\xdef\csname save\@quesctr\endcsname{%
+        \expandafter\the\csname c@\@quesctr\endcsname}%
+    \end{questions}}
+\def\popquestions{%
+    \begin{questions}
+    \setcounter{\@quesctr}{\csname save\@quesctr\endcsname}}
+\def\sq@priorhook{\medskip\noindent}
+\def\@shortquizCnt{0}
+\def\@sqGenBaseName{eqSqBn\@shortquizCnt}
+\newenvironment{shortquiz}
+{%
+    {\count0=\@shortquizCnt \advance\count0by1\relax
+        \xdef\@shortquizCnt{\the\count0}}%
+    \goodbreak\@ifstar{\gdef\sqstar{*}\@shortquiz}%
+        {\gdef\sqstar{}\@shortquiz}%
+}{\aeb@endshortquiz}
+\newenvironment{shortquiz*}
+{%
+    {\count0=\@shortquizCnt\advance\count0by1\relax
+        \xdef\@shortquizCnt{\the\count0 }}%
+    \gdef\sqstar{*}\@shortquiz
+}{\aeb@endshortquiz}
+\def\@shortquiz{\@ifnextchar[%
+    {\@@shortquiz}{\@@shortquiz[\@sqGenBaseName]}}
+\def\@@shortquiz[#1]{%\begingroup
+  \gdef\oField{#1}\gdef\curr@quiz{#1}\gdef\currQuiz{#1}%
+  \global\let\eqQuizType=s\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@priorhook\sqlabel\space\ignorespaces
+}
+\def\aftershortquizskip{\medskip}
+\def\aeb@endshortquiz{\setcounter{quizno}{0}%
+    \global\let\sqlabel=\eq@sqlabel
+    \global\let\sqslrtnlabel=\eq@sqslrtnlabel
+    \global\let\sqsllabel=\eq@sqsllabel
+    \par\aftershortquizskip
+}
+\def\sqLinks{\gdef\sqstar{}}\sqLinks{}
+\def\sqForms{\gdef\sqstar{*}}
+\let\eq@tq@star\relax
+\def\solution@sq{\let\eq@next=\relax
+  \ifx\@qzsolndest\@empty
+    \typeout{exerquiz: * Solutions unexpected here *}%
+    \typeout{exerquiz: * Will assume 'solutionsafter' option *}%
+    \eq@solutionsaftertrue
+  \fi
+  \ifeq@solutionsafter
+    \par\smallskip\noindent
+    \sqsolafter
+  \else
+    \global\therearequizsolutionstrue\let\verbatim@out=\quiz@solns
+    \set@display@protect
+    \immediate\write\verbatim@out{%
+      \ifx\eqQuizType q\string\eqQt\else\string\eqSQt\fi%
+      \string\quizSolnHeader\ifx\eqQuizType q\ifx\allow@peek n%
+        [{\curr@quiz}{\currQuizStartPage}]\fi\fi%
+        {\@qzsolndest}{\sqsllabel}\relax}%
+    \set@typeset@protect
+    \expandafter\verbatimwrite\fi
+}
+\def\solutionsAfterSkip{\par\bigskip}
+\def\endsolution@sq
+{%
+    \ifeq@solutionsafter
+        \eq@fititin\hbox{\sqslrtnlabel}\solutionsAfterSkip
+    \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}
+\newcommand\eqSqSolnTrailer{%
+    \ifx\eqQuizType q%
+        \string\ReturnTo{page.\the\c@page}%
+            {\hbox{\sqslrtnlabel}}\string\endeqQt
+    \else
+        \string\ReturnTo{page.\the\c@page}%
+            {\hbox{\sqslrtnlabel}}\string\endeqSQt
+    \fi
+    \ifeqforpaper\string\fpAfterSolutionsSkip\fi^^J%
+}
+\let\eqSQt\relax
+\let\endeqSQt\relax
+\let\eqQt\relax
+\let\endeqQt\relax
+\newcommand\quizSolnHeader[3][]{%
+    \ifeqforpaper\else\webnewpage\fi\noindent
+    #2%
+    \solnhspace
+}
+\newif\iftherearequizsolutions \therearequizsolutionsfalse
+\let\aeb@FLOverride\relax
+\def\includequizsolutions
+{%
+        \include@quizsolutions
+        \let\include@quizsolutions=\relax
+}
+\def\answers@sq{\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{\stepcounter{questionno}%
+    \if\sqstar*\relax
+        \if\aeb@FLOverride l
+            \let\@An\Ans@ck@sq@f
+        \fi
+    \else
+        \if\aeb@FLOverride f
+            \let\@An\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{%
+    \gdef\aeb@numCols{#2}%
+    \ifx\sq@hwdest\@empty
+        \xdef\@qzsolndest{#1}%
+    \else
+        \gdef\@qzsolndest{\sq@hwdest}%
+    \fi
+    \ifx#21\gdef\eq@listType{1}\expandafter\answers@sq@list\else
+    \gdef\eq@listType{0}\expandafter\answers@@sq@tabular\fi{#2}%
+}
+\def\eq@hspanner{\ }
+\def\eq@hspanner@default{\ }
+\def\eq@lw@l{\eq@l@l\eq@hspanner}
+\def\setMClabelsep#1{\def\eq@hspanner{#1}}
+\def\resetMClabelsep{\let\eq@hspanner\eq@hspanner@default}
+\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\if\eq@listType1%
+    \addtocounter{quizno}{-1}\refstepcounter{quizno}\fi}
+\newenvironment{answers@sq@list}[1]
+{%
+    \if\aeb@answerType r
+        \let\endanswers=\endanswers@sq@list
+    \else
+        \let\endmanswers=\endanswers@sq@list
+    \fi
+    \vskip\aboveanswersSkip
+    \begin{list}{\strut\@Ans}%\begin{list}{\strut\@Ans\ }
+    {%
+        \if\sqstar*\relax
+            \settowidth{\labelwidth}{\eq@lw@f}%
+        \else
+            \settowidth{\labelwidth}{\eq@lw@l}%
+        \fi
+        \setlength{\parsep}{0pt}\setlength{\itemindent}{0pt}%
+        \setlength{\topsep}{0pt}\setlength{\partopsep}{0pt}%
+        \setlength{\listparindent}{\parindent}%
+        \setlength{\leftmargin}{\labelwidth}%
+        \setlength{\labelsep}{0pt}%
+        \def\Ans{\Ans@list}%
+    }%
+}%
+{\end{list}\setcounter{quizno}{0}}
+\newcommand\Ans@tabular[2][0]{\gdef\eq@pPTs{#1}%
+    \xdef\Ans@choice{#2}\leavevmode\@Ans
+}
+\def\answers@@sq@tabular#1{%
+    \vskip\aboveanswersSkip\noindent\tabcolsep=0pt
+    \eq@tmpdima=\linewidth \divide \eq@tmpdima by#1 %
+    \def\Ans{\Ans@tabular}%
+    \begin{tabular}{*{#1}{p{\eq@tmpdima}}}}%
+\def\endanswers@sq{\end{tabular}\setcounter{quizno}{0}}%
+\def\endmanswers@sq{\end{tabular}\setcounter{quizno}{0}}%
+\def\popiiictm{\special{CTM: pop pop pop}}
+\def\linkContentFormat{%
+    \if\probstar*\arabic{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
+\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
+}
+\def\bChoices{\@ifnextchar[{\@ansChoices}{\@ansChoices[\aeb@numCols]}}
+\def\@ansChoices[#1]%
+{%
+    \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}}%
+}
+\long\def\@getListAns\Ans#1\eAns{%
+    \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{%
+    \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{}{\expandafter\@findendans\@gobble}}
+\def\graylettersOn{\aebshowgrayletterstrue}
+\def\graylettersOff{\aebshowgraylettersfalse}
+\def\aeb@exiii{\expandafter\expandafter\expandafter}
+\def\REF{\@ifstar{\aeb@REFstar}{\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'.
-- 
cgit v1.2.3

