\documentclass{article}
\usepackage{amsmath}
\usepackage{graphicx}
\usepackage[dvipsone,tight,designvi,nodirectory]{web}  % dvipsone, dvips, pdftex, dvipdfm
\usepackage[execJS]{exerquiz} %[preview,proofing]{exerquiz}
\usepackage{multicol}

\title{\texorpdfstring{Acro\!\TeX}{AcroTeX} Bundle Test File\texorpdfstring{\\}{: }
    Multiple Choice with Partial Credit}
\author{D. P. Story}
\subject{File to test web and exerquiz packages}
\keywords{LaTeX, hyperref, PDF, exercises, quizzes}

\university{THE UNIVERSITY OF AKRON\\
   Theoretical and Applied Mathematics}
\email{dpstory@uakron.edu}
\version{3.0}
\copyrightyears{1999-\the\year}

\makeatletter
\let\web@copyright=\@gobble
\renewcommand\eq@sqsllabel{{\string\color{blue}\string\textbf{Solution to
\ifcase\@eqquestiondepth\or\arabic{eqquestionnoi}.\or\arabic{eqquestionnoi}(\alph{eqquestionnoii})\or
\arabic{eqquestionnoi}(\alph{eqquestionnoii})(\roman{eqquestionnoiii}).\fi}}}
\makeatother

\newenvironment{eqComments}[1][\strut]
{\medskip\leftskip-\labelwidth \noindent\textbf{\textcolor{blue}{#1}}}{\par\vspace{\smallskipamount}}

% reduce amount of vspace before and after multicols environment
\setlength{\multicolsep}{6pt plus 4pt minus 1.5pt}

%\sqTurnOffAlerts
%\sqCorrections
\useBeginQuizButton[\BC{}\textColor{1 0 0 rg}\CA{Start}\RC{}\AC{}] % use buttons
\useEndQuizButton[\BC{}\textColor{1 0 0 rg}\CA{End}\RC{}\AC{}]

% I want to give each of these field a unique name. If there are nested questions environment,
% the qMark fields may not have a unique name unless I include an additional counter.
\newcounter{qMarkCnt}
\def\qMark{\textField[\Ff\FfReadOnly\BC{}\F\FHidden\textColor{1 0 0 rg}\textSize{0}\autoCenter{n}\DV{0 pts}\V{0 pts}]%
    {qMark.\currQuiz.\thequestionno.\arabic{qMarkCnt}}{11bp}{8bp}%
\stepcounter{qMarkCnt}}
\makeatletter
\renewcommand{\prior@questionsHook}{\makebox[0pt][r]{\qMark\hspace{-2pt}}}
\makeatother

% Acrobat 5.0 or higher required
\begin{execJS}{execjs}
var i, f, g, str1, str2;
f = this.getField("qMark");
g = f.getArray();
var deleteThese = new Array()
for ( i = 0; i< g.length-1; i++ )
{
    str1 = g[i].name.substring(0, g[i].name.lastIndexOf("."));
    str2 = g[i+1].name.substring(0, g[i+1].name.lastIndexOf("."));
    if ( str1 == str2 ) deleteThese.push( g[i].name );
}
for ( i=0; i < deleteThese.length; i++ ) this.removeField( deleteThese[i] );
app.execMenuItem("Save");
\end{execJS}

\PTsHook{($\eqPTs^{\text{pts}}$)}

\NoPeeking

\begin{document}

\maketitle

% With the *-option, this quiz would use form boxes by default for multiple
% choice questions.
\begin{quiz}*{qzTeXf} Answer each of the following. Passing
is 100\%.

\begin{questions}

\everymath{\displaystyle}

\useLinks

\item\PTs{10}\QT{limits} Which limits have a value of $-\infty$?
\begin{answers}{3}
\Ans[1]{0} $\lim_{x\to-\pi/2^-}\sec(x)$ &
\Ans[1]{0} $\lim_{x\to5^-}\frac{6}{x-5}$ &
\Ans{0} A, C  and F \\
%
\Ans{0} $\lim_{x\to-\pi/2^+}\sec(x)$ &
\Ans{0} $\lim_{x\to5^+}\frac{6}{x-5}$ &
\Ans[6]{0} A, C and E \\
%
\Ans[1]{0} $\lim_{x\to-\pi/2^+}\tan(x)$ &
\Ans[1]{0} $\lim_{x\to5^+}\frac{6}{5-x}$ &
\Ans[10]{1} A, C, G, and E \\
%
\Ans{0} $\lim_{x\to+\pi/2^-}\sec(x)$ &
\Ans{0} A and C &
\Ans[4]{0} A, C, F and E \\
%
\Ans{0} None of these
\end{answers}

\begin{eqComments}
Now let's pose another multiple-choice question with forms, the
default for this quiz, in the absence of a \verb+\useLinks+
command.
\end{eqComments}

\item\PTs{2} Is the quadratic polynomial $x^2-4x + 3$ irreducible?
\begin{answers}4
\Ans0 Yes &\Ans1 No
\end{answers}

\NewPage % defined in web.sty

\begin{eqComments}
The following question was taken from a demo quiz, published by
\href{http://webwork.math.rochester.edu/} {\textsf{WebWork}}, the
University of Rochester.
\end{eqComments}

\item \PTs{15} In questions~(\ref*{velfirst})--(\ref*{vellast}), a particle moves
along a straight line and its position at time $t$ is given by
$s(t) = 2t^3 - 15 t^2 + 24 t$, where $s$ is measured in feet and $t$ in
seconds.

    \begin{questions}

    \item\PTs*{3}\QT{velocity}\label{velfirst} Find the velocity (in
    ft/sec) of the particle at time $t=0$:\\[1ex]
    $
        v = \RespBoxMath{24}*{1}{.0001}24\CorrAnsButton{24}
    $
    \begin{solution}
    We have $v(t) = s'(t) = 6t^2 - 30 t + 24 = 6 ( t^2 - 5t + 4 )$ and so
    $v(0) = 6(4) = \boxed{24}$.
    \end{solution}

    \item The particle stops moving (i.e.\ is in a rest) twice, once
    when $t=A$ and again when $t=B$ where $A < B$. Then\dots\smallskip

    \begin{questions}
    \begin{multicols}{2}
        \item $\PTs*{2}\QT{velocity}A= \RespBox[\rectW{.5in}]{1}*{1}{.0001}24\CorrAnsButton{1}$
            \begin{solution}
            From the solution to \hyperref[velfirst]{(\ref*{velfirst})}, we have
            \begin{equation*}
                v(t) = s'(t) = 6 ( t^2 - 5t + 4 ) = 6 (t-1)(t-4)
            \end{equation*}
            It is clear that $\boxed{A = 1}$ and $B=4$.
            \end{solution}
        \item $\PTs*{3}B=\RespBox[\rectW{.5in}]{4}*{1}{.0001}24\CorrAnsButton{4}$
            \begin{solution}
            From the solution to \hyperref[velfirst]{(\ref*{velfirst})}, we have
            \begin{equation*}
                v(t) = s'(t) = 6 ( t^2 - 5t + 4 ) = 6 (t-1)(t-4)
            \end{equation*}
            It is clear that $A = 1$ and $\boxed{B=4}$.
            \end{solution}
    \end{multicols}
    \end{questions}
    \item\PTs*{2}\QT{velocity}\QT{position} What is the position of the particle at time $10$?\\[1ex]
    $s = \RespBox{740}*{1}{.0001}24\CorrAnsButton{740}$
    \begin{solution}
    We have
    \begin{align*}
        s(t) &=   2t^3 - 15 t^2 + 24 t = t ( t^2 - 15 t + 24) \\
        s(10) &= 10 ( 100 - 150 + 24 ) = 10 ( 74 ) = \boxed{ 740 }
    \end{align*}
    \end{solution}

    \item\PTs*{5}\QT{distance}\label{vellast} Finally, what is the \textbf{total} distance
    the particle travels between time $0$ and time $10$?\\[1ex]
    $
        \text{distance} = \RespBox{794}{1}{.0001}24\CorrAnsButton{794}
    $
    \end{questions}
\end{questions}
\end{quiz}\quad\PointsField\currQuiz\eqButton\currQuiz

\vfill
\noindent Answers: \AnswerField\currQuiz\hfill


\end{document}
