% \iffalse
%<*copyright>
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%% Exerquiz.sty package,             2000-8-16          %%
%% Copyright (C) 1999-2004  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{exerquiz}
%<package> [2007/05/05 v6.08 Exerquiz Exercises and Quizzes for LaTeX/PDF package (dps)]
%<*driver>
\documentclass{ltxdoc}
\usepackage[dviwindo,colorlinks,hyperindex]{hyperref}
\pdfstringdefDisableCommands{\let\\\textbackslash}
\OnlyDescription  % comment out for implementation details
\EnableCrossrefs
\CodelineIndex
\begin{document}
  \GetFileInfo{exerquiz.sty}
  \title{Exerquiz: Exercises and Quizzes for \LaTeX/PDF}
  \author{D. P. Story\\
    Email: \texttt{dpstory@uakron.edu}}
  \date{processed \today}
  \maketitle
  \tableofcontents
  \let\Email\texttt
  \DocInput{exerquiz.dtx}
  \PrintIndex
\end{document}
%</driver>
% \fi
%
% \MakeShortVerb{|}
%
% \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}
%
%    \begin{macrocode}
%<*package>
%    \end{macrocode}
% \newpage
% \section{Change History}
%  \makeatletter
%  \renewenvironment{theglossary}{%
%
%    \let\efill=\relax
%    \begin{itemize}}%
%   {\end{itemize}}
%  \global\c@GlossaryColumns = 1
%  \makeatother
%  \PrintChanges
% \section{Package options and setup}\label{options}
%
% Introduce a number of useful options for \textsl{exerquiz}.
% \subsection{Options for paper, solutions, JavaScript and preview}
%    \begin{macrocode}
\IfFileExists{xcolor.sty}%
{\def\eq@ColorPackage{xcolor}\PassOptionsToPackage{table,hyperref}{xcolor}}
{\def\eq@ColorPackage{color}}
\DeclareOption{noxcolor}{\def\eq@ColorPackage{color}}
%    \end{macrocode}
%    \begin{macro}{forpaper}
%    \begin{macro}{forcolorpaper}
%    Pass the |monochrome| option to the color package
%\changes{v6.06a}{2007/04/09}
%{
%   Added  the \texttt{forcolorpaper} option for those using \textsf{exerquiz} without \textsf{web}.
%}
%    \begin{macrocode}
\DeclareOption{forpaper}{%
   \eqforpapertrue\PassOptionsToPackage{monochrome}{\eq@ColorPackage}
   \AtBeginDocument{\ifnum\eq@drivernum=4 \else\AllowPeeking\fi}
}
\DeclareOption{forcolorpaper}{\eqforpapertrue  % for print
   \AtBeginDocument{\ifnum\eq@drivernum=4 \else\AllowPeeking\fi}
}
%    \end{macrocode}
%    \end{macro}
%    \end{macro}
%    \begin{macro}{preview}
% With this option, the bounding boxes of all form fields appear in the
% dvi preview. Use this option of properly positioning your fields, then
% remove this option on the final build of the document. This option is no
% appropriate for the \texttt{pdftex} option which does not have a dvi preview.
%    \begin{macrocode}
\DeclareOption{preview}{\PassOptionsToPackage{preview}{eforms}}
%    \end{macrocode}
%    \end{macro}
%    \begin{macro}{nosolutions}
%    With the option, the solutions to the exercises are not
%    included in the typeset document.
%    \begin{macrocode}
\DeclareOption{nosolutions}{\eq@nosolutionstrue\eq@nolinktrue}
%    \end{macrocode}
%    \end{macro}
%    \begin{macro}{noquizolutions}
% No solutions for quizzes (shortquiz and quiz environments).
%    \begin{macrocode}
\DeclareOption{noquizsolutions}{\eq@noquizsolutionstrue\eq@nolinktrue}
%    \end{macrocode}
%    \end{macro}
%    \begin{macro}{online}
% An \texttt{online} options.
%    \begin{macrocode}
\DeclareOption{online}{\let\eq@online=y}
\let\eq@online=n
%    \end{macrocode}
%    \end{macro}
%    \begin{macro}{nohiddensolutions}
% Overrides any hidden solutions specified with the \texttt{exercise}
% environment.
%    \begin{macrocode}
\DeclareOption{nohiddensolutions}{\eq@globalshowsolutionstrue}
\DeclareOption{noHiddensolutions}%
    {\eq@globalshowsolutionstrue\AtBeginDocument{\def\Hidesymbol{h}}}
%    \end{macrocode}
%    \end{macro}
%    \begin{macro}{solutionsafter}
%    Solutions will appear after the statement of the exercise.
%    \begin{macrocode}
\DeclareOption{solutionsafter}{\eq@solutionsaftertrue\eq@nolinktrue}
%    \end{macrocode}
%    \end{macro}
%    \begin{macro}{nocorrections}
%    The code for correcting the |quiz| environment is
%    not written; this results in a smaller file.
%    \begin{macrocode}
\DeclareOption{nocorrections}{\eq@nocorrectionstrue}
%    \end{macrocode}
%    \end{macro}
%    \begin{macro}{proofing}
%    An option for marking the correct answers for shortquiz and quiz
%    \begin{macrocode}
\DeclareOption{proofing}{\eq@proofingtrue}
%    \end{macrocode}
%    \end{macro}
%    \begin{macro}{showgrayletters}
% When this option is in effect, capital letters in gray appear under
% the multiple choice question boxes of quizzes.
%    \begin{macrocode}
\newif\ifaebshowgrayletters\aebshowgraylettersfalse
\DeclareOption{showgrayletters}{\aebshowgrayletterstrue}
%    \end{macrocode}
%    \end{macro}
%    \begin{macro}{nodljs}
%    An option for excluding all DLJS from the document. Useful with the
%    \texttt{forpaper} option, or a document destined to be printed. Pass
%    on to insdljs package.
%    \begin{macrocode}
\DeclareOption{nodljs}{\PassOptionsToPackage{nodljs}{insdljs}%
     \AtEndOfPackage{\let\importdljs=y}}
%    \end{macrocode}
%    \end{macro}
%    \begin{macro}{execAfter}
% Execute any JS defined within the \texttt{execJS} environment. Works only for
% authors using Acrobat 5.0 or Acrobat Approval.
%    \begin{macrocode}
\DeclareOption{execJS}{\PassOptionsToPackage{execJS}{insdljs}}
%    \end{macrocode}
%    \end{macro}
%    \begin{macro}{exercisesonly}
% If the document author wants only to create a series of exercises, no quizzes, there is no
% need for the Document-level JavaScript. So, we have a couple of convenience options.
%    \begin{macrocode}
\DeclareOption{exercisesonly}{\PassOptionsToPackage{nodljs}{insdljs}}
%    \end{macrocode}
%    \end{macro}
%    \begin{macro}{debug}
%    An option for debugging JavaScript. Pass on to insdljs package.
%    \begin{macrocode}
\DeclareOption{debug}{\PassOptionsToPackage{debug}{insdljs}}
%    \end{macrocode}
%    \end{macro}
%    \subsection{Driver Options}
%     The \textsf{web} package passes these driver options to \textsf{exerquiz}.
%    These options are needed is \textsf{exerquiz} is used without
%    \textsf{web}; in this case, the options below must explicitly included.
%    \begin{macro}{dvipsone}
%    Set the driver dependent code for the |quiz| environments.
%    \begin{macrocode}
% \def\eq@drivernum{5} % 5 = no choice
\DeclareOption{dvipsone}{\def\eq@drivernum{0}%
    \PassOptionsToPackage{dvipsone}{eforms}
%    \PassOptionsToPackage{dvipsone}{insdljs}
}
\DeclareOption{dvips}{\def\eq@drivernum{0}%
    \PassOptionsToPackage{dvips}{eforms}
    \PassOptionsToPackage{dvips}{insdljs}}
\DeclareOption{pdftex}{\def\eq@drivernum{1}%
   \def\eq@driver{pdftex}%
   \PassOptionsToPackage{pdftex}{\eq@ColorPackage}
   \PassOptionsToPackage{pdftex}{eforms}
   \PassOptionsToPackage{pdftex}{insdljs}
}
%    \end{macrocode}
%    \end{macro}
%    \begin{macro}{dvipdfm}
%    Set the driver dependent code for the \texttt{quiz} and \texttt{quiz}
%    environments.
%    \begin{macrocode}
\DeclareOption{dvipdfm}{\def\eq@drivernum{2}%
     \def\eq@driver{dvipdfm}%
     \PassOptionsToPackage{dvipdfm}{\eq@ColorPackage}
     \PassOptionsToPackage{dvipdfm}{eforms}
     \PassOptionsToPackage{dvipdfm}{insdljs}
}
%    \end{macrocode}
%    \end{macro}
%    \begin{macro}{textures}
% This option, and testing are due to Ross Moore  3/6/02
%    \begin{macrocode}
\DeclareOption{textures}{\def\eq@drivernum{3}%
  \def\eq@driver{textures}%
  \PassOptionsToPackage{textures}{\eq@ColorPackage}%
  \PassOptionsToPackage{textures}{eforms}
  \PassOptionsToPackage{textures}{insdljs}%
}
%    \end{macrocode}
%    \end{macro}
%    \begin{macro}{dviwindo}
%    Set \cmd{\eq@noformstrue}, this inserts an \cmd{\endinput} just after
%    the end of the |exercise| environment.  No quizzes for
%    \texttt{dviwindo}.
%    \begin{macrocode}
\DeclareOption{dviwindo}{\def\eq@drivernum{4}\def\eq@driver{dviwindo}%
    \eq@noformstrue\PassOptionsToPackage{nodljs}{insdljs}}
%    \end{macrocode}
%    \end{macro}
% If no driver is passed to \textsf{exerquiz}, assume it is
% dvipsone or dvips---\textsf{hyperref} defines the specials.
% Default driver dvipsone/dvips
%    \begin{macrocode}
% \def\eq@drivernum{5}
% \def\eq@driver{dvipsone/dvips}
% \def\eq@driver{no driver specified}
%    \end{macrocode}
% \subsection{Language Options}
%    \textsf{exerquiz} uses many language dependent typeset labels
%    and JavaScript messages.  These messages are defined in the
%    English language in Section~\ref{ss:ldm}. The language options
%    defines the macro \cmd{\LangRedefinition} to input language
%    dependent redefinitions of these messages.  Initially,
%    \cmd{\LangRedefinition} is set to relax and no redefinition files
%    are input.
%    \begin{macrocode}
\let\LangRedefinitions=\relax
%    \end{macrocode}
%    \begin{macro}{french}
%    Translations due to Jean-Michel SARLAT.
%    \begin{macrocode}
\DeclareOption{french}{%
   \def\LangRedefinitions{\InputIfFileExists{eqfr.def}%
     {\typeout{exerquiz: Inputting French Option}}%
     {\typeout{exerquiz: French Option: Cannot find the file eqfr.def,
      using the default, English.}}}}
%    \end{macrocode}
%    \end{macro}
%    \begin{macro}{german}
%    Translation due to Michael Wiedmann.
%    \begin{macrocode}
\DeclareOption{german}{%
   \def\LangRedefinitions{\InputIfFileExists{eqde.def}%
   {\typeout{exerquiz: Inputting German Option}}%
   {\typeout{exerquiz: German Option: Kann die Datei eqde.def
     nicht finden, benutze Default, Englisch.}}}}
%    \end{macrocode}
%    \end{macro}
%    \begin{macro}{norsk}
%    Translation due to Hans Fredrik Nordhaug.
%    \begin{macrocode}
\DeclareOption{norsk}{%
   \def\LangRedefinitions{\InputIfFileExists{eqno.def}%
   {\typeout{exerquiz: Inputting Norsk Option}}%
   {\typeout{exerquiz: Norsk Option: Cannot find the file eqno.def,
   using the default, English.}}}}
%    \end{macrocode}
%    \end{macro}
%    \begin{macro}{dutch}
%    Translation due to Henny Wilbrink
%    \begin{macrocode}
\DeclareOption{dutch}{%
   \def\LangRedefinitions{\InputIfFileExists{eqnl.def}%
   {\typeout{exerquiz: Inputting Dutch Option}}%
   {\typeout{exerquiz: Dutch Option: Kan bestand eqnl.def niet vinden,
   gebruik default, Engels.}}}}
%    \end{macrocode}
%    \end{macro}
%    \begin{macro}{spanish}
%    Translation due to Pedro Luis Luque
%    \begin{macrocode}
\DeclareOption{spanish}{%
   \def\LangRedefinitions{\InputIfFileExists{eqes.def}%
   {\typeout{exerquiz: Inputting Spanish Option}}%
   {\typeout{exerquiz: Spanish Option: Opci\'on Espa\~nola: no puede
    encontrar el fichero eqes.def, usar\'a por defecto, English.}}}}
%    \end{macrocode}
%    \end{macro}
%    \begin{macro}{italian}
%    Translation due to PierLuigi Zezza
%    \begin{macrocode}
\DeclareOption{italian}{%
   \def\LangRedefinitions{\InputIfFileExists{eqit.def}%
   {\typeout{exerquiz: Opzione Lingua Italiana}}%
   {\typeout{exerquiz, Opzione Italiano: Non trovo il file eqit.def,
    utilizzo  quello di default, English.}}}}
%    \end{macrocode}
%    \end{macro}
%    \begin{macro}{russian}
%    Translation due to Sergei V. Znamenskii
%    \begin{macrocode}
\DeclareOption{russian}{%
   \def\LangRedefinitions{\InputIfFileExists{eqru.def}%
   {\typeout{exerquiz: Inputting Russian Option}}%
   {\typeout{exerquiz: Russian Option: Cannot find the file  eqru.def,
   using the default, English.}}}}
%    \end{macrocode}
%    \end{macro}
%    \begin{macro}{dansk}
%    Translation due to Erik Leimand
%    \begin{macrocode}
\DeclareOption{dansk}{%
   \def\LangRedefinitions{\InputIfFileExists{eqda.def}%
   {\typeout{exerquiz: Inputting Dansk Option}}%
   {\typeout{exerquiz: Dansk Option: Cannot find the file eqda.def,
   using the default, English.}}}}
%    \end{macrocode}
%    \end{macro}
%    \begin{macro}{polish}
%    Translation due to Jerzy Mycielski
%    \begin{macrocode}
\DeclareOption{polish}{%
   \def\LangRedefinitions{\InputIfFileExists{eqpo.def}%
   {\typeout{exerquiz: Inputting Polish Option}}%
   {\typeout{exerquiz: Polish Option: Cannot find the file
    eqpo.def, using the default, English.}}}}
%    \end{macrocode}
%    \end{macro}
%    \begin{macro}{finnish}
% Translation due to Paivi Porras
%    \begin{macrocode}
\DeclareOption{finnish}{%
   \def\LangRedefinitions{\InputIfFileExists{eqfin.def}%
   {\typeout{exerquiz: Inputting Finnish Option}}%
   {\typeout{exerquiz: Finnish Option: Cannot find the file eqfin.def,
   using the default, English.}}}}
%    \end{macrocode}
%    \end{macro}
%    \begin{macro}{catalan}
% Translation due to Ramon Ballester
%    \begin{macrocode}
\DeclareOption{catalan}{%
   \def\LangRedefinitions{\InputIfFileExists{eqcat.def}%
   {\typeout{exerquiz: Inputting Catalan Option}}%
   {\typeout{exerquiz: Catalan Option: Cannot find the file eqcat.def,
   using the default, English.}}}}
%    \end{macrocode}
%    \end{macro}
%    \begin{macro}{czech}
% Translation due to Robert Marik
%    \begin{macrocode}
\DeclareOption{czech}{%
   \def\LangRedefinitions{\InputIfFileExists{eqcz.def}%
   {\typeout{exerquiz: Inputting Czech Option}}%
   {\typeout{exerquiz: Czech Option: Cannot find the file eqcz.def,
   using the default, English.}}}}
%    \end{macrocode}
%    \end{macro}
%    \begin{macro}{brazil}
%    Translation due to Koichi Sameshima
%    \begin{macrocode}
\DeclareOption{brazil}{%
   \def\LangRedefinitions{\InputIfFileExists{eqbr.def}%
   {\typeout{exerquiz: Inputting Brazilian Portuguese Option}}%
   {\typeout{exerquiz: Portuguese Option: Opc\~ao Portugu\^es: n\~ao foi poss\'ivel
    encontrar o arquivo eqbr.def, usaremos o padr\~ao, English.}}}}
%    \end{macrocode}
%    \end{macro}
%    \begin{macrocode}
\DeclareOption*{\PassOptionsToPackage{\CurrentOption}{\eq@ColorPackage}}
\@ifpackageloaded{xcolor}%
{%
    \@ifpackagelater{xcolor}{2004/07/04}{}
    {%
    \PackageError{exerquiz}{%
    *************************************************\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]{exerquiz}\MessageBreak
    *************************************************}{}%
    }%
}{}
%    \end{macrocode}
% \subsection{Switches}
%    Boolean switches used by the declared options.
%    \begin{macrocode}
%\newif\ifpreview \previewfalse
\let\iterate\relax
\newif\ifeq@solutionsafter \eq@solutionsafterfalse
\newif\ifeq@hidesolution \eq@hidesolutionfalse
\newif\ifeq@globalshowsolutions \eq@globalshowsolutionsfalse
\newif\ifeq@nosolutions \eq@nosolutionsfalse
\newif\ifeq@proofing \eq@proofingfalse
\newif\ifeqforpaper \eqforpaperfalse
%</package>
%<*package|eqexam>
%\newif\ifeqforpaper \eqforpaperfalse
\newif\ifeq@noforms \eq@noformsfalse
%\newif\ifeq@nosolutions \eq@nosolutionsfalse
\newif\ifeq@noquizsolutions \eq@noquizsolutionsfalse % dps new
%\newif\ifeq@solutionsafter \eq@solutionsafterfalse
\newif\ifeq@nocorrections \eq@nocorrectionsfalse
%\newif\ifeq@proofing \eq@proofingfalse
\newif\ifeq@nolink \eq@nolinkfalse
%\newif\ifeq@globalshowsolutions \eq@globalshowsolutionsfalse
%\newif\ifeq@hidesolution \eq@hidesolutionfalse
\def\eq@ckglobalhide{\ifeq@globalshowsolutions\eq@hidesolutionfalse\fi}
\def\hidesymbol{h}\def\Hidesymbol{H}
%    \end{macrocode}
% When the first solution is written, \cs{therearesolutions} is
% made true.  When the solutions are input back into the file, and
% this switch is still false, then no exercise header is typeset;
% this avoids an empty exercise section with only the header.
%    \begin{macrocode}
\newif\iftherearesolutions \therearesolutionsfalse
%    \end{macrocode}
%    \begin{macro}{\SolutionsAfter}
%    \begin{macro}{\SolutionsAtEnd}
% Some macros to turn \cs{eq@solutionsafter} on or off
%    \begin{macrocode}
\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
%</package|eqexam>
%<*package>
%    \end{macrocode}
%    \end{macro}
%    \end{macro}
%    \begin{macro}{\CorrectionsOn}
%    \begin{macro}{\CorrectionsOff}
%    Use these macros to locally turn on or off the inclusion
%    of the correction code.
%    \begin{macrocode}
\def\CorrectionsOn{\global\eq@nocorrectionsfalse}
\def\CorrectionsOff{\global\eq@nocorrectionstrue}
%    \end{macrocode}
%    \end{macro}
%    \end{macro}
%    \subsection{Process Options and Require Packages}
% The \texttt{quiz} environments use Acrobat forms and JavaScript
% so we need to load in the AcroForm Dictionary---unless the
% \texttt{dviwindo} (\cmd{\eq@noformstrue}) option is requested.
%    \begin{macrocode}
\AtBeginDocument{\ifeq@noforms\else\begin{Form}\fi}
\AtEndDocument
{%
    \include@solutions
    \ifeq@noforms\else
        \include@quizsolutions
    \fi
    \end{Form}
%    \end{macrocode}
% (04/12/07) I put a \cs{clearpage} for some good reason, can't remember, I think
% it had to do with templates, but dvipdfm has problems with this. The document
% level JavaScript are not inserted, they are cleared out by the \cs{clearpage}.
% So, we'll only to a \cs{clearpage} if the driver is not dvipdfm.
%    \begin{macrocode}
    \if\eq@drivernum2\else\clearpage\fi
}
%    \end{macrocode}
% \subsection{Load Configuration File: exerquiz.cfg}
% Look for configuration file, exerquiz.cfg.
%\begin{verbatim}
%    \ExecuteOptions{noquizsolutions,nocorrections}
%\end{verbatim}
% sets several options.
%    \begin{macrocode}
\InputIfFileExists{exerquiz.cfg}{}{}
%    \end{macrocode}
%    \begin{macrocode}
\ProcessOptions
%\def\eq@xcolor{xcolor}\ifx\eq@ColorPackage\eq@xcolor
%\def\eq@coloropts{hyperref,table}\else\def\eq@coloropts{}\fi
%\RequirePackage[\eq@coloropts]{\eq@ColorPackage}
\RequirePackage{\eq@ColorPackage}
%\RequirePackage{color}
\RequirePackage{verbatim}
\RequirePackage{hyperref}
\RequirePackage{insdljs}
\RequirePackage{eforms}
%    \end{macrocode}
%    \begin{macrocode}
\@ifundefined{eq@drivernum}{%
    \PackageError{Exerquiz}%
        {You  have not specified dvips, dvipsone, pdftex or dvipdfm
        \MessageBreak in the option list of the exerquiz package}
        {Place one of the driver names dvips, dvipsone, pdftex or dvipdfm
        \MessageBreak in the option list of the exerquiz package.}
}{}
%    \end{macrocode}
%    \begin{macrocode}
%</package>
%    \end{macrocode}
% \subsection{The Template \& Language dependent messages}\label{ss:ldm}
% The following define labels and messages for the exercise and
% various quiz environments. They are all redefined when a
% language option is used.  All of them can be redefined to
% customize a users document.
%
% In attempt to better manage the language localizations, I've placed the
% template for Web and Exerquiz in the Exerquiz.dtx file.
%    \begin{macrocode}
%<template>
%<template>%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%<template>%% Web.sty                                            %%
%<template>%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%<template>% Language dependent definitions for Web.sty
%<*template>
\DeclareOption{newlanguage}{%
  \AtEndOfPackage{%
    \def\today{\ifcase\month\or January
            \or February \or March \or April
            \or May \or June  \or July  \or August
            \or September  \or October  \or November
            \or December \fi \the\day,  \the\year}
    \def\web@versionlabel{Version}
    \def\web@toc{Table of Contents}
    \def\web@continued{cont.}
    \def\web@article{Begin \hyperlink{section.1}{Article}}
    \def\web@directory{Directory}
    \def\web@revision{Last Revision Date:}
    \def\web@copyright{Copyright}
    \def\web@section{Section}
    % Label Navibar
    \def\web@back{Back}
    \def\web@doc{Doc}} % restricted to three characters
    \PassOptionsToPackage{newlanguage}{exerquiz}
}
%</template>
%    \end{macrocode}
%    \begin{macrocode}
%<template>%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%<template>%% Exerquiz.sty                                       %%
%<template>%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%<template>\DeclareOption{newlanguage}{%
%<template>   \def\LangRedefinitions{\InputIfFileExists{eqlang.def}%
%<template>   {\typeout{exerquiz: Inputting a New Language Option}}%
%<template>   {\typeout{exerquiz: Language Option: Cannot find the file
%<template>    eqpo.def, using the default, English.}}}}
%<template>
%<package>\def\eqretnSymb{$\blacksquare$}%{\rule{6bp}{6.8bp}}
% The exercise label
%<package>\newcommand\exlabel{Exercise}
%<package>\newcommand\exlabelsol{\exlabel}
%<template>% The exercise label
%<template>% Accents: \renewcommand\exlabel{\"Ubung} (German)
%<template>\renewcommand\exlabel{Exercise}
%<template>% The value of this macro is written to \jobname.sol,
%<template>% accented characters must be protected with a \noexpand
%<template>% E.g., \renewcommand\exlabelsol{\noexpand\"Ubung} (German)
%<template>\renewcommand\exlabelsol{\exlabel}
%    \end{macrocode}
%    \begin{macrocode}
% Title of exercise solution section
%<package>\newcommand\exsectitle{Solutions to \exlabel s}
%<package>\newcommand\exsecrunhead{\exsectitle} %% change to @ form
%<template>
%<template>% Title of exercise solution section
%<template>% E.g.: \renewcommand\exsectitle
%<template>%            {L\"osungen der \exlabel en} (German)
%<template>\renewcommand\exsectitle{Solutions to \exlabel s}
%<template>\renewcommand\exsecrunhead{\exsectitle} %% change to @ form
%    \end{macrocode}
%    \begin{macrocode}
%<*package|eqexam>
%    \end{macrocode}
%    \begin{macro}{\exsolafter}
%    \begin{macro}{\exsolafterDefault}
%    \begin{macro}{\renameSolnAfterTo}
%    \begin{macro}{\resetSolnAfterToDefault}
%\changes{v6.05g}{2007/01/28}
%{
% Added to commands for use in exerquiz or in eqexam. They are
% \cs{renameSolnAfterTo} for conveniently changing the solution
% after label, and \cs{resetSolnAfterToDefault} for resetting
% back to the default.
%}
% Solution label for solutionafter option for exercise
%    \begin{macrocode}
\newcommand{\exsolafter}{\eq@exsolafterDefault}
\newcommand{\eq@exsolafterDefault}{\textit{Solution}:}
\newcommand{\renameSolnAfterTo}[1]{\def\exsolafter{#1}}
\newcommand{\resetSolnAfterToDefault}{\def\exsolafter{\eq@exsolafterDefault}}
%    \end{macrocode}
%    \end{macro}
%    \end{macro}
%    \end{macro}
%    \end{macro}
%    \begin{macrocode}
%</package|eqexam>
%<template>
%<template>% Solution label for solutionafter option for exercise
%<template>\renewcommand\exsolafter{\textit{Solution}:}
%    \end{macrocode}
%    \begin{macrocode}
% Title of quiz solution section
%<package>\newcommand\eq@sqslsectitle{Solutions to Quizzes}
%<package>\newcommand\sqslsectitle{\eq@sqslsectitle}
%<template>
%<template>% Title of short quiz solution section
%<template>% Example: \renewcommand\eq@sqslsectitle
%<template>%               {L\"osungen der Aufgaben} (German)
%<template>\renewcommand\eq@sqslsectitle{Solutions to Quizzes}
%<template>\renewcommand\sqslsectitle{\eq@sqslsectitle}
%    \end{macrocode}
%    \begin{macrocode}
% Running header/section title for solutions to short quizzes
%<package>\newcommand\eq@sqslsecrunhead{Solutions to Quizzes}
% User access
%<package>\newcommand\sqslsecrunhead{\eq@sqslsecrunhead}
%<template>
%<template>% Running header/section title for solutions to short quizzes
%<template>\renewcommand\eq@sqslsecrunhead{Solutions to Quizzes}
%<template>% User access
%<template>\renewcommand\sqslsecrunhead{\eq@sqslsecrunhead}
%    \end{macrocode}
%    \begin{macrocode}
% Label for solutions to quizzes, appears in solutions sections
%<package>\newcommand\eq@sqsllabel{\string\textbf{Solution to Quiz:}}
% User access
%<package>\newcommand\sqsllabel{\eq@sqsllabel}
%<template>
%<template>% Label for solutions to short quizzes, appears
%<template>% in solutions sections
%<template>% Protect accents with \noexpand
%<template>% E.g.: \renewcommand\eq@sqsllabel
%<template>%       {\string\textbf{L\noexpand\"osung zu Aufgabe:}} (German)
%<template>\renewcommand\eq@sqsllabel{\string\textbf{Solution to Quiz:}}
%<template>% User access
%<template>\renewcommand\sqsllabel{\eq@sqsllabel}
%    \end{macrocode}
%    \begin{macrocode}
% Solution label for solutionafter option for shortquiz
%<package>\newcommand\sqsolafter{\textit{Solution}:}
%<template>
%<template>% Solution label for solutionafter option for shortquiz
%<template>\renewcommand\sqsolafter{\textit{Solution}:}
%    \end{macrocode}
%    \begin{macrocode}
% Here is the default short quiz label.
%<package>\newcommand\eq@sqlabel{\textcolor{red}{Quiz}}
% User access to shortquiz label
%<package>\newcommand\sqlabel{\eq@sqlabel}
%<template>
%<template>% Here is the default short quiz label.
%<template>\renewcommand\eq@sqlabel{\textcolor{red}{Quiz.}}
%<template>% User access to shortquiz label
%<template>\renewcommand\sqlabel{\eq@sqlabel}
%    \end{macrocode}
%    \begin{macrocode}
% Here is the default short quiz return label
% No formatting allowed
%<package>\newcommand\eq@sqslrtnlabel
%<package>   {\ifeq@solutionsafter\else\expandafter\string\fi\eqretnSymb}
% User access to shortquiz label
%<package>\newcommand\sqslrtnlabel{\eq@sqslrtnlabel}
%<template>
%<template>% Here is the default short quiz return label
%<template>% No formatting allowed
%<template>\renewcommand\eq@sqslrtnlabel{End Quiz}
%<template>% User access to shortquiz label
%<template>\renewcommand\sqslrtnlabel{\eq@sqslrtnlabel}
%    \end{macrocode}
%    \begin{macrocode}
% Short quiz feedback messages
%<package>\newcommand\eqsqrtmsg{"Right!"}
%<package>\newcommand\eqsqwgmsg{"Wrong!"}
%<template>
%<template>% Short quiz feedback messages
%<template>\renewcommand\eq@sqrtmsg{"Right!"}
%<template>\renewcommand\eq@sqwgmsg{"Wrong!"}
%    \end{macrocode}
%    \begin{macrocode}
% Here is the default quiz label.
%<package>\newcommand\eq@bqlabel{Begin Quiz}
% User access to quiz label
%<package>\newcommand\bqlabel{\eq@bqlabel}
% Used for writing JavaScript Messages on screen
%<package>\newcommand\eq@bqlabelISO{\eq@bqlabel}
%<package>\newcommand\bqlabelISO{\eq@bqlabelISO}
%<template>
%<template>% Here is the default quiz label.
%<template>% No formatting allowed
%<template>% For Example: \renewcommand\eq@bqlabel{D\'ebut}  (French)
%<template>\renewcommand\eq@bqlabel{Begin Quiz}
%<template>% User access to shortquiz label
%<template>\renewcommand\bqlabel{\eq@bqlabel}
%<template>% Used for writing JavaScript Messages on screen.
%<template>% Use PDFDocEncoding
%<template>% For Example:
%<template>% \renewcommand\eq@bqlabelISO{D\string\351but}  (French)
%<template>% Use \string not \noexpand, this helps out
%<template>% TeX4ht by Eitan Gurari.
%<template>\renewcommand\eq@bqlabelISO{\eq@bqlabel}
%<template>\renewcommand\bqlabelISO{\eq@bqlabel}
%    \end{macrocode}
%    \begin{macrocode}
% Here is the default quiz label.
% No formatting allowed
%<package>\newcommand\eq@eqlabel{End Quiz}
% User access to shortquiz label
%<package>\newcommand\eqlabel{\eq@eqlabel}
%<template>
%<template>% Here is the default quiz label.
%<template>% No formatting allowed
%<template>\renewcommand\eq@eqlabel{End Quiz}
%<template>% User access to shortquiz label
%<template>\renewcommand\eqlabel{\eq@eqlabel}
%    \end{macrocode}
%    \begin{macrocode}
% JavaScript Messages for Quiz Environments
%<package>\newcommand\eq@Score{Score:}\newcommand\eq@OutOf{out of}
%<package>\newcommand\eqScore{\eq@Score}\newcommand\eqOutOf{\eq@OutOf}
%<template>
%<template>% JavaScript Messages for Quiz Environments. Use PDFDocEncoding
%<template>% Note: Use  \string rather than \noexpand for escape codes,
%<template>% i.e. \string\374
%<template>%
%<template>% In the Text Field showing the score, there is the default
%<template>% phrase in English
%<template>% Score: 2 out of 3, the word "Score" and "out of" needs
%<template>% translation.
%<template>\renewcommand\eq@Score{Score:}\renewcommand\eq@OutOf{out of}
%    \end{macrocode}
%    \begin{macrocode}
%<package>\newcommand\eqInitQuizMsg{%
%<package>  "You must initialize the Quiz! Click on "+msg+"."}
%<template>
%<template>% If you are taking a quiz and click on an alternative without
%<template>% initializing the quiz
%<template>% first, this message appears.
%<template>% This string is placed in the DLJS, so the escape sequences
%<template>% need to be protected more. Instead of \string\340 we need
%<template>% \string\\340.
%<template>% Example: \renewcommand\eqInitQuizMsg{%    (German)
%<template>%   "Sie m\string\\374ssen die Aufgaben initialisieren!
%<template>%    Bitte klicken Sie auf "+msg+"."}
%<template>\renewcommand\eqInitQuizMsg{%
%<template>  "You must initialize the Quiz! Click on "+msg+"."}
%    \end{macrocode}
%    \begin{macrocode}
%<package>\newcommand\eqQuizTotalMsg{%
%<package>  "\eqScore\space"+Score+" \eqOutOf\space"+nQuestions}
%<package>\newcommand\eqQuizPointsMsg{%
%<package>  "\eqScore\space"+ptScore+" \eqOutOf\space"+nPointTotal}
%<package>\newcommand\eqQuizPercentMsg{pcScore+"\%"}
%<package>\newcommand\eqQuizGradeMsg{quizGrade}
%<template>
%<template>% This macro doesn't usually need translation, it uses \eqScore
%<template>% and \eqOutOf. However, if the sentence "Score: 2 out of 3"
%<template>% does not translate conveniently into a particular language,
%<template>% this macro may have to be modified.  It's the one that puts
%<template>% the message in the message box.
%<template>\renewcommand\eqQuizTotalMsg
%<template>% {"\eqScore\space"+Score+" \eqOutOf\space"+nQuestions}
%<template>\renewcommand\eqQuizPointsMsg{%
%<template>  "\eqScore\space"+ptScore+" \eqOutOf\space"+nPointTotal}
%<template>\renewcommand\eqQuizPercentMsg{pcScore+"\%"}
%<template>\renewcommand\eqQuizGradeMsg{quizGrade}
%    \end{macrocode}
%    \begin{macrocode}
%<package>\newcommand\eqMadeChoice{%
%<package>  "You have already made a choice.
%<package>   Your choice was ("+Responses[probno]+").
%<package>   Do you want to change it?"}
%<template>
%<template>% In the link form of a quiz, of you change your choice,
%<template>% this message appears. This string is placed in the
%<template>% DLJS, so the escape sequences need to be protected more.
%<template>% Instead of \string\340 we need \string\\340.
%<template>% For Example: \renewcommand\eqMadeChoice{%
%<template>% "Vous avez d\string\\351j\string\\340 fait un choix,
%<template>%   ce choix est ("+Responses[probno]+").
%<template>%   Souhaitez vous le modifier ?"}  (French)
%<template>\renewcommand\eqMadeChoice{%
%<template>  "You have already made a choice.
%<template>   Your choice was ("+Responses[probno]+").
%<template>   Do you want to change it?"}
%    \end{macrocode}
% Default language phrases used by \cmd{\eqButton}. These are overwritten by the
% language options.
%    \begin{macrocode}
%<package>\newcommand\eq@local@CA{Correct}
%<package>\newcommand\eq@local@RC{My Answers!}
%<package>\newcommand\eq@local@AC{Please!}
%<template>% Default button labels for \eqButton
%<template>% Accents are handled as above:
%<template>% A French Language Example
%<template>% \renewcommand\eq@local@CA{R\string\351ponses}
%<template>% \renewcommand\eq@local@RC{Correctes}
%<template>% \renewcommand\eq@local@AC{SVP !}
%<template>\renewcommand\eq@local@CA{Correct}
%<template>\renewcommand\eq@local@RC{My Answers!}
%<template>\renewcommand\eq@local@AC{Please!}
%    \end{macrocode}
% Default language phrases used by \cmd{\CorrAnsButton}. These are overwritten by the
% language options.
%    \begin{macrocode}
%<package>\newcommand\eq@local@CorrAnsButton{Ans}
%<template>
%<template>% Default button label of \CorrAnsButton.
%<template>\renewcommand\eq@local@CorrAnsButton{Ans}
%    \end{macrocode}
% The following are (error) messages generated from the math fill-in questions.
%    \begin{macrocode}
%<*package>
\newcommand\eqerrABS{"Absolute values not balanced. Please correct."}
\newcommand\eqerrBadMathFunc{"The expression `"+aF[i]+"' is neither a
    defined function, nor a valid math expression."}
\newcommand\eqParens{"Parentheses"}
\newcommand\eqBrackets{"Brackets"}
\newcommand\eqBraces{"Braces"}
\newcommand\eqerrDelimNotBal{aGroup[i][2] + " not balanced.
    Please correct."}
\newcommand\eqerrBadExp{"Invalid mathematical expression.
    A problem with one of the exponents.  Please correct."}
\newcommand\eqerrUnfinishQuiz{"There is an unfinished quiz,
    please finish before moving on to another."}
\newcommand\noPeekMsg{"Viewing Solutions to quizzes is not allowed
    until you take or finish this quiz!"}
\newcommand\highThresholdMsg{"You are required to respond to all
    questions before the quiz is evaluated."}
\newcommand\eqSyntaxErrorUndefVar{"Syntax Error: Possibly an undefined
    variable present, or an expression is not written in an expected
    format."}
%</package>
%<template>
%<template>% These (error) messages are generated when the user enters an
%<template>% invalid math expression into a math fill-in response box.
%<template>% The messages come in the form of an app.alert() so
%<template>% PDFDocEncoding needs to be used.
%<*template>
\renewcommand\eqerrABS{"Absolute values not balanced. Please correct."}
\renewcommand\eqerrBadMathFunc{"The expression `"+aF[i]+"' is neither
    a defined " +"function, nor a valid math expression."}
\renewcommand\eqParens{"Parentheses"}
\renewcommand\eqBrackets{"Brackets"}
\renewcommand\eqBraces{"Braces"}
\renewcommand\eqerrDelimNotBal{aGroup[i][2] + " not balanced.
    Please correct."}
\renewcommand\eqerrBadExp{"Invalid mathematical expression.
    A problem with one of the exponents. Please correct."}
\renewcommand\eqerrUnfinishQuiz{"There is an unfinished quiz,
    please finish before moving on to another."}
\renewcommand\noPeekMsg{"Viewing Solutions to quizzes is not allowed
    until you take or finish this quiz!"}
\renewcommand\highThresholdMsg{"You are required to respond to all
    questions before the quiz is evaluated."}
\renewcommand\eqSyntaxErrorUndefVar{"Syntax Error: Possibly an
    undefined variable present."}
%</template>
%<*template>
%%%%%%%%%%%%%%%%%%%%%% End Message Section %%%%%%%%%%%%%
%% Some typeout messages                              %%
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
% In exerquiz.sty
\typeout{Inputting French Option}
\typeout{French Option: Cannot find the file eqfr.def, using the
    default, English.}
\typeout{Solutions not allowed with this option}
\typeout{Check: `#1' is not an acceptable option, inserting
    default, `check'.}
%</template>
%    \end{macrocode}
%
% Announce driver option
%    \begin{macrocode}
%<*package>
\typeout{^^Jexerquiz: * Using \eq@driver\space option *^^J}
%    \end{macrocode}
%    \subsection{Handles, counters and such}
% Handles to write solutions to quizzes and exercises to a file.
%    \begin{macrocode}
%</package>
%<*package|eqexam>
\newwrite \ex@solns \immediate\openout \ex@solns \jobname.sol
\newwrite \quiz@solns \immediate\openout \quiz@solns \jobname.qsl
%    \end{macrocode}
% Counters to keep track of exercise questions.
%    \begin{macrocode}
\newcounter{eqexno} \setcounter{eqexno}{0}
\newcounter{@exno} \setcounter{@exno}{0}  % running exno
%    \end{macrocode}
% Counter to keep track of quiz questions.
%    \begin{macrocode}
\newcounter{quizno} \setcounter{quizno}{0}
\renewcommand\thequizno{\alph{quizno}}
%</package|eqexam>
%<*package>
\renewcommand\theHquizno{\curr@quiz.\theeqquestionnoi.\alph{quizno}}
%</package>
%<*package|eqexam>
%    \end{macrocode}
% Keep track of point values of quizzes
%    \begin{macrocode}
\newcounter{eqpointvalue} \setcounter{eqpointvalue}{0}
%    \end{macrocode}
% Some scratch registers and boxes.
%    \begin{macrocode}
%\newsavebox{\eq@tmpbox} % defined in eqforms
%\newdimen\eq@tmpdima    % defined in eqforms
\newlength\eq@tmplength
%    \end{macrocode}
%    \begin{macro}{eqquestionno}
% The counter that keeps track of the question number. Used by the \texttt{questions }[environment
%    \begin{macrocode}
\newcounter{eqquestionnoi}
\newcounter{eqquestionnoii}
\newcounter{eqquestionnoiii}
\newcount\@eqquestiondepth \@eqquestiondepth=0
\newcounter{questionno}
%</package|eqexam>
%<*package>
\newcounter{grpquestionno}
%</package>
%    \end{macrocode}
%    \end{macro}
%    \begin{macro}{partno}
%    This counter keeps track of the parts of an exercise, when the *-option
%    is used.
%    \begin{macrocode}
%<*package|eqexam>
\newcounter{partno}
\renewcommand\thepartno{\alph{partno}}
%\newcounter{list@partno}
%\renewcommand\thelist@partno{\alph{list@partno}}
%    \end{macrocode}
%    \end{macro}
%    \subsection{Write to a file}
% We must have a way to write the solutions of our exercises and
% quizzes to a file.  The following \cmd{\verbatimwrite} was
% taken from the \texttt{moreverb} package, it uses the
% \texttt{verbatim} package.
%
%    \begin{macrocode}
\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}
%    \end{macrocode}
%    \section{The \texttt{exercise} Environment}
%
% We use \cmd{\raggedright} within a \texttt{tabular} environment,
% so we must use a little trick, illustrated in the \textsl{\LaTeX\
% Companion} by M. Goossens et al. This macro is used with \texttt{exercise}
% with parts, \texttt{shortquiz} and \texttt{quiz} environments.
%    \begin{macrocode}
\providecommand\PBS[1]{\let\temp=\\#1\let\\=\temp}
%\newcommand\PBS[1]{\let\temp=\\#1\let\\=\temp}
%</package|eqexam>
%<*package>
%    \end{macrocode}
% Define some formatting commands.  These can all be redefined to
% customize the document.
%    \begin{macro}{\exlabelformat}
%    This is the formatted label for the exercise environment.
%    \begin{macrocode}
\newcommand\exlabelformat{{\scshape\exlabel\ \theeqexno.}}
%    \end{macrocode}
%    \end{macro}
%    \begin{macro}{\exlabelformatwp}
%    This is the formatted label for the exercise environment with parts.
%    When an exercises has parts, the word `Exercise' is not a link,
%    so we color this word for emphasis.
%    \begin{macrocode}
\newcommand\exlabelformatwp{{\scshape\exlabel\ \theeqexno.}}
%    \end{macrocode}
%    \end{macro}
%    \begin{macro}{\exsllabelformat}
%    This is the formatted solution label.
%    \begin{macrocode}
\newcommand\exsllabelformat{\noexpand\textbf{\exlabelsol\ \theeqexno.}}
%    \end{macrocode}
%    \end{macro}
%    \begin{macro}{\exsllabelformatwp}
%    This is the formatted solution when the *-options is use, that is,
%    when there are multiple parts to the question.
%    \begin{macrocode}
\newcommand\exsllabelformatwp
     {\noexpand\textbf{\exlabelsol\ \theeqexno(\thepartno)}}
%    \end{macrocode}
%    \end{macro}
%    \begin{macro}{\exrtnlabelformat}
%    This is the formatted return label (return from the solution).
%    \begin{macrocode}
\newcommand\exrtnlabelformat{\exlabelsol\ \theeqexno}
%    \end{macrocode}
%    \end{macro}
%    \begin{macro}{\exrtnlabelformat}
%    This is the formatted return label (return from the solution),
%    for an exercise with parts.
%    \begin{macrocode}
\newcommand\exrtnlabelformatwp{$\square$}
%    \end{macrocode}
%    \end{macro}
%    \begin{macro}{\eqexerskip}
% Amount of skip before and after exercise environment
%    \begin{macrocode}
%</package>
%<*package|eqexam>
\newcommand{\eqexerskip}[1]{\def\eq@exerskip{\vskip#1}}
\eqexerskip{\medskipamount}
\newcommand{\priorexskip}[1]{\def\eq@priorexskip{\vspace{#1}}}
\priorexskip{\medskipamount}
%    \end{macrocode}
%    \end{macro}
%    \begin{macro}{\eqafterexersolnskip}
% Amount of skip after solutions, this one is written to a file, so
% we must protect it from early expansion.
%    \begin{macrocode}
\newcommand\eqafterexersolnskip{\string\medskip}
%</package|eqexam>
%<*package>
%    \end{macrocode}
%    \end{macro}
%    \begin{macro}{\nolinkcolor}
% This is the color to paint the word 'Exercise' with parts;
% or it colors all the 'Exercise's when the nosolutions option
% has been used
% \changes{v6.05a}{2006/05/08}
% {
%   Changed \cs{nolinkcolor} into a text fill-in. Now, the command \cs{nolinkcolor}
%   fills in \cs{@nolinkcolor}, which holds the named color.
% }
%    \begin{macrocode}
\newcommand{\nolinkcolor}[1]{\def\@nolinkcolor{#1}}
\nolinkcolor{blue}
%    \end{macrocode}
%    \end{macro}
%    \begin{macro}{\proofingsymbol}
%    \begin{macro}{\proofingsymbolColor}
% Proofing symbol and accompanying color (little green bullet)
% \changes{v6.05b}{2006/05/12}
% {
% added a command to change the color of the proofing symbol
% changed the definition of \cs{proofingsymbol} to a text fillin. This creates the command
% \cs{@proofingsymbol}. Can now control the symbol and the color (through \cs{proofingsymbolColor}
% }
%    \begin{macrocode}
\newcommand{\proofingsymbolColor}[1]{\def\@proofingsymbolColor{#1}}
\proofingsymbolColor{webgreen}
\newcommand{\proofingsymbol}[1]{\def\@proofingsymbol{\textcolor{\@proofingsymbolColor}{#1}}}
\proofingsymbol{$\bullet$}
%\newcommand{\proofingsymbol}{\textcolor{\@proofingsymbolColor}{$\bullet$}}
%    \end{macrocode}
%    \end{macro}
%    \end{macro}
%    \subsection{Define \texttt{exercise} Environment}
% Defines the \texttt{exercise} environment for writing exercises,
% and solutions.  The solutions are written to the file
% \cmd{\jobname.sol}, and input at the end of the file.  Hypertext
% links connect the statement of the exercise with its solution.
%
%\smallskip\noindent\textbf{Basic usage}
%\begin{verbatim}
%\begin{exercise}
%The exercise question is posed.
%\begin{solution}
%The solution to exercise goes here.
%\end{solution}
%\end{exercise}
%\end{verbatim}
% These environments should be nested as illustrated above.
%
% The \texttt{exercise} environment has three optional arguments. The syntax
% for an exercise without parts is\dots
%\begin{verbatim}
%   \begin{exercise}[<ctr>][h|H] ...\end{exercise}
%\end{verbatim}%
%
% (1) The value of this first optional argument, \texttt{<ctr>}, is a counter.
% You can use the \texttt{exercise}
% environment then to create other environments with their own
% counters.  A special value of zero (0) for this optional argument,
% means not to associate any counter with the environment.  These
% features can be used in combination with the \cs{SolutionsAfter}
% and \cs{SolutionsAtEnd} commands to obtain different effects,
% see the manual for examples
%
% (2) The second optional argument is an `\texttt{h}' or an \texttt{H}, this signals that the
% solution to the exercise should not be written to the \cmd{\jobname.sol}
% file.  See manual for examples.
%
% The \texttt{exercise} environment has three optional arguments. The syntax
% for an exercise with parts is\dots
%\begin{verbatim}
%   \begin{exercise}[<ctr>]* ...\end{exercise}
%   \begin{exercise*}[<ctr>] ...\end{exercise*}
%\end{verbatim}%
%
% (1) The value of this first optional argument, \texttt{<ctr>}, is a counter.
% You can use the \texttt{exercise}
% environment then to create other environments with their own
% counters.  A special value of zero (0) for this optional argument,
% means not to associate any counter with the environment.  These
% features can be used in combination with the \cs{SolutionsAfter}
% and \cs{SolutionsAtEnd} commands to obtain different effects,
% see the manual for examples
%
% (2) The second argument is a star \texttt{*}.  The presence of a * signals
% that this exercise has multiple parts.  See the manual for the proper
% syntax.
%
% Beginning with version 6.07, there is now a \texttt{exercise*}
% environment, this is what I should have done originally, but now its
% done.  The \texttt{exercise*} signals an exercise with parts. It takes
% one optional parameter, the name of a counter \texttt{<ctr>} that is to
% be used.
%    \begin{macro}{\exerSolnInExtFile}
% With the exercises, you have the option of including them in the main document, or putting them
% in an external document.  The \cs{exerSolnsInExtFile} command lets you specify an external file name.
% Just use the \textit{basename}, hyperref will add the extension.  If an external file is specified, all
% solution links are changed to links between documents. Usage:
%\begin{verbatim}
%\exerSolnsInExtFile{myExSonls}
%\end{verbatim}
%    \begin{macrocode}
\newcommand{\exerSolnsInExtFile}[2][]
    {\let\exerSolns@ExtFile=y\gdef\eq@exerSolns@fileName{#2}%
     \gdef\exerSolns@ReturnPath{#1}}
\let\exerSolns@ExtFile=n
\def\exerSolns@ReturnPath{}
%    \end{macrocode}
%    \end{macro}
%    \begin{macrocode}
%</package>
%<*package|eqexam>
\def\marginparpriorhook{} % used to material before the exercise
\def\marginparafterhook{} % used to material after the exercise
\let\afterlabelhskip=\space
%    \end{macrocode}
% Inserted in the header of each exercise solution. May be used for inserting
% addition text or macros in the solution.
%    \begin{macrocode}
\let\exersolnheadhook=\@empty
%    \end{macrocode}
%    \begin{macro}{\eqexheader}
%    \begin{macro}{\eqexheader@wrapper}
% \cs{eqexheader} typesets `Exercise xx'. \cs{eqexheader@wrapper} creates a hypertarget
% at the heading. Portions of \cs{eqexheader} is also used by \textsf{eqExam}.
%    \begin{macrocode}
\newcommand{\eqexheader}
{%
%</package|eqexam>
%<*package>
    \ifeq@nolink   % no link to solution
%</package>
%<*package|eqexam>
        \hbox{\color{\@nolinkcolor}\if\exerstar*\exlabelformatwp\else
        \exlabelformat\fi}%
%</package|eqexam>
%<*package>
    \else
        \if\exerSolns@ExtFile y%
            \hbox{\href{\eq@exerSolns@fileName\#ex.\the@exno}%
                {\exlabelformat}}%
        \else
            \hbox{\hyperlink{ex.\the@exno}{\exlabelformat}}%
        \fi
    \fi
%</package>
%<*package|eqexam>
}
\def\eqexheader@wrapper{\hypertarget{qex.\the@exno}{\eqexheader}}
%    \end{macrocode}
%    \end{macro}
%    \end{macro}
%    \begin{macro}{\eqexlisttabheader}
% \cs{eqexlisttabheader} typesets `(a)' when we have exercises with parts.
% Portions are also used by \textsf{eqExam}.
%    \begin{macrocode}
\newcommand{\eqexlisttabheader}
{%
%</package|eqexam>
%<*package>
    \ifeq@nolink
%</package>
%<*package|eqexam>
      \color{\@nolinkcolor}(\hfil\thepartno\hfil)%
%</package|eqexam>
%<*package>
    \else
      \if\exerSolns@ExtFile y%
        \href{\eq@exerSolns@fileName\#ex.\the@exno\thepartno}%
            {(\hfil\thepartno\hfil)}%
        \else
            \hyperlink{ex.\the@exno\thepartno}{(\hfil\thepartno\hfil)}%
        \fi
    \fi
%</package>
%<*package|eqexam>
}
%    \end{macrocode}
%    \end{macro}
%    \begin{environment}{exercise}
% With some of the preliminaries out of the way, we begin the exercise `environment'.
%    \begin{macrocode}
\newenvironment{exercise}
{%
    \par\eq@priorexskip\noindent%\begingroup % set defaults
    \def\eq@argi{eqexno}%  % use eqexno counter
%   \def\exerstar{x}%      % default, no *
    \if\eq@exerstarEnv*\def\exerstar{*}\else\def\exerstar{x}\fi % default, no *
    \def\currhideopt{x}%
    \@ifnextchar[{\exercise@}{%
    \if\exerstar*%
        \def\eq@next{\@exercise}% was \exercise@@@
    \else
        \def\eq@next{\exercise@@}%
    \fi\eq@next}%
}{\par\global\eq@exerciseheadingtrue\eq@exerskip}
%   \@ifnextchar[{\exercise@}{\exercise@@[\eq@argi]}}
\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}% was \exercise@@
            \else
                \def\eq@next{\def\eq@argi{#1}\exercise@@}%
            \fi
        \fi
    \fi
\eq@next}
%    \end{macrocode}
% specified counter, test for *
%    \begin{macrocode}
\def\exercise@@{\@ifstar{\def\exerstar{*}\@exercise}% was \exercise@@@
   {\exercise@@@}}%
%    \end{macrocode}
% we have recorded the presence of a star, is there
% another optional argument, h
%    \begin{macrocode}
\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}
%    \end{macrocode}
%    \begin{macro}{\exerSolnHeader}
% When a solution is written to the .sol file, there is a header line that contains formatting information.
% This command can be redefined as desired.  We also introduce to markers, \cs{eqEXt} and \cs{endeqEXt} which
% can be used in any way your imaginations can conjure up. Basically, the mark the beginning and ending of the solution.
%    \begin{macrocode}
\newif\ifeq@exerciseheading \eq@exerciseheadingtrue
\newcommand\exerSolnHeader[3]
{%
    \ifeqforpaper\else\webnewpage\fi\markright{#1}\par\noindent%
%</package|eqexam>
%<*package>
    \hypertarget{#2}{#3}\relax
%</package>
%<*eqexam>
    #3%
%</eqexam>
%<*package|eqexam>
    \solnhspace
}
%    \end{macrocode}
% These two mark the beginning and end of solution to an exercise.
%    \begin{macrocode}
\let\eqEXt=\relax
\let\endeqEXt=\relax
%    \end{macrocode}
%    \end{macro}
%    \begin{macrocode}
\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
%    \end{macrocode}
% Here's where we write the header to the .sol file.
%    \begin{macrocode}
                    \gdef\eq@writeexheader{%
                    \immediate\write\verbatim@out{\string\eqEXt
                    \string\exerSolnHeader{\exsecrunhead}{ex.\the@exno}%
                    {\exsllabelformat}\exersolnheadhook\string\relax}%
                    }%
                \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
%    \eq@exerskip
%    \end{macrocode}
% Here is where `Exercise' is typeset; the commands \cs{marginparpriorhook} and \cs{marginpartafterhook}
% can be used to insert content in before and after the `Exercise'.
%    \begin{macrocode}
    \ifeq@exerciseheading
    \prior@questionsHook\marginparpriorhook\noindent\eqexheader@wrapper
    \afterlabelhskip\marginparafterhook\ignorespaces
    \fi
}
%    \end{macrocode}
%    \end{environment}
%    \subsection{Define \texttt{solution} Environment for \texttt{exercise}}
%    \begin{macro}{solution}
%    This is the \texttt{solution} environment for
%    \texttt{exercise}; either start \cmd{\verbatim} or,
%    \cmd{\eq@solutionsaftertrue} write the label \cmd{\exsolafter}.
%
% The solution macro for the \texttt{exercise} environment now takes an optional
% argument. This argument must be a vertical skip ( i.e., [1in] ).  When the solution
% does not correspond to a tabular multi-part question, a vertical skip
% |\vspace{#1}| is introduced when the \texttt{nosolutions} is in effect and when
% \texttt{solutionsafter} is not.  This feature may be useful for constructing
% tests in this space is left for the student to write in the answer; yet, later
% when \texttt{solutionsafter} is true, the solutions appear instead of the vertical
% white space.
%    \begin{macrocode}
\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
        \gdef\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
                \par\solutionsafterSkip
                \noindent\exsolafter\space\ignorespaces
            \else
                \eq@writeexheader % write the solution header 11/03/05
                \global\let\eq@writeexheader\@empty
                \global\therearesolutionstrue\expandafter\procsoln
            \fi
        }%
    \fi
\eq@next}
%    \end{macrocode}
%    \end{macro}
%    \begin{macro}{\endsolnexer@woparts}
%    Unless \cmd{\eq@solutionsaftertrue}, then \cmd{\endverbitim},
%    and write return labels.
%    \begin{macrocode}
\def\endsolnexerhook{}
\def\endsolnexerhookaux{}
%    \end{macrocode}
% This macro attempts to insert the return link at the end of the
% last paragraph of the solutions, this makes the return label
% look nice, and saves a little space.
%    \begin{macrocode}
\def\eq@fititin{\noindent\unskip\nobreak\hfill\penalty50
    \hskip2em\hbox{}\nobreak\hfill}
\let\eqfititin=\eq@fititin
%</package|eqexam>
%<*package>
\def\ReturnTo#1#2{\eq@fititin\hyperlink{#1}{#2}}
\def\xReturnTo#1#2{\eq@fititin\href{#1}{#2}}
%</package>
%    \end{macrocode}
%    \begin{macro}{\eqExerSolnTrailer}
% The material that follows the solution in the .sol file.
%    \begin{macrocode}
%<*package|eqexam>
\newcommand\eqExerSolnTrailer
{%
%</package|eqexam>
%<*package>
    \if\exerSolns@ExtFile y\string\xReturnTo
        {\exerSolns@ReturnPath\jobname\#qex.\the@exno}%
    \else
        \string\ReturnTo{qex.\the@exno}%
    \fi
    {\hbox{\if\exerstar*\exrtnlabelformatwp\else\exrtnlabelformat\fi}}%
    \string\endeqEXt\ifeqforpaper\string\par\eqafterexersolnskip\fi^^J
%</package>
%<*eqexam>
    \string\ReturnTo{page.\the\c@page}%
    {\hbox{\if\exerstar*\exrtnlabelformatwp\else\exrtnlabelformat\fi}}%
    \string\endeqEXt\ifeqforpaper\string\par\eqafterexersolnskip\fi^^J
%</eqexam>
%<*package|eqexam>
}
%    \end{macrocode}
%    \end{macro}
%    \begin{macrocode}
\def\endsolnexer@woparts
{%
    \if\currhideopt H%
        \csname endprocsoln\endcsname
    \else
        \ifeq@solutionsafter
            \eq@fititin\hbox{\exrtnlabelformat}%
        \else
            \endprocsoln
            \eq@ckglobalhide
            \ifeq@hidesolution\else
                \endsolnexerhookaux
%    \end{macrocode}
% Here's were we write the trailer for the solution
%    \begin{macrocode}
                \immediate\write\verbatim@out{\eqExerSolnTrailer}%
            \fi
        \fi
    \fi
\endsolnexerhook}
%    \end{macrocode}
%    \end{macro}
% \subsection{The \texttt{exercise*} Environment: Exercises with Parts}
% Exercises with parts are enclosed within a \texttt{parts} environment. There are two types
% of parts listing: list-type and tabular-type.
%    \begin{environment}{exercise*}
% For the exercise* environment, we set a flag to indicate that the \cs{exerstar}
% has been set in the star environment, the begin the \cs{exercise} and finished with
% \cs{endexercise}.
%\changes{v6.07}{2007/05/05}
%{
%   Created the \texttt{exercise*} environment, this is equivalent to the \texttt{*} option of the
%   \texttt{exercise} environment. You can use either version, but now, \texttt{exercise*} is preferred.
%}
%    \begin{macrocode}
\let\eq@exerstarEnv\relax
\newenvironment{exercise*}{\def\eq@exerstarEnv{*}\exercise}
{\endexercise}
%    \end{macrocode}
%    \end{environment}
%    \begin{macro}{parts}
%    Initially, we see if there is an optional argument, if yes, the
%    tabular environment is used, the argument is the number of columns
%    requested.  Otherwise, we use a list environment.
%    \begin{macrocode}
\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}}
%    \end{macrocode}
% \subsubsection{List-type Parts Question}
%    This is a redesigned \texttt{list} environment.  Meant to be used with the
%    \texttt{exercise} environment with the *-option.
%    \begin{macrocode}
\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
%    \end{macrocode}
% Write the solution header to .sol for list type question.
%    \begin{macrocode}
                    \gdef\eq@writeexheader{%
                    \immediate\write\verbatim@out{\string\eqEXt
                    \string\exerSolnHeader{\exsecrunhead}%
                    {ex.\the@exno\thepartno}{\exsllabelformatwp}\relax}%
                    }%
                \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}}
%    \end{macrocode}
% \subsubsection{Tabular-type Parts Question}
% Now for the tabular style of multi-part exercise, the argument
% \#1 is the number of columns requested.
%    \begin{macrocode}
\def\exercise@parts@tabular@[#1]{%
  \def\exerwparts@cols{#1}\exercise@parts@tabular}
%    \end{macrocode}
%    Set up the tabular environment, after making a lot of decisions.
%    \begin{macrocode}
\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}}
%    \end{macrocode}
%    Redefine \verb+\item+, could be risky
%    \begin{macrocode}
\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
%    \end{macrocode}
% Write the solution header to .sol for tabular type question.
%    \begin{macrocode}
      \gdef\eq@writeexheader{%
        \immediate\write\verbatim@out{%
        \string\eqEXt\string\exerSolnHeader{\exsecrunhead}%
            {ex.\the@exno\thepartno}{\exsllabelformatwp}\relax}%
      }%
  \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
}
%    \end{macrocode}
%    \begin{macrocode}
\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
}
%    \end{macrocode}
%    \end{macro}
%    \subsection{Including the \texttt{exercise} Solutions}
% Include solutions to the exercises back into the file.  This
% section also handles solutions to quizzes as well. This macro
% was taken from the \TeX book.
%    \begin{macro}{\includeexersolutions}
% This macro inserts the solutions to the exercises, if there are
% any solutions.  If a user uses this macro to insert the solutions
% elsewhere, \cmd{\include@solutions} is called, then put is to
% \cmd{\relax}.
%    \begin{macrocode}
\def\includeexersolutions
{%
%</package|eqexam>
%<*package>
   \if\exerSolns@ExtFile n%
%</package>
%<*package|eqexam>
       \include@solutions\let\include@solutions=\relax
%</package|eqexam>
%<*package>
   \fi
%</package>
%<*package|eqexam>
}
%    \end{macrocode}
%    \end{macro}
% The internal command that insert solutions.  This command
% appears at the end of document, where it will insert the
% solutions, unless it has been redefined to \cmd{\relax} by
% \cmd{\includesolutions}.
%    \begin{macrocode}
\let\eqsolutionshook\@empty
\let\priorexsectitle\@empty
\let\priorexslinput\@empty
\def\exerSolnsHeadnToc{\section*{\exsectitle}%
    \addcontentsline{toc}{section}{\protect\numberline{}\exsectitle}}
\newcommand{\exerSolnInput}
{%
    \let\webnewpage=\relax
    \immediate\closeout\ex@solns
    \ifeq@nosolutions\else
        % changed from \exsecrunhead, 6/1/05
        \iftherearesolutions\newpage\markright{\exsectitle}%
            \ifx\webnewpage\relax
                \def\webnewpage{\let\webnewpage=\newpage}%
            \fi
            \priorexsectitle\exerSolnsHeadnToc\priorexslinput
            \input{\jobname.sol}%
            \eqsolutionshook
        \fi
    \fi
}
\def\include@solutions
{%
%</package|eqexam>
%<*package>
    \if\exerSolns@ExtFile n%
%</package>
%<*package|eqexam>
        \exerSolnInput
%</package|eqexam>
%<*package>
    \fi
%</package>
%<*package|eqexam>
}
%</package|eqexam>
%<*package>
%    \end{macrocode}
%    \section{Early end of input}
% There is no support for the Acrobat Forms features with the
% texttt{dviwindo} option by \textsf{hyperref}; therefore there is
% none here as well.  \textsf{dviwindo} can use the
% \texttt{exercise} environment, but not the quizzes, so end here.
%    \begin{macrocode}
\ifeq@noforms\endinput\fi
%    \end{macrocode}
% Begin the Quiz Part of Exerquiz
%    \section{The \texttt{shortquiz} Environment}
%    \subsection{The \texttt{questions} Environment}
% The \texttt{questions} environment is used inside the
% \texttt{shortquiz} and \texttt{quiz} environments, though it can
% also be used a stand alone list. Beginning with version 5.5, the \texttt{questions}
% environment can be nested three deep.
%    \begin{macro}{questions}
%    This is a redesigned \texttt{list} environment.
%    \begin{macrocode}
%</package>
%<*package|eqexam>
\newcommand{\prior@questionsHook}{}
\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}{\prior@questionsHook\gdef\eqPTs{1}\global\let\eqQT=\eq@na%
    \makebox[\labelwidth][r]{\normalfont\bfseries\csname label\@quesctr\endcsname}%
        \post@questionsHook}%
    {\usecounter{\@quesctr}%
%    \setcounter{eqpointvalue}{0}%\setcounter{questionno}{0}%
    \settowidth{\labelwidth}{\normalfont\bfseries00.\ }%
    \setlength{\topsep}{3pt}\setlength{\parsep}{0pt}%
    \setlength{\itemindent}{0pt}\setlength{\itemsep}{3pt}%
    \setlength{\leftmargin}{\labelwidth}%
%    \setlength{\labelsep}{0pt}}%
    \settowidth{\labelsep}{\ }}

}{\end{list}}
%    \end{macrocode}
%    \end{macro}
%    \subsection{The \texttt{shortquiz} and \texttt{shortquiz*} Environments}
% This \texttt{shortquiz} environment sets up multiple choice
% questions, with immediate feedback whether the user clicked on the
% right or wrong answer.  Solutions to the \texttt{shortquiz} may,
% or may not be included.
%    \begin{macro}{shortquiz}
% The shortquiz environment, really just a shell to define the
% \cmd{\Ans} macro and the \texttt{solution} environment that go with
% the \texttt{shortquiz}
%    \begin{macrocode}
\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]}}
%    \end{macrocode}
% \#1: unique name to be used for defining objective style questions.
%      Required if there are objective question; use this parameter
%      if there are objective questions. Also required if
%      using the * option (forms)
%    \begin{macrocode}
\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
%    \end{macrocode}
% Lay down the question header. \cs{sqlabel} defaults to a red ``Quiz''.
%    \begin{macrocode}
  \sq@priorhook\sqlabel\space\ignorespaces
}
%    \end{macrocode}
%    \end{macro}
%    \begin{macro}{\aeb@endshortquiz}
%    \begin{macro}{\aftershortquizskip}
% We reset the labels to the default in case the author
% of the document has redefined them temporarily. The author can
% avoid this reset, by redefining the global variables.
%    \begin{macrocode}
\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%\endgroup
}
%    \end{macrocode}
%    \end{macro}
%    \end{macro}
%    \begin{macro}{\sqLinks}
%    \begin{macro}{\sqForms}
% (01/01/05) Use these two commands to locally change the style of multiple choice
% questions: link or form.
%    \begin{macrocode}
\def\sqLinks{\gdef\sqstar{}}\sqLinks{}
\def\sqForms{\gdef\sqstar{*}}
%    \end{macrocode}
%    \end{macro}
%    \end{macro}
%    \begin{macrocode}
%</package|eqexam>
%<*package>
%    \end{macrocode}
% The \texttt{shortquiz} contains two other environments, each nested inside
% the next: The \texttt{answers} environment and the \texttt{solution}
% environment. The latter environment is optional.
%
% \smallskip\noindent\textbf{Basic Usage for the \texttt{shortquiz} environment}
%\begin{verbatim}
%No solutions included             With Solutions
%\begin{shortquiz}                 \begin{shortquiz}
%The question                      The question
%\begin{answers}                   \begin{answers}[qz:mysoln]
%\Ans1 ... &\Ans0 &... &\Ans0 ...  \Ans1 ... &\Ans0 &... &\Ans0 ...
%\end{answers}                     \begin{solution}
%\end{shortquiz}                   .....
%                                  \end{solution}
%                                  \end{answers}
%                                  \end{shortquiz}
%\end{verbatim}
% To further complicate matters, the \texttt{shortquiz} can be
% used with the \texttt{questions} environment to create a series of
% numbered short question quizzes. See the manual for examples.
% \texttt{solution} environment is defined next.
%    \begin{macro}{solution}
% The \texttt{solution} environment does double duty, it is used by both
% the \texttt{shortquiz} and \texttt{quiz} environments.
% The macro \cmd{\solution@sq} is the one that actually does the work
% of \cmd{\solution}: It  writes the solutions to the file
% \cmd{\jobname.qsl}.  This macro obeys the \texttt{forpaper}
% option. In this case, solutions are separated by a
% \cmd{\medskip} rather then put on a separate page.  It also
% obeys the \texttt{solutionsafter} option
%    \begin{macrocode}
%</package>
%<*package|eqexam>
\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
    \immediate\write\verbatim@out{%
%    \end{macrocode}
% Mark in the solutions files whether this is a quiz or a shortquiz solution.
%    \begin{macrocode}
      \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}%
    \expandafter\verbatimwrite\fi
}
\def\solutionsAfterSkip{\par\bigskip}
\def\endsolution@sq
{%
    \ifeq@solutionsafter
        \eq@fititin\hbox{\sqslrtnlabel}\solutionsAfterSkip
    \else
        \endverbatimwrite
        \ifx\@qzsolndest\@empty\else
            \immediate\write\verbatim@out{\eqSqSolnTrailer}%
        \fi
    \fi
    \global\let\@qzsolndest=\@empty
}
%</package|eqexam>
%<*package>
%    \end{macrocode}
%    \begin{macro}{\saveDest}
%    \begin{macro}{\useDest}
% These two macros are used, as needed to save the destination name of a solution, then
% re-emitting it later, just prior to the solution. Useful for grouped questions.
%    \begin{macrocode}
\def\saveDest{\xdef\holdDest{\@qzsolndest}}
\def\useDest{\def\@qzsolndest{\holdDest}}
%    \end{macrocode}
%    \end{macro}
%    \end{macro}
%    \begin{macrocode}
%</package>
%<*package|eqexam>
\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%
}
%</package|eqexam>
%<*package>
%    \end{macrocode}
%    \end{macro}
%    \begin{macro}{\eqQt}
% The \cmd{\eqQt} is a marker at the beginning of each quiz
% solution. It takes one argument: 0 if the solution is from a
% short quiz; 1 if the solution is from a quiz.  If you want to
% input the \texttt{*.qsl} file and typeset the solutions, separate
% from the generating document, you can redefine this command
% for various purposes, for  example, to strip of the shortquiz
% solutions. Here's an example:
%\begin{verbatim}
%\makeatletter
%\renewcommand\eqQt[1]{\ifx#10\expandafter\eqQtSQ\fi}
%\long\def\eqQtSQ#1\ReturnTo{\@gobbletwo}
%\makeatother
%\begin{document}
%\input{mydoc.qsl}
%\end{document}
%\end{verbatim}
%\noindent The default action of \cmd{eqQt} is to do nothing and to eat its argument.
%    \begin{macrocode}
%\let\eqQt=\@gobble
%</package>
%<*package|eqexam>
\let\eqSQt=\relax
\let\endeqSQt=\relax
\let\eqQt=\relax
\let\endeqQt=\relax
%    \end{macrocode}
%    \end{macro}
%    \begin{macro}{\quizSolnHeader}
%  Each solution begins with \cmd{\quizSolnHeader}. This can be redefined
%  for whatever reason. It takes three arguments, one of which is optional.
%  \#1 is the \cmd{\noPeek} parameters; \#2 is the named destination to this
%  solution; \#3 is the \cmd{\sqsllabel}.
%
% If you want to typeset solutions separately, you could redefine
% \cmd{\quizSolnHeader} as desired, and used in conjunction with
% \cmd{eqQt}.
%    \begin{macrocode}
\newcommand\quizSolnHeader[3][]{%
    \ifeqforpaper\else\webnewpage\fi\noindent
%</package|eqexam>
%<*package>
    \ifx#1\empty\else\noPeek#1\fi
    \hypertarget{#2}{#3}\relax
%</package>
%<*eqexam>
    #2%
%</eqexam>
%<*package|eqexam>
    \solnhspace
}
%</package|eqexam>
%<*package>
%    \end{macrocode}
%    \end{macro}
%    \begin{macro}{\NoPeeking}
%    \begin{macro}{\AllowPeeking}
% A \texttt{quiz} solution has an additional (optional) feature. If
% \cmd{\NoPeeking} is executed, then an open action is placed on the opening
% page of each solution. This open action simply changes the page back to
% the page of the quiz. This is an attempt at keeping students from ``peeking''
% at the solutions before, or while they are taking a quiz. \cmd{\AllowPeeking}
% is the default.
%    \begin{macrocode}
\def\AllowPeeking{\global\let\allow@peek=y}\AllowPeeking
\def\NoPeeking{\global\let\allow@peek=n}
%    \end{macrocode}
%    \end{macro}
%    \end{macro}
%    \begin{macro}{\noPeekAction}
% The default definition of \cmd{quizSolnHeader} contains a macro called
% \cmd{\noPeek}. This is the action that \cmd{\noPeek} performs. The actual
% definition of \cmd{\noPeek} is driver dependent, and is listed elsewhere.
% An open page action will be created with a JavaScript action, which calls
% a DLJS function \texttt{noPeek("\#1",\#2)}. The first parameter is the base
% name of the quiz; the second parameter is the page number the quiz starts from
% (so that we can return to that page when the student tries to view the solution
% when he is not authorized to).
%    \begin{macrocode}
\def\noPeekAction#1#2{%
    /AA <</O<</S/JavaScript/JS(noPeek("#1",#2))>> >>
}
%    \end{macrocode}
%    \end{macro}
%    \subsection{The \texttt{shortquiz} Solutions}
% When the first solution is written, \cmd{\therearequizsolutions} is
% made true.  When the solutions are input back into the file, and
% this switch is still false, then no quiz header is typeset;
% this avoids an empty quiz solutions section with only the header.
%    \begin{macrocode}
%</package>
%<*package|eqexam>
\newif\iftherearequizsolutions \therearequizsolutionsfalse
%    \end{macrocode}
%    \begin{macro}{\includequizsolutions}
% This macro inserts the solutions to the short quizzes, if there are
% any solutions.  If a user uses this macro to insert the solutions
% elsewhere, \cmd{\include@quizsolutions} is called, then put is to
% \cmd{\relax}.
%    \begin{macrocode}
\def\includequizsolutions
{%
        \include@quizsolutions
        \let\include@quizsolutions=\relax
}
%</package|eqexam>
%<*package>
%    \end{macrocode}
%    \end{macro}
% Commands executed at the beginning of the page of quiz solutions
%    \begin{macrocode}
\let\eqqzsolutionshook\@empty
\let\priorsqslsectitle\@empty
\let\priorsqslinput\@empty
\def\quizSolnsHeadnToc{\section*{\sqslsectitle}%
    \addcontentsline{toc}{section}{\protect\numberline{}\sqslsectitle}}
\newcommand{\quizSolnInput}
{%
    \let\webnewpage=\relax
    \immediate\closeout\quiz@solns
    \ifeq@noquizsolutions\else
        \iftherearequizsolutions\newpage\markright{\eq@sqslsecrunhead}%
            \ifx\webnewpage\relax
                \def\webnewpage{\let\webnewpage=\newpage}%
            \fi
            \priorsqslsectitle\quizSolnsHeadnToc\priorsqslinput
            \input{\jobname.qsl}\eqqzsolutionshook
        \fi
    \fi
}
%    \end{macrocode}
% The internal command that insert solutions.  This command
% appears at the end of document, where it will insert the
% solutions, unless it has been redefined to \cmd{\relax} by
% \cmd{\includequizsolutions}.
%    \begin{macrocode}
\def\include@quizsolutions{\quizSolnInput}
%    \end{macrocode}
%
%    \section{The \texttt{quiz} and \texttt{quiz*} Environments}
%
% In this section we introduce the \texttt{quiz} environment, and all its
% supporting elements.
%
%    \subsection{Define the \texttt{quiz} Environment}
%
%    \begin{macrocode}
\def\q@priorhook{\par\medskip}
\let\eq@initializeServerSubmit\@empty
%    \end{macrocode}
%    \begin{macro}{\quiztype}
%    \begin{macro}{\defaultquiztype}
% The command \cs{quiztype} can be used to force subsequent quizzes to be link
% style or form style, independent of the environment. Recognized values are
% \texttt{f} and \texttt{l}.  Once the override \cs{quiztype} has been used,
% you can recover the default behavior of the quizzes by expanding
% \cs{defaultquiztype}.
%    \begin{macrocode}
\newcommand{\quiztype}[1]{\def\@quiztype{#1}}\let\@quiztype\@empty
\newcommand{\defaultquiztype}{\let\@quiztype=\@empty}
%    \end{macrocode}
%    \end{macro}
%    \end{macro}
% begin dps 12/20/03
%    \begin{macrocode}
\def\setdefault@Ans{\expandafter\global\expandafter
    \let\expandafter\@Ans\expandafter=\csname Ans@\@@quiztype\endcsname
}
% end dps 12/20/03
%    \end{macrocode}
%    \begin{macro}{\useForms}
%    \begin{macro}{\useLinks}
% For multiple choice questions, here we give the option of using a mixture of links
% and forms.
%    \begin{macrocode}
% dps 12/20/03
\newcommand\useForms{\let\@Ans=\Ans@f}
\newcommand\useLinks{\let\@Ans=\Ans@l}
%    \end{macrocode}
%    \end{macro}
%    \end{macro}
%    \begin{environment}{quiz}
% The \texttt{quiz} environment takes an optional `\texttt*'
% and one required argument.  There are two styles of quizzes:
% links or checkboxes. Beginning with v6.08, the use of the \texttt*-option
% is discouraged, use the quiz* environment instead.
%\begin{verbatim}
%\begin{quiz}[*]{<base_name>}
% ...
%\end{quiz}
%\end{verbatim}
% \begin{itemize}
% \item optional \texttt{*} $=$ use checkboxes, otherwise use links
% \item \texttt{<base\_name>}: required argument $=$ base name of quiz.
% \end{itemize}
%    \begin{macrocode}
\newenvironment{quiz}
{\goodbreak\@ifstar{\def\qstar{*}\@quiz*f}{\def\qstar{x}\@quiz*l}}
    {\aeb@endquiz}
\def\@quiz*#1#2%
{%
    \setcounter{eqpointvalue}{0}\setcounter{questionno}{0}%
    \eq@initializeServerSubmit
    \global\let\eqQuizType=q\tabcolsep=0pt
    \gdef\eqPTs{1}\global\let\eqQT\eq@na
    \gdef\quiz@total{#2}\gdef\curr@quiz{#2}%
    \gdef\currQuiz{#2}\xdef\currQuizStartPage{\thepage}%
    \xdef\aPointType{0}%
    \ifx\@quiztype\@empty
        \gdef\@@quiztype{#1}%
    \else
        \xdef\@@quiztype{\@quiztype}%
    \fi
    \setdefault@Ans
    \let\@qzsolndest=\@empty
    \let\answers=\answers@q\let\endanswers=\endanswers@q
    \let\solution=\solution@sq\let\endsolution=\endsolution@sq
    \q@priorhook\eq@beginQuiz\space\ignorespaces
}
%    \end{macrocode}
% Here is the end for the \texttt{quiz} and \texttt{quiz*} environments. The
% \cs{eq@prior@endQuiz} can be used for whatever purposes a
% developer wants.
%    \begin{macrocode}
\let\eq@prior@endQuiz\@empty
\def\aeb@endquiz
{%
    \eq@prior@endQuiz
    \eq@endQuiz
    \global\let\bqlabel=\eq@bqlabel % reset beginning label to default
    \global\let\eqlabel=\eq@eqlabel % reset ending label to default
    \global\let\bqlabelISO=\eq@bqlabelISO
}
%    \end{macrocode}
%    \end{environment}
%    \begin{environment}{quiz*}
% This environment is more latexy, \texttt{quiz*} environment is for quizzes with forms. Equivalent
% to \verb!\begin{quiz}*...\end{quiz}!/
%    \begin{macrocode}
\newenvironment{quiz*}{\goodbreak\def\qstar{*}\@quiz*f}{\aeb@endquiz}
%    \end{macrocode}
%    \end{environment}
%    \begin{macro}{\Quiz}
%   A convenience macro for setting the name of the quiz. This command defines the
%   text macro \cs{thisQuiz} which contains the quiz name. Can be used in conjunction
%   with \cs{floatQuiz} and \cs{startQuizHere}.
% \changes{v6.05c}{2006/05/19}
% {
%   Added a convenience macro for setting the name of the quiz. This command defines the
%   text macro \cs{thisQuiz} which contains the quiz name. Can be used in conjunction
%   with \cs{floatQuiz} and \cs{startQuizHere}.
% }
%
%    \begin{macrocode}
\def\Quiz#1{%
    \def\thisQuiz{#1}%
    \def\curr@quiz{\thisQuiz}%
    \def\currQuiz{\curr@quiz}%
}
%    \end{macrocode}
%    \end{macro}
%    \begin{macro}{\floatQuiz}
%    \begin{macro}{\dockQuiz}
% Use \cs{floatQuiz} to create commands \cs{startQuizHere} and \cs{endQuizHere}. These commands expand to the
% `Begin Quiz' button or link (`End Quiz' button or link).  But these commands can be placed anywhere before the
% \texttt{quiz} environment (after the \texttt{quiz} environment). Use \cs{dockQuiz} to return to the default behavior of the
% \texttt{quiz} environment.
% \changes{v6.05c}{2006/05/19}
% {
%   Added \cs{floatQuiz}, \cs{dockQuiz} and \cs{startQuizHere} to start a quiz in an
%   arbitrary place prior to the beginning of the quiz.
% }
%\par\medskip\noindent Usage:
%\begin{verbatim}
%\Quiz{myQuiz}
%\floatQuiz
%........
%\begin{center}
%\startQuizHere
%\end{center}
%....
%\begin{quiz*}{\thisQuiz}
%....
%\end{quiz*}
%....
%\endQuizHere
% ...
%\docQuiz
%\begin{quiz}{anotherQuiz}
%....
%\end{verbatim}
%    \begin{macrocode}
\def\noindgobble{\noindent\@gobbletwo}
\let\startQuizHere\relax
\let\endQuizHere\relax
\let\dockQuiz\relax
\newcommand\floatQuiz{%
    \global\let\eq@beginQuiz@saved\eq@beginQuiz
    \global\let\eq@endQuiz@saved\eq@endQuiz
    \global\let\startQuizHere\eq@beginQuiz
    \global\let\endQuizHere\eq@endQuiz
    \global\let\eq@beginQuiz\noindgobble
    \global\let\eq@endQuiz\@empty
    \global\let\dockQuiz\eq@dockQuiz
}
\newcommand\eq@dockQuiz{%
    \global\let\eq@beginQuiz\eq@beginQuiz@saved
    \global\let\eq@endQuiz\eq@endQuiz@saved
    \global\let\startQuizHere\relax
    \global\let\endQuizHere\relax
    \global\let\eq@beginQuiz@saved\relax
    \global\let\eq@endQuiz@saved
    \global\let\dockQuiz\relax
}
%    \end{macrocode}
%    \end{macro}
%    \end{macro}
%
%    \subsection{Begin/End Quiz with Link or Buttons}
%
% Redefine this macro to \cmd{\eq@BeginQuizButton} to get a form button
% for the \texttt{quiz} environment. Pressing on the link or button
% initializes the quiz. The default is `link': \cmd{\eq@BeginQuizLink}.
%    \begin{macrocode}
\newcommand\eq@beginQuiz{\eq@BeginQuizLink}
%    \end{macrocode}
% Redefine this macro to |\eq@EndQuizButton| to get a form button
% for the \texttt{quiz} environment. Pressing on the link or button
% will score the quiz. The default is `link': |\eq@EndQuizLink|.
%    \begin{macrocode}
\newcommand\eq@endQuiz{\eq@EndQuizLink}
%    \end{macrocode}
%    \begin{macro}{\useBeginQuizButton}
% Use a button instead of a link for begin quiz
%    \begin{macrocode}
\newcommand\useBeginQuizButton[1][]
    {\renewcommand\eq@beginQuiz{\eq@BeginQuizButton[#1]}}
%    \end{macrocode}
%    \end{macro}
%    \begin{macro}{\useEndQuizButton}
% Use a button instead of a link for end quiz
%    \begin{macrocode}
\newcommand\useEndQuizButton[1][]
    {\renewcommand\eq@endQuiz{\eq@EndQuizButton[#1]}}
%    \end{macrocode}
%    \end{macro}
%    \begin{macro}{\useBeginQuizLink}
% Use a link begin quiz (the default)
%    \begin{macrocode}
\newcommand\useBeginQuizLink
    {\renewcommand\eq@beginQuiz{\eq@BeginQuizLink}}
%    \end{macrocode}
%    \end{macro}
%    \begin{macro}{\useEndQuizLink}
% Use a link end quiz (the default)
%    \begin{macrocode}
\newcommand\useEndQuizLink
    {\renewcommand\eq@endQuiz{\eq@EndQuizLink}}
%    \end{macrocode}
%    \end{macro}
%    \begin{macro}{\@initQuiz}
%    \begin{macro}{\priorInitQuiz}
%    \begin{macro}{\postInitQuiz}
% \cs{@initQuiz} is executed when you click on `Begin Quiz'. Included here are some
% macro hooks for insert code prior to, and after the quiz initialization. This
% command appears in the commands \cs{eq@@BeginQuizLinkActions} and \cs{eq@@BeginQuizButtonActions} below.
%    \begin{macrocode}
\newcommand\@initQuiz
    {InitializeQuiz("\curr@quiz",\ifeq@nocorrections0\else1\fi);\jsR
    var \curr@quiz = new Object();\jsR
    \curr@quiz.oAlertCheck = { bAfterValue: false };\jsR
    \curr@quiz.Grp = {};\jsR
}
%    \end{macrocode}
% \cs{priorInitQuiz} and \cs{postInitQuiz} are hooks that allow a document author to
% execute JavaScript just prior to submittal and just after. These appear in
% \cs{eq@@BeginQuizLinkActions} and \cs{eq@@BeginQuizButtonActions} below.
%    \begin{macrocode}
\newcommand{\priorInitQuiz}{}
\newcommand{\postInitQuiz}{}
%    \end{macrocode}
%    \end{macro}
%    \end{macro}
%    \end{macro}
% Here are a couple of macros used with `End Quiz', and are used for
% submitting quiz results to a web server.
%    \begin{macrocode}
\let\eq@submitURL=\@empty
\let\eq@insertHiddenFields=\@empty
%    \end{macrocode}
%
% \subsubsection{With Links}
%
%    \begin{macro}{\eq@BeginQuizLink}
% Begin quiz with links
%    \begin{macrocode}
\def\eq@@BeginQuizLinkActions
{%
    \A{\JS{%
      \priorInitQuiz
      \@initQuiz
      \postInitQuiz}}%
}
\def\eq@BeginQuizLinkDefaults{\Border{0 0 0}}
\def\eq@BeginQuizLink
{%
    \set@@Link{}{}{}{\color{\@linkcolor}\bqlabel}{}%
    {\eq@setWidgetProps\setLink@driver}%
    {\eq@BeginQuizLinkDefaults\eq@@BeginQuizLinkActions\every@Link}%
    \space\ignorespaces
}
%    \end{macrocode}
%    \end{macro}
%    \begin{macro}{\eq@EndQuizLink}
% Code the the link version of `End Quiz'.
%    \begin{macrocode}
\newcommand\priorSubmitQuiz{}
\newcommand\postSubmitQuiz{}
\def\eq@@EndQuizLinkActions
{%
    \A{\JS{%
        if (!isQuizInitialized("\curr@quiz"))\jsR\jsT
            app.alert(InitMsg("\bqlabelISO"),3);\jsR
        else {\jsR\jsT
            if (\minQuizResp(\thequestionno)) {\jsR\jsT\jsT
                DisplayQuizResults("\curr@quiz",\theeqpointvalue,%
                    \thequestionno);\jsR\jsT\jsT
                \eq@submitURL
                \postSubmitQuiz
                resetQuiz("\curr@quiz");\jsR\jsT
            }\jsR
            }}}%
}
\def\eq@EndQuizLinkDefaults{\Border{0 0 0}}
\def\eq@EndQuizLink
{%
    \ifx\eq@CGI\@empty
        \let\eq@submitURL=\@empty
        \let\eq@insertHiddenFields=\@empty
    \fi
    \set@@Link{}{}{}{\color{\@linkcolor}\eqlabel}{}%
    {\eq@setWidgetProps\setLink@driver}%
    {\eq@EndQuizLinkDefaults\eq@@EndQuizLinkActions\every@Link}%
    \makebox[0pt][r]{\eq@insertHiddenFields}\gdef\eq@CGI{}%
    \ignorespaces
}
%    \end{macrocode}
%    \end{macro}
%
% \subsubsection{With Buttons}
%
%    \begin{macro}{\eq@BeginQuizButton}
% This is the button when the user wants button rather than link for the
% \texttt{quiz} environment.
%    \begin{macrocode}
\def\eq@BeginQuizButtonDefaults
{%
    \CA{\bqlabel}\RC{\bqlabel}\AC{\bqlabel}\H{P}\F{\FPrint}
    \BC{1 0 0}\BG{.7529 .7529 .7529}\W{1}\S{B}
}
\def\eq@@BeginQuizButtonActions
{%
    \A{\JS{%
        \priorInitQuiz
        \@initQuiz
        \postInitQuiz}%
    }%
}
\newcommand\eq@BeginQuizButton[1][]
{%
    \push@@Button{#1}{beginQuiz.\curr@quiz}{}{\DefaultHeightOfWidget}%
    {\eq@protect\A}{\eq@setButtonProps\eq@Button@driver}%
    {\eq@BeginQuizButtonDefaults\eq@@BeginQuizButtonActions\every@ButtonField
     \every@BeginQuizButton}%
}
%    \end{macrocode}
%    \end{macro}
%    \begin{macro}{\eq@EndQuizButton}
% The `End Quiz' code for Links
%    \begin{macrocode}
\def\eq@EndQuizButtonDefaults
{%
    \CA{\eqlabel}\RC{\eqlabel}\AC{\eqlabel}\F{\FPrint}
    \BC{1 0 0}\BG{.7529 .7529 .7529}\W{1}\S{B}\H{P}
}
\def\eq@@EndQuizButtonActions
{%
    \A{\JS
        {if (!isQuizInitialized("\curr@quiz"))\jsR\jsT
            app.alert(InitMsg("\bqlabelISO"),3);\jsR
        else {\jsR\jsT
            if (\minQuizResp(\thequestionno)) {\jsR\jsT\jsT
                DisplayQuizResults("\curr@quiz",\theeqpointvalue,%
                    \thequestionno);\jsR\jsT\jsT
                \eq@submitURL
                \postSubmitQuiz
                resetQuiz("\curr@quiz");\jsR\jsT
            }\jsR
            }}%
    }
}
\newcommand\eq@EndQuizButton[1][]
{%
    \ifx\eq@CGI\@empty
        \let\eq@submitURL=\@empty
        \let\eq@insertHiddenFields=\@empty
    \fi
    \push@@Button{#1}{endQuiz.\curr@quiz}{}{\DefaultHeightOfWidget}%
        {\eq@protect\A}{\eq@setButtonProps\eq@Button@driver}%
        {\eq@EndQuizButtonDefaults\eq@@EndQuizButtonActions\every@ButtonField
         \every@EndQuizButton}%
    \makebox[0pt][r]{\eq@insertHiddenFields}\gdef\eq@CGI{}%
}
%    \end{macrocode}
%    \end{macro}
%    \begin{macro}{\databaseName}
%    \begin{macro}{\tableName}
%    \begin{macro}{\eqCGI}
%    \begin{macro}{\eqSubmit}
% These four commands give general support for submitting quiz data
% to a web server for storage in a database.  Use in my \textsf{eq2db} Package
% which I have not completed yet.
%    \begin{macrocode}
\newcommand\databaseName[1]{\def\db@Name{#1}}\def\db@Name{}
\newcommand\tableName[1]{\def\db@Table{#1}}\def\db@Table{}
\newcommand\eqCGI[1]{\def\eq@CGI{#1}}\def\eq@CGI{}
\newcommand\eqSubmit[3]{\eqCGI{"#1"}\databaseName{#2}\tableName{#3}}
%    \end{macrocode}
%    \end{macro}
%    \end{macro}
%    \end{macro}
%    \end{macro}
% The next two commands are used in the \textsf{eq2db} package. We make the
% definitions here so that they can be used even if the package is not loaded.
% In this way, a self-contained quiz can be submitted just by loading the
% package.
%    \begin{macrocode}
\newcommand\addHiddenTextField[3][]{}
\newcommand\populateHiddenField[2]{}
%    \end{macrocode}
%    \subsection{Correcting the Quiz}
%
%    \begin{macro}{\eqButton}
% Use this button to correct the quiz. Can be customize with
% optional arguments.
% section.
%\begin{verbatim}
% #1 = optional attributes of button
% #2 = title of textfield that contains the score.
%\end{verbatim}
%    \begin{macrocode}
\def\eqButtonDefaults
{%
    \CA{\eq@local@CA}\RC{\eq@local@RC}
    \AC{\eq@local@AC}\H{P}\W{1}\S{B}
    \BC{1 0 0}\BG{.7529 .7529 .7529}
}
\def\@@eqButtonActions
{%
    \A{\JS{if (isEndQuizPushed("\eqBaseName"))\jsR\jsT
            correctQuiz("\eqBaseName",\thequestionno);}%
    }%
}
\newcommand\eqButton[2][]
{%
%    \end{macrocode}
% If nocorrections is true, then this button does not appear.
%    \begin{macrocode}
    \ifeq@nocorrections\else
        \medskip\def\eqBaseName{#2}%
        \push@@Button{#1}{correct.#2}{}{\DefaultHeightOfWidget}%
        {\eq@protect\A}{\eq@setButtonProps\eq@Button@driver}%
        {\eqButtonDefaults\@@eqButtonActions\every@ButtonField
        \every@eqButton}%
    \fi
}
%    \end{macrocode}
%    \end{macro}
%
%    \subsection{Measuring Quiz Results}
%
%    \begin{macro}{\minQuizResp}
% Define the threshold level. The two permissible values are \texttt{lowTreshold}
% and \texttt{highThreshold}. These are names of DLJS. New threshold functions
% can be defined and specified.
%    \begin{macrocode}
\newcommand\minQuizResp{lowThreshold}
%    \end{macrocode}
%    \end{macro}
%    \begin{macro}{\PTs}
% Use this macro to assign weights to the quiz questions. Use only within
% the \texttt{questions} environment, just after an \cmd{\item}. If
% \cmd{\PTs} does not appear, then a weight of $1$ is assumed.
%\par\noindent|#1 = number of points for the current question.|
%    \begin{macrocode}
\newcommand\PTs{%
    \@ifstar{\def\eq@star{*}\@PTs}{\def\eq@star{x}\@PTs}%
}
\def\@PTs#1{%
    \gdef\eq@PTs{#1}\ifx\eq@PTs\@empty\gdef\eq@PTs{1}\fi
    \global\let\eqPTs=\eq@PTs\global\let\eq@PTs=\@empty
    \if\eq@star*\else\PTs@Hook\fi
}
\def\eq@PTs{0} % initialize this variable
% begin dps 12/20/03
%    \end{macrocode}
%    \begin{macro}{\QT}
% \cs{QT} is used for entering the ``question type'' for the question (optional).
% This question type is entered into the ``\texttt{tagged}'' data, and is meant to be
% used for classifying and in tracking the problem types. Example: \verb+\QT{limits}+.
%    \begin{macrocode}
\newcommand\QT[1]
{%
    \gdef\eq@qT{#1}\ifx\eq@qT\@empty\global\let\eq@qT=\eq@na\fi% not applicable
    \global\let\eqQT=\eq@qT\global\let\eq@qT=\eq@na
}
%    \end{macrocode}
%    \end{macro}
%    \begin{macrocode}
\def\eq@na{na} % not applicable
\let\eq@qT=\eq@na
% end dps 12/20/03
%    \end{macrocode}
%    \end{macro}
%    \begin{macro}{\PTsHook}
% Used to typeset the number of points.
%    \begin{macrocode}
\newcommand\PTsHook[1]{\def\PTs@Hook{#1}}
\let\PTs@Hook=\@empty
\let\eq@PTs=\@empty
%    \end{macrocode}
%    \end{macro}
%    \begin{macro}{\eqGradeScale}
% This is an array of letter grades and grade ranges. This macro is use as the argument
% of the JS function \texttt{GetGrade}.
%    \begin{macrocode}
\newcommand\eqGradeScale{%
    "A",[90, 100],"B",[80,90],"C",[70,80],"D",[60,70],"F",[0,60]}
%    \end{macrocode}
%    \end{macro}
%    \begin{macro}{\ScoreField}
%     This text field will receive the scores
%     of a quiz.  The command \cmd{\eqScore} was defined
%     in Section~\ref{ss:ldm}.  This command takes an optional
%     argument and a required argument.
%\begin{verbatim}
%#1 = one or more commands that will customize the design of the
%     field.  See the manual for examples.
%#2 = Base name of the quiz
%\end{verbatim}
%    \begin{macrocode}
\def\ScoreFieldDefaults
{%
    \Ff{\FfReadOnly}\BC{1 0 0}\BG{}\S{N}
    \DV{\eqScore}\V{\eqScore}
}
\newcommand\ScoreField[2][]
{%
    \medskip\text@@Field{#1}{ScoreField.#2}{\SFW}%
        {\DefaultHeightOfWidget}{}{\eq@setWidgetProps\eq@TextField}%
        {\ScoreFieldDefaults\every@eqTextField\every@ScoreField}%
}
%    \end{macrocode}
%    \end{macro}
%    \begin{macro}{\GradeField}
% This command creates a text field that shows the letter grade of the user's
% effort on the current quiz.
%    \begin{macrocode}
\def\GradeFieldDefaults
{%
    \textColor{0 0 1 rg}
    \BC{1 0 0}\BG{1 1 1}\S{N}
    \Ff{\FfReadOnly}\Q{1}
}
\newcommand\GradeField[2][]
{%
    \medskip\text@@Field{#1}{GradeField.#2}{20bp}%
        {\DefaultHeightOfWidget}{}{\eq@setWidgetProps\eq@TextField}%
        {\GradeFieldDefaults\every@eqTextField\every@GradeField}%
}
%    \end{macrocode}
%    \end{macro}
%    \begin{macro}{\AnswerField}
% This command creates a text field to receive the answers to the
% fill-in questions.
%    \begin{macrocode}
\def\AnswerFieldDefaults
{%
   \BC{0 0 0}\S{N}\Ff{\FfReadOnly}
 }
\newcommand\AnswerField[2][]
{%
    \text@@Field{#1}{Ans.#2}{\RBW}{\DefaultHeightOfWidget}%
        {}{\eq@setWidgetProps\eq@TextField}%
        {\AnswerFieldDefaults\every@eqTextField\every@AnswerField}%
}
%    \end{macrocode}
%    \end{macro}
% Now let's define some additional text fields for the quiz environment.
%    \begin{macro}{\PointsField}
% This command creates a text field which displays the number of points in the
% quiz scored by the user of the \texttt{quiz}.
%    \begin{macrocode}
\def\PointsFieldDefaults
{%
   \rawPDF{}\BC{1 0 0}\BG{}\S{N}\Ff{\FfReadOnly}
 }
\newcommand\PointsField[2][]
{%
    \medskip\text@@Field{#1}{PointsField.#2}{\SFW}%
        {\DefaultHeightOfWidget}{}{\eq@setWidgetProps\eq@TextField}%
        {\PointsFieldDefaults\every@eqTextField\every@PointsField}%
}
%    \end{macrocode}
%    \end{macro}
%    \begin{macro}{\PercentField}
% This command creates a text field which displays user's score in percent
% form.
%    \begin{macrocode}
\def\PercentFieldDefaults
{%
    \rawPDF{}\BC{1 0 0}\BG{}\S{N}\Ff{\FfReadOnly}%
}
\newcommand\PercentField[2][]
{%
    \medskip\text@@Field{#1}{PercentField.#2}{\SFW}%
        {\DefaultHeightOfWidget}{}{\eq@setWidgetProps\eq@TextField}%
        {\PercentFieldDefaults\every@eqTextField\every@PercentField}%
}
%    \end{macrocode}
%    \end{macro}
%    \begin{macro}{\RestoreScoreField}
% Reset the score field to its default, in case some author
% changed things.
%    \begin{macrocode}
\newcommand\RestoreScoreField
{%
    \global\let\eqScore=\eq@Score
    \global\let\eqOutOf=\eq@OutOf
}
%    \end{macrocode}
%    \end{macro}
%
% \section{Multiple Choice Alternatives}
% \subsection{For \texttt{shortquiz}}
% \subsubsection{The \texttt{answers} Environment}
%    \begin{macro}{\answers}
% The alternatives of a multiple choice question are enclosed in
% the \texttt{answers} environment.
% This environment takes an optional argument, and one
% required argument.  The required parameter is the number of
% columns to  construct in the underlying \texttt{tabular}
% environment; the presence of the optional argument means the author
% wants to include the solution to this quiz question.  The value of
% the optional parameter is the named destination of the solution.
% The optional parameter for the named destination can also be a
% `\texttt*', in which case a name of \texttt{\string\curr@quiz.\string\thequestionno}
% is assigned.
%    \begin{macrocode}
%</package>
%<*package|eqexam>
\def\answers@sq{\stepcounter{questionno}%
    \if\sqstar*\relax\let\@Ans=\Ans@sq@f\else\let\@Ans=\Ans@sq@l\fi
    \def\answerType{r}%
    \@ifnextchar[{\answers@@sq}%
    {\@ifstar{\answers@@sq[\curr@quiz.\thequestionno]}{\answers@@sq[]}}}
% dps 4/16/05
\def\manswers@sq{\stepcounter{questionno}%
    \if\sqstar*\relax\let\@Ans=\Ans@ck@sq@f\else\let\@Ans=\Ans@ck@sq@l\fi
    \def\answerType{c}%
    \@ifnextchar[{\answers@@sq}%
    {\@ifstar{\answers@@sq[\curr@quiz.\thequestionno]}{\answers@@sq[]}}}
%    \end{macrocode}
%    \end{macro}
%\begin{verbatim}
% #1 = named destination to be associated with solution
% #2 = number of columns in the tabular environment
%\end{verbatim}
% If the number of columns specified, then we use a list environment.
%    \begin{macrocode}
\let\sq@hwdest=\@empty % hard-wired destination
\def\answers@@sq[#1]#2{%
    \gdef\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}%
}
%    \end{macrocode}
%    \begin{macro}{\setMClabelsep}
% \changes{v6.05e}{2006/18/06 v6.05e}
% {
%   Added control over the separation between the MC label and subsequent text:
%   \cs{setMClabelsep} and \cs{resetMClabelsep}.
% }
%    \begin{macro}{\resetMClabelsep}
%    \begin{macro}{\eq@hspanner}
%    \begin{macro}{\eq@hspanner@default}
% Some convenience macros for computing the width of labels. The command \cs{setMClabelsep}
% can be used to set the separation between the MC label and the beginning of text.  The
% argument for this command is anything that takes up horizontal space. The command sets
% the value of \cs{eq@hspanner}. The default value % of the separation is given by \cs{eq@hspanner@default}.
% The default value can be restored by executing \cs{resetMClabelsep}.
%    \begin{macrocode}
\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}
%    \end{macrocode}
% For the link-style MC question, the default width, \cs{eq@l@l}, of the label is the normalsize width of
% `(d)'. For a form checkbox or radiobutton bux, the default width, cs{eq@lw@f}, is \cs{RadioFieldSize},
% normally defined as \texttt{11bp}.
%    \begin{macrocode}
\def\eq@l@l{\normalsize\normalfont(d)}
\def\eq@lw@f{\kern\RadioFieldSize\eq@hspanner}
%    \end{macrocode}
%    \end{macro}
%    \end{macro}
%    \end{macro}
%    \end{macro}
% This macro will pick up the 0 (false) or 1 (true) of the \cs{Ans} command.
%    \begin{macrocode}
%\newcommand\Ans@list[2][0]{\gdef\eq@pPTs{#1}%
%    \xdef\Ans@choice{#2}\item\relax}
\newcommand\Ans@list[2][0]{\gdef\eq@pPTs{#1}%
    \xdef\Ans@choice{#2}\item\relax\if\eq@listType1%
    \addtocounter{quizno}{-1}\refstepcounter{quizno}\fi}
%    \end{macrocode}
% Answers environment for a list environment.
%    \begin{macrocode}
\newenvironment{answers@sq@list}[1]
{%
    \if\answerType r
        \let\endanswers=\endanswers@sq@list
    \else
        \let\endmanswers=\endanswers@sq@list
    \fi
    \vskip\aboveanswersSkip
    \begin{list}{\strut\@Ans}%\begin{list}{\strut\@Ans\ }
    {%
%        \usecounter{list@partno}%
        \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}%
%       \def\Ans{\item\relax\eq@Ans}%
    }%
}%
{\end{list}\setcounter{quizno}{0}}
%    \end{macrocode}
% Answers environment for a tabular environment.
%    \begin{macrocode}
\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}}}}%
%    \end{macrocode}
%    \begin{macro}{\endanswers}
%    Close off \texttt{tabular} environment, and reinitialize the
%    \texttt{quizno} counter.
%    \begin{macrocode}
\def\endanswers@sq{\end{tabular}\setcounter{quizno}{0}}%
\def\endmanswers@sq{\end{tabular}\setcounter{quizno}{0}}%
\def\popiiictm{\special{CTM: pop pop pop}}
%</package|eqexam>
%<*package>
%    \end{macrocode}
%    \end{macro}
% \subsubsection{Link Style}
%    \begin{macro}{\Ans@sq@l}
% For the link multiple choice type question. The driver independent stuff starts
% here, then goes to |\Ans@sq@l@driver| the rest of the code that depends on the
% driver.
%    \begin{macrocode}
%\def\sqWrongRespJS{app.alert(\eqsqwgmsg,3);}
%\def\sqRightRespJS{app.alert(\eqsqrtmsg,3);}
\def\sqWrongRespJS{OnBlurRespBox( false, "\oField" );}
\def\sqRightRespJS{OnBlurRespBox( true, "\oField" );}
\def\Ans@sq@l@Actions
{%
    \A{\if\Ans@choice1
        \JS{\sqRightRespJS}
        \ifx\@qzsolndest\@empty\else
            \ifeq@solutionsafter\else
                /Next <</S/GoTo/D(\@qzsolndest)>>
            \fi
        \fi
    \else
        \JS{\sqWrongRespJS\jsR
        \ifx\oField\@empty\else
            updateTally("\oField.\thequestionno");
        \fi}%
    \fi
    }%
}
\def\linkContentFormat{\alph{quizno}}
%</package>
%<*eqexam>
\def\linkContentFormat{%
    \if\probstar*\arabic{quizno}\else\alph{quizno}\fi}
%</eqexam>
%<*package|eqexam>
%\def\linkContentFormat{\alph{quizno}}
\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
%</package|eqexam>
%<*eqexam>
    \Ans@sq@l@driver
%</eqexam>
%<*package>
    \set@@Link{}{}{}%
        {\makebox[\eq@tmpdima]{\color{\@linkcolor}\link@@Content}}%
        {\eq@protect\A}{\eq@setWidgetProps\setLink@driver}%
        {\set@LinkTextDefaults\Ans@sq@l@Actions\every@Link}%
    \Ans@proofing{\eq@tmpdima}%
%</package>
%<*package|eqexam>
\eq@hspanner\ignorespaces}
%</package|eqexam>
%<*package>
%    \begin{macro}{\Ans@ck@sq@l}
% Created in support of eqExam to give multiple selection for the
% online and email options.  Otherwise, it defaults to a radio button field.
%    \begin{macrocode}
%</package>
%<*package|eqexam>
% dps 4/16/05
\let\Ans@ck@sq@l=\Ans@sq@l
%</package|eqexam>
%<*package>
%    \end{macrocode}
%    \end{macro}
% \subsubsection{Form Style}
%    \begin{macro}{\Ans@sq@f}
% For the link multiple choice type question. The driver independent stuff starts
% here, then goes to |\Ans@sq@f@driver| the rest of the code that depends on the
% driver.
%    \begin{macrocode}
\def\@@Ans@sq@f@Defaults
{%
    \BC{0 0 0}\Ff{\FfNoToggleToOff}
    \textSize{12}\textColor{0 g}
}
%    \end{macrocode}
% For short quizzes, refine the type of responses: turn off the alert message (the default is on);
% or have a (red) `\texttt{x}' make an incorrect answer, and a (green) check mark a correct answer.
%    \begin{macrocode}
\def\sqTurnOffAlerts{\let\@sqTurnOffAlerts=0}
\def\sqTurnOnAlerts{\let\@sqTurnOffAlerts=1}
\sqTurnOnAlerts
\def\sqNoCorrections{\let\@sqAlertsOnly=1}
\def\sqCorrections{\let\@sqAlertsOnly=0}
\sqNoCorrections
%    \end{macrocode}
% The actions for the form version of a multiple choice question of a shortquiz.
%    \begin{macrocode}
\def\Ans@sq@f@Actions
{%
    \A{\if\Ans@choice1%
        \JS{event.target.textColor=\correctColor;\jsR
            event.target.style=style.ch;\jsR
            \if\@sqTurnOffAlerts1OnBlurRespBox( true, "\oField" );\fi}%
        \ifx\@qzsolndest\@empty\else
            \ifeq@solutionsafter\else
                /Next <</S/GoTo/D(\@qzsolndest)>>
            \fi
        \fi%
    \else
        \JS{event.target.textColor=\wrongColor;\jsR
            event.target.style=style.cr;\jsR
            \if\@sqTurnOffAlerts1OnBlurRespBox( false, "\oField" );\fi
        \ifx\oField\@empty\else\jsR
            updateTally("\oField.\thequestionno");
        \fi}%
    \fi%
    }%
}
\def\Ans@proofing
#1{%
    \ifeq@proofing\if\Ans@choice1\relax
        \llap{\@proofingsymbol\,\hskip#1\relax}%
    \fi\fi
}
%</package>
%<*package|eqexam>
\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
%</package|eqexam>
%<*eqexam>
    \Ans@sq@f@driver
%</eqexam>
%<*package>
    \insertGrayLetters\radio@@Button{}{mc.\oField.\thequestionno}{\RadioFieldSize}%dps 11/16/05 changed from \oField to mc.\oField
        {\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}%
    \Ans@proofing{\RadioFieldSize}%
%</package>
%<*package|eqexam>
\eq@hspanner\ignorespaces}
%</package|eqexam>
%<*package>
%    \end{macrocode}
%    \end{macro}
%    \begin{macro}{\Ans@ck@sq@f}
% Created in support of eqExam to give multiple selection for the
% online and email options.  Otherwise, it defaults to a radio button field.
%    \begin{macrocode}
%</package>
%<*package|eqexam>
% dps 4/16/05
\let\Ans@ck@sq@f=\Ans@sq@f
%</package|eqexam>
%<*package>
%    \end{macrocode}
%    \end{macro}
% \subsection{For \texttt{quiz}}
% \subsubsection{The \texttt{answers} Environment}
%    \begin{macro}{\answers}
% This is the answers environment for the \texttt{quiz}
% environment.  The \texttt{quiz} environment states
% \verb+\let\answers=\answers@q+.  This is to avoid a conflict
% with \texttt{shortquiz}, which also as an \texttt{answers}
% environment.
%\begin{verbatim}
% #1 = named destination to be associated with solution
% #2 = number of columns in the tabular environment
%\end{verbatim}
% If the number of columns is $1$, then we use a list environment,
% else, we use a tabular environment.
%    \begin{macrocode}
%</package>
%<*package|eqexam>
\newlength\aboveanswersSkip
\setlength\aboveanswersSkip{3pt}
%</package|eqexam>
%<*package>
\let\q@hwdest=\@empty % hard-wired destination
\newcommand\answers@q
{%
    \addtocounter{eqpointvalue}{\eqPTs}\stepcounter{questionno}%
    \@ifnextchar[{\answers@@q}%
    {\@ifstar{\answers@@q[\curr@quiz.\thequestionno]}{\answers@@q[]}}%
}
\def\answers@@q[#1]#2%
{%
    \gdef\numCols{#2}%
    \edef\eqtmp{\aPointType}\xdef\aPointType{\eqtmp,[\eqPTs,"mc"]}%
        \ifx\q@hwdest\@empty
            \xdef\@qzsolndest{#1}%
        \else
            \gdef\@qzsolndest{\q@hwdest}%
        \fi
    \ifx#21\gdef\eq@listType{1}\expandafter\answers@q@list\else
    \gdef\eq@listType{0}\expandafter\answers@q@tabular\fi{#2}%
}
%    \end{macrocode}
%    \end{macro}
%    \begin{macrocode}
\newenvironment{answers@q@list}[1]
{%
    \let\endanswers=\endanswers@q@list
    \vskip\aboveanswersSkip
    \begin{list}{\strut\@Ans}%\
    {%
%        \usecounter{list@partno}%
%        \if\qstar*\relax
        \ifx\@Ans\Ans@f
            \settowidth{\labelwidth}{\eq@lw@f}%
        \else
            \settowidth{\labelwidth}{\eq@lw@l}%
        \fi
        \setlength{\parsep}{0pt}\setlength{\itemindent}{0pt}%
        \setlength{\listparindent}{\parindent}
        \setlength{\leftmargin}{\labelwidth}%
        \setlength{\labelsep}{0pt}
        \def\Ans{\Ans@list}%
        %\def\Ans{\item\relax\eq@Ans}%
    }%
}{\end{list}\setcounter{quizno}{0}%
% dps 12/20/03
    \setdefault@Ans
}
%    \end{macrocode}
%    \begin{macrocode}
\def\answers@q@tabular#1{%
    \vskip\aboveanswersSkip\noindent\tabcolsep=0pt
    \eq@tmpdima=\linewidth \advance\eq@tmpdima-\leftskip
        \divide\eq@tmpdima by#1
    \def\Ans{\Ans@tabular}%
    \let\endanswers=\endanswers@q@tabular
    \begin{tabular}{*{#1}{p{\eq@tmpdima}}}%
}
%    \end{macrocode}
%    \begin{macro}{\endanswers}
% Again, we put \verb+\let\endanswers=\endanswers@q+.
%    \begin{macrocode}
\def\endanswers@q@tabular
{%
    \end{tabular}\setcounter{quizno}{0}%
% dps 12/20/03
    \setdefault@Ans
}
%    \end{macrocode}
%    \end{macro}
% \subsubsection{Link Style}
%    \begin{macro}{\Ans@l}
% For the forms version of the \texttt{quiz} environment.
%    \begin{macrocode}
% \#1 = 0 or 1 (wrong or right)
% dps 12/19/03 removed the notify because we are not embedding a radio button field
\def\Ans@@l@Actions
{%
    \A{\JS{%
       this.getField("mc.\curr@quiz.\thequestionno").value = "\Ans@choice\alph{quizno}";\jsR
       RecordPointValue([0,\eqPTs,\eq@pPTs],\thequestionno);\jsR
       RecordProblemType("\eqQT",\thequestionno);\jsR
       ProcessQuestion(\Ans@choice,"\alph{quizno}",\thequestionno,%
       \arabic{quizno},"\curr@quiz",0,\ifeq@nocorrections0\else1\fi,%
       "\bqlabelISO"\ifx\eqQuizType q\ifx\eq@online y\ifeq@noquizsolutions\else,1\fi\fi\fi)}%
    }
}
\def\Ans@r@l@Defaults
{%
    \BC{}\S{S}\W{1}\Ff{\FfNoToggleToOff}
    \textSize{12}\textColor{0 g}
}
\def\Ans@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}%
    \hangindent=\eq@tmplength\hangafter=1\relax
    \eq@tmpdima=\wd\eq@tmpbox
    \def\link@@Content{(\hfil\linkContentFormat\hfil)}%
% begin dps changes 12/19/03
    \makebox[0pt][l]{\radio@@Button{}{mc.\curr@quiz.\thequestionno}%
        {\eq@tmpdima}{\RadioFieldSize}{\Ans@choice\alph{quizno}}%
        {\eq@protect\A}{\eq@setWidgetProps\eq@l@check@driver}%
        {\Ans@r@l@Defaults\every@RadioButton\every@qRadioButton}}%
% end dps changes 12/19/03
    \set@@Link{}{}{}%
    {\makebox[\eq@tmpdima]{\color{\@linkcolor}\link@@Content}}%
    {\eq@protect\A}{\eq@setWidgetProps\setLink@driver}%
    {\set@LinkTextDefaults\Ans@@l@Actions\every@Link}%
    \ifeq@nocorrections\else
        \if\Ans@choice1\relax
            \edef\Ans@c@l@Choice{\noexpand\DV{Yes}%
                \ifx\@qzsolndest\@empty\noexpand\BC{}\noexpand\Ff{\FfReadOnly}%
                \else % there is a solution to this multiple choice question
                    \ifeq@noquizsolutions
                        \noexpand\BC{}\noexpand\Ff{\FfReadOnly}%
                    \else
                        \noexpand\BC{0 .6 0}\noexpand\A{\noexpand\quiz@SolutionActionHook}%
                    \fi
                \fi
            }%
        \else
            \def\Ans@c@l@Choice{\Ff{\FfReadOnly}\BC{}}%
        \fi
        \makebox[0pt][r]{\check@@Box{}%
            {mcq.\curr@quiz.\thequestionno.\arabic{quizno}}%
            {\eq@tmpdima}{0pt}{Yes}{}% \@tempdimb
            {\eq@setWidgetProps\eq@l@check@driver}% \eq@RadioCheck@driver
            {\Ans@c@f@Defaults\Ans@c@l@Choice\every@RadioButton
             \every@qRadioButton}}%
    \fi
    \Ans@proofing{\eq@tmpdima}%
\eq@hspanner\ignorespaces}
%    \end{macrocode}
%    \end{macro}
% \subsubsection{Form Style}
%    \begin{macro}{\Ans@f}
% For the form button multiple choice type question. The driver independent stuff starts
% here, then goes to |\Ans@f@driver| the rest of the code that depends on the
% driver.
%    \begin{macrocode}
%\def\Ans@f{\leavevmode\refstepcounter{quizno}\PBS\raggedright\Ans@@f}
\def\Ans@f{\leavevmode\if\eq@listType1\stepcounter{quizno}%
    \else\refstepcounter{quizno}\fi\PBS\raggedright\Ans@@f}
\def\Ans@r@f@Defaults
{%
    \BC{0 0 0}\S{S}\W{1}\Ff{\FfNoToggleToOff}
    \textSize{12}\textColor{0 g}
}
% Action of the radio button field
\def\Ans@r@f@Actions
{%
    \A{\JS{%
        RecordPointValue([0,\eqPTs,\eq@pPTs],\thequestionno);\jsR
        RecordProblemType("\eqQT",\thequestionno);\jsR
        ProcessQuestion(\Ans@choice,"\alph{quizno}",\thequestionno,%
        \arabic{quizno},"\curr@quiz",0,\ifeq@nocorrections0\else1\fi,%
        "\bqlabelISO"\ifx\eqQuizType q\ifx\eq@online y\ifeq@noquizsolutions\else,1\fi\fi\fi);}%
    }
}
% Action of the check box underlying the radio button field
\def\quiz@SolutionActionHook{%
    /S/GoTo/D(\@qzsolndest)/Next<<\JS
    {this.resetForm(["mcq.\curr@quiz.\thequestionno.\arabic{quizno}"]);}>>
}
\def\Ans@c@f@Defaults
{%
    \BC{0 0 0}\S{S}\W{1}\F{\FHidden}\textSize{12}\textColor{0 .6 0 rg}
    \symbolchoice{circle}
}
%    \end{macrocode}
% \changes{v6.05d}{2007/04/14}
% {
%   Added the command \cs{insertGrayLetters}. This can be defined to place symbols under
%   the multiple choice form boxes. The command \cs{bottomOfAnsfStack} is there as a
%   hook for whatever purposes are desired.
% }
%    \begin{macrocode}
\let\bottomOfAnsfStack\relax
\def\insertGrayLetters{\ifaebshowgrayletters
    \rlap{\makebox[\RadioFieldSize]{\textcolor{gray}{\Alph{quizno}}}}\else\relax\fi}
\def\Ans@@f
{%
    \settowidth{\eq@tmplength}{\eq@lw@f}%
    \hangindent=\eq@tmplength\hangafter=1
    \bottomOfAnsfStack\insertGrayLetters
    \radio@@Button{}{mc.\curr@quiz.\thequestionno}%
        {\RadioFieldSize}{\RadioFieldSize}{\Ans@choice\alph{quizno}}%
        {\eq@protect\A}{\eq@setWidgetProps\eq@RadioCheck@driver}%
        {\Ans@r@f@Defaults\Ans@r@f@Actions\every@RadioButton
         \every@qRadioButton}%
    \ifeq@nocorrections\else
        \if\Ans@choice1\relax
            \edef\Ans@c@f@Choice{\noexpand\DV{Yes}%
                \ifx\@qzsolndest\@empty\noexpand\Ff{\FfReadOnly}%
                \else
                    \ifeq@noquizsolutions
                        \noexpand\Ff{\FfReadOnly}%
                    \else
                        \noexpand\BC{0 .6 0}\noexpand\A{\noexpand\quiz@SolutionActionHook}%
                    \fi
                \fi
            }%
        \else
            \def\Ans@c@f@Choice{\Ff{\FfReadOnly}}%
        \fi
        \makebox[0pt][r]{\check@@Box{}%
            {mcq.\curr@quiz.\thequestionno.\arabic{quizno}}%
            {\RadioFieldSize}{\RadioFieldSize}{Yes}{}%
            {\eq@setWidgetProps\eq@RadioCheck@driver}%
            {\Ans@c@f@Defaults\Ans@c@f@Choice\every@RadioButton
             \every@qRadioButton}}%
    \fi
    \Ans@proofing{\RadioFieldSize}%
\eq@hspanner\ignorespaces}
%</package>
%<*package|eqexam>
%    \end{macrocode}
%\subsection{The \cs{bChoices}/\cs{eChoices} Pair}
% (2/15/05) This pair of macros is not really an environment, the
% \cs{eChoices} really does nothing other than to act as an ending marker. The idea
%behind this pair of macros twofold: (1) To provide a convenient way of listing
%alternate choices for a multiple choice questions, the ``environment'' makes it
%easy to change the number of columns, or to change from tabular to list (or visa-versa);
%(2) Laying out the alternatives in a list style, makes it easy to develop techniques
%of randomizing the alternatives. Here is an example of usage:
%\begin{verbatim}
%\begin{answers}{4}
%\bChoices[2]
%    \Ans0 a choice\eAns
%    \Ans1 another choice\eAns
%    \Ans0 still another choice\eAns
%    \Ans0 another\eAns
%    \Ans0 incoming\eAns
%    \Ans0 more choices\eAns
%    \Ans0 another still\eAns
%    \Ans0 too many\eAns
%    \Ans0 choices\eAns
%\eChoices
%\end{answers}
%\end{verbatim}
%\noindent The argument of the \texttt{answers} environment is $4$ which means we are
%going to use the tabular environment with $4$ columns. Now within those $4$ we are going
%to only use the first $2$ columns ( this is the optional argument of \cs{bChoices}.
%
% If the optional argument is removed from \cs{bChoices}, the choices are typeset
% in the with $4$ columns. If the argument of \cs{answers} is changed to $1$, then the
% optional argument of \cs{bChoices} is ignored, and the alternatives are typeset in a
% one column list environment.
%
% By changing the two parameters (one for \cs{answers} and one for \cs{bChoices})
% you can easily modify how the alternatives are typeset.
%\par\medskip\noindent
% This counter tracts the column number we are in.
%    \begin{macrocode}
\newcount\eq@tabColCnt
%    \end{macrocode}
%    \begin{macro}{\bChoices}
% This command has one optional argument, the number of columns to use.
%    \begin{macrocode}
\def\bChoices{\@ifnextchar[{\@ansChoices}{\@ansChoices[\numCols]}}
%    \end{macrocode}
% If \cs{numCols} is $1$, we use a list environment, otherwise, a tabular is used.
%    \begin{macrocode}
\def\@ansChoices[#1]%
{%
    \global\eq@tabColCnt=0
    \ifnum\numCols=1 % list mode
        \def\eq@next{\@layoutListAns}%
    \else % tabular mode
         \def\eq@next{\@layoutTabularAns{#1}}%
    \fi
    \eq@next
}
\let\eChoices=\relax
%    \end{macrocode}
%    \end{macro}
% If the next token is \cs{Ans} we grab its all stuff between
% \cs{Ans} and \cs{eAns} and typeset it. We continue until the
% next token is not \cs{Ans}. (This last token
% should be \cs{eChoices}.)
%    \begin{macrocode}
\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}%
}
%    \end{macrocode}
% The argument is the number of columns to typeset, this number
% is forced to be \texttt{<=} to the number of columns specified in the \texttt{answers}
% environment.
%    \begin{macrocode}
\def\@layoutTabularAns#1{%
    \let\eq@tabSep=\@empty
    \gdef\numShortCols{#1}%
    \ifnum#1>\numCols \xdef\numShortCols{\numCols}\fi
    \@@layoutTabularAns
}
%    \end{macrocode}
% If the next token is \cs{Ans} we grab its all stuff between
% \cs{Ans} and \cs{eAns} and typeset it and insert the appropriate
% token, either \texttt{\&} or \texttt{\string\cr}.
% We continue until the next token is not \cs{Ans}. (This last token
% should be \cs{eChoices}.)
%    \begin{macrocode}
\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}}%
%        \global\eq@tabColCnt=0 \xdef\eq@tabSep{\noexpand\\\@rowsep}%
    \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}}
%</package|eqexam>
%    \end{macrocode}
%    \end{macro}
%\subsection{In Support of showgrayletters}
% This is a hack to reference multiple choice questions when the \texttt{showgrayletters}
% option is in effect. We define \cs{REF} to return the uppercase version of the letters.
%    \begin{macrocode}
\def\aeb@exiii{\expandafter\expandafter\expandafter}
%    \end{macrocode}
%    \begin{macro}{\REF}
% Same syntax as \cs{ref}, including a \texttt{*} option. the \texttt{*} version does
% not create a link. If \texttt{showgrayletters} is not in effect, then \cs{REF} is equivalent to
% \cs{ref}.
%\changes{v6.06c}{2007/04/26}
%{
%   Added \cs{REF} in support of the \texttt{showgrayletters} option.
%}
%    \begin{macrocode}
\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\@firstoffive\csname r@#1\endcsname}%
    \xdef\tmp@expand{\uppercase{\tmp@expand}}\tmp@expand
}
%    \end{macrocode}
%    \end{macro}
%    \section{Objective Style Questions}
% The code for objective style questions is very simple. The
% evaluation of the  user's response is done by JavaScript. The
% JavaScript is inserted into the PDF file through DLJS. For
% authors using \textsf{pdftex} or \textsf{dvipdfm}, this process
% is automatic; for authors using the distiller (hence, would use
% the \texttt{dvips} or \texttt{dvipsone} option), the solution is
% also automatic if you  use \textbf{Acrobat 5.0}. If you do not have
% the latest version  of Acrobat, the DLJS must be inserted
% manually using the \texttt{Document > Insert Pages} menu item. See
% paragraphs below for a little more detail, or see the manual.
%
% There are two kinds of questions that can be posed (actually only one type):
% (1) a question that has a numerical answer;
% (2) a question that has a symbolic answer in one variable,
% $x$. The symbolic answer must reduce, however, to a numerical value when
% $x$ is given a numerical value.  Thus, only questions whose answers can
% be reduced to numerical values can be posed.
%
% If the author has Acrobat 5.0, the \textsf{exerquiz} package should be
% built using the \texttt{Acrobatv} option in the
% \textsf{exerquiz.ins} file. In this case, Document level
% Javascript will be input when the newly distilled file is
% first opened in the Acrobat Viewer. If the function ``CkBalP'' is
% undefined, the we input the FDF file contained the Doc Level JS.
% The file needs to be saved (Save As) for the Doc Level JS to
% remain in the PDF file.
%
% In the case of the author using Acrobat 4.0, he/she needs to load manually
% insert the \texttt{eq\_DLJS.pdf} file. If only exercises are used, this insertion is not needed.
%    \begin{macrocode}
%<*package>
%    \end{macrocode}
%    \begin{macro}{\oQuestion}
% This was my first attempt and I have not deleted it from the package yet.
% Useful for posing a single question only. The argument is the (unique) name
% of this question. This name is used to define the macro \cmd{\oField} which is used
% by support macros.  The \texttt{shortquiz} environment can also be used for
% single/multiple questions as well.
%    \begin{macrocode}
\newenvironment{oQuestion}[1]
{%
    \gdef\oField{#1}\gdef\curr@quiz{#1}\def\currQuiz{#1}%
    \let\@qzsolndest=\@empty
%    \setcounter{questionno}{0}
    \stepcounter{questionno}%
    \let\eqQuizType=s\gdef\eqPTs{1}\global\let\eqQT=\eq@na%
    \let\solution=\solution@sq
    \let\endsolution=\endsolution@sq
}{}
\def\oSolution#1{\edef\@qzsolndest{#1}}
%    \end{macrocode}
%    \end{macro}
%    \subsection{Math Fill-In Questions}
%    \begin{macro}{\RespBox}
%    \begin{macro}{\RespBoxMath}
%    \begin{macro}{\RespBoxNT}
% \cmd{\RespBox} and \cmd{\RespBoxNT} lay out a text box, into which the
% user enters his/her response to the question. \cmd{\RespBox} expects the presence
% of \cmd{\sqTallyBox}, whereas \cmd{\RespBoxNT} does not (NT = No Tally ).
%\par\medskip
% Usage: |\RespBox[#1]#2(#3)[#4]#5#6#7#8[#9]*#10|
% \begin{description}
% \item[\ttfamily\#1 :] Optional parameter used to modify the appearance of the
%     text field.
% \item[\ttfamily\#2 :] The correct answer to the question.
%     This must be a numerical value, or a function of one variable.
%     JavaScript Note:
%     In JavaScript, functions such as \texttt{sin(x)} and \texttt{cos(x)} are
%     methods of the \texttt{Math} object.  It is not necessary, however, to
%     type \texttt{Math.sin(x)} or \texttt{Math.cos(x)}; this is done by inserting
%     the expression into a \texttt{with(Math)} group.
% \item[\ttfamily\#3 :] An optional parameter, \textit{delimited by parentheses},
% that defines the independent variable; \texttt{x}, is the default value. Note
% that this parameter is set off by parentheses.  For a multivariate question, just
% list the variables in juxtaposition, \texttt{(xyz)}.  An alternate method is to
% delimit with commas \texttt{(x,y,n)} and include the type of the variables
% \texttt{(r:x,r:y,i:n)}, where \texttt{"r"} means a real variable and \texttt{"i"}
% means an integer variable.  The variables must be either of the old style (no commas, no typing)
% or the new style. Do  not mix the styles.
% \item[\ttfamily\#4 :] Optional, a named destination to the solution to the
% question. If this parameter appears, then a solution must follow the
% question, enclosed in a \texttt{solution} environment.
% Alternately, the fourth parameter can be a `\texttt*', in which case, we have
% automatic naming of the destination, namely, \texttt{[\string\curr@quiz.\string\thequestionno]}
% \item[\ttfamily\#5 :] The number of samples points to be used, usually $3$ or $4$ is
% sufficient.
% \item[\ttfamily\#6 :] Precision required, the $\epsilon$ value, if you will.
% \item[\ttfamily\#7 :] Parameters \#7 and \#8 are  used to define the interval from
% which to draw the sample points. There are two forms: (1) \#7 is the left-hand endpoint
% of the interval and \#8 is the right-hand endpoint (the use of \#7 and \#8 in this form
% is deprecated); (2) the interval is defined by standard interval notation, \texttt{[a,b]}.
% For a multivariate question---one where parameter \#2 lists more than one variable,
% separate the intervals for each variable by a `x', \texttt{[0,2]x[1,2]x[3,4]}.
% \item[\ttfamily\#8 :] (1) \#8 is the right-hand endpoint of the interval (the use of this
% parameter is deprecated); (2) in the second
% case, \#8 is not used.
% \item[\ttfamily\#9 :] This optional parameter is either the name of a customized
% comparison function \textit{or} a JavaScript object with at most two properties:
% \texttt{priorParse} and \texttt{comp}. See the demo file \texttt{integer\_tst.tex} for
% examples of usage.
% \item[\ttfamily\#10:] (Only detected if following an asterisk, `\texttt*')
% The name of a JavaScript function that is to be used to process the user input.
% \end{description}
% Example:
%\begin{flushleft}\footnotesize
%|\RespBoxMath{<exp(t), 2*t, sin(t)>}(t)[soln]{3}{.0001}{[0,1]}[compare]*{ProcVec}|
%\end{flushleft}
% or (the deprecated form)
%\begin{flushleft}\footnotesize
%|\RespBoxMath{<exp(t), 2*t, sin(t)>}(t)[soln]{3}{.0001}{0}{1}[compare]*{ProcVec}|
%\end{flushleft}
%    \begin{macrocode}
\newcommand\RespBoxNT{\def\rbFlag{0}\@RespBox}
\newcommand\RespBox{\def\rbFlag{0}\@RespBox}
\newcommand\RespBoxMath{\def\rbFlag{0}\@RespBox}
%    \end{macrocode}
% These commands can be used define the default appearance of the \cs{RespBoxMath},
% \cs{RespBoxTxt} et al.  This first set controls all standard text fields.
%    \begin{macrocode}
%    \end{macrocode}
% Get any changes in the appearance of the text box
%    \begin{macrocode}
\begin{defineJS}[\catcode`\@=0\relax]{\AAKqRespBoxMath}
if(event.willCommit){
    RecordPointValue(@eqPTs,@thequestionno@ifx@grpquestions1,@thegrpquestionno,@grpPointValue,@grpTotalWeight,"@grpEvalFunction"@fi);
    RecordProblemType("@eqQT",@thequestionno);
    var retn = @processJSfunc(@rbArgs,@compareJSfunc);
    if (retn != null)
        ProcUserResp(retn,event.value,@thequestionno,0@ifx@grpquestions1,@thegrpquestionno@fi);
}
if (!isQuizInitialized("@currQuiz")) {
    @eqObjAlert@space app.alert(InitMsg("@bqlabelISO"),3);
    event.rc = false;
}
\end{defineJS}
\def\RespBoxMathDefaults
{%
    \BC{0 0 0}\S{N}\F{\FPrint}%
}
\def\moreRespBoxMathDefaults
{%
    \edef\@moreRespBoxMathDefaults{%
        \ifx\eqQuizType q\ifx\eq@online y\ifeq@noquizsolutions\else\noexpand\Ff{\FfReadOnly}\fi\fi\fi
    }%
}
\let\eqFormatArg\@empty
\def\@@RespBoxMathActions
{%
    \AA{\ifx\eqQuizType q%
            \AAKeystroke{\AAKqRespBoxMath}
            \AAFormat{\eqFormatArg}
        \else
            \AAKeystroke{if(event.willCommit) {\r\t
                retn = \processJSfunc(\rbArgs,\compareJSfunc);\r
\if\@sqTurnOffAlerts1
                \t OnBlurRespBox(\if\@sqTurnOffAlerts1retn\else null\fi,"\curr@quiz");\r
\fi
                }%
            }
            \AAFormat{\eqFormatArg}%
            \AAOnFocus{\JS{var retn = null;}}%
% dps 2/12/05 A fix for Acro7.0, a change in the blur event, must move this event to
%             keystroke so behavior is the same as in previous versions.
\if\@sqTurnOffAlerts0
            \AAOnBlur{\JS{OnBlurRespBox(\if\@sqTurnOffAlerts1retn\else null\fi,"\curr@quiz");}}%
\fi
        \fi
    }
}
\newcommand\@RespBox[1][]
{%
    \smallskip\ifx\grpquestions0\addtocounter{eqpointvalue}{\eqPTs}\fi
    \ifx\eqQuizType q%
        \def\rbFlag{1}%
        \ifx\grpquestions1%
            \stepcounter{grpquestionno}%
            \def\Fld@name{grpobj.\curr@quiz.\thequestionno.\thegrpquestionno}%
        \else
            \edef\eqtmp{\aPointType}\xdef\aPointType{\eqtmp,[\eqPTs,"math"]}%
            \stepcounter{questionno}%
            \def\Fld@name{obj.\curr@quiz.\thequestionno}%
        \fi
    \else % shortquiz
        \ifx\grpquestions1%
            \stepcounter{grpquestionno}%
            \def\Fld@name{grpobj.\oField.\thequestionno.\thegrpquestionno}%
        \else
            \stepcounter{questionno}%
            \def\Fld@name{obj.\oField.\thequestionno}%dps change from \oField to obj.\oField
        \fi
    \fi
        \moreRespBoxMathDefaults
        \text@@Field{#1}{\Fld@name}{\RBW}{\DefaultHeightOfWidget}%
        {\eq@protect\AA}{\eq@setWidgetProps\eq@RespBox}%
        {\RespBoxMathDefaults\@moreRespBoxMathDefaults\@@RespBoxMathActions\every@eqTextField
        \every@RespBoxMath}%
}
%\newcommand\@RespBox[1][]
%{%
%    \smallskip\addtocounter{eqpointvalue}{\eqPTs}\refstepcounter{questionno}%
%    \ifx\eqQuizType q\def\Fld@name{obj.\curr@quiz.\thequestionno}%
%    \def\rbFlag{1}\edef\eqtmp{\aPointType}\xdef\aPointType{\eqtmp,[\eqPTs,"math"]}%
%    \else\def\Fld@name{\oField.\thequestionno}\fi\moreRespBoxMathDefaults
%    \text@@Field{#1}{\Fld@name}{\RBW}{\DefaultHeightOfWidget}%
%    {\eq@protect\AA}{\eq@setWidgetProps\eq@RespBox}%
%    {\RespBoxMathDefaults\@moreRespBoxMathDefaults\@@RespBoxMathActions\every@eqTextField
%     \every@RespBoxMath}%
%}
%    \end{macrocode}
% Get the second parameter, which is the correct answer to the question, and
% test to see if there is a specification for the optional third parameter,
% which is the variable list, `\texttt x' is the default.
%    \begin{macrocode}
\def\eq@RespBox#1{\gdef\eq@currentAns{#1}%
    \@ifnextchar({\@eq@RespBox{#1}}{\@eq@RespBox{#1}(x)}}
%    \end{macrocode}
% Pick up the optional third parameter, then test whether the optional fourth parameter is there.
% There are two forms: the [mydest] an explicit destination for the solution to the problem, or
% a `\texttt*', in which case, we have automatic naming, the name is
% \texttt{[\string\curr@quiz.\string\thequestionno]}.
%    \begin{macrocode}
\def\@eq@RespBox#1(#2){\@ifnextchar[{\@eq@RespB@x{#1}(#2)}%
    {\@ifstar{\@eq@RespB@x{#1}(#2)[\curr@quiz.\thequestionno]}%
            {\@eq@RespB@x{#1}(#2)[]}}}
%    \end{macrocode}
% Now get the next three parameters: the number of samples, the precision, and the first of the
% two interval parameters.
%    \begin{macrocode}
\def\eq@Zero{0}
\def\defaultRDPrecision#1{\def\eq@defaultRDPrecision{#1}}
\defaultRDPrecision{1E-14}
%    \end{macrocode}
% dps/change 02/23/07 Here we try to implement a suggest of Bruce Wagner. If the tolerance
% is set to zero, then use \texttt{reldiffCompare} as the default compare, and set the tolerance
% to some small value. Here, the small value is the value of the command
% \cs{eq@defaultRDPrecision} which can be set by \cs{defaultRDPrecision}. The default definition
% is \verb!\defaultRDPrecision{1E-14}!.
%    \begin{macrocode}
\def\@eq@RespB@x#1(#2)[#3]#4#5#6{%
    \xdef\@qzsolndest{#3}\def\indepVar{"#2"}%
    \def\eq@precision{#5}\ifx\eq@precision\eq@Zero
    \def\eq@defaultCompare{reldiffCompare}%
        \def\rbArgstmp{\rbFlag,"#1",#4,\eq@defaultRDPrecision}%
    \else
        \def\eq@defaultCompare{diffCompare}\def\rbArgstmp{\rbFlag,"#1",#4,#5}%
    \fi
%    \end{macrocode}
% We have arrived at the first of possibly two parameters that define the interval(s)
% from which to sample random points. There are two forms, the old style (deprecated)
% and the new style. We must detect which form this is.
%    \begin{macrocode}
    \@checkforInterval#6\\%
}
%    \end{macrocode}
% If the next token is a `\texttt[', then that signals the beginning of an interval
% such as \texttt{[a,b]}, must be the new style. The second parameter is not
% needed, and not expected in this case. It would be a mistake to include it.
%    \begin{macrocode}
\def\@checkforInterval{%
    \@ifnextchar[{\@checkforIntervali}{\@checkforIntervalii}}
%    \end{macrocode}
% This is the case of the new style of defining the interval. We insert it into the
%  arguments list, and continue on to the next stage.
%    \begin{macrocode}
\def\@checkforIntervali#1\\{%
    \def\rbArgs{\rbArgstmp,"#1",\indepVar}%
    \@ifnextchar[{\@eq@@RespBox}{\@eq@@RespBox[\eq@defaultCompare]}%
}
%    \end{macrocode}
% This is assumed to be the old style for defining the interval. In this case, the next
% token is the right-hand endpoint of the interval, we need it.  It would be a mistake
% \texttt{not} to include it. We also test for the presence of the optional
% of a customized comparison function, parameter \texttt{\#9}
%    \begin{macrocode}
\def\@checkforIntervalii#1\\#2{%
    \def\rbArgs{\rbArgstmp,"[#1,#2]",\indepVar}%
    \@ifnextchar[{\@eq@@RespBox}{\@eq@@RespBox[\eq@defaultCompare]}%
}
%    \end{macrocode}
% Finally, we see if there will be a 10th parameter by seeing if `\texttt*' comes
% next. We change the catcodes here, so we can have a left and right brace in the
% optional argument \#9. Hope it works. dps 12/30/03
%    \begin{macrocode}
%\begingroup
%\catcode`\<=1\relax\catcode`\>=2\relax\catcode`\{=12\relax\catcode`\}=12\relax
\def\@eq@@RespBox{\begingroup\catcode`\<=1\relax\catcode`\>=2\relax
    \catcode`\{=12\relax\catcode`\}=12\relax\@eq@@@RespBox}
\def\@eq@@@RespBox[#1]{\endgroup\@ifstar{\jsRespBox[#1]}{\jsRespBox[#1]{ProcResp}}}
%\gdef\@eq@@RespBox<\begingroup\catcode`\<=1\relax\catcode`\>=2\relax\catcode`\{=12\relax\catcode`\}=12\relax
%    \@eq@@@RespBox>
%\gdef\@eq@@@RespBox[#1]<\endgroup\@ifstar<\jsRespBox[#1]><\jsRespBox[#1]<ProcResp>>>
%\def\@eq@@RespBox[#1]{\@ifstar{\jsRespBox[#1]}{\jsRespBox[#1]{ProcResp}}}
%\endgroup
\def\jsRespBox[#1]#2{%
    \def\compareJSfunc{#1}\def\processJSfunc{#2}%
    \ifeq@proofing\makebox[0pt][l]{\space\math@correctAnswer}\fi
    \eq@TextField % send to the driver-dependent macro
}
%    \end{macrocode}
% The primitive \cs{meaning} is used to get a typeset version of the answer for the \texttt{proofing}
% option. I found it a difficult problem because once the answer is scanned, it has catcodes attached.
% Once that is done, it is impossible to use standard methods to make a typeset the answer in
% verbatim mode.  This trick appears in the \TeX book.  \cs{meaning} inserts additional spaces on occasion,
% for example, following a period (`.'). Oh, well.
%    \begin{macrocode}
\def\gobbleMacro#1>{}
\gdef\math@correctAnswer{%
    \ttfamily\color{webgreen}\spaceskip=2pt\xspaceskip=2pt%
    \expandafter\gobbleMacro\meaning\eq@currentAns
}
%    \end{macrocode}
%    \end{macro}
%    \end{macro}
%    \end{macro}
%\subsection{Text Fill-In}
%    \begin{macro}{\RespBoxTxt}
%    \begin{macro}{\RespBoxTxtNT}
% These two macros process open-ended questions that require a text response.
% There are several ways to customize these macros; as described below.
% \par\medskip
% \noindent Usage: |\RespBoxTxt[#1]#2#3[#4]#5<plus listing of alternatives>|
% \begin{description}
% \item[\ttfamily\#1 :] Optional parameter used to modify the appearance of the
%     text field.
% \item[\ttfamily\#2 :] This required parameter is a number that indicates
% the filtering method to be used. Permissible values of this parameter are
% \begin{description}
%     \item[\ttfamily -1: ] (The default) The author's and user's answers are not filtered
%     in any way. (Spaces, case, and punctuation are preserved.)
%     \item[\ttfamily 0: ] The author's and user's answers are converted to
%     lower case, any white space and non-word characters are removed.
%     \item[\ttfamily 1: ] The author's and user's answers are converted to
%     lower case, any white space is removed.
%     \item[\ttfamily 2: ] The author's and user's answers are stripped of any
%     white space.
% \end{description}
% \item[\ttfamily\#3 :] This parameter a number that indicates the compare
% method to be used. Permissible values of this parameter are
% \begin{description}
%     \item[\ttfamily 0: ] (The default) The author's and user's answers are
%     compared for an exact match. (These answers are filtered before they are
%     compared.)
%     \item[\ttfamily 1: ] The user's response is searched in an attempt to
%     get a substring match with the author's alternatives. Additional comparison
%     methods may be added.
% \end{description}
% \item[\ttfamily\#4 :] Optional, a named destination to the solution to the
% question. If this parameter appears, then a solution must follow the
% question, enclosed in a \texttt{solution} environment.
% \item[\ttfamily\#5 :] This required parameter is the number of alternative
% answers that are acceptable. The alternative answers are listed
% immediately after this parameter. (The example above specified
% that $4$ alternatives follow.)
% \end{description}
%    \begin{macrocode}
\newcommand\RespBoxTxtNT{\def\rbFlag{0}\@RespBoxTxt}
\newcommand\RespBoxTxt{\def\rbFlag{0}\@RespBoxTxt}
%    \end{macrocode}
% Pick up any parameters that would modify the appearance of this text field.
%    \begin{macrocode}
\def\RespBoxTxtOnBlur{OnBlurRespBox(\if\@sqTurnOffAlerts1retn\else null\fi,"\curr@quiz");}
\def\eqObjAlert{%
    \ifx\eqQuizType q\ifx\eq@online y\ifeq@noquizsolutions\else if (false)\fi\fi\fi
}
\begin{defineJS}[\catcode`\@=0\relax]{\AAKqRespBoxTxt}
if(event.willCommit){
    RecordPointValue(@eqPTs,@thequestionno@ifx@grpquestions1,@thegrpquestionno,@grpPointValue,@grpTotalWeight,"@grpEvalFunction"@fi);
    RecordProblemType("@eqQT",@thequestionno);
    var retn = ProcRespTxt(@rbTxtAlt);
    if (retn != null)
        ProcUserResp(retn,event.value,@thequestionno,0@ifx@grpquestions1,@thegrpquestionno@fi);
}
if (!isQuizInitialized("@currQuiz")) {
    @eqObjAlert@space app.alert(InitMsg("@bqlabelISO"),3);
    event.rc = false;
}
\end{defineJS}
\def\RespBoxTxtDefaults
{%
    \BC{0 0 0}\W{1}\S{N}\textColor{0 g}\F{\FPrint}%
}
\def\moreRespBoxTxtDefaults
{%
    \edef\@moreRespBoxTxtDefaults{%
        \ifx\eqQuizType q\ifx\eq@online y\ifeq@noquizsolutions\else\noexpand\Ff{\FfReadOnly}\fi\fi\fi
    }%
}
\def\@@RespBoxTxtActions
{%
    \AA{\ifx\eqQuizType q%
            \AAKeystroke{\AAKqRespBoxTxt}
        \else
            \AAKeystroke{%
                if(event.willCommit) {\r\t
                    retn = ProcRespTxt(\rbTxtAlt);\r
\if\@sqTurnOffAlerts1
                \t\RespBoxTxtOnBlur\r
\fi
                }%
            }
            \AAOnFocus{\JS{var retn = null;}}
% dps 2/12/05 A fix for Acro7.0, a change in the blur event, must move this event to
%             keystroke so behavior is the same as in previous versions.
\if\@sqTurnOffAlerts0
            \AAOnBlur{\JS{\RespBoxTxtOnBlur}}%
\fi
        \fi
    }
}
\newcommand\@RespBoxTxt[1][]
{%
    \smallskip\ifx\grpquestions0\addtocounter{eqpointvalue}{\eqPTs}\fi
    \ifx\eqQuizType q%
        \def\rbFlag{1}%
        \ifx\grpquestions1%
            \stepcounter{grpquestionno}%
            \def\Fld@name{grpobj.\curr@quiz.\thequestionno.\thegrpquestionno}%
        \else
            \edef\eqtmp{\aPointType}\xdef\aPointType{\eqtmp,[\eqPTs,"text"]}%
            \stepcounter{questionno}%
            \def\Fld@name{obj.\curr@quiz.\thequestionno}%
        \fi
    \else
        \stepcounter{questionno}%
        \def\Fld@name{obj.\oField.\thequestionno}%%dps change from \oField to obj.\oField
    \fi
    \moreRespBoxTxtDefaults
    \text@@Field{#1}{\Fld@name}{\RBW}{\DefaultHeightOfWidget}%
    {\eq@protect\AA}{\eq@setWidgetProps\@@RespBoxTxt}%
    {\RespBoxTxtDefaults\@moreRespBoxTxtDefaults\@@RespBoxTxtActions\every@eqTextField
     \every@RespBoxTxt}%
}
%\newcommand\@RespBoxTxt[1][]
%{%
%    \smallskip\addtocounter{eqpointvalue}{\eqPTs}\refstepcounter{questionno}%
%    \ifx\eqQuizType q\def\Fld@name{obj.\curr@quiz.\thequestionno}%
%    \def\rbFlag{1}\edef\eqtmp{\aPointType}\xdef\aPointType{\eqtmp,[\eqPTs,"text"]}%
%    \else\def\Fld@name{\oField.\thequestionno}\fi\moreRespBoxTxtDefaults
%    \text@@Field{#1}{\Fld@name}{\RBW}{\DefaultHeightOfWidget}%
%    {\eq@protect\AA}{\eq@setWidgetProps\@@RespBoxTxt}%
%    {\RespBoxTxtDefaults\@moreRespBoxTxtDefaults\@@RespBoxTxtActions\every@eqTextField
%     \every@RespBoxTxt}%
%}
%    \end{macrocode}
% Now get the next two required parameters. Also, see if there is going to be a solution.
% This can be specified in two ways: (1) By inserting an explicit named destination \texttt{[mydest]}
% or (2) by specifying a `\texttt*', in which case, automatic naming is performed. The name is
% \texttt{\string\curr@quiz.\string\thequestionno}, \texttt{[\string\curr@quiz.\string\thequestionno]]} is inserted
% as the parameter.
%    \begin{macrocode}
\def\@@RespBoxTxt#1#2{%
    \@ifnextchar[{\@@@RespBoxTxt{#1}{#2}}
        {\@ifstar{\@@@RespBoxTxt{#1}{#2}[\curr@quiz.\thequestionno]}%
            {\@@@RespBoxTxt{#1}{#2}[]}}}
\def\@@@RespBoxTxt#1#2[#3]#4{%
    \xdef\@qzsolndest{#3}%
    \def\numArgs{#4}% check whether this is a positive integer?
    \begingroup
    \gdef\rbTxtAlt{\rbFlag,#1,#2}%
    \count0 = #4 \ifnum\count0 > 0 \expandafter\@argRead\fi
}
\def\@argRead#1{\edef\jsTemp{\rbTxtAlt}\xdef\rbTxtAlt{\jsTemp,"#1"}%
    \@@argRead}
\def\@@argRead{\advance\count0 by-1\relax
    \ifnum\count0=0\relax\def\next{\endgroup\eq@@RespBoxTxt}%
    \else\def\next{\@argRead}%
    \fi\next
}
\def\eq@@RespBoxTxt{%
    \ifeq@proofing\makebox[0pt][l]{\space\txt@correctAnswer}\fi
    \eq@TextField
}
%    \end{macrocode}
% If the \texttt{proofing} option is specified, then we type out the author's list of
% acceptable answers.  Again, we use \cs{meaning}, probably not needed here.
%    \begin{macrocode}
\def\gobbleTxt#1>#2,#3,#4,{}
\gdef\txt@correctAnswer{\ttfamily\color{webgreen}\spaceskip=2pt
    \xspaceskip=2pt\expandafter\gobbleTxt\meaning\rbTxtAlt
}
%    \end{macrocode}
%    \end{macro}
%    \end{macro}
%\subsection{Essay Fill-In}
%    \begin{macro}{\RespBoxEssay}
% Here is a simple text field with a multi-line attribute for entering
% essay-type questions. This question will not be graded by JavaScript,
% of course; ideally, the response will be submitted to a CGI for storage
% in a database. The instructor can later bring up the student's response
% and assign a grade.
%    \begin{macrocode}
\def\RespBoxEssayDefaults
{%
    \BC{0 0 0}\W{1}\S{N}\Ff{\FfMultiline}\rawPDF{}%
}
\def\@@RespBoxEssayActions
{%
    \AA{\ifx\eqQuizType q%
        \AAKeystroke{%
            if(event.willCommit){\jsR\jsT
            RecordPointValue(\eqPTs,\thequestionno);\jsR\jsT
            RecordProblemType("\eqQT",\thequestionno);\jsR\jsT
            }\jsR
            if (!isQuizInitialized("\curr@quiz")) {\jsR\jsT
                @eqObjAlert\space app.alert(InitMsg("\bqlabelISO"),3);\jsR\jsT
                event.rc = false;\jsR
            }%
        }%
    \fi
    }
}
\newcommand\RespBoxEssay[3][]
{%
    \smallskip\addtocounter{eqpointvalue}{\eqPTs}\stepcounter{questionno}%
    \text@@Field{#1}{essay.\curr@quiz.\thequestionno}{#2}{#3}%
    \edef\eqtmp{\aPointType}\xdef\aPointType{\eqtmp,[\eqPTs,"essay"]}%
    {\eq@protect\AA}{\eq@setWidgetProps\@@RespBoxEssayActions
     \eq@TextField}{\RespBoxEssayDefaults\every@eqTextField}%
}
%    \end{macrocode}
%    \end{macro}
%\subsection{Fields that Support the Fill-Ins}
%    \begin{macro}{\sqTallyBox}
% The \cmd{\sqTallyBox} holds the number of incorrect responses to the
% question. This box is not required to appear. If it does not
% appear, use \cmd{\RespBoxNT} to prevent the doc level JavaScript
% from trying to write a nonexistent text field.
%    \begin{macrocode}
\def\sqTallyBoxDefaults
{%
    \BC{0 0 0}\textColor{1 0 0 rg}\S{I}\Q{2}\Ff{\FfReadOnly}
}
\newcommand\sqTallyBox[1][]
{%
    \text@@Field{#1}{tally.\oField.\thequestionno}%
        {\tally@width}{\DefaultHeightOfWidget}%
        {}{\eq@setWidgetProps\eq@TextField}%
        {\sqTallyBoxDefaults\every@eqTextField\every@sqTallyBox}%
}
%    \end{macrocode}
%    \end{macro}
%    \begin{macro}{\sqTallyTotal}
% This text field stores the tally total. Only used within the
% \texttt{shortquiz} environment. Takes on optional parameter; this
% parameter can be used to modify the appearance of the fields.
%    \begin{macrocode}
\def\sqTallyTotalDefaults
{%
    \rawPDF{}\BC{0 0 0}\S{I}\textColor{1 0 0 rg}%
    \Q{2}\Ff{\FfReadOnly}%
}
\def\@@sqTallyTotalActions
{%
    \AA{%
        \AAKeystroke{AFNumber_Keystroke(0,0,0,0,"",true);}
        \AAFormat{AFNumber_Format(0,0,0,0,"",true);}
        \AACalculate{AFSimple_Calculate("SUM",new Array("tally.\oField"));}
    }
}
\newcommand\sqTallyTotal[1][]
{%
    \text@@Field{#1}{tallytotal.\oField}{\tally@width}{\DefaultHeightOfWidget}%
        {\eq@protect\AA}{\eq@setWidgetProps\eq@calcTextField}%
        {\sqTallyTotalDefaults\@@sqTallyTotalActions\every@eqTextField
         \every@sqTallyTotal}%
}
%    \end{macrocode}
%    \end{macro}
%    \begin{macro}{\CorrAnsButton}
% The \cmd{\CorrAnsButton} is a button macro which, when pressed, will
% display the correct answer for the user. This button is again
% optional. This macro takes one parameter and one optional parameter
%\begin{verbatim}
%#1 : the correct answer as the user should enter it.
%\end{verbatim}
% The value if \texttt{\#1} may be different from the parameter
% \texttt{\#2} in \cmd{\RespBox}; for example, if the answer is
% $x^2$, then \texttt{\#2} of \cmd{\RespBox} would be
% \texttt{pow(x,2)}; but the user would enter |x^2|.
%
% The optional parameter is specified by a star * followed by a
% name of a JavaScript function. The arguments of this JS function
% is the same as that of DisplayAnswer. For example,
%\begin{verbatim}
%\CorrAnsButton{convertFrac('#1','#2')}*{EvalCorrAnsButton}}
%\end{verbatim}
% The JavaScript function might be
%\begin{verbatim}
%function EvalCorrAnsButton(fieldname,theanswer)
%{
%    theanswer = eval(theanswer);
%    DisplayAnswer(fieldname,theanswer);
%}
%\end{verbatim}
% Here, we call a function to evaluate the answer for us.
%    \begin{macrocode}
\def\CorrAnsButtonDefaults
{%
   \CA{\eq@local@CorrAnsButton}\W{1}\S{N}
    \BC{0 0 0}\BG{.7529 .7529 .7529}\H{P}
 }
 \def\qCorrAnsButtonActionHook
 {%
     \JS{%
        \ifx\@qzsolndest\@empty\else
            if (event.shift)\jsR\jsT
                this.gotoNamedDest("\@qzsolndest");\jsR
            else\jsR\jsT
        \fi
        \processJSfunc("Ans.\curr@quiz","\CorrectAns");
     }%
 }
 \def\sqCorrAnsButtonActionHook
 {%
     \JS{%
        \ifx\@qzsolndest\@empty\else
            if (event.shift)\jsR\jsT
            this.gotoNamedDest("\@qzsolndest");\jsR
            else\jsR\jsT
        \fi
        \processJSfunc("obj.\oField.\thequestionno","\CorrectAns");
     }%
 }
\newcommand\CorrAnsButton[1][]
{%
%    \@ifstar{\let\cabStar=y}{\let\cabStar=n}%
    \eq@CorrAnsButton{#1}%
}
\def\eq@CorrAnsButton#1{\@ifstar{\let\cabStar=y\eq@@CorrAnsButton{#1}}%
    {\let\cabStar=n\eq@@CorrAnsButton{#1}}}
\def\eq@@CorrAnsButton#1#2{%
    \@ifstar{\eq@@@CorrAnsButton{#1}{#2}}{\eq@@@CorrAnsButton{#1}{#2}{DisplayAnswer}}%
}
\def\eq@@@CorrAnsButton#1#2#3{%
    \def\CorrectAns{#2}\def\processJSfunc{#3}%
    \ifx\eqQuizType q\def\Fld@name{corr.\curr@quiz.\thequestionno}%
    \else\def\Fld@name{corr.\oField.\thequestionno}\fi
    \ifx\eqQuizType q%
        \edef\@@CorrAnsButtonActions{\noexpand\F{\FHidden}%
            \ifx\@qzsolndest\@empty\noexpand\BC{0 0 0}\else\noexpand\BC{0 .6 0}\fi
            \noexpand\A{\noexpand\qCorrAnsButtonActionHook}}%
        \ifeq@noquizsolutions\else
            \push@@Button{#1}{\Fld@name}{}{\DefaultHeightOfWidget}%
                {\eq@protect\A}{\eq@setButtonProps\eq@Button@driver}%
                {\CorrAnsButtonDefaults\@@CorrAnsButtonActions\every@ButtonField
                \every@CorrAnsButton}%
        \fi
    \else
        \edef\@@CorrAnsButtonActions{%
        \ifx\@qzsolndest\@empty\noexpand\BC{0 0 0}\else\noexpand\BC{0 .6 0}\fi
        \noexpand\A{\noexpand\sqCorrAnsButtonActionHook}}%
        \push@@Button{#1}{\Fld@name}{}{\DefaultHeightOfWidget}%
            {\eq@protect\A}{\eq@setButtonProps\eq@Button@driver}%
            {\CorrAnsButtonDefaults\@@CorrAnsButtonActions\every@ButtonField
            \every@CorrAnsButton}%
    \fi
}
%    \end{macrocode}
%    \end{macro}
%    \begin{macro}{\sqClearButton}
% This button will clear the tallyfields and change the color of
% the \cmd{\RespBox} back to \cmd{\eqDefaultColor}. The button clears the fields
% based on the current value of \cmd{\oField}. This text macro is
% given its value when the optional parameter in the
% \texttt{shortquiz} environment is specified.
%    \begin{macrocode}
\def\sqClearButtonDefaults
{%
    \CA{Clear}\RC{}\AC{}\textColor{0 g}\F{\FPrint}
    \BC{0 0 0}\BG{.7529 .7529 .7529}\W{1}\S{B}\Ff{\FfNoExport}
}
\def\@@sqClearButtonActions
{%
    \A{\JS{ProcessIt = false;\jsR
           this.resetForm(new Array("mc.\oField","obj.\oField","tally.\oField","grpobj.\oField"));\jsR
           var f = this.getField("\oField");\jsR
           if ( f != null ) f.strokeColor=\eqDefaultColor;\jsR
           f = this.getField("grpobj.\oField");\jsR
           if ( f != null ) f.strokeColor=\eqDefaultColor;\jsR
           \oField = new Object;\jsR
           \oField.Grp = {};\jsR
           appAlerts["\oField"] = {bAfterValue: false};\jsR
           ProcessIt=true;}%
    }
}
\newcommand\sqClearButton[1][]
{%
    \push@@Button{#1}{clear.\oField}{}{\DefaultHeightOfWidget}%
        {\eq@protect\A}{\eq@setButtonProps\eq@Button@driver}%
        {\sqClearButtonDefaults\@@sqClearButtonActions\every@ButtonField
         \every@sqClearButton}%
}
%    \end{macrocode}
%    \end{macro}
%    \begin{macro}{\@PromptButton}
% The \cs{@PromptButton} is used to create a ``progressive-style'' question (for math fill-in).
% Some series of questions build on one another. You can use this button to show the solution
% for one problem, so the student can try the next problem. On clicking on the prompt button,
% the student cannot enter another answer in the text field, and the input that is already
% there will be the one that is counted has the student's response.
%    \begin{macrocode}
\def\PromptButtonDefaults
{%
   \CA{Ans}\W{1}\S{N}
    \BC{0 0 0}\BG{.7529 .7529 .7529}\H{P}
}
\newcommand{\promptButtonMsg}{%
    "Would you like to see the correct answer at this time? "\r\t\t
    + "Your current answer will be the one that will be scored. "\r\t\t
    + "If you click on \\"Yes\\", you will not be able to change your answer."
}
\def\PromptButtonActionHook
{%
     \JS{%
        if (!isQuizInitialized("\currQuiz")) {\r\t
            app.alert(InitMsg("\bqlabelISO"),3);\r\t
            event.rc = false;\r
        } else {\r\t
            if ( ! \currQuiz.oAlertCheck.bAfterValue ) {\r\t
                var resp = app.alert({\r\t\t
                    cMsg:\promptButtonMsg,\r\t\t
                    nIcon: 2, nType: 2,\r\t\t
                    cTitle: "AcroTeX Prompt Message",\r\t\t
                    oCheckbox: \currQuiz.oAlertCheck\r\t
                });\r\t
            }\r
            if ( resp == 4 )\r\t
            {\r\t\t
                var field = this.getField("obj.\currQuiz.\thequestionno");\r\t\t
                field.readonly = true;\r\t\t
                this.getField("Ans.\currQuiz").value = "Answer: \PromptAns";\r\t
            }\r
        }
    }%
}
%    \end{macrocode}
% This button takes the standard two arguments
% \begin{flushleft}
% \texttt{\#1}: Optional parameters to change the appearance of the field\\
% \texttt{\#2}: Base name of the current quiz.
% \end{flushleft}
%    \begin{macrocode}
\newcommand\@PromptButton[2][]
{%
    \def\PromptAns{#2}%
    \ifx\eqQuizType q\def\Fld@name{promptButton.\curr@quiz.\thequestionno}%
    \else\def\Fld@name{promptButton.\oField.\thequestionno}\fi
    \ifx\eqQuizType q%
        \edef\@@PromptButtonActions{%
            \noexpand\A{\noexpand\PromptButtonActionHook}}%
            \push@@Button{#1}{\Fld@name}{}{\DefaultHeightOfWidget}%
                {\eq@protect\A}{\eq@setButtonProps\eq@Button@driver}%
                {\PromptButtonDefaults\@@PromptButtonActions\every@ButtonField
                \every@CorrAnsButton}%
        \else \typeout{The \string\PromptButton is for quiz questions only.}
    \fi
}
%    \end{macrocode}
%    \end{macro}
%    \begin{environment}{mathGrp}
% An environment for enclosing a collection of math/text fill-ins that are to be grouped
% together. This grouping should not cross a begin or end of another environment, or include more
% an \cs{item}. This environment has two optional arguments:
%\begin{description}
% \item[\texttt{[\#1]}] : total weight (needed when sum of weight is greater than total number of points
% \item[\texttt{[\#2]}] : evaluation function, a JavaScript function to evaluate the user's responses.
% The default evaluation function is \texttt{groupEval}.
%\end{description}
% The way the parsing of the parameters works out, to specify \texttt{\#1}, you must specify
%\texttt{\#2}.
%    \begin{macrocode}
\let\grpquestions=0
\def\mathGrp{\@ifnextchar[{\@imathGrp}{\@imathGrp[groupEval]}}
\def\@imathGrp[#1]{\def\argi{#1}\@ifnextchar[{\@iimathGrp}{\@iimathGrp[]}}
\def\@iimathGrp[#1]{\def\argii{#1}%
    \global\let\grpquestions=1
    \setcounter{grpquestionno}{0}%
    \stepcounter{questionno}%
    \xdef\beginGrp{\thequestionno}%
    \xdef\grpPointValue{\eqPTs}%
\ifx\eqQuizType q%
    \edef\eqtmp{\aPointType}%
    \xdef\aPointType{\eqtmp,[\eqPTs,"grp"]}%
\fi
    \addtocounter{eqpointvalue}{\eqPTs}%
%    \xdef\grpTotalWeight{#1}%
%    \xdef\grpEvalFunction{#2}%
    \ifx\argii\@empty
        \xdef\grpTotalWeight{\eqPTs}%
        \xdef\grpEvalFunction{\argi}%
    \else
        \xdef\grpTotalWeight{\argi}%
        \xdef\grpEvalFunction{\argii}%
    \fi
}
%\newcommand\objGrp[2][\eqPTs]{%
%    \global\let\grpquestions=1
%    \setcounter{grpquestionno}{0}%
%    \refstepcounter{questionno}%
%    \xdef\grpPointValue{\eqPTs}%
%    \addtocounter{eqpointvalue}{\eqPTs}%
%    \xdef\grpTotalWeight{#1}%
%    \xdef\grpEvalFunction{#2}%
%    \xdef\beginGrp{\thequestionno}%
%}
\def\endmathGrp{\global\let\grpquestions=0\xdef\endGrp{\thequestionno}}
%    \end{macrocode}
%    \end{environment}
%    \begin{macro}{\CorrAnsButtonGrp}
%    \begin{macrocode}
\def\CorrAnsButtonGrpDefaults
{%
   \CA{Ans}\W{1}\S{N}
    \BC{0 0 0}\BG{.7529 .7529 .7529}\H{P}
 }
 \def\CorrAnsButtonGrpActionHook
 {%
     \JS{%
        \ifx\@qzsolndest\@empty\else
            if (event.shift)\jsR\jsT
                this.gotoNamedDest("\@qzsolndest");\jsR
            else\jsR
        \fi
            {\jsR\jsT
                var aCorrectAns = \CorrectAns;\jsR\jsT
                var beginGrp = 1;\jsR\jsT
%                var beginGrp = 1*\beginGrp+1;\jsR\jsT
%                var endGrp = \endGrp;\jsR\jsT
                grpOffset = beginGrp;\jsR\jsT
                if ( typeof \currQuiz == "undefined" ) {\jsR\jsT\jsT
                    \currQuiz = new Object;\jsR\jsT\jsT
                    \currQuiz.Grp = {};\jsR\jsT
                }\jsR\jsT
                if ( typeof \currQuiz.Grp["\thequestionno"] == "undefined" )\jsR\jsT
                {\jsR\jsT\jsT
                    \currQuiz.Grp["\thequestionno"] = {offset: 0};\jsR\jsT\jsT
%                    \currQuiz.Grp["\thegrpquestionno"].offset = 0;\jsR\jsT\jsT
                    var f = this.getField("grpobj.\curr@quiz.\thequestionno." + grpOffset)\jsR\jsT\jsT
%    \end{macrocode}
% When the field is readonly, then we cannot set the focus. We'll remove the readonly, set focus, then
% reset readonly to true again; however, we must wait a little for \texttt{setFocus} to finish.
%    \begin{macrocode}
                    if ( f.readonly ) {\jsR\jsT\jsT
                        f.readonly = false;\jsR\jsT\jsT
                        f.setFocus();\jsR\jsT\jsT
                        eqDelay = app.setTimeOut("f.readonly = true; app.clearTimeOut(eqDelay);",10);\jsR\jsT
                    } else f.setFocus();\jsR\jsT
                }\jsR\jsT
                else \jsR\jsT
                {\jsR\jsT\jsT
                    \currQuiz.Grp["\thequestionno"].offset = ++\currQuiz.Grp["\thequestionno"].offset \% aCorrectAns.length;\jsR\jsT\jsT
                    grpOffset = beginGrp + \currQuiz.Grp["\thequestionno"].offset;\jsR\jsT\jsT
                    var f = this.getField("grpobj.\curr@quiz.\thequestionno."+ grpOffset);\jsR\jsT\jsT
                    if ( f.readonly ) {\jsR\jsT\jsT
                        f.readonly = false;\jsR\jsT\jsT
                        f.setFocus();\jsR\jsT\jsT
                        eqDelay = app.setTimeOut("f.readonly = true; app.clearTimeOut(eqDelay);",10);\jsR\jsT
                    } else f.setFocus();\jsR\jsT
                }\jsR\jsT
\ifx\eqQuizType q%
                DisplayAnswer("Ans.\curr@quiz", aCorrectAns[\currQuiz.Grp["\thequestionno"].offset]);\jsR
\else
                DisplayAnswer("grpobj.\oField.\thequestionno."+ grpOffset, aCorrectAns[\currQuiz.Grp["\thequestionno"].offset]);\jsR
\fi
            }
    }%
 }
\newcommand\CorrAnsButtonGrp[2][]
{%
    \makeStringArray{#2}%
%    \def\CorrectAns{#2}%
    \edef\CorrectAns{\stringArray}%
    \ifx\eqQuizType q\def\Fld@name{corr.\curr@quiz.\thequestionno}%
    \else\def\currQuiz{\oField}\def\Fld@name{corr.\oField.\thequestionno}\fi
    \ifx\eqQuizType q%
        \edef\@@CorrAnsButtonGrpActions{\noexpand\F{\FHidden}%
            \ifx\@qzsolndest\@empty\noexpand\BC{0 0 0}\else\noexpand\BC{0 .6 0}\fi
            \noexpand\A{\noexpand\CorrAnsButtonGrpActionHook}}%
        \ifeq@noquizsolutions\else
            \push@@Button{#1}{\Fld@name}{}{\DefaultHeightOfWidget}%
                {\eq@protect\A}{\eq@setButtonProps\eq@Button@driver}%
                {\CorrAnsButtonGrpDefaults\@@CorrAnsButtonGrpActions\every@ButtonField
                \every@CorrAnsButton}%
        \fi
    \else
        \edef\@@CorrAnsButtonGrpActions{%
            \ifx\@qzsolndest\@empty\noexpand\BC{0 0 0}\else\noexpand\BC{0 .6 0}\fi
            \noexpand\A{\noexpand\CorrAnsButtonGrpActionHook}}%
        \push@@Button{#1}{\Fld@name}{}{\DefaultHeightOfWidget}%
            {\eq@protect\A}{\eq@setButtonProps\eq@Button@driver}%
            {\CorrAnsButtonGrpDefaults\@@CorrAnsButtonGrpActions\every@ButtonField
            \every@CorrAnsButton}%
    \fi
}
\def\makeStringArray#1{\def\stringArray{[}\@makeStringArray#1,\@nil}
\def\@makeStringArray#1,#2\@nil{%
    \edef\eq@temp{\stringArray}%
    \def\argii{#2}%
    \ifx\argii\@empty
        \edef\stringArray{\eq@temp"#1"]}%
        \def\next{}%
    \else
        \edef\stringArray{\eq@temp"#1",}%
        \def\next{\@makeStringArray#2\@nil}%
    \fi
    \next
}
%    \end{macrocode}
%    \end{macro}
%    \section{Input Driver Specific Code}
%
% Here is were we make the redefinitions of the above commands if
% a language option is specified.
%    \begin{macrocode}
\LangRedefinitions
%    \end{macrocode}
% Now bring in driver dependent macros.  The macros defined are
% the answer macros for the \texttt{shortquiz} environment and most all
% for the \texttt{quiz} environment.  These macros make heavy use of
% JavaScript.  The method of introducing these JavaScripts and
% PDF code related elements depends on the driver.
%    \begin{macrocode}
\input{aebjs.def}
%    \end{macrocode}
%    \begin{macrocode}
%</package>
%    \end{macrocode}
%    \section{eForms Support}
%    \begin{macrocode}
%<*package>
%    \end{macrocode}
%    \begin{macro}{\solutionColor}
% This color is introduced at the pdfmark/rawPDF level. Define
% the color without commas. For example |\solutionColor{0 .6 0}|
%    \begin{macrocode}
\newcommand\solutionColor[1]{\def\solution@Color{#1}}
\def\solution@Color{0 .6 0}
%    \end{macrocode}
%    \end{macro}
% \subsubsection{``Every'' Definitions}
%    \begin{macrocode}
\newcommand\everyeqTextField[1]{\def\every@eqTextField{#1}}
\def\every@eqTextField{}
\newcommand\everyRespBoxMath[1]{\def\every@RespBoxMath{#1}}
\def\every@RespBoxMath{}
\newcommand\everyRespBoxTxt[1]{\def\every@RespBoxTxt{#1}}
\def\every@RespBoxTxt{}
\newcommand\everysqTallyBox[1]{\def\every@sqTallyBox{#1}}
\def\every@sqTallyBox{}
\newcommand\everysqTallyTotal[1]{\def\every@sqTallyTotal{#1}}
\def\every@sqTallyTotal{}
\newcommand\everyScoreField[1]{\def\every@ScoreField{#1}}
\def\every@ScoreField{}
\newcommand\everyAnswerField[1]{\def\every@AnswerField{#1}}
\def\every@AnswerField{}
\newcommand\everyPointsField[1]{\def\every@PointsField{#1}}
\def\every@PointsField{}
\newcommand\everyPercentField[1]{\def\every@PercentField{#1}}
\def\every@PercentField{}
\newcommand\everyGradeField[1]{\def\every@GradeField{#1}}
\def\every@GradeField{}
%    \end{macrocode}
%Here is the definition of \cs{AddAAFormat}. This macro can be used
%in \cs{RespBoxMath} to add in formatting of the answer. This macro is
%necessary because the \cs{AA} actions for the \textsf{exerquiz} quiz macros
%are ``protected''; the document author cannot accidently overwrite my
%JavaScript for processing the user's answer.
%\begin{flushleft}
%Example: In the preamble
%\begin{verbatim}
%\begin{defineJS}{\formatAsSet}
%if (event.value.replace(/\\s/g,"") != "")
%    event.value =  "{ " + event.value + " }";
%\end{defineJS}
%\end{verbatim}
%and in the body of a \texttt{quiz} environment,
%\begin{verbatim}
%$x^2 - 3x + 2 = 0$, $S = \RespBoxMath[\AddAAFormat{\formatAsSet}
%    \rectW{.75in}\textSize{0}]{1,2}{1}{.0001}{[0,1]}*{ProcRespSetNum}$
%\end{verbatim}
%\end{flushleft}
%    \begin{macrocode}
\def\@eqAddAAFormat#1{\def\eqFormatArg{#1}}
\def\eq@AddAAFormat{}
%    \end{macrocode}
% Here, you can control the appearance of all the standard checkboxes, also
% effects radio fields of shortquiz and quiz.
%    \begin{macrocode}
\newcommand\everysqRadioButton[1]{\def\every@sqRadioButton{#1}}
\def\every@sqRadioButton{}
\newcommand\everyqRadioButton[1]{\def\every@qRadioButton{#1}}
\def\every@qRadioButton{}
%    \end{macrocode}
% Here, you can control the appearance of all the standard buttons.
%    \begin{macrocode}
\let\everyeqButtonField=\everyButtonField
\newcommand\everyCorrAnsButton[1]{\def\every@CorrAnsButton{#1}}
\def\every@CorrAnsButton{}
\newcommand\everysqClearButton[1]{\def\every@sqClearButton{#1}}
\def\every@sqClearButton{}
\newcommand\everyeqButton[1]{\def\every@eqButton{#1}}
\def\every@eqButton{}
\newcommand\everyBeginQuizButton[1]{\def\every@BeginQuizButton{#1}}
\def\every@BeginQuizButton{}
\newcommand\everyEndQuizButton[1]{\def\every@EndQuizButton{#1}}
\def\every@EndQuizButton{}
% Replace everyeqGenButten with everyPushButton
\let\everyeqGenButton=\everyPushButton
\let\every@eqGenButton=\every@PushButton
\newcommand\everyeqIcon[1]{\def\every@eqIcon{#1}}
\def\every@eqIcon{}
% dps new
\let\eqGenButton = \pushButton
%    \end{macrocode}
%    \begin{macro}{\eqIcon}
% Create a push button for displaying an icon. I've set this on read only, this
%can be removed by saying \verb+\Ff{-\FfReadOnly}+/
%\begin{verbatim}
%#1 = optional, used to enter any modification of the appearance/actions
%#2 = the title of the button field
%#3 = the width of the bounding rectangle
%#4 = the height of the bounding rectangle
%\end{verbatim}%    \begin{macrocode}
\def\eqIconDefaults
{%
    \rawPDF{}\S{}\mkIns{/TP 1}
    \CA{}\RC{}\AC{}\BC{}\BG{}\H{N}
    \textColor{0 g}\Ff{\FfReadOnly}
}
\newcommand\eqIcon[4][]
{%
    \push@@Button{#1}{#2}{#3}{#4}{}{\eq@setButtonProps\eq@Button@driver}%
        {\eqIconDefaults\every@ButtonField\every@eqIcon}%
}
%    \end{macrocode}
%    \end{macro}
%    \begin{macrocode}
%</package>
%    \end{macrocode}
%    \section{Document Level JavaScripts}
% The \texttt{insDLJS} package is used to insert the JavaScript at
% the document level. This package makes all necessary
% driver-dependent conversions, we just write the JavaScript code,
% which is hard enough.
%    \begin{macrocode}
%<*aebjs>
%    \end{macrocode}
%    \begin{macrocode}
\begin{insDLJS*}[exerquizLoaded]{exerquiz}
%    \end{macrocode}
% \subsection{Global Data}
% Global data and some miscellaneous definitions
%    \begin{macrocode}
\begin{newsegment}{AeB: AcroTeX eDucation Bundle}
/*
        Document Level JavaScript
        AcroTeX eDucation Bundle
        D. P. Story copyright 2000-\the\year
*/
var exerquizLoaded = true;
this.disclosed = true;
\end{newsegment}
\begin{newsegment}{Eq: Global Data}
var ok2Continue = true;
%    \end{macrocode}
%The global variable \texttt{ProcessIt} is really used only once. In the
%function \texttt{DisplayAnswer()}. The function is called by the correct
%answer button. It sets \texttt{ProcessIt = false}, then it inserts the correct
%answer into the text field. A \texttt{false} value of \texttt{ProcessIt}
%prevents the \texttt{ProcResp} (and others) from from processing the answer.
%    \begin{macrocode}
var ProcessIt = true;
var retn;
var Score=0;
var ptScore=0;
var pcScore=0;
var quizGrade="C";
var e = Math.E;
var pi = Math.PI;
var aQuizControl = new Array();
var RightWrong=new Array();
var ProbValue = new Array();
var ProbDist = new Array();
var ProbType = new Array();
var Responses=new Array();
var appAlerts = new Object;
%    \end{macrocode}
% JSf is an array of supported mathematical functions.
%\changes{v6.06}{2007/02/23}
%{
% Separated the \texttt{JSf} array into \texttt{JSfBuiltIn} and \texttt{JSfCustom}. This
% allows us to identify the built-in JavaScript functions. I concatenate these two
% into \texttt{JSf}.
%}
%    \begin{macrocode}
var JSfBuiltIn = new Array
    ( "abs","acos","asin","atan","ceil","cos","exp",
      "log","max","min","pow","random","round","sin",
      "sqrt","tan");
var JSfCustom = new Array
    ( "arctan", "logc", "arcsin", "arccos", "ln","sec",
      "csc","cot","C","P","fact","pi");
var JSf = new Array();
JSf = JSf.concat(JSfBuiltIn, JSfCustom);
%var JSf = new Array
%    ( "abs","acos","asin","atan","ceil","cos","exp",
%      "log","max","min","pow","random","round","sin", "arctan", "logc",
%      "arcsin", "arccos", "sqrt","tan","ln","sec","csc","cot","C","P","fact","pi"
%    );
var JSc = new Array("PI","E")
%    \end{macrocode}
% Additional functions that I've defined.
%    \begin{macrocode}
function ln(x) { return Math.log(x); }
function sec(x) { return 1/Math.cos(x); }
function csc(x) { return 1/Math.sin(x);}
function cot(x) { return Math.cos(x)/Math.sin(x); }
function arctan(x) { return Math.atan(x); }
function arcsin(x) { return Math.asin(x); }
function arccos(x) { return Math.acos(x); }
function logc(x) { return Math.LOG10E * Math.log(x); }
function C(x,y) {return ch(x,y);}
function P(x,y) {return perm(x,y);}
%    \end{macrocode}
% The aGroup array lists left and right grouping delimiters. This array is
% used by ParseInput() to call CkBalP().
%    \begin{macrocode}
var aGroup = new Array
    ( ["\(","\)",\eqParens],
      ["[","]",\eqBrackets],
      ["{","}",\eqBraces]
    );
\end{newsegment}
%    \end{macrocode}
% \subsection{Math Fill-in}
% This section of the code is primarily dedicated to processing the math fill-in questions.
%    \begin{macrocode}
\begin{newsegment}{Eq: Support for Math Fill-in}
%    \end{macrocode}
% Description: Checks for balanced grouping delimiters.
% Arguments:
%   UserInput: A string
%   lDelimiter: left delimiter
%   rDelimiter: right delimiter
% Returns: true (if balanced); false (if not)
%    \begin{macrocode}
function CkBalP(UserInput,lDelimiter,rDelimiter)
{
    var Lcount=0, Rcount=0;
    for (var k=0; k < UserInput.length; k++)
    {
        if (UserInput.charAt(k) == lDelimiter) Lcount++;
        else if (UserInput.charAt(k) == rDelimiter) Rcount++;
    }
    return (Lcount==Rcount);
}
%    \end{macrocode}
% Description: This function simply determines if there are an even number of
% `\verb+|+' chars.  Used for parsing absolute value.
% \verb=| x+2 | --> abs(x+2)=.
% Arguments:
%   UserInput: a string
%   Returns: true (if even); false (if odd)
%    \begin{macrocode}
function CkBalVert(UserInput)
{
    var Lcount=0;
    for (var k=0; k < UserInput.length; k++)
        if (UserInput.charAt(k)=="|") Lcount++;
    return (Lcount \% 2 == 0);
}
%    \end{macrocode}
% Description: This function searches for alpha words and matches them against supported
% mathematical functions.
% Arguments:
%   UserInput: a string
%   Returns: 1 (if there is a match); 0 (if no match)
%       also sets the global variable ok2Continue to false.
%    \begin{macrocode}
function Ckfuncs(UserInput)
{
    var re, regexp;
    re = /[a-zA-Z]{2,}/g;
    aF = UserInput.match(re);
    if (  aF == null ) return true;
    for (var i=0; i < aF.length; i++)
    {
        for(var j=0; j < JSf.length; j++)
            if ( aF[i].indexOf(JSf[j]) != -1 ) break;
        if (j < JSf.length) continue;
        for(var j=0; j < JSc.length; j++)
            if ( aF[i].indexOf(JSc[j]) != -1 ) break;
        if(j==JSc.length)
        {
            app.alert(\eqerrBadMathFunc,3);
            return false;
        }
    }
    return true;
}
%    \end{macrocode}
% This function displays the answer.
%    \begin{macrocode}
function DisplayAnswer(fieldname,theanswer)
{
    ProcessIt = false;
    try {
    this.getField(fieldname).value=(theanswer);
    this.getField(fieldname).strokeColor=\eqDefaultColor;
    } catch(e) {}
%    event.rc=false;
    ProcessIt = true;
}
%    \end{macrocode}
% Finds and returns the position of the matching parentheses.
%    \begin{macrocode}
function FindBalP(UserInput,Poff,Forward)
{
    var depth;
    if (Forward)
    {
        for (depth=-1, j=Poff+1; depth !=0; j++)
        {
            if (UserInput.charAt(j)=="\(") depth--;
            else if (UserInput.charAt(j)=="\)") depth++;
        }
        j--
    }
    else
    {
        for (depth=-1, j=Poff-1; depth !=0; j--)
        {
            if (UserInput.charAt(j)=="\)") depth--;
            else if (UserInput.charAt(j)=="\(") depth++;
        }
        j++
    }
    return j;
}
%    \end{macrocode}
% This is the tricky one. First get rid of all whitespace. Then
% check for balanced parentheses followed by checking for known
% or unknown math functions.
%
% The power function is \texttt{pow}; thus, |x^2| is pow(x,2). Rather than
% make students write pow(x,2) we try to code things so they can enter
% |x^2| instead, much easier for them.  Now we must scan through for different
% patterns. The patterns are: |x^n|, |(expr)^n|, |x^(expr)| and |(expr1)^(expr1)|. We
% search through looking for these patterns and replace them appropriately:
% |pow(x,n)|, |pow(expr,n)|, |pow(x,expr)| and |pow (expr1,expr2)|. To do this, we
% must find balanced parentheses.
%
%    \begin{macrocode}
function stripWhiteSpace (UserInput)
{
    UserInput = UserInput.replace(/\s/g,"");
    if(UserInput==null || UserInput.length==0)
    {
        ok2Continue = false;
        return false;
    } else return UserInput;
}
%    \end{macrocode}
% This function takes its argument, and adds in the suffix of \texttt{Math.}
% in front of every recognizable JS built-in functions.
%    \begin{macrocode}
function addMathObject(UserInput)
{
    for ( var i=0; i < JSfBuiltIn.length; i++) {
        var re = new RegExp("\\b("+JSfBuiltIn[i]+")\\b","g");
        UserInput = UserInput.replace(re,"Math.$1");
    }
    re = /\b(PI)\b/g;
    UserInput = UserInput.replace(re,"Math.$1");
    return UserInput;
}
%    \end{macrocode}
% This is the very heart of parsing the user's input.  This function takes the
% \texttt{UserInput} and works it over and places it in a proper JavaScript expression
% for the JavaScript interpreter to evaluate.
%
% For those who have Acrobat 5.0, you can call this function from the console, something
% I do quite a lot when developing new scripts. From the console, enter, for example,
% \verb+ParseInput("xycos(xy^3)")+, and the return value of this function will be
% displayed in the console.  An author can check the syntax of his/her answer.
%    \begin{macrocode}
function ParseInput(UserInput)
{
    var re;
    UserInput = stripWhiteSpace (UserInput);
    if (!ok2Continue) return null;
%    \end{macrocode}
% See if there are matching `\texttt{[]}', `\texttt{\{\}}' and `\texttt{()}'.
%    \begin{macrocode}
    for(var i=0; i< aGroup.length; i++)
    {
        if(!CkBalP(UserInput, aGroup[i][0], aGroup[i][1]))
        {
            app.alert(\eqerrDelimNotBal,3);
            ok2Continue = false;
            return false;
        }
    }
%    \end{macrocode}
% Replace `\texttt{[]}' and `\texttt{\{\}}' with `\texttt{()}'; only parentheses
% are used in JavaScript for grouping.
%    \begin{macrocode}
    UserInput = UserInput.replace(/\[|\{/g, "\(");
    UserInput = UserInput.replace(/\]|\}/g, "\)");
%    \end{macrocode}
% Check to see if there are an even number of absolute value symbols, `\verb+|+'.
%    \begin{macrocode}
    if (!CkBalVert(UserInput))
    {
        app.alert(\eqerrABS,3);
        ok2Continue = false;
        return false;
    }
%    \end{macrocode}
% Now try to insert the multiplication operator where applicable.
%    \begin{macrocode}
    if (typeof(Ck4Exponents) == "undefined") if(!Ckfuncs(UserInput)) return false;
    if (typeof(Ck4Exponents) != "undefined") UserInput = Ck4Exponents(UserInput);
    if (typeof(Ck4Products) != "undefined" ) UserInput = Ck4Products(UserInput);
    ok2Continue = true;
%    \end{macrocode}
% Convert any occurrence of log to log10 (known internally as logc). We are now (12/22/06) going to use log for
% common log even though log in JS is natural log. This may break a few things.
% \changes{v6.05f}{2006/12/22 }
% {
%   Added support for common logarithms.  log is now common logs, and ln is
%   natural logs.
% }
%    \begin{macrocode}
    re = /\b(log)\b/g;
    UserInput = UserInput.replace(re, "logc");
%    \end{macrocode}
% Search for occurrences of \verb!|<exp>|! and replace with \texttt{abs(<exp>)}.
%    \begin{macrocode}
    while (/\|/.test(UserInput)&&(ok2Continue))
    {
        re = /(\|)([^\|]*)(\|)([-\+\/\*\^\)\|])/;
        if (re.test(UserInput))
            if (re.exec(UserInput)[4] == '^')
                UserInput = UserInput.replace(re, "(abs($2))$4");
            else
                UserInput = UserInput.replace(re, "abs($2)$4");
        else
        {
            re = /(\|)([^\|]*)(\|$)/;
            if (re.test(UserInput))
                UserInput = UserInput.replace(re, "abs($2)");
        }
    }
    while (/\^/.test(UserInput)&&(ok2Continue))
    {
        if (/\)\^\(/.test(UserInput))
        {
            aP = /\)\^\(/.exec(UserInput);
            LeftP=FindBalP(UserInput,aP.index,0); // backward search
            RightP=FindBalP(UserInput,aP.index+2,1); // forward search
            re = new RegExp("\\((.{"+eval(aP.index-LeftP-1)+"})\\)\\^\\((.{"+eval(RightP-aP.index-3)+"})\\)");
            if (re.test(UserInput)) UserInput=UserInput.replace(re,"pow($1,$2)");
            else ok2Continue=false;
        }
        else if (/\)\^/.test(UserInput))
        {
            aP =/\)\^/.exec(UserInput);
            LeftP=FindBalP(UserInput,aP.index,0); // backward search
            re = new RegExp("\\((.{"+eval(aP.index-LeftP-1)+"})\\)\\^([a-zA-Z]|[\+-]?\\d+\\.?\\d*|[\+-]?\\d*\\.?\\d+)");
            if (re.test(UserInput)) UserInput=UserInput.replace(re,"pow($1,$2)");
            else ok2Continue=false;
        }
        else if (/\^\(/.test(UserInput))
        {
            aP = /\^\(/.exec(UserInput);
            RightP=FindBalP(UserInput,aP.index+1,1); // forward search
            re = new RegExp("([a-zA-Z]|\\d*\\.?\\d*)\\^\\((.{"+eval(RightP-aP.index-2)+"})\\)");
            if (re.test(UserInput)) UserInput=UserInput.replace(re,"pow($1,$2)");
            else ok2Continue=false;
        }
        else if (/\^/.test(UserInput))
        {
            re=/([a-zA-Z]|\d*\.?\d*)\^([a-zA-Z]|[\+-]?\d+\.?\d*|[\+-]?\d*\.?\d+)/;
            if (re.test(UserInput)) UserInput=UserInput.replace(re,"pow($1,$2)");
            else ok2Continue=false;
        }
    }
    if (!ok2Continue)
    {
        app.alert(\eqerrBadExp,3);
\db     console.println("Bad UserInput: " + UserInput);\db%
        return false;
    }
    else {
%    \end{macrocode}
%\changes{v6.06}{2007/02/23}
%{
% Now, just before we return the parsed expression, we append all built-in
% JavaScript functions and constants with \texttt{Math.}, this is to avoid
% having to use the \texttt{with(Math)} construct. These changes are in support
% of using scientific notation.
%}
%    \begin{macrocode}
        UserInput=addMathObject(UserInput);
        return UserInput;
    }
}
%    \end{macrocode}
% Process the user's response.  Here, we randomly choose, $n$,
% points from the selected interval $[a,b]$. The correct answer (as
% supplied by the author of the document and the answer provided by
% the user are evaluated at each of the $n$ points. If any of the
% evaluations differs by more than \texttt{epsilon}, the answer is
% considered wrong.
%
% The idea for evaluating user input in this way comes from  Drs.\
% Wlodzimierz Bryc and Stephan Pelikan of The University of
% Cincinnati.  These two have developed an \texttt{html} based
% \textbf{Online Exercise System} which can  evaluate objective
% type questions. This evaluation, however, takes place on the
% \emph{server-side}. This implementation is on \emph{the client-side}.
%
%    \begin{macro}{TypeParameters}
% is either a comma delimited list of variables "x,y,z" or just a list "xyz"
% this function types each untyped variable that is not typed. Currently, there
% are only two data types: "r" and "i".  "r:x" means "x" is a real variable,
% "i:x" means "x" is an integer varaible.
%    \begin{macrocode}
function TypeParameters(v)
{
    var aV;
%    \end{macrocode}
% If \texttt{v} has a colon in it, we take that as a signal that the variables are comma
% delimited.
%    \begin{macrocode}
    aV = ( (v.indexOf(":") == -1) && (v.indexOf(",") == -1) ) ? v.split("") : v.split(",");
    for ( var i=0; i < aV.length; i++)
        if ( aV[i].indexOf(":") == -1 )
            aV[i] = "r:"+aV[i];
    return aV.join(",")
}
%    \end{macro}
%    \begin{macro}{ProcResp}
% This function handles numerical answers or function of a single variable, x,
% that evaluate to a number.
function ProcResp(flag,CorrAns,n,epsilon,a,indepVar,oComp)
{
    if (!ProcessIt) return null;
    var fieldname = event.target.name;
    var UserAns = event.value;
    var success = _ProcResp(flag,CorrAns,UserAns,n,epsilon,a,indepVar,oComp);
    if ( success == -1 ) return null;
    if ( success == null ) { return syntaxError(), null; }
    return notifyField(success, flag, fieldname);
}
function _ProcResp(flag,CorrAns,UserAns,n,epsilon,a,indepVar,oComp) // changed name of var comp -> oComp
{
    ok2Continue = true;
%    \end{macrocode}
% Implement an "undefined" answer. Due to Ross-Griffin. This can be accomplished
% by preprocessing.
%    \begin{macrocode}
%    if (UserAns == "undefined") {
%        success = (CorrAns == UserAns);
%        return notifyField(success, flag, fieldname);
%    }
    CorrAns = ParseInput(CorrAns);
\db console.println("ParseInput: CorrAns = " + CorrAns);\db%
    if (!ok2Continue) {
        app.alert("Syntax error in author's answer! Check console.", 3);
\db     console.println("Syntax Error: " + CorrAns);\db%
        return null;
    }
%    \end{macrocode}
% If \texttt{oComp} is an object, then see if it has a \texttt{comp} property
%    \begin{macrocode}
    var comp = ( typeof oComp == "object" ) ?
       (typeof oComp.comp == "undefined" ) ? diffCompare : oComp.comp : oComp;
%    \end{macrocode}
% The \texttt{comp} parameter, which has been changed to \texttt{oComp} can now be
% an object. One property of this object is \texttt{comp}, handled above. Another
% property is \texttt{priorParse}, this is a function that returns \texttt{null}
% or \texttt{true}. This \texttt{priorParse} function allows for additional
% filtering of the \texttt{UserAns} before parsing. If it returns \texttt{true},
% we are ok to continue, if \texttt{null}, we don't like something the user has entered,
% and ask him/her to change it.
%    \begin{macrocode}
    if ( typeof oComp == "object" && typeof oComp.priorParse != "undefined" )
    {
%    \end{macrocode}
% Let's go ahead and allow \texttt{oComp.priorParse} be an array of functions.
%    \begin{macrocode}
        if ( typeof oComp.priorParse == "object" )
        {
            for ( var i=0; i < oComp.priorParse.length; i++)
            {
                var retn = oComp.priorParse[i](UserAns);
                if ( retn == null ) return -1; // -1 signals an alert has already been made, silent from here
            }
        } else {
            var retn = oComp.priorParse(UserAns);
            if ( retn == null ) return -1;
        }
    }
    UserAns = ParseInput(UserAns);
%    \end{macrocode}
% Originally, the value of \texttt{indepVar} is a string of variables "xyz". You can
% now have variables of the form "r:x,i:n,r:y". Where the identifier "r:" indicates a
% real variable and "i:" indicates an integer variable. \texttt{indepVar} must be either
% of the old style, or the new style, not a mixture of both, e.g. "xyi:n".
%    \begin{macrocode}
    indepVar = TypeParameters(indepVar);
    if (!ok2Continue) return null;
    var success=randomPointCompare (n,a,indepVar,epsilon,CorrAns,UserAns,comp);
    return success;
}
%    \end{macrocode}
%    \end{macro}
% This function randomly selects points from the interval [a,b]
% and calls the 'comp' function to compare results.
% Returns: null if the expression is bad, no penalty.
%          true if the error of the random comparison is less than epsilon
%          false if the error of the random comparison is greater than epsilon
%    \begin{macrocode}
function randomPointCompare (n,a,indepVar,epsilon,CorrAns,userAns,comp)
{
    var error, i, j, k;
    var aXY = new Array();
    a = a.replace(/[\[\]\s]/g, "");
    var aIntervals = a.split("&");
    for (k=0; k < aIntervals.length; k++)
    {
        var aInterval = aIntervals[k].split("x");
        nI = aInterval.length;
%        var nV = indepVar.length;
        with (Math) {
            for (j=0; j < n; j++)
            {
                for (i=0; i < nI; i++)
                {
                    var endpoints = aInterval[i].split(",");
                    aXY[i] = eval(endpoints[0])-0+(eval(endpoints[1])-eval(endpoints[0]))*random();
                }
                var cXY = aXY.toString();
                error = comp(a,cXY,indepVar,CorrAns,userAns);
                if (error == null) return null;
                if ( (error == -1) || (error > epsilon) ) {j=-1; break;}
            }
        }
        if (j!=n) return false;
    }
    return true;
}
%    \end{macrocode}
% \texttt{diffCompare}: A simple comparison function, we evaluate the two input function `\texttt{\_F}'
% and `\texttt{\_G}' and the point `\texttt{\_c}' and return the absolute difference.
%
% Returns: Absolute difference between `\texttt{\_F}' and `\texttt{\_G}'
%          null if expression was not valid
%          -1 if expression is not a number
%    \begin{macrocode}
function diffCompare(_a,_c,_v,_F,_G) {
    var aXY = _c.split(",");
    var _V = _v.split(",");  // e.g. _V[0] = "i:x"
    var _n = aXY.length;
%    with(Math) { // dps/change 02/23/07
%    \end{macrocode}
% For each of the independent variables, we set them equal to a randomly chosen value
% from the specified interval.
%    \begin{macrocode}
    for (var _i=0; _i < _n; _i++)
    {
%            var nTyped = _v.match(/(.?:.?)/g);
%            var nV = indepVar.length - 2*nTyped;
            if (_V[_i].charAt(0) == "r" )
                eval ( "var "+ _V[_i].charAt(2) + " = " + aXY[_i] + ";");
%                eval ( "var "+_v[i] + " = " + aXY[i] + ";");
            else // assume type "i"
                eval ( "var "+ _V[_i].charAt(2) + " = " + ceil(aXY[_i]) + ";");
    }
%    \end{macrocode}
% The \texttt{\_F} is the author's answer, we assume this is  well formed JavaScript
% and do not test it for possible errors. The author can correct before s/he distributes
% the document.
%    \begin{macrocode}
    _F = eval(_F);
%    \end{macrocode}
% Now we try to protect our code from bad input. We use \texttt{try/catch} to try and
% thrown exceptions. However, \texttt{try/catch} is not valid in any version of the
% Acrobat Reader prior to version 5.
%    \begin{macrocode}
    if ( app.viewerVersion >= 5)
    {
%    \end{macrocode}
% This code, which uses \texttt{eval()} and \texttt{try/catch} is an attempt to write
% code that both works for Acro5 (or higher) and Acro4.05/4.0.  In Acro4.x, \texttt{try/catch}
% are reserved words, so we can't use them even in a conditional. However, within a string
% the JavaScript interpreter does not see them. The other complication is that Acro5 objects
% to having a \texttt{return} within an \texttt{eval()}, so we work around that with a
% \texttt{rtnCode}. The returns are executed outside the \texttt{eval()}.
%    \begin{macrocode}
        var rtnCode = 0;
        eval("try { if(isNaN(_G = eval(_G))) rtnCode=-1; } catch (e) { rtnCode=1; }");
        switch(rtnCode)
        {
            case  0: break;
            case  1: return null;
            case -1: return -1;
        }
    }
    else
%    \end{macrocode}
% For Acro4/4.05, all we can do is detect whether \texttt{\_G} is a number or not. If the user
% enters an undefined symbol, for example, we cannot catch this as we can with Acro5. Oh, well.
%    \begin{macrocode}
        if(isNaN(_G = eval(_G))) return -1;
%    \end{macrocode}
%
% The function \texttt{G} is the user's input expression. There may be syntax errors
% that prevent the successful numerical evaluation of the expression. We try to
% prevent problems.
%
% If the user enters a function such as \texttt{sqrt( 1 - x )}, and this function is
% evaluated at a x = 2, for example, we are outside the domain of the function. The \texttt{isNaN}
% function will catch this type of error.  A return of \texttt{-1} signals an error
% at this of this type. This is considered to be an error by the user, and will be scored as an
% incorrect answer.
%
% The error described above does not throw an exception. What will throw an exception
% is if the users function has some undefined variables in it. For example, suppose
% we are expecting a response that is a function of \texttt{x} and the user enters a
% function of \texttt{t} instead. This will throw an exception as \texttt{t} is undefined.
% In this case, we do not treat this as an error, and expect the user to correct the
% input. This kind of error is signaled by returning a \texttt{null}.
%
%    \begin{macrocode}
    return Math.abs ( _F - _G );
%    }  // dps/change 02/23/07
}
%    \end{macrocode}
% This function is the same as above, but returns the relative absolute error.
%    \begin{macrocode}
function reldiffCompare(_a,_c,_v,_F,_G) {
    var aXY = _c.split(",");
    var n = aXY.length
%    with(Math) { // dps/change 02/23/07
    for (var i=0; i< n; i++)
            eval ( "var "+_v[i] + " = " + aXY[i] + ";");
    _F = eval(_F);
    if ( app.viewerVersion >= 5)
    {
        var rtnCode = 0;
        eval("try { if(isNaN(_G = eval(_G))) rtnCode=-1; } catch (e) { rtnCode=1; }");
        switch(rtnCode)
        {
            case  0: break;
            case  1: return null;
            case -1: return -1;
        }
    }
    else
        if(isNaN(_G = eval(_G))) return -1;

    return Math.abs ( (_F - _G)/_G );
%    } // dps/change 02/23/07
}
\end{newsegment}
%    \end{macrocode}
% \subsection{Text Fill-in}
% Now the JS functions that process text fill-in questions.
%    \begin{macrocode}
\begin{newsegment}{Eq: Support Text Fill-in}
%    \end{macrocode}
% This function processes fill-in problems that require only a text
% response. It takes a variable number of arguments, which are retrieved
% using the arguments[] array
%    \begin{macrocode}
function ProcRespTxt() {
    var i, success, authorAnswer, userAnswer = event.value;
    var fieldname=event.target.name;
    var flag = arguments[0];
    var filterMethod = arguments[1];
    var compareMethod = arguments[2];
    if ( !ProcessIt || userAnswer == "" ) return null;
    for (i = 3; i < arguments.length; i++)
        if ( (success = compareTxt(userAnswer, arguments[i], filterMethod, compareMethod)) == true) break;
    return notifyField(success, flag, fieldname);
}
%    \end{macrocode}
% \texttt{compareTxt} actually compares the \texttt{userAnswer} with the \texttt{authorAnswer}.
% there are options for various types of comparisons.
% Returns true or false.
%    \begin{macrocode}
function compareTxt(userAnswer, authorAnswer, filterMethod, compareMethod)
{
    userAnswer = new String(userAnswer).filter(filterMethod)
    switch(compareMethod) {
        case 1:
            var AuthorAnswer;
            var aAuthorAnswer = authorAnswer.split(/\s+/);
            for (var j=0; j < aAuthorAnswer.length; j++) {
                AuthorAnswer = new String(aAuthorAnswer[j]).filter(filterMethod);
                AuthorAnswer = AuthorAnswer.replace(/\./g, "\\.");
                var re = new RegExp(AuthorAnswer, "g");
                if (!re.test(userAnswer)) return false;
            }
            return true;
        default:
            authorAnswer = new String(authorAnswer).filter(filterMethod)
            return (userAnswer == authorAnswer) ? true : false;
    }
}
%    \end{macrocode}
% Various string prototypes. This function is called by compareTxt.
% The function returns the 'filtered' string.
%    \begin{macrocode}
String.prototype.filter = eqFilter;
function eqFilter(filterMethod) {
    switch (filterMethod) {
        case 0:
            var re = /\W/g;
            return this.replace(re,"").toLowerCase();
        case 1:
            var re = /\s/g;
            return this.replace(re,"").toLowerCase();
        case 2:
            var re = /\s/g;
            return this.replace(re,"");
        default:
            return this;
    }
}
\end{newsegment}
%    \end{macrocode}
% \subsection{Multiple Choice Questions}
% These are the routines for processing multiple choice questions.
%    \begin{macrocode}
\begin{newsegment}{Eq: Quiz Management}
function InitMsg(msg) { return (\eqInitQuizMsg) }
function syntaxError() { app.alert(\eqSyntaxErrorUndefVar,3); }
%    \end{macrocode}
% There are four required parameters, if there is a fifth, that means
% we have a grouped question, parameter 5 will be the group sub-problem number.
%    \begin{macrocode}
function ProcUserResp(key,userresp,probno,notify)
{
    if ( arguments.length > 4 ) {
        if ( typeof RightWrong[probno] == "undefined" ) {
            RightWrong[probno] = new Array();
            Responses[probno] = new Array();
        }
        RightWrong[probno][arguments[4]] = (!!key) ? 1 : 0;
        Responses[probno][arguments[4]] = userresp;
    } else {
        RightWrong[probno] = (!!key) ? 1 : 0;
        Responses[probno] = userresp;
    }
}
function InitializeQuiz(qtfield,mark)
{
    Score=0;
    retn = null;
    if (!isQuizInitialized(qtfield)&&!isAQuizUnfinished()) return null;
    neutralizeQuizzes();
    ProcessIt = false;
    aQuizControl[qtfield] = 1;
    this.resetForm(["ScoreField." + qtfield,"mc."+qtfield,"obj."+qtfield,
        "Ans."+qtfield,"PointsField."+qtfield,"PercentField."+qtfield,
        "essay."+qtfield,"GradeField."+qtfield, "grpobj."+qtfield,"qMark"]);
    ProcessIt = true;
    var f = this.getField("qMark");
    if ( f != null ) f.display = display.hidden;
    f = this.getField("obj." + qtfield);
    if ( f != null ) f.readonly = false;
    RightWrong=new Array();
    Responses=new Array();
    ProbValue=new Array();
    ProbDist=new Array();
    ProbType=new Array();
    if (mark==1)
    {
        var f = this.getField("mcq." + qtfield);
        if (f != null) {
            f.delay=true;
            f.display=display.hidden;
            this.resetForm([f.name]);
            if (typeof app.formsVersion != "undefined" && app.formsVersion >=4.0)
                f.textColor = \correctColor;
            else
                f.fgColor = \correctColor;
            var a = f.getArray();
            for (var i=0; i<a.length; i++) a[i].style=style.ci;
            f.delay=false;
        }
        f = this.getField("obj." + qtfield);
        if ( f != null )
            f.strokeColor = \eqDefaultColor;
        f = this.getField("grpobj." + qtfield);
        if ( f != null )
            f.strokeColor = \eqDefaultColor;
        f = this.getField("corr." + qtfield);
        if ( f != null )
            f.display = display.hidden;
    }
    return null;
}
function neutralizeQuizzes()
{
    for ( var qtfield in aQuizControl ) aQuizControl[qtfield] = 0;
}
function isAQuizUnfinished()
{
    for ( var qtfield in aQuizControl )
        if ( aQuizControl[qtfield] == 1 )
        {
            app.alert(\eqerrUnfinishQuiz, 3);
            return false;
        }
    return true;
}
function isQuizInitialized(qtfield)
{
    if (typeof (aQuizControl[qtfield]) == "undefined")
    {
%    \end{macrocode}
%There is one complication.  In the Acrobat/Reader 4.05 versions,
%when the document is first opened, (almost) all format script is
%read and executed. As a result, when the doc is first opened, this
%function is called, and would normally return a 'false' which causes an alert box to
%appear stating that the user must initiate the quiz. The
%work around for this is to test whether we are in that situation,
%and if yes, return true (but only if the aQuizControl array has
%not been modified).  We manually modify the array (so the code below is
%not a factor again), and return true.
%    \begin{macrocode}
        if ( (app.viewerVersion < 5 )&& (app.viewerVersion > 4) && (aQuizControl.length == 0) )
        {
            aQuizControl[0] = -1;
            return true;
        }
        return false;
    }
    else
        return (aQuizControl[qtfield] == 1);
}
% old version of isQuizInitialized() before fix to Reader 4.05 problem
%function isQuizInitialized(qtfield)
%{
%    if (typeof (aQuizControl[qtfield]) == "undefined")
%        return false;
%    else
%        return (aQuizControl[qtfield] == 1);
%}
function isEndQuizPushed(qtfield)
{
    if (typeof (aQuizControl[qtfield]) == "undefined")
        return false;
    else
        return (aQuizControl[qtfield] == -1);
}
function resetQuiz(qtfield)
{
    aQuizControl[qtfield] = -1;
}
%    \end{macrocode}
% The function RecordPointValue has two required parameters. For a grouped question,
% there are three more parameters, they are, in order (2) grpquestionno (3) grpPointValue
% (4) total weight (5) grpEvalFunction, a JS function that evaluates the group.
% The elements of the ProbValue array are as follows:
%\begin{enumerate}
%    \item If multiple choice, then the entry is \texttt{[0, point value, partial credit]}
%    \item If objective type question that is not part of a group, the entry is a number \texttt{point value}
%    \item total weight of the group, significant only if greater than point value
%    \item If objective grouped-type question, the entry is \texttt{[1,EvalJS,grpPointValue,list of points for each part]}
%\end{enumerate}
%    \begin{macrocode}
function RecordPointValue(ptvalue,probno)
{
    if (arguments.length > 2) {
        if ( typeof ProbValue[probno] == "undefined" ) {
            ProbValue[probno] = [1,arguments[5],arguments[3],arguments[4]];
            ProbValue[probno][3+arguments[2]] = ptvalue;
        } else ProbValue[probno][3+arguments[2]] = ptvalue;
    }
    else
        ProbValue[probno]=ptvalue;
}
function RecordProblemType(qType,probno)
{
    ProbType[probno]=qType;
}
function GrpRight( a, nProb, qtfield )
{
    var f = this.getField("grpobj."+qtfield+"."+nProb);
    var l = f.getArray().length
    var prod = 1;
    for ( var i=1; i <= l; i++) prod *= !!a[i];
    return prod;

}
function DisplayQuizResults(qtfield,nPointTotal,nQuestions)
{
    Score = 0; ptScore = 0;
    for (var i=1; i < RightWrong.length; i++)
    {
        if (typeof RightWrong[i] == "object") {
            // grouped question
                Score += GrpRight(RightWrong[i], i, qtfield);
                var aWeights = ProbValue[i].slice(2);
                var evalGrpJS = eval(ProbValue[i][1]);
                var evalGrpJSValue = evalGrpJS(this,qtfield,i,RightWrong[i],aWeights);
                ProbDist[i] = evalGrpJSValue;
                ptScore = ptScore + evalGrpJSValue;
        } else {
            if (RightWrong[i]==1) {
                Score++;
                ProbDist[i] = ( typeof ProbValue[i] == "object") ? ProbValue[i][1] : ProbValue[i];
                ptScore += ProbDist[i];
            }
            else {
                ProbDist[i] = ( typeof ProbValue[i] == "object") ? ProbValue[i][2] : 0;
                ptScore += ProbDist[i];
            }
        }
    }
    if (ptScore == nPointTotal) pcScore = 100;
    else pcScore = util.printf("\%.1f", (100 * ptScore) / nPointTotal);
    quizGrade = GetGrade(\eqGradeScale);
    var f = this.getField("ScoreField."+qtfield);
    if ( f != null ) f.value=(\eqQuizTotalMsg);
    f = this.getField("PointsField."+qtfield);
    if ( f != null) f.value=(\eqQuizPointsMsg);
    f = this.getField("PercentField."+qtfield);
    if ( f != null) f.value=(\eqQuizPercentMsg);
    f = this.getField("GradeField."+qtfield);
    if ( f != null) f.value=(\eqQuizGradeMsg);
}
function GetGrade()
{
    var cGrade, aRange;
    if (pcScore >=100) return arguments[0];
    for (var i=0; i<arguments.length/2; i++)
    {
        cGrade = arguments[2*i];
        aRange = arguments[2*i+1];
        if ( (pcScore >= arguments[2*i+1][0]) && (pcScore < arguments[2*i+1][1]))
            return cGrade;
    }
    return null;
}
function ProcessQuestion (key,letterresp,probno,quizno,qtfield,notify,mark,msg)
{
    var silent = ( arguments.length > 8 ) ? true : false;
    if (!isQuizInitialized(qtfield))
    {
        if (!silent) app.alert(InitMsg(msg),3);
        this.resetForm(["mc."+qtfield+"."+probno]);
    }
    else
    {
        ProcUserResp(key,letterresp,probno,notify);
        if (mark==1)
        {
            this.getField("mcq."+qtfield+"."+probno).delay=true;
            this.resetForm(["mcq."+qtfield+"."+probno]);
            var f = this.getField("mcq."+qtfield+"."+probno);
            var a = f.getArray();
            for (var i=0; i < a.length; i++)
                if (a[i].style == style.ch)
                {
                    a[i].style = style.ci;
                    a[i].textColor = \correctColor;
                }
            var qr=this.getField("mcq."+qtfield+"."+probno+"."+quizno);
            if (typeof app.formsVersion != "undefined" && app.formsVersion >=4.0)
                qr.textColor = key ? \checkColor\space : \crossColor;
            else
                qr.fgColor = key ? \checkColor\space : \crossColor;
            qr.style = key ? style.ch : style.cr;
            qr.value="Yes"; // gr.checkThisBox(0);  // ver 5.0
            this.getField("mcq."+qtfield+"."+probno).delay=false;
        }
    }
}
%    \end{macrocode}
% Dependencies: \texttt{RightWrong}, \texttt{ProbDist} (if \texttt{qMark} is present).
%    \begin{macrocode}
function correctQuiz(qtfield,nQuestions)
{
    var f = this.getField("mcq." + qtfield);
    if ( f != null) f.display = display.visible;
    f = this.getField("obj." + qtfield);
    if ( f != null ) {
        var a = f.getArray();
        for (var i = 0; i < a.length; i++) {
            var probno = a[i].name.replace(/.*\./g,"")
            if ( RightWrong[probno] == 1 )
                a[i].strokeColor = \correctColor;
            else
                a[i].strokeColor = \crossColor;
        }
    }
    f = this.getField("grpobj." + qtfield);
    if ( f != null ) {
        var a = f.getArray();
        for ( var i = 0; i < a.length; i++) {
            var aX = a[i].name.split(".");
            var probno = 1*aX[aX.length-2];
            var grpProbno = 1*aX[aX.length-1];
            if ( ( RightWrong[probno] != undefined ) && ( RightWrong[probno][grpProbno] == 1 ) )
                a[i].strokeColor = \correctColor;
            else
                a[i].strokeColor = \crossColor;
        }
    }
    f = this.getField("Ans." + qtfield);
    if ( f != null ) f.strokeColor = \eqDefaultColor;
    f = this.getField("promptButton." + qtfield)
    if ( f != null ) f.display = display.hidden;
    f = this.getField("corr." + qtfield);
    if ( f != null ) f.display = display.noPrint;
%    \end{macrocode}
% dps (01/01/04) If there are qMark fields, then write marks for each question
% to them.
%    \begin{macrocode}
    f = this.getField("qMark");
    if ( f != null )
    {
%        console.println("ProbDist = " + ProbDist.toSource() );
        for ( var i = 1; i <= nQuestions; i++)
        {
            if ( ProbValue[i] == undefined ) ProbValue[i]=0
            f = this.getField("qMark."+qtfield+"."+(i-1));
            if ( f != null )
            {
%    \end{macrocode}
% (3/22/04) This is code to account for grouping
%    \begin{macrocode}
                // find the next non-null field
                for ( var j=i; j <= nQuestions; j++)
                {
                    var h = this.getField("qMark."+qtfield+"."+j);
                    if ( h != null ) break;
                }
                var g = f.getArray();
                var qpts = ( ProbDist[i] == undefined ) ? 0 : ProbDist[i];
%console.println("qpts = " + qpts);
                g[0].value = qpts + (( qpts == 1 ) ? "pt " : " pts");
%                g[0].value = qpts + " pts";
            }
        }
        this.getField("qMark").display = display.visible;
    }
}
\end{newsegment}
%    \end{macrocode}
% \subsection{Miscellaneous JS}
%    \begin{macrocode}
\begin{newsegment}{Eq: Miscellaneous JS}
%    \end{macrocode}
% This function notifies the calling field of the results. If flag=0,
% it changes the color of the field and updates the tally field.
%    \begin{macrocode}
function notifyField(success, flag, fieldname) {
    if (success) {
        if (flag == 0) {
            this.getField(fieldname).strokeColor = \correctColor;
        }
        return true;
    }
    else {
        if (flag == 0) {
            updateTally(fieldname);
            this.getField(fieldname).strokeColor = \wrongColor;
        }
        return false;
    }
    return null;
}
%    \end{macrocode}
%    \begin{macrocode}
function updateTally(fieldname)
{
    var objre = /^obj\./;
    var grpre = /^grpobj\./;
%    \end{macrocode}
% If the question is part of a group of questions, then it has a root name of ``grpobj''.
% This root needs to be removed, as well as the sub-group number.
%    \begin{macrocode}
    if ( grpre.test(fieldname) ) {
        fieldname = fieldname.replace(grpre,"");
        var pos = fieldname.lastIndexOf(".");
        fieldname = fieldname.substring(0,pos);
    } else if ( objre.test(fieldname) ) fieldname = fieldname.replace(objre,"");
    var f = this.getField("tally."+fieldname)
    if ( f != null ) {
        f.value += 1;
        return true;
    } else return false;

}
function noPeek(qtfield,rtnPage)
{
    if ( (typeof (aQuizControl[qtfield]) == "undefined") || (aQuizControl[qtfield] != -1) )
    {
        this.pageNum = rtnPage-1;
        app.alert(\noPeekMsg,3);
    }
}
%    \end{macrocode}
% When the user exits a fill-in shortquiz field, this function is called.
% It immediately notifies notifies user of whether their answer is right
% or wrong, and changes the color of the boundary field.
%    \begin{macrocode}
function OnBlurRespBox (retn)
{
    var respMsg;
    var cTitle = "AcroTeX eDucation Bundle";
    if (retn != null) {
        if ( typeof appAlerts[arguments[1]] == "undefined")
            appAlerts[arguments[1]] = {bAfterValue: false};

        var respMsg = (retn) ? \eqsqrtmsg : \eqsqwgmsg;

        if (event.target == this)
            app.alert({ cMsg: respMsg, nIcon: 3, cTitle: cTitle });
        else {
            if ( ! appAlerts[arguments[1]].bAfterValue )
                app.alert({ cMsg: respMsg, nIcon: 3, cTitle: cTitle,
                oCheckbox: appAlerts[arguments[1]]});
        }
    }
    else {
        var str = event.target.value.toString();
        if (str.replace(/\s/g,"") == "")
            event.target.strokeColor = \eqDefaultColor;
    }
}
%    \end{macrocode}
% Description: This is the default function for determining whether
%   the minimal requirements for finishing a quiz have been met. The
%   default is that there is no minimal requirement.
% Arguments: qtfield = name of the field.
% Returns: true if minimum threshold is met, false otherwise.
%    \begin{macrocode}
function lowThreshold(nQuestions)
{
    return true;
}
%    \end{macrocode}
% Description: This is the default function for determining whether
%   the minimal requirements for finishing a quiz have been met. Here
%   the requirements are to answer all the questions.
% Arguments: qtfield = name of the field.
% Returns: true if minimum threshold is met, false otherwise.
%
% \noindent You can define this function as the default threshold function by
% typing\par
%\begin{verbatim}
%\renewcommand\minQuizResp{highThreshold}
%\end{verbatim}
%    \begin{macrocode}
function highThreshold(nQuestions)
{
    if (Responses.length <= nQuestions)
        app.alert(\highThresholdMsg,3)
    return (Responses.length > nQuestions);
}
\end{newsegment}
%    \end{macrocode}
% \subsection{Support for Grouped Questions}
% These function can be called by the \texttt{mathGrp} environment to score the user's
% responses to the grouped questions.
%    \begin{macrocode}
\begin{newsegment}{Eq: Support for Grouped Questions}
function groupEval(doc,qtfield,probno,aKey,aWeights)
{
    var totalGrpPts = aWeights[0];
    var totalWeight = aWeights[1];
    var total=0;
    for ( var i=1; i< aKey.length; i++ )
        if (aKey[i] != undefined) total += aKey[i]*aWeights[i+1];
    return total;
}
function WeightedEval(doc,qtfield,probno,aKey,aWeights)
{
    var f = doc.getField("grpobj." + qtfield + "." + probno);
    var nGrpQno = f.getArray().length;
    var totalGrpPts = aWeights[0];
    var totalWeight = aWeights[1];
    var total=0;
    for ( var i=1; i < aKey.length; i++ )
        if (aKey[i] != undefined) total += aKey[i]*aWeights[i+1];
    total /= totalWeight;
    total = Math.floor( total * totalGrpPts );
    return total;
}
\end{newsegment}
\end{insDLJS*}
%</aebjs>
%    \end{macrocode}
%    \section{Language Definitions}
% \StopEventually{Comment out \cs{OnlyDescription}
%   at the beginning of this file to see the language code.}
%    \subsection{French}
%    \begin{macrocode}
%<*eqfr>
%    \end{macrocode}
%    \begin{macrocode}
%%%%%%%%%%%%%%%%%%%%%%% eqfr.def %%%%%%%%%%%%%%%%%%%%%%%
%% Foreign language support for the exerquiz package. %%
%% Name of translator: Jean-Michel SARLAT             %%
%% Language: French                                   %%
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%
% Exercise label
\renewcommand\exlabel{Exercice}
% The value of this macro is written to \jobname.sol,
% accented characters must be protected with a \noexpand
\renewcommand\exlabelsol{\exlabel}

% Solution label for solutionafter option for exercise
\renewcommand\exsolafter{\textit{Solution} :}

% Title of exercise solution section
\renewcommand\exsectitle{Solutions des \exlabelsol s}
\renewcommand\exsecrunhead{\exsectitle}

% Title of quiz solution section
\renewcommand\eq@sqslsectitle{Les r\'{e}ponses aux questionnaires}
\renewcommand\sqslsectitle{\eq@sqslsectitle}

% Running header/section title for solutions to quizzes
\renewcommand\eq@sqslsecrunhead{Les r\'{e}ponses aux questionnaires}
% User access
\renewcommand\sqslsecrunhead{\eq@sqslsecrunhead}

% Label for solutions to quizzes, appears in solutions sections
\renewcommand\eq@sqsllabel{%
   \string\textbf{R\noexpand\'{e}ponse :}}
\renewcommand\sqsllabel{\eq@sqsllabel}% User access

% Solution label for solutionafter option for shortquiz
\renewcommand\sqsolafter{\textit{Solution} :}

% Here is the default short quiz label.
\renewcommand\eq@sqlabel{\textcolor{red}{Question.}}
% User access to shortquiz label
\renewcommand\sqlabel{\eq@sqlabel}

% Here is the default short quiz return label
% No formatting allowed
\renewcommand\eq@sqslrtnlabel{Retour au questionnaire.}
% User access to shortquiz label
\renewcommand\sqslrtnlabel{\eq@sqslrtnlabel}

% Short quiz feedback messages
\renewcommand\eqsqrtmsg{"Exact !"}
\renewcommand\eqsqwgmsg{"Faux !"}

% Here is the default quiz label. No formatting allowed!
\renewcommand\eq@bqlabel{D\'ebut}
% User access to shortquiz label
\renewcommand\bqlabel{\eq@bqlabel}
%==> modif JMS <==%
% Les modifications du contenu de \eqlabel ne seront pas prises en
% compte dans les messages de javascript (pb pour faire passer les
% accents dans le code !). Ceci justifie pour moi l'introduction de
% la variable \bqlabelISO ou le label de debut de questionnaire est
% cod\'{e}  ISO (octal). Cela parce que je veux utiliser le mot D\'ebut.
% Use \string\351, this helps out TeX4ht by Eitan Gurari
\renewcommand\eq@bqlabelISO{D\string\351but}
\renewcommand\bqlabelISO{\eq@bqlabelISO}

% Here is the default quiz label.
\renewcommand\eq@eqlabel{Fin}
% User access to shortquiz label
\renewcommand\eqlabel{\eq@eqlabel}
%
% JavaScript Messages for Quiz Environments
\renewcommand\eq@Score{Score :}\renewcommand\eq@OutOf{sur}
\renewcommand\eqInitQuizMsg{%
   "Vous devez initialiser le questionnaire ! Clicker sur "+msg+"."}
\renewcommand\eqMadeChoice{
   "Vous avez d\string\\351j\string\\340 fait un choix,
    ce choix est ("+Responses[probno]+").
    Souhaitez vous le modifier ?"}
%
% Valeur "Yes" d'Acrobat
%
% Default button labels for \eqButton
%\renewcommand\eq@local@CA{R\string\351ponses}
\renewcommand\eq@local@CA{%
    R\texorpdfstring{\'}{\string\351}ponses}
\renewcommand\eq@local@RC{Correctes}
\renewcommand\eq@local@AC{SVP !}
%</eqfr>
%    \end{macrocode}
%    \subsection{German}
%    \begin{macrocode}
%<*eqde>
%    \end{macrocode}
%    \begin{macrocode}
%%%%%%%%%%%%%%%%%%%% eqde.def %%%%%%%%%%%%%%%%%%%%%%%%%%
%% Foreign language support for the exerquiz package. %%
%% Name of translator: Michael Wiedmann               %%
%% e-mail address: michael.wiedmann@detewe.de         %%
%% Language: German                                   %%
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%
% The exercise label
\renewcommand\exlabel{\"Ubung}
% The value of this macro is written to \jobname.sol,
% accented characters must be protected with a \noexpand
\renewcommand\exlabelsol{\noexpand\"Ubung}

% Title of exercise solution section
\renewcommand\exsectitle{L\"osungen der \exlabel en}
\renewcommand\exsecrunhead{L\noexpand\"osungen der \exlabelsol en}

% Solution label for solutionafter option
\renewcommand\exsolafter{\textit{L\"osung}:}

% Title of quiz solution section
\renewcommand\eq@sqslsectitle{L\"osungen der Aufgaben}
\renewcommand\sqslsectitle{\eq@sqslsectitle}

% Running header/section title for solutions to quizzes
%\renewcommand\eq@sqslsecrunhead{L\"osungen der \"Ubungen}
\renewcommand\eq@sqslsecrunhead{L\"osungen der Aufgaben}
% User access
\renewcommand\sqslsecrunhead{\eq@sqslsecrunhead}

% Label for solutions to quizzes, appears in solutions sections
\renewcommand\eq@sqsllabel{%
   \string\textbf{L\noexpand\"osung zu Aufgabe:}}
% User access
\renewcommand\sqsllabel{\eq@sqsllabel}

% Solution label for solutionafter option for shortquiz
\renewcommand\sqsolafter{\textit{L\"osung}:}

% Here is the default short quiz label.
\renewcommand\eq@sqlabel{\textcolor{red}{Aufgabe}}
% User access to shortquiz label
\renewcommand\sqlabel{\eq@sqlabel}

% Here is the default short quiz return label
%\renewcommand\eq@sqslrtnlabel{Ende Aufgabe}
\renewcommand\eq@sqslrtnlabel{Test beenden}
% User access to shortquiz label
\renewcommand\sqslrtnlabel{\eq@sqslrtnlabel}

% Short quiz feedback messages
\renewcommand\eqsqrtmsg{"Richtig!"}
\renewcommand\eqsqwgmsg{"Falsch!"}

% Here is the default quiz label.
%\renewcommand\eq@bqlabel{Beginn Aufgabe}
\renewcommand\eq@bqlabel{Test starten}
% User access to quiz label
\renewcommand\bqlabel{\eq@bqlabel}
% Used for writing JavaScript Messages on screen. Use PDFDocEncoding
\renewcommand\eq@bqlabelISO{\eq@bqlabel}
\renewcommand\bqlabelISO{\eq@bqlabelISO}

% Here is the default quiz label.
%\renewcommand\eq@eqlabel{Ende Aufgabe}
\renewcommand\eq@eqlabel{Test beenden}
% User access to quiz label
\renewcommand\eqlabel{\eq@eqlabel}

% JavaScript Messages for Quiz Environments. Use PDFDocEncoding
%
\renewcommand\eq@Score{Punkte:}\renewcommand\eq@OutOf{von}
%\renewcommand\eqInitQuizMsg{%
%   "Sie m\string\374ssen die Aufgaben initialisieren!"
%   +" Bitte klicken Sie auf "+msg+"."}
\renewcommand\eqInitQuizMsg{%
   "Sie m\string\374ssen die Aufgaben zuerst initialisieren!"
   +" Bitte klicken Sie hierf\string\374r auf "+msg+" am Anfang des Tests."}
\renewcommand\eqMadeChoice{%
   "Sie haben bereits geantwortet.
    Ihre Antwort war ("+Responses[probno]+").
    Wollen Sie dies \string\344ndern?"}
%
% Default button labels for \eqButton
\renewcommand\eq@local@CA{Richtig}
\renewcommand\eq@local@RC{Meine Antworten!}
\renewcommand\eq@local@AC{Bitte!}

\renewcommand\eqerrABS{"Betr\string\344ge sind nicht ausgeglichen. Bitte korrigieren
    Sie das."}
\renewcommand\eqerrBadMathFunc{"Der Ausdruck `"+aF[i]+"' ist weder
    eine definierte Funktion noch ein g\string\374ltiger mathematischer Ausdruck."}
\renewcommand\eqParens{"runde Klammern"} % ( )
\renewcommand\eqBrackets{"eckige Klammern"} % [ ]
\renewcommand\eqBraces{"geschweifte Klammern"} % { }
\renewcommand\eqerrDelimNotBal{aGroup[i][2] + " sind nicht ausgeglichen.
    Bitte korrigieren Sie das."}
\renewcommand\eqerrBadExp{"Ung\string\374ltiger mathematischer Ausdruck.
    Es gibt ein Problem mit einem der Exponenten. Bitte korrigieren Sie das."}
\renewcommand\eqerrUnfinishQuiz{"Sie haben einen Test nicht beendet.
    Bitte beenden Sie diesen, bevor Sie einen neuen Test beginnen."}
\renewcommand\noPeekMsg{"Bevor Sie den Test nicht beendet haben, ist es
    nicht erlaubt, die L�sungen anzuschauen!"}
\renewcommand\highThresholdMsg{"Sie m\string\374ssen alle Fragen beantworten, bevor
    der Test ausgewertet wird."}
\renewcommand\eqSyntaxErrorUndefVar{"Syntax Error: Es existiert
    m�glicherweise eine undefinierte Variable oder ein Ausdruck ist nicht im
    erwarteten Format geschrieben."}
%</eqde>
%    \end{macrocode}
%    \subsection{Norwegian}
%    \begin{macrocode}
%<*eqno>
%%%%%%%%%%%%%%%%%%%% eqno.def %%%%%%%%%%%%%%%%%%%%%%%%%%
%% Foreign language support for the exerquiz package. %%
%% Name of translator: Hans Fredrik Nordhaug          %%
%% e-mail address: hansfn@mi.uib.no                   %%
%% Language: Norwegian                                %%
%%                                                    %%
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
\renewcommand\exlabel{{\O}velse}
\renewcommand\exlabelsol{{\noexpand\O}velse}

\renewcommand\exsectitle{L{\o}sning p{\aa} {\o}velsene}
\renewcommand\exsecrunhead{L{\noexpand\o}sning p{\noexpand\aa}
   {\noexpand\o}velsene}

\renewcommand\exsolafter{\textit{L{\o}sning}:}

\renewcommand\eq@sqslsectitle{L{\o}sning p{\aa} oppgavene}
\renewcommand\sqslsectitle{\eq@sqslsectitle}

\renewcommand\eq@sqslsecrunhead{L{\o}sning p{\aa} oppgavene}
\renewcommand\sqslsecrunhead{\eq@sqslsecrunhead}

\renewcommand\eq@sqsllabel{%
    \string\textbf{L{\noexpand\o}sning p{\noexpand\aa} oppgave:}}
\renewcommand\sqsllabel{\eq@sqsllabel}

\renewcommand\sqsolafter{\textit{L{\o}sning}:}

\renewcommand\eq@sqlabel{\textcolor{red}{Oppgave}}
\renewcommand\sqlabel{\eq@sqlabel}

\renewcommand\eq@sqslrtnlabel{Slutt}
\renewcommand\sqslrtnlabel{\eq@sqslrtnlabel}

\renewcommand\eqsqrtmsg{"Rett!"}
\renewcommand\eqsqwgmsg{"Feil!"}

\renewcommand\eq@bqlabel{Start oppgaver}
\renewcommand\bqlabel{\eq@bqlabel}
\renewcommand\eq@bqlabelISO{\eq@bqlabel}
\renewcommand\bqlabelISO{\eq@bqlabel}

\renewcommand\eq@eqlabel{Slutt}
\renewcommand\eqlabel{\eq@eqlabel}

\renewcommand\eqScore{Poeng:}\renewcommand\eqOutOf{av}
\renewcommand\eqInitQuizMsg{"Du m\string\\345 initialisere testen!"
+" Klikk p\string\\345 "+msg+"."}
\renewcommand\eqMadeChoice{%
    "Du har allerede gjort et valg.
     Valget var ("+Responses[probno]+").
     Vil du endre det?"}
\renewcommand\eq@local@CA{Rett}
\renewcommand\eq@local@RC{mine svar!}
%\renewcommand\eq@local@AC{V\string\346r s\string\345 snill!}}
\renewcommand\eq@local@AC{%
    V\texorpdfstring{\ae}{\string\346}r s\texorpdfstring{\r}{\string\345}snill!}
%</eqno>
%    \end{macrocode}
%    \subsection{Dutch}
%    \begin{macrocode}
%<*eqnl>
%%%%%%%%%%%%%%%%%%% eqnl.def %%%%%%%%%%%%%%%%%%%%%%%%%%%
%% Foreign language support for the exerquiz package. %%
%% Name of translator: Henny Wilbrink                 %%
%% e-mail address: wsdwhw@win.tue.nl                  %%
%% Language: Dutch                                    %%
%%                                                    %%
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%
% The exercise label
\renewcommand\exlabel{Opgave}
\renewcommand\exlabelsol{\exlabel}

% Title of exercise solution section
\renewcommand\exsectitle{Oplossingen van de Opgaven}
\renewcommand\exsecrunhead{\exsectitle}

% Solution label for solutionafter option for exercise
\renewcommand\exsolafter{\textit{Oplossing}:}

% Title of short quiz solution section
\renewcommand\eq@sqslsectitle{Oplossingen van de Toetsen}
\renewcommand\sqslsectitle{\eq@sqslsectitle}

% Running header/section title for solutions to short quizzes
\renewcommand\eq@sqslsecrunhead{Oplossingen van de Toetsen}
% User access
\renewcommand\sqslsecrunhead{\eq@sqslsecrunhead}

% Solution label for solutionafter option
\renewcommand\exsolafter{\textit{Oplossing}:}

% Label for solutions to short quizzes, appears in solutions sections
\renewcommand\eq@sqsllabel{\string\textbf{Oplossing van Toets:}}
% User access
\renewcommand\sqsllabel{\eq@sqsllabel}

% Solution label for solutionafter option for shortquiz
\renewcommand\sqsolafter{\textit{Oplossing}:}

% Here is the default short quiz label.
\renewcommand\eq@sqlabel{\textcolor{red}{Toets.}}
% User access to shortquiz label
\renewcommand\sqlabel{\eq@sqlabel}

% Here is the default short quiz return label
\renewcommand\eq@sqslrtnlabel{Terug naar Toets}
% User access to shortquiz label
\renewcommand\sqslrtnlabel{\eq@sqslrtnlabel}

% Short quiz feedback messages
\renewcommand\eqsqrtmsg{"Goed!"}
\renewcommand\eqsqwgmsg{"Fout!"}

% Here is the default quiz label.
\renewcommand\eq@bqlabel{Begin Toets}
% User access to shortquiz label
\renewcommand\bqlabel{\eq@bqlabel}
% Used for writing JavaScript Messages on screen. Use PDFDocEncoding
\renewcommand\eq@bqlabelISO{\eq@bqlabel}
\renewcommand\bqlabelISO{\eq@bqlabel}

% Here is the default quiz label.
% No formatting allowed
\renewcommand\eq@eqlabel{Einde Toets}
% User access to shortquiz label
\renewcommand\eqlabel{\eq@eqlabel}

%
% JavaScript Messages for Quiz Environments. Use PDFDocEncoding
%
\renewcommand\eq@Score{Score:}\renewcommand\eq@OutOf{van de}

\renewcommand\eqInitQuizMsg{%
  "U moet de Toets initialiseren! Klik op "+msg+"."}
\renewcommand\eqMadeChoice{%
   "U hebt al een keuze gemaakt.
    Uw keuze was ("+Responses[probno]+").
    Wil u dit veranderen?"}
%
% Default button labels for \eqButton
\renewcommand\eq@local@CA{Corrigeer}
\renewcommand\eq@local@RC{Mijn Antwoorden!}
\renewcommand\eq@local@AC{AUB!}
%</eqnl>
%    \end{macrocode}
%    \subsection{Spanish}
%    \begin{macrocode}
%<*eqes>
%%%%%%%%%%%%%%%%%%% eqes.def %%%%%%%%%%%%%%%%%%%%%%%%%%%
%% Foreign language support for the exerquiz package. %%
%% Name of translator: Pedro Luis Luque               %%
%% e-mail address: calvo@cica.es                      %%
%% Language:  (spanish)                               %%
%%                                                    %%
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%

% The exercise label
\renewcommand\exlabel{Ejercicio}
% The value of this macro is written to \jobname.sol,
\renewcommand\exlabelsol{\exlabel}

% Title of exercise solution section
\renewcommand\exsectitle{Soluciones a los \exlabel s}
\renewcommand\exsecrunhead{\exsectitle} %% change to @ form

% Solution label for solutionafter option for exercise
\renewcommand\exsolafter{\textit{Soluci\'{o}n}:}

% Title of short quiz solution section
\renewcommand\eq@sqslsectitle{Soluciones a los Tests}
\renewcommand\sqslsectitle{\eq@sqslsectitle}

% Running header/section title for solutions to short quizzes
\renewcommand\eq@sqslsecrunhead{Soluciones a los Tests}
% User access
\renewcommand\sqslsecrunhead{\eq@sqslsecrunhead}

% Label for solutions to short quizzes, appears in solutions sections
\renewcommand\eq@sqsllabel{%
  \string\textbf{Soluci\noexpand\'{o}n al Test:}}
% User access
\renewcommand\sqsllabel{\eq@sqsllabel}

% Solution label for solutionafter option for shortquiz
\renewcommand\sqsolafter{\textit{Soluci\'{o}n}:}

% Here is the default short quiz label.
\renewcommand\eq@sqlabel{\textcolor{red}{Test.}}
% User access to shortquiz label
\renewcommand\sqlabel{\eq@sqlabel}

% Here is the default short quiz return label
\renewcommand\eq@sqslrtnlabel{Final del Test}
% User access to shortquiz label
\renewcommand\sqslrtnlabel{\eq@sqslrtnlabel}

% Short quiz feedback messages
\renewcommand\eqsqrtmsg{"Correcto!"}
\renewcommand\eqsqwgmsg{"Incorrecto!"}

% Here is the default quiz label.
\renewcommand\eq@bqlabel{Inicio del Test}
% User access to shortquiz label
\renewcommand\bqlabel{\eq@bqlabel}
% Used for writing JavaScript Messages on screen. Use PDFDocEncoding
\renewcommand\eq@bqlabelISO{\eq@bqlabel}
\renewcommand\bqlabelISO{\eq@bqlabel}

% Here is the default quiz label.
% No formatting allowed
\renewcommand\eq@eqlabel{Final del Test}
% User access to shortquiz label
\renewcommand\eqlabel{\eq@eqlabel}
%
% JavaScript Messages for Quiz Environments. Use PDFDocEncoding
%
\renewcommand\eq@Score{Puntos:}\renewcommand\eq@OutOf{de}
\renewcommand\eqInitQuizMsg{"Debes inicializar el Test! Click sobre "+msg+"."}
\renewcommand\eqMadeChoice{%
   "Ya has elegido una respuesta.
    Tu respuesta fue ("+Responses[probno]+").
    Quieres cambiarla?"}
%
% Default button labels for \eqButton
\renewcommand\eq@local@CA{Correctas}
\renewcommand\eq@local@RC{Mis Respuestas!}
\renewcommand\eq@local@AC{Por Favor!}
%</eqes>
%    \end{macrocode}
%    \subsection{Italian}
%    \begin{macrocode}
%<*eqit>
%%%%%%%%%%%%%%%%%%% eqit.def %%%%%%%%%%%%%%%%%%%%%%%%%%%
%% Foreign language support for the exerquiz package. %%
%% Name of translator:  PierLuigi Zezza               %%
%% e-mail address:  pzezza@cce.unifi.it               %%
%% Language: Italian                                  %%
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
% The exercise label
\renewcommand\exlabel{Esercizio}
%
% The value of this macro is written to \jobname.sol,
\renewcommand\exlabelsol{\exlabel}
%
% Title of exercise solution section
\renewcommand\exsectitle{Soluzioni degli Esercizi }
\renewcommand\exsecrunhead{\exsectitle}
%
% Solution label for solutionafter option for exercise
\renewcommand\exsolafter{\textit{Soluzione}:}
%
% Title of short quiz solution section
\renewcommand\eq@sqslsectitle{Soluzioni dei Quiz}
\renewcommand\sqslsectitle{\eq@sqslsectitle}
%
% Running header/section title for solutions to short quizzes
\renewcommand\eq@sqslsecrunhead{Soluzioni dei Quiz}
%
% User access
\renewcommand\sqslsecrunhead{\eq@sqslsecrunhead}
%
% Label for solutions to short quizzes, appears in solutions sections
\renewcommand\eq@sqsllabel{\string\textbf{Soluzione del Quiz:}}
%
% User access
\renewcommand\sqsllabel{\eq@sqsllabel}
%
% Solution label for solutionafter option for shortquiz
\renewcommand\sqsolafter{\textit{Soluzione}:}
%
% Here is the default short quiz label.
\renewcommand\eq@sqlabel{\textcolor{red}{Quiz.}}
%
% User access to shortquiz label
\renewcommand\sqlabel{\eq@sqlabel}
%
% Here is the default short quiz return label
\renewcommand\eq@sqslrtnlabel{Fine Quiz}
%
% User access to shortquiz label
\renewcommand\sqslrtnlabel{\eq@sqslrtnlabel}
%
% Short quiz feedback messages
\renewcommand\eqsqrtmsg{"Giusto!"}
\renewcommand\eqsqwgmsg{"Sbagliato!"}
%
% Here is the default quiz label.
% No formatting allowed
\renewcommand\eq@bqlabel{Inizio Test}
%
% User access to shortquiz label
\renewcommand\bqlabel{\eq@bqlabel}
\renewcommand\eq@bqlabelISO{\eq@bqlabel}
\renewcommand\bqlabelISO{\eq@bqlabel}
%
% Here is the default quiz label.
% No formatting allowed
\renewcommand\eq@eqlabel{Fine Test}
%
% User access to shortquiz label
\renewcommand\eqlabel{\eq@eqlabel}
%
% JavaScript Messages for Quiz Environments. Use PDFDocEncoding
%
\renewcommand\eq@Score{Punteggio:}\renewcommand\eq@OutOf{su}
\renewcommand\eqInitQuizMsg{"Dovete inizializzare il Quiz! Click su "+msg+"."}
\renewcommand\eqMadeChoice{%
   "Avete gi\string\\340 fatto una scelta.
    La vostra scelta era ("+Responses[probno]+").
    Volete cambiarla ?"}
%
% Default button labels for \eqButton
\renewcommand\eq@local@CA{Correggere}
\renewcommand\eq@local@RC{Le mie risposte!}
\renewcommand\eq@local@AC{Per favore!}
%</eqit>
%    \end{macrocode}
%    \subsection{Russian}
%    \begin{macrocode}
%<*eqru>
%%%%%%%%%%%%%%%%%%% eqru.def %%%%%%%%%%%%%%%%%%%%%%%%%%%
%% Foreign language support for the exerquiz package. %%
%% Name of translator:  Sergei V. Znamenskii          %%
%% e-mail address:  znamensk@rustex.botik.ru          %%
%% Language: Russian                                  %%
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
\edef\restoreAtCatcode{\noexpand\catcode64 =\the\catcode64 }%
\catcode`\@=11
\gdef\eq@protected#1#2{{\ifhmode #2\else
    \ifvmode #2\else\ifinner#2\else\noexpand #1\fi\fi\fi}}%
\def\cyrCommand#1#2{\def#1{\eq@protected#1{#2}}}%
%
% The exercise label
\cyrCommand\exlabel{\CYRU\cyrp\cyrr\cyra\cyrzh\cyrn
        \cyre\cyrn\cyri\cyre}%
% The value of this macro is written to \jobname.sol,
\cyrCommand\exlabelsol{\CYRK{ }\cyru\cyrp\cyrr\cyra\cyrzh\cyrn
        \cyre\cyrn\cyri\cyryu}%
%
% Title of exercise solution section
\cyrCommand\exsectitle{\CYRR\cyre\cyrsh\cyre\cyrn\cyri\cyrya{ }%
        \cyru\cyrp\cyrr\cyra\cyrzh\cyrn\cyre\cyrn\cyri\cyrishrt}%
\renewcommand\exsecrunhead{\exsectitle}
%
% Solution label for solutionafter option for exercise
\cyrCommand\exsolafter{\textit{\CYRR\cyre\cyrsh\cyre\cyrn\cyri\cyre}:}%
%
% Title of short quiz solution section
\cyrCommand\eq@sqslsectitle{\CYRO\cyrt\cyrv\cyre\cyrt\cyrery{ }%
        \cyrk{ }\cyrt\cyre\cyrs\cyrt\cyra\cyrm}%
\renewcommand\sqslsectitle{\eq@sqslsectitle}
% Running header/section title for solutions to short quizzes
\renewcommand\eq@sqslsecrunhead{\eq@sqslsectitle}%
% User access
\renewcommand\sqslsecrunhead{\eq@sqslsecrunhead}
% Label for solutions to short quizzes, appears in solutions sections
\cyrCommand\eqSqsllabel{\textbf{\CYRO\cyrt\cyrv\cyre\cyrt}:}%
\renewcommand\eq@sqsllabel{\eqSqsllabel}%
% User access
\renewcommand\sqsllabel{\eq@sqsllabel}
% Solution label for solutionafter option for shortquiz
\cyrCommand\sqsolafter{\textit{\CYRR\cyre\cyrsh\cyre
        \cyrn\cyri\cyre}:}% ??
% Here is the default short quiz label.
\cyrCommand\eq@sqlabel{\textcolor{red}{\CYRV\cyro\cyrp\cyrr\cyro\cyrs}}%
% User access to shortquiz label
\renewcommand\sqlabel{\eq@sqlabel}
% Here is the default short quiz return label
\cyrCommand\eqsqslrtnlabel{\CYRK{ }%
        \cyrf\cyro\cyrr\cyrm\cyru\cyrl\cyri\cyrr\cyro\cyrv\cyrk\cyre{ }%
        \cyrv\cyro\cyrp\cyrr\cyro\cyrs\cyra}%
% User access to shortquiz label
\renewcommand\eq@sqslrtnlabel{\eqsqslrtnlabel}
% Short quiz feedback messages
\renewcommand\eqsqrtmsg{"BEPHO !!! "}%
\renewcommand\eqsqwgmsg{"HEBEPHO !!! "}%
% Here is the default quiz label.
\renewcommand\eq@bqlabel{CTAPT!}%
% User access to shortquiz label
\renewcommand\bqlabel{\eq@bqlabel}
% Used for writing JavaScript Messages on screen. Use PDFDocEncoding
\renewcommand\eq@bqlabelISO{\eq@bqlabel}
\renewcommand\bqlabelISO{\eq@bqlabel}
% Here is the default quiz label.
% No formatting allowed
\cyrCommand\eq@eqlabel{CYRI\CYRT\CYRO\CYRG\CYRO:}%
% User access to shortquiz label
\renewcommand\eqlabel{\eq@eqlabel}
%
% JavaScript Messages for Quiz Environments. Use PDFDocEncoding
%
\renewcommand\eq@Score{ ?}\renewcommand\eq@OutOf{}
\renewcommand\eqInitQuizMsg{"HA CTAPT !!! "}%
\renewcommand\eqMadeChoice{"AX, HE TAK ?"}%
% \renewcommand\eqQuizTotalMsg{%
%   "\space"+Score+"/\thequestionno\space"}%
\renewcommand\eqQuizTotalMsg{%
  "\space"+Score+"/"+nQuestions\space"}%
% Russian letters on outlines should be transliterated.
% It is the best choice for them
\DeclareTextCommand{\cyra    }{PD1}{a} % Cyrillic letter
\DeclareTextCommand{\cyrb    }{PD1}{b} % Cyrillic letter
\DeclareTextCommand{\cyrv    }{PD1}{v} % Cyrillic letter
\DeclareTextCommand{\cyrg    }{PD1}{g} % Cyrillic letter
\DeclareTextCommand{\cyrd    }{PD1}{d} % Cyrillic letter
\DeclareTextCommand{\cyre    }{PD1}{e} % Cyrillic letter
\DeclareTextCommand{\cyryo   }{PD1}{yo} % Cyrillic letter
\DeclareTextCommand{\cyrzh   }{PD1}{zh} % Cyrillic letter
\DeclareTextCommand{\cyrz    }{PD1}{z} % Cyrillic letter
\DeclareTextCommand{\cyri    }{PD1}{i} % Cyrillic letter
\DeclareTextCommand{\cyrishrt}{PD1}{i} % Cyrillic letter
\DeclareTextCommand{\cyrk    }{PD1}{k} % Cyrillic letter
\DeclareTextCommand{\cyrl    }{PD1}{l} % Cyrillic letter
\DeclareTextCommand{\cyrm    }{PD1}{m} % Cyrillic letter
\DeclareTextCommand{\cyrn    }{PD1}{n} % Cyrillic letter
\DeclareTextCommand{\cyro    }{PD1}{o} % Cyrillic letter
\DeclareTextCommand{\cyrp    }{PD1}{p} % Cyrillic letter
\DeclareTextCommand{\cyrr    }{PD1}{r} % Cyrillic letter
\DeclareTextCommand{\cyrs    }{PD1}{s} % Cyrillic letter
\DeclareTextCommand{\cyrt    }{PD1}{t} % Cyrillic letter
\DeclareTextCommand{\cyru    }{PD1}{u} % Cyrillic letter
\DeclareTextCommand{\cyrf    }{PD1}{f} % Cyrillic letter
\DeclareTextCommand{\cyrh    }{PD1}{h} % Cyrillic letter
\DeclareTextCommand{\cyrc    }{PD1}{c} % Cyrillic letter
\DeclareTextCommand{\cyrch   }{PD1}{ch} % Cyrillic letter
\DeclareTextCommand{\cyrsh   }{PD1}{sh} % Cyrillic letter
\DeclareTextCommand{\cyrshch }{PD1}{shch} % Cyrillic letter
\DeclareTextCommand{\cyrhrdsn}{PD1}{"} % Cyrillic letter
\DeclareTextCommand{\cyrery  }{PD1}{y} % Cyrillic letter
\DeclareTextCommand{\cyrsftsn}{PD1}{'} % Cyrillic letter
\DeclareTextCommand{\cyrerev }{PD1}{e1} % Cyrillic letter
\DeclareTextCommand{\cyryu   }{PD1}{yu} % Cyrillic letter
\DeclareTextCommand{\cyrya   }{PD1}{ya} % Cyrillic letter
\DeclareTextCommand{\CYRA    }{PD1}{A} % Cyrillic letter
\DeclareTextCommand{\CYRB    }{PD1}{B} % Cyrillic letter
\DeclareTextCommand{\CYRV    }{PD1}{V} % Cyrillic letter
\DeclareTextCommand{\CYRG    }{PD1}{G} % Cyrillic letter
\DeclareTextCommand{\CYRD    }{PD1}{D} % Cyrillic letter
\DeclareTextCommand{\CYRE    }{PD1}{E} % Cyrillic letter
\DeclareTextCommand{\CYRYO   }{PD1}{YO} % Cyrillic letter
\DeclareTextCommand{\CYRZH   }{PD1}{ZH} % Cyrillic letter
\DeclareTextCommand{\CYRZ    }{PD1}{Z} % Cyrillic letter
\DeclareTextCommand{\CYRI    }{PD1}{I} % Cyrillic letter
\DeclareTextCommand{\CYRISHRT}{PD1}{I} % Cyrillic letter
\DeclareTextCommand{\CYRK    }{PD1}{K} % Cyrillic letter
\DeclareTextCommand{\CYRL    }{PD1}{L} % Cyrillic letter
\DeclareTextCommand{\CYRM    }{PD1}{M} % Cyrillic letter
\DeclareTextCommand{\CYRN    }{PD1}{N} % Cyrillic letter
\DeclareTextCommand{\CYRO    }{PD1}{O} % Cyrillic letter
\DeclareTextCommand{\CYRP    }{PD1}{P} % Cyrillic letter
\DeclareTextCommand{\CYRR    }{PD1}{R} % Cyrillic letter
\DeclareTextCommand{\CYRS    }{PD1}{S} % Cyrillic letter
\DeclareTextCommand{\CYRT    }{PD1}{T} % Cyrillic letter
\DeclareTextCommand{\CYRU    }{PD1}{U} % Cyrillic letter
\DeclareTextCommand{\CYRF    }{PD1}{F} % Cyrillic letter
\DeclareTextCommand{\CYRH    }{PD1}{H} % Cyrillic letter
\DeclareTextCommand{\CYRC    }{PD1}{C} % Cyrillic letter
\DeclareTextCommand{\CYRCH   }{PD1}{CH} % Cyrillic letter
\DeclareTextCommand{\CYRSH   }{PD1}{SH} % Cyrillic letter
\DeclareTextCommand{\CYRSHCH }{PD1}{SHCH} % Cyrillic letter
\DeclareTextCommand{\CYRHRDSN}{PD1}{"} % Cyrillic letter
\DeclareTextCommand{\CYRERY  }{PD1}{Y} % Cyrillic letter
\DeclareTextCommand{\CYRSFTSN}{PD1}{'} % Cyrillic letter
\DeclareTextCommand{\CYREREV }{PD1}{E1} % Cyrillic letter
\DeclareTextCommand{\CYRYU   }{PD1}{YU} % Cyrillic letter
\DeclareTextCommand{\CYRYA   }{PD1}{YA} % Cyrillic letter
\restoreAtCatcode
%
% Default button labels for \eqButton
\renewcommand\eq@local@CA{KOPPEKTOP}
\renewcommand\eq@local@RC{KOPPEKTOP}
\renewcommand\eq@local@AC{KOPPEKTOP}
%</eqru>
%    \end{macrocode}
%    \subsection{Danish}
%    \begin{macrocode}
%<*eqda>
%%%%%%%%%%%%%%%%%%%% eqda.def %%%%%%%%%%%%%%%%%%%%%%%%%%
%% Foreign language support for the exerquiz package. %%
%% Name of translator: Erik Leimand                   %%
%% e-mail address: buhlleimand@worldonline.dk         %%
%% Language: Danish                                   %%
%%                                                    %%
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
\renewcommand\exlabel{{\O}velse}
\renewcommand\exlabelsol{{\noexpand\O}velse}

\renewcommand\exsectitle{L{\o}sning p{\aa} {\o}velserne}
\renewcommand\exsecrunhead{L{\noexpand\o}sning p{\noexpand\aa}
   {\noexpand\o}velserne}

\renewcommand\exsolafter{\textit{L{\o}sning}:}

\renewcommand\eq@sqslsectitle{L{\o}sning p{\aa} opgaverne}
\renewcommand\sqslsectitle{\eq@sqslsectitle}

\renewcommand\eq@sqslsecrunhead{L{\o}sning p{\aa} opgaverne}
\renewcommand\sqslsecrunhead{\eq@sqslsecrunhead}

\renewcommand\eq@sqsllabel{%
    \string\textbf{L{\noexpand\o}sning p{\noexpand\aa} opgave:}}
\renewcommand\sqsllabel{\eq@sqsllabel}

\renewcommand\sqsolafter{\textit{L{\o}sning}:}

\renewcommand\eq@sqlabel{\textcolor{red}{Opgave.}}
\renewcommand\sqlabel{\eq@sqlabel}

\renewcommand\eq@sqslrtnlabel{Slut}
\renewcommand\sqslrtnlabel{\eq@sqslrtnlabel}

\renewcommand\eqsqrtmsg{"Rigtigt!"}
\renewcommand\eqsqwgmsg{"Forkert!"}

\renewcommand\eq@bqlabel{Start opgaver}
\renewcommand\bqlabel{\eq@bqlabel}
\renewcommand\eq@bqlabelISO{\eq@bqlabel}
\renewcommand\bqlabelISO{\eq@bqlabel}

\renewcommand\eq@eqlabel{Slut}
\renewcommand\eqlabel{\eq@eqlabel}

\renewcommand\eq@Score{Score:}\renewcommand\eq@OutOf{ud af}
%\renewcommand\eqQuizTotalMsg{"\eqScore\space"+Score+" \eqOutOf\space"+"\thequestionno"}
\renewcommand\eqQuizTotalMsg{"\eqScore\space"+Score+" \eqOutOf\space"+nQuestions}
\renewcommand\eqInitQuizMsg{"Du skal starte testen! Klik p\string\\345 "+msg+"."}
\renewcommand\eqMadeChoice{%
   "Du har allerede valgt.
    Du valgte ("+Responses[probno]+").
    Vil du \string\\346ndre det?"}
\renewcommand\eq@local@CA{Ret}
\renewcommand\eq@local@RC{Mine svar!}
%\renewcommand\eq@local@AC{V\string\346r s\string\345 god!}}
\renewcommand\eq@local@AC{%
    V\texorpdfstring{\ae}{\string\346}r s\texorpdfstring{\r}{\string\345}god!}
%</eqda>
%    \end{macrocode}
%    \subsection{Polish}
%    \begin{macrocode}
%<*eqpo>
%%%%%%%%%%%%%%%%%%%% eqpo.def %%%%%%%%%%%%%%%%%%%%%%%%%%
%% Foreign language support for the exerquiz package. %%
%% Name of translator: Jerzy Mycielski                %%
%% e-mail address: jmyc@poczta.onet.pl                %%
%% Language: Polish                                   %%
%%                                                    %%
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%% The polish accented characters included in pdfendconding is
%% lslash and oacute, not included are zacute, zdot, cacute,
%% nacute, sacute, aogonek, eogonek and corresponding capital characters.
%  Z   \'{Z}  \u0179
%  a   \k{a}  \u0105
%  c   \'{c}  \u0107
%  l   \l     \u0142
%  s   \'{s}  \u015B
%  z   \.{z}  \u017C
%  �   \'{o}  \u00F3
\renewcommand\exlabel{Zadanie}
\renewcommand\exlabelsol{\exlabel}

\renewcommand\exsectitle{Rozwi\k{a}zania Zada\'{n}}
\renewcommand\exsecrunhead{\noexpand\exsectitle}

\renewcommand\exsolafter{\textit{Rozwi\k{a}znie}:}

\renewcommand\eq@sqslsectitle{Rozwi\k{a}zania Test\'{o}w}
\renewcommand\sqslsectitle{\eq@sqslsectitle}

\renewcommand\eq@sqslsecrunhead{Rozwi\noexpand\k{a}zania Test\noexpand\'{o}w}
\renewcommand\sqslsecrunhead{\eq@sqslsecrunhead}

\renewcommand\eq@sqsllabel{\string\textbf{Rozwi\noexpand\k{a}zanie Testu:}}
\renewcommand\sqsllabel{\eq@sqsllabel}

\renewcommand\sqsolafter{\textit{Rozwi\k{a}zanie}:}

\renewcommand\eq@sqlabel{\textcolor{red}{Test.}}
\renewcommand\sqlabel{\eq@sqlabel}

%\renewcommand\eq@sqslrtnlabel{Zako\noexpand\'{n}cz Test}
\renewcommand\eq@sqslrtnlabel{Zako\ifeq@solutionsafter\else\expandafter\noexpand\fi\'{n}cz Test}
\renewcommand\sqslrtnlabel{\eq@sqslrtnlabel}

\renewcommand\eqsqrtmsg{"Dobrze!"}
\renewcommand\eqsqwgmsg{"\string\\u0179le!"}
%\renewcommand\eqsqwgmsg{"\'{Z}le!"}

\renewcommand\eq@bqlabel{Rozpocznij Test}
\renewcommand\bqlabel{\eq@bqlabel}
\renewcommand\eq@bqlabelISO{\eq@bqlabel}
\renewcommand\bqlabelISO{\eq@bqlabel}

\renewcommand\eq@eqlabel{Zakoncz Test}
% \renewcommand\eq@eqlabel{Zako\'{n}cz Test}
\renewcommand\eqlabel{\eq@eqlabel}

\renewcommand\eq@Score{Punkt\'{o}w:}\renewcommand\eq@OutOf{z mozliwych}
%\renewcommand\eq@Score{Punkt\'{o}w:}\renewcommand\eq@OutOf{z mo\'{z}liwych}
\renewcommand\eqQuizTotalMsg{"\eqScore\space"+Score+" \eqOutOf\space"+nQuestions}

\renewcommand\eqInitQuizMsg{"Musisz rozpoczac Test! Kliknij na "+msg+"."}
%\renewcommand\eqInitQuizMsg{"Musisz rozpocz\'{a}c Test! Kliknij na "+msg+"."}

\renewcommand\eqMadeChoice{%
   "Juz dokonal\string\\233e\string\\u015B wyboru.
    Twoim wyborem by\string\\233o ("+Responses[probno]+").
    Czy chcesz go zmieni\string\\u0107?"}
%\renewcommand\eqMadeChoice{%
%"Ju\.{z} dokona\string\233e\'{s} wyboru. Twoim wyborem"
%+" by\string\233o ("+Responses[probno]+")."+" Czy chcesz go zmieni\'{c}?"}

\renewcommand\eq@local@CA{Popraw}
\renewcommand\eq@local@RC{Moje odpowiedzi!}
\renewcommand\eq@local@AC{Prosze!}
%\renewcommand\eq@local@AC{Prosz\k{e}!}
%</eqpo>
%    \end{macrocode}
%    \subsection{Finnish}
%    \begin{macrocode}
%<*eqfin>
%%%%%%%%%%%%%%%%%%%% eqfin.def %%%%%%%%%%%%%%%%%%%%%%%%%%
%% Foreign language support for the exerquiz package.  %%
%% Name of translator: Paivi Porras                    %%
%% e-mail address: paivi.porras@lut.fi                 %%
%% Language: Finnish                                   %%
%%                                                     %%
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
\renewcommand\exlabel{Harjoitus}
\renewcommand\exlabelsol{Harjoitus}

\renewcommand\exsectitle{Ratkaisut}
\renewcommand\exsecrunhead{Ratkaisu \exlabelsol }

\renewcommand\exsolafter{\textit{Ratkaisu}:}

\renewcommand\eq@sqslsectitle{Vastaukset testikysymyksiin}
\renewcommand\sqslsectitle{\eq@sqslsectitle}

\renewcommand\eq@sqslsecrunhead{Vastaukset testikysymyksiin}
\renewcommand\sqslsecrunhead{\eq@sqslsecrunhead}

\renewcommand\eq@sqsllabel{%
   \string\textbf{Vastaus testikysymykseen:}}
\renewcommand\sqsllabel{\eq@sqsllabel}

\renewcommand\sqsolafter{\textit{Ratkaisu}:}

\renewcommand\eq@sqlabel{\textcolor{red}{Testikysymys}}
\renewcommand\sqlabel{\eq@sqlabel}

\renewcommand\eq@sqslrtnlabel{Lopeta testi}
\renewcommand\sqslrtnlabel{\eq@sqslrtnlabel}

\renewcommand\eqsqrtmsg{"Oikein!"} %muokattu
\renewcommand\eqsqwgmsg{"V\string\344\string\344rin!"} %m
%\renewcommand\eqsqwgmsg{"V\"a\"arin!"} %m

\renewcommand\eq@bqlabel{Aloita testi}
\renewcommand\bqlabel{\eq@bqlabel}
\renewcommand\eq@bqlabelISO{\eq@bqlabel}
\renewcommand\bqlabelISO{\eq@bqlabelISO}

\renewcommand\eq@eqlabel{Lopeta testi}
\renewcommand\eqlabel{\eq@eqlabel}

\renewcommand\eq@Score{Pisteet:}\renewcommand\eq@OutOf{/}
\renewcommand\eqInitQuizMsg{%m
   "Testi on aloitettava painamalla  "+msg+"."}
\renewcommand\eqMadeChoice{%m
   "Olet jo kerran valinnut.
    Valintasi oli ("+Responses[probno]+")."
+" Haluatko vaihtaa?"}
\AtEndOfPackage{%
\renewcommand\eq@local@CA{Oikein}
\renewcommand\eq@local@RC{Omat vastaukset!}
\renewcommand\eq@local@AC{Ole hyv\string\344!}}
%</eqfin>
%    \end{macrocode}
%    \subsection{catalan}
%    \begin{macrocode}
%<*eqcat>
%%%%%%%%%%%%%%%%%%% eqcat.def %%%%%%%%%%%%%%%%%%%%%%%%%%%
%% Foreign language support for the exerquiz package.  %%
%% Name of translator: Ramon Ballester                 %%
%% e-mail address: ramon.ballester@udg.es              %%
%% Language:  (catalan)                                %%
%%                                                     %%
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%

% The exercise label
\renewcommand\exlabel{Exercici}
% The value of this macro is written to \jobname.sol,
\renewcommand\exlabelsol{\exlabel}

% Title of exercise solution section
\renewcommand\exsectitle{Solucions als \exlabel s}
\renewcommand\exsecrunhead{\exsectitle} %% change to @ form

% Solution label for solutionafter option for exercise
\renewcommand\exsolafter{\textit{Soluci\'o}:}

% Title of short quiz solution section
\renewcommand\eq@sqslsectitle{Solucions als Tests}
\renewcommand\sqslsectitle{\eq@sqslsectitle}

% Running header/section title for solutions to short quizzes
\renewcommand\eq@sqslsecrunhead{Solucions als Tests}
% User access
\renewcommand\sqslsecrunhead{\eq@sqslsecrunhead}

% Label for solutions to short quizzes, appears in solutions sections
\renewcommand\eq@sqsllabel{%
   \string\textbf{Soluci\noexpand\'{o} al Test:}}
% User access
\renewcommand\sqsllabel{\eq@sqsllabel}

% Solution label for solutionafter option for shortquiz
\renewcommand\sqsolafter{\textit{Soluci\'o}:}

% Here is the default short quiz label.
\renewcommand\eq@sqlabel{\textcolor{red}{Test.}}
% User access to shortquiz label
\renewcommand\sqlabel{\eq@sqlabel}

% Here is the default short quiz return label
\renewcommand\eq@sqslrtnlabel{Final del Test}
% User access to shortquiz label
\renewcommand\sqslrtnlabel{\eq@sqslrtnlabel}

% Short quiz feedback messages
\renewcommand\eqsqrtmsg{"Correcte!"}
\renewcommand\eqsqwgmsg{"Incorrecte!"}

% Here is the default quiz label.
\renewcommand\eq@bqlabel{Inici del Test}
% User access to shortquiz label
\renewcommand\bqlabel{\eq@bqlabel}
% Used for writing JavaScript Messages on screen. Use PDFDocEncoding
\renewcommand\eq@bqlabelISO{\eq@bqlabel}
\renewcommand\bqlabelISO{\eq@bqlabel}

% Here is the default quiz label.
% No formatting allowed
\renewcommand\eq@eqlabel{Final del Test}
% User access to shortquiz label
\renewcommand\eqlabel{\eq@eqlabel}
%
% JavaScript Messages for Quiz Environments. Use PDFDocEncoding
%
\renewcommand\eq@Score{Punts:}\renewcommand\eq@OutOf{de}
\renewcommand\eqInitQuizMsg{"Has d'iniciar el Test! Prem sobre "+msg+"."}
\renewcommand\eqMadeChoice{%
    "Ja has elegit una resposta.
     La teva resposta ha estat ("+Responses[probno]+").
     Vols canviar--la?"}
%
% Default button labels for \eqButton
\renewcommand\eq@local@CA{Correctes}
\renewcommand\eq@local@RC{Les meves Respostes!}
\renewcommand\eq@local@AC{Si us plau!}
%</eqcat>
%    \end{macrocode}
%--------------------------------------------------------
%    \subsection{Czech}
%    \begin{macrocode}
%<*eqcz>
%%%%%%%%%%%%%%%%%%% eqcat.def %%%%%%%%%%%%%%%%%%%%%%%%%%%
%% Foreign language support for the exerquiz package.  %%
%% Name of translator: Robert Marik                    %%
%% e-mail address: marik@mendelu.cz                    %%
%% Language:  (czech)                                  %%
%%                                                     %%
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
\AtBeginDocument{\everyScoreField{\rectW{1.75in}}}

% The exercise label
\renewcommand\exlabel{Cvi\v{c}en\'{\i}}
% The value of this macro is written to \jobname.sol,
\renewcommand\exlabelsol{Cvi\noexpand\v{c}en\noexpand\'{\noexpand\i}}

% Title of exercise solution section
\renewcommand\exsectitle{\texorpdfstring{\v{R}e\v{s}en\'{\i} ke cvi\v{c}en\'{\i}m}
    {Resen\355{} ke cvicen\355m}} %% change to @ form
\renewcommand\exsecrunhead{\string\v{R}e\string\v{s}en\string\'{\string\i} ke cvi\string\v{c}en\string\'{\string\i}m}

% Solution label for solutionafter option for exercise
\renewcommand\exsolafter{\textit{\v{R}e\v{s}en\'\i}:}

% Title of short quiz solution section
\renewcommand\eq@sqslsectitle{\texorpdfstring{\v{R}e\v{s}en\'{\i} kv\'{\i}z\r{u}}{Resen\355{} kv\355zu}}
\renewcommand\sqslsectitle{\eq@sqslsectitle}

% Running header/section title for solutions to short quizzes
\renewcommand\eq@sqslsecrunhead{\v{R}e\v{s}en\'{\i} kv\'{\i}z\r{u}}
% User access
\renewcommand\sqslsecrunhead{\eq@sqslsecrunhead}

% Label for solutions to short quizzes, appears in solutions sections
\renewcommand\eq@sqsllabel{\string\textbf{\string\v{R}e\string\v{s}en\string\'{\string\i} kv\string\'{\string\i}zu:}}
% User access
\renewcommand\sqsllabel{\eq@sqsllabel}

% Solution label for solutionafter option for shortquiz
\renewcommand\sqsolafter{\textit{\v{R}e\v{s}en\'{\i}}:}

% Here is the default short quiz label.
\renewcommand\eq@sqlabel{\textcolor{red}{Kv\'{\i}z.}}
% User access to shortquiz label
\renewcommand\sqlabel{\eq@sqlabel}

% Here is the default short quiz return label
%\renewcommand\eq@sqslrtnlabel{Konec kv\string\'{\string\i}zu}
\renewcommand\eq@sqslrtnlabel{Zp\string\v{e}t na ot\string\'{a}zky}
% User access to shortquiz label
\renewcommand\sqslrtnlabel{\eq@sqslrtnlabel}

% Short quiz feedback messages
\renewcommand\eqsqrtmsg{"Spravne !"}
\renewcommand\eqsqwgmsg{"Spatne !"}

% Here is the default quiz label.
\renewcommand\eq@bqlabel{Zacatek kvizu}
% User access to shortquiz label
\renewcommand\bqlabel{\eq@bqlabel}
% Used for writing JavaScript Messages on screen. Use PDFDocEncoding
\renewcommand\eq@bqlabelISO{Zacatek kvizu}
\renewcommand\bqlabelISO{Zacatek kvizu}

% Here is the default quiz label.
% No formatting allowed
\renewcommand\eq@eqlabel{Konec kvizu}
% User access to shortquiz label
\renewcommand\eqlabel{\eq@eqlabel}
%
% JavaScript Messages for Quiz Environments. Use PDFDocEncoding
%
%\renewcommand\eq@Score{Hodnoceni:}
\renewcommand\eq@Score{}
\renewcommand\eq@OutOf{z celkovych}
\renewcommand\eqInitQuizMsg{%
  "Chcete-li pracovat s kvizem, musite jej nejprve spustit! Kliknete na "+msg+"."}
\renewcommand\eqMadeChoice{%
  "Uz jste si jednou odpoved vybral(a). Vase odpoved byla ("+Responses[probno]+").
   Chcete ji opravdu zmenit?"}
%
% Default button labels for \eqButton
\renewcommand\eq@local@CA{Opravit}
\renewcommand\eq@local@RC{odpovedi!}
\renewcommand\eq@local@AC{Prosim!}
% Messages for math fill-in questions
\renewcommand\eqerrABS{"Spatne uzavrena absolutni hodnota. Opravte prosim."}
\renewcommand\eqerrBadMathFunc{"Vyraz `"+aF[i]+"' neni ani definovanou funkci ani  " +", ani platnym matematickym vyrazem."}
\renewcommand\eqParens{"Zavorky (kulate)"}
\renewcommand\eqBrackets{"Hranate zavorky"}
\renewcommand\eqBraces{"Slozene zavorky"}
\renewcommand\eqerrDelimNotBal{aGroup[i][2] + " nejsou parove. Opravte je prosim."}
\renewcommand\eqerrBadExp{"Spatny matematicky vyraz - problem v nekterem exponentu. Opravte jej prosim."}
\renewcommand\eqerrUnfinishQuiz{"Chyba: Nektery kviz mate nedokonceny. Musite jej dokoncit, nez budete pokracovat u dalsiho kvizu. Pokud si nepamatuje, ktery kviz jste nechali rozpracovany, zavrete cely soubor, znovu jej otevrete a k testu, ktery chcete vyplnovat, se vratte."}
\renewcommand\noPeekMsg{"Prohlizeni reseni neni povoleno pred dokoncenim kvizu!"}
\renewcommand\highThresholdMsg{"Musite odpovedet na vsechny otazky, nez ukoncite kviz."}
\renewcommand\eqSyntaxErrorUndefVar{"Chyba: Pravdepodobne pouzivate nespravnou promennou nebo mate preklep ve jmenu nektere funkce."}
\renewcommand{\promptButtonMsg}{%
        "Chcete ted videt spravnou odpoved? "\r\t\t
        + "Hodnocena bude Vase soucasna odpoved. "\r\t\t
        + "Kliknete-li na \\"Yes\\", uvidite spravnou odpoved, ale svou stavajici
           odpoved na tuto otazku uz nebudete moct zmenit."
}
%</eqcz>
%    \end{macrocode}
%    \subsection{brazil}
%    \begin{macrocode}
%<*eqbr>
%%%%%%%%%%%%%%%%%%% eqbr.def %%%%%%%%%%%%%%%%%%%%%%%%%%%
%% Foreign language support for the exerquiz package. %%
%% Name of translator: Koichi Sameshima               %%
%% e-mail address: ksameshi@usp.br                    %%
%% Language:  (brazil)                                %%
%%                                                    %%
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%

% The exercise label
\renewcommand\exlabel{Exerc\texorpdfstring{\'{\i}}{\string\355}cio}
% The value of this macro is written to \jobname.sol,
\renewcommand\exlabelsol{Exerc\string\'{\string\i}cio}

% Title of exercise solution section
\renewcommand\exsectitle{Solu\texorpdfstring{\c{c}}{\string\347}\texorpdfstring{\~{o}}{%
    \string\365}es dos  Exerc\texorpdfstring{\'{\i}}{\string\355}cios}
    %{Solu\string\\347\string\\363es dos Exerc\string\\355cios}}
\renewcommand\exsecrunhead{%
    Solu\noexpand\c{c}\noexpand\~{o}es dos Exerc\noexpand\'{i}cios} %% change to @ form

% Solution label for solutionafter option for exercise
\renewcommand\exsolafter{\textit{Solu\c{c}\~{a}o}:}

% Title of short quiz solution section
\renewcommand\eq@sqslsectitle{Solu\c{c}\~{o}es dos Testes}
\renewcommand\sqslsectitle{\eq@sqslsectitle}

% Running header/section title for solutions to short quizzes
\renewcommand\eq@sqslsecrunhead{Solu\noexpand\c{c}\noexpand\~{o}es dos Testes}
% User access
\renewcommand\sqslsecrunhead{\eq@sqslsecrunhead}

% Label for solutions to short quizzes, appears in solutions sections
\renewcommand\eq@sqsllabel{%
  \string\textbf{Solu\noexpand\c{c}\noexpand\~{a}o do Teste:}}
% User access
\renewcommand\sqsllabel{\eq@sqsllabel}

% Solution label for solutionafter option for shortquiz
\renewcommand\sqsolafter{\textit{Solu\noexpand\c{c}\noexpand\~{a}o}:}

% Here is the default short quiz label.
\renewcommand\eq@sqlabel{\textcolor{red}{Teste.}}
% User access to shortquiz label
\renewcommand\sqlabel{\eq@sqlabel}

% Here is the default short quiz return label
\renewcommand\eq@sqslrtnlabel{Finaliza Teste}
% User access to shortquiz label
\renewcommand\sqslrtnlabel{\eq@sqslrtnlabel}

% Short quiz feedback messages
\renewcommand\eqsqrtmsg{"Correto!"}
\renewcommand\eqsqwgmsg{"Incorreto!"}

% Here is the default quiz label.
\renewcommand\eq@bqlabel{Inicia Teste}
% User access to shortquiz label
\renewcommand\bqlabel{\eq@bqlabel}
% Used for writing JavaScript Messages on screen. Use PDFDocEncoding
\renewcommand\eq@bqlabelISO{\eq@bqlabel}
\renewcommand\bqlabelISO{\eq@bqlabel}

% Here is the default quiz label.
% No formatting allowed
\renewcommand\eq@eqlabel{Finaliza Teste}
% User access to shortquiz label
\renewcommand\eqlabel{\eq@eqlabel}
%
% JavaScript Messages for Quiz Environments. Use PDFDocEncoding
%
\renewcommand\eq@Score{Pontos:}\renewcommand\eq@OutOf{de}
\renewcommand\eqInitQuizMsg{% ******
   "Voc\string\352 precisa iniciar o Teste! Clique sobre "+msg+"."}
\renewcommand\eqMadeChoice{%
   "Voc\string\352 j\string\341 respondeu.
    Sua resposta foi ("+Responses[probno]+").
    Quer alter\string\341-la?"}
%
% Default button labels for \eqButton
\renewcommand\eq@local@CA{Corretas}
\renewcommand\eq@local@RC{Minhas Respostas!}
\renewcommand\eq@local@AC{Por Favor!}
%</eqbr>
%    \end{macrocode}
%  \Finale
\endinput