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

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

\university{OKALOOSA-WALTON COLLEGE\\
   Department of Mathematics}
\email{dpstory@acrotex.net}
\version{3.0}
\copyrightyears{1999-\the\year}
\nocopyright
\revisionLabel{}

\sqTurnOffAlerts
%\sqCorrections

% Uncomment this to obtain external links to exercise solutions.
% \exerSolnsInExtFile[../]{extSolns/eqSol}

% To insert a message on the cover page, uncomment the lines below,
% and insert the 'nodirectory' option into the web package line above.
\usepackage{pifont}
\renewcommand\optionalpagematter{\par\minimumskip\vspace{\stretch{1}}
    \begin{center}
    \fcolorbox{blue}{webyellow}{
    \begin{minipage}{.67\linewidth}
    \noindent\textcolor{red}{\textbf{Legend:}} In \hyperref[s:corrections]
    {Section~\ref*{s:corrections}}, a \textcolor{red}{\ding{52}}
    indicates that the student gave the correct response; a
    \textcolor{red}{\ding{56}}, indicates an incorrect response,
    in this case, the correct answer is marked with a \textcolor{webgreen}
    {\ding{108}}.
    \end{minipage}}
    \end{center}
}

\newcounter{probno}[section]
\renewcommand{\theprobno}{\thesection.\arabic{probno}}
%
% Define a problem environment with its own counter.
\newenvironment{problem}{%
\renewcommand\exlabel{Problem}
\renewcommand\exlabelformat{\textbf{\exlabel\ \theprobno.}}
\renewcommand\exsllabelformat
   {\noexpand\textbf{\exlabel\ \theprobno.}}
\renewcommand\exrtnlabelformat{$\blacktriangleleft$}
\renewcommand\exsecrunhead{Solutions to Problems}
\begin{exercise}[probno]}
{\end{exercise}}


% Define a example environment with no counter
\newenvironment{example}{%
\renewcommand\exlabel{Example}
\renewcommand\exlabelformat{\textbf{\exlabel.}}
\renewcommand\exrtnlabelformat{$\square$}
\SolutionsAfter
\begin{exercise}[0]}%
{\end{exercise}}

%\makeatletter
%\renewcommand\eq@beginQuiz{\eq@BeginQuizButton}
%\renewcommand\eq@endQuiz{\eq@EndQuizButton}
%\makeatother

\def\useFullWidthForPaper{%
    \ifeqforpaper
    \setlength{\textwidth}{6.5in}
    \setlength{\textheight}{8.5in}
    \oddsidemargin=0pt
    \evensidemargin=0pt
    \marginparsep=0pt
    \marginparwidth=0pt
    \fi
}
\useFullWidthForPaper

\begin{document}

\maketitle

\tableofcontents

\section{Introduction}

This is a sample file to give templates of the environments
defined in \texttt{exerquiz}. The file illustrates the
\texttt{exercise}, the \texttt{shortquiz} and \texttt{quiz}
environments.

In the case of the quiz environments, only multiple-choice
questions are illustrated. Open ended, or objective style
questions are demonstrated in other sample files.

\section{Online Exercises}

A well-designed sequences of exercises can be of aid to the
student.  The \texttt{exercise} environment makes it easy to
produce electronic exercises.  By using the \texttt{forpaper}
option, you can also make a paper version of your exercises.
See the \texttt{Webeqman.pdf} reference manual.

\begin{exercise}
Evaluate the integral \(\displaystyle\int x^2 e^{2x}\,dx\).
\begin{solution}
We evaluate by \texttt{integration by parts}:\normalsize
\begin{alignat*}{2}
 \int x^2 e^{2x}\,dx &
   = \tfrac12 x^2 e^{2x} - \int x e^{2x}\,dx &&\quad
           \text{$u=x^2$, $dv=e^{2x}\,dx$}\\&
   = \tfrac12 x^2 e^{2x} -
           \Bigl[\tfrac12 x e^{2x}-\int \tfrac12 e^{2x}\,dx\Bigr] &&\quad
           \text{integration by parts}\\&
   = \tfrac12 x^2 e^{2x} - \tfrac12 x e^{2x} + \tfrac12\int e^{2x}\,dx &&\quad
           \text{$u=x^2$, $dv=e^{2x}\,dx$}\\&
   = \tfrac12 x^2 e^{2x} - \tfrac12 x e^{2x} + \tfrac14 e^{2x} &&\quad
           \text{integration by parts}\\&
   = \tfrac14(2x^2-2x+1)e^{2x} &&\quad
           \text{simplify!}
\end{alignat*}
\end{solution}
\end{exercise}

In the preamble of this document, we defined a \texttt{problem}
environment with its own counter.  Here is an example of it.

\begin{problem}
Is $F(t)=\sin(t)$ an antiderivative of $f(x)=\cos(x)$?  Explain
your reasoning.
\begin{solution}
The answer is yes. The definition states that $F$ is an
antiderivative of $f$ if $F'(x)=f(x)$.  Note that
$$
       F(t)=\sin(t) \implies F'(t) = \cos(t)
$$
hence, $F(x) = \cos(x) = f(x)$.
\end{solution}
\end{problem}

\begin{problem}
Is $F(t)=\sin(t)$ an antiderivative of $f(x)=\cos(x)$?  Explain
your reasoning.
\begin{solution}
The answer is yes. The definition states that $F$ is an
antiderivative of $f$ if $F'(x)=f(x)$.  Note that
$$
       F(t)=\sin(t) \implies F'(t) = \cos(t)
$$
hence, $F(x) = \cos(x) = f(x)$.
\end{solution}
\end{problem}

\noindent By modifying the \texttt{exercise} environment, you can
also create an \texttt{example} environment.  The one defined in
the preamble of this document has no associated counter.

\begin{example}
Give an example of a set that is \textit{clopen}.
\begin{solution}
The real number line is both closed and open in the
usual topology of the real line.
\end{solution}
\end{example}


There is a \texttt*-option with the \texttt{exercise} environment,
using it signals the presence of a multiple part exercise
question. The following exercise illustrates this option.

\begin{exercise}*\label{ex:parts}
Suppose a particle is moving along the $s$-axis, and that its position
at any time $t$ is given by $s=t^2 - 5t + 1$.
\begin{parts}
\item[h]\label{item:part} Find the velocity, $v$, of the particle at any time
$t$.
\begin{solution}
Velocity is the rate of change of position with respect to time. In
symbols:
$$
                    v = \frac{ds}{dt}
$$
For our problem, we have
$$
        v = \frac{ds}{dt} =\frac d{dt}(t^2 - 5t + 1) = 2t-5.
$$
The velocity at time $t$ is given by $\boxed{v=2t-5}$.
\end{solution}

\item Find the acceleration, $a$, of the particle at any time $t$.
\begin{solution}
Acceleration is the rate of change of velocity with respect to time.
Thus,
$$
                    a = \frac{dv}{dt}
$$
For our problem, we have
$$
        a = \frac{dv}{dt} =\frac d{dt}(2t-5)=2.
$$
The acceleration at time $t$ is constant: $\boxed{a=2}$.
\end{solution}
\end{parts}
\end{exercise}

References can be made to a particular part of an exercise; for example,
``see \hyperref[item:part]{Exercise~\ref*{ex:parts}(\ref*{item:part})}.''
Part (a) is in \textcolor{webblue}{blue}; the solutions for that part is
``hidden''.  This is a new option for the \texttt{exercise} environment.

There is now an option for listing multipart question in tabular form.
This problem style does not obey the \texttt{solutions\-after} option.

\begin{exercise}*
Simplify each of the following expressions in the complex number
system. \textit{Note}: $\bar z$ is the conjugate of $z$;
$\operatorname{Re} z$ is the real part of $z$ and
$\operatorname{Im} z$ is the imaginary part of $z$.
\begin{parts}[2]
\item $i^2$
\begin{solution} $i^2 = -1$ \end{solution}
&
\item $i^3$ \begin{solution} $i^3 = i i^2 = -i$\end{solution}
\\
\item $z+\bar z$
\begin{solution} $z+\bar z=\operatorname{Re} z$\end{solution}
&
\item[h] $1/z$
\begin{solution}
$\displaystyle\frac 1z=\frac 1z\frac{\bar z}{\bar z}=\frac z{z\bar z}=\frac z{|z|^2}$
\end{solution}
\end{parts}
\end{exercise}

\section{Short Quizzes with or without Solutions}


Short quizzes are quizzes with immediate response. As soon as the
user enters an answer, that answer is immediately evaluated, the
results of the evaluation are communicated to the user.

Solutions can optionally be included in each question. Below is a
\texttt{shortquiz} without solution.

\begin{shortquiz}
Was it in Xanadu did Kubla Kahn a stately pleasure dome
decree?
\begin{answers}{4}
\bChoices
    \Ans1 True\eAns
    \Ans0 False\eAns
\eChoices
\end{answers}
\end{shortquiz}

Below is a \texttt{shortquiz} with a solution.

\begin{shortquiz}*[KublaKhan]
In what year did Columbus sail the ocean blue?
\begin{answers}[qz:columbus1]{4}
\bChoices
    \Ans0 1490\eAns
    \Ans0 1491\eAns
    \Ans1 1492\eAns
    \Ans0 1493\eAns
\eChoices
\end{answers}
\begin{solution}
\begin{quote}
  In 1492, \\
  Columbus sailed the ocean blue.

  Profound was the logic in his quest,\\
  to get to the east, he headed west.\footnote{This poem was obtained by personal
  communication from Leonard A. Stefanski,
Department of Statistics, North Carolina State University.}
\end{quote}
\end{solution}
\end{shortquiz}

These two types can be bundled together using the
\texttt{questions} environment.

\begin{shortquiz}
Answer each of the following. Passing is 100\%.

\begin{questions}

\item Was it in Xanadu did Kubla Kahn a stately pleasure dome
decree?
\begin{answers}{4}
\Ans1 True & \Ans0 False \\
\end{answers}

\item In what year did Columbus sail the ocean blue?
\begin{answers}[qz:columbus2]{4}
\Ans0 1490 &\Ans0 1491 &\Ans1 1492 &\Ans0 1493
\end{answers}
\begin{solution}
\begin{quote}
  In 1492, \\
  Columbus sailed the ocean blue.

  Profound was the logic in his quest,\\
  to get to the east, he headed west.\footnote{This poem was obtained by personal
  communication from Leonard A. Stefanski,
Department of Statistics, North Carolina State University.}
\end{quote}
\end{solution}
\end{questions}
\end{shortquiz}

Try using the \texttt{proofing} option of \textsf{exerquiz}. In this
case, the correct answer is indicated to the side; useful, perhaps, for
proof-reading the document


\section{Graded Quizzes with JavaScript}

\CorrectionsOff % Don't want corrections for these two quizzes.

You can create graded quizzes using the \texttt{quiz} environment.
Here is a graded quiz using simple links.  This might be suitable for a
limited number of questions.

\begin{quiz}{qzdiscr1} Using the discriminant, $b^2-4ac$, respond to each of the
following questions.

\begin{questions}
\item Is the quadratic polynomial $x^2-4x + 3$ irreducible?
\begin{answers}{4}
\Ans0 Yes & \Ans1 No
\end{answers}
\item Is the quadratic polynomial $2x^2 - 4x + 3 $ irreducible?
\begin{answers}{4}
\Ans1 Yes &\Ans0 No
\end{answers}
\item How many solutions does the equation $2x^2 - 3x - 2= 0$ have?
\begin{answers}{4}
\Ans0 none &\Ans0 one &\Ans1 two
\end{answers}
\end{questions}
\end{quiz}

\ScoreField{qzdiscr1}

% \medskip
% By  using the \texttt*-option, you can create a multiple choice
% set of question using check boxes.

\begin{quiz}*{qzdiscr2}
Using the discriminant, $b^2-4ac$, respond to each of the
following questions.

\begin{questions}
\item Is the quadratic polynomial $x^2-4x + 3$ irreducible?
\begin{answers}{4}
\Ans0 Yes &\Ans1 No
\end{answers}
\item Is the quadratic polynomial $2x^2 - 4x + 3 $ irreducible?
\begin{answers}{4}
\Ans1 Yes &\Ans0 No
\end{answers}
\item How many solutions does the equation $2x^2 - 3x - 2= 0$ have?
\begin{answers}{4}
\Ans0 none &\Ans0 one &\Ans1 two
\end{answers}
\end{questions}
\end{quiz}\quad\ScoreField\currQuiz

\medskip
The \texttt{proofing} option of \textsf{exerquiz} can be used to mark
the correct answer to the side; useful, perhaps, for proof-reading the
document


\section{Correcting Quizzes with JavaScript}\label{s:corrections}

\CorrectionsOn  % Now we want corrections

Beginning with version 1.2 of \textsf{exerquiz}, you can now grade
the quizzes created by the \texttt{quiz} environment.
In this section, we illustrate the \texttt{quiz} environment with
corrections.

There are two types: link-style and form-style.
This is the link-style format:

\begin{quiz}{qzTeXl} Answer each of the following. Passing
is 100\%.
\begin{questions}
\item Who created \TeX?
\begin{answers}4
\Ans1 Knuth &\Ans0 Lamport &\Ans0 Carlisle &\Ans0 Rahtz
\end{answers}
\item Who originally wrote \LaTeX?
\begin{answers}4
\Ans0 Knuth &\Ans1 Lamport &\Ans0 Carlisle &\Ans0 Rahtz
\end{answers}
\end{questions}
\end{quiz}

\ScoreField\currQuiz\eqButton\currQuiz

\medskip
We can obtain the forms-style quiz simply by inserting an \texttt*
before the quiz field name.
\textcolor{red}{Important!}  Be sure to name each quiz field
differently!

%\previewtrue

\begin{quiz}*{qzTeXf} Answer each of the following. Passing
is 100\%.
\begin{questions}
\item Who created \TeX?
\begin{answers}*{4}
\Ans1 Knuth &\Ans0 Lamport &\Ans0 Carlisle &\Ans0 Rahtz
\end{answers}
\begin{solution}
Yes, it was Donald Knuth who first created \TeX.
\end{solution}
\item Who originally wrote \LaTeX?
\begin{answers}*{4}
\Ans0 Knuth &\Ans1 Lamport &\Ans0 Carlisle &\Ans0 Rahtz
\end{answers}
\begin{solution}
Yes, it was Leslie Lamport who first created \TeX.
\end{solution}
\end{questions}
\end{quiz}\quad\ScoreField\currQuiz\eqButton\currQuiz

The ``corrections'' button can be modified to suite your needs.
The quiz below queries your knowledge of the people who maintain
various freeware \TeX\ Systems for \textsc{unix} and Win95/98/NT.
The corrections button has been modified to take on a different
look.

\begin{quiz}*{qzTeXc} Answer each of the following. Passing
is 100\%.
\begin{questions}
\item What \TeX\ System does Thomas Esser maintain?
\begin{answers}4
\Ans0 Mik\TeX &\Ans0 cs\TeX &\Ans1 te\TeX &\Ans0 fp\TeX
\end{answers}
\item What \TeX\ System does Fabrice Popineau maintain?
\begin{answers}4
\Ans0 Mik\TeX &\Ans0 cs\TeX &\Ans0 te\TeX &\Ans1 fp\TeX
\end{answers}
\item What \TeX\ System does Christian Schenk maintain?
\begin{answers}4
\Ans1 Mik\TeX &\Ans0 cs\TeX &\Ans0 te\TeX &\Ans0 fp\TeX
\end{answers}
\end{questions}
\end{quiz}\quad
\ScoreField{qzTeXc}%
   \eqButton[\BC{0 0 1}         %  blue border color
   \CA{TeX}                     %  Button text
   \RC{Users}                   %  rollover text
   \AC{Group}                   %  pushed text
   \DA{/TiRo 10 Tf 0 0 1 rg}    % times roman, 10 pt, blue text
   \W{1}\S{I}                   % border width 1, inset button
   ]{qzTeXc}

\section{Objective-Style Questions}

Beginning with version~2 of \textsf{Exerquiz}, it is possible to
pose objective-style questions (fill-in-the-blank). The demo file
for this style question is called
\href{http://www.math.uakron.edu/~dpstory/tutorial/webeq/jquiztst.pdf}{jquiztst.pdf}
(relative link: \href{jquiztst.pdf}{jquiztst.pdf}).
Click on the link to review this demo file.

\end{document}
