\documentclass{article}
\usepackage{amsmath}
\usepackage[nodirectory,tight]{web}  % dvipsone, dvips, pdftex, dvipdfm
\usepackage{exerquiz}
\usepackage{pifont}

\title{\texorpdfstring{Web and Exerquiz Packages\\ Test File}
   {Web and Exerquiz Packages Test File}}
\author{D. P. Story}
\subject{File to test web and exerquiz packages}
\keywords{LaTeX, hyperref, PDF, exercises, quizzes}

\university{THE UNIVERSITY OF AKRON\\
   Mathematics and Computer Science}
\email{dpstory@uakron.edu}
\version{1.30}
\copyrightyears{1999-2000}

%
% Insert a message on the cover page
%
\renewcommand\optionalpagematter{\vfill
    \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}
\SolutionsAtEnd}



\begin{document}
\maketitle
\tableofcontents


\section{Introduction}

This is a sample file to give templates of the environments
defined in \texttt{exerquiz}.

\section{On-Line 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 &
   = \frac12 x^2 e^{2x} - \int x e^{2x}\,dx &&\quad
           \text{$u=x^2$, $dv=e^{2x}\,dx$}\\&
   = \frac12 x^2 e^{2x} -
           \left[\frac12 x e^{2x}-\int \frac12 e^{2x}\,dx\right] &&\quad
           \text{integration by parts}\\&
   = \frac12 x^2 e^{2x} - \frac12 x e^{2x} + \frac12\int e^{2x}\,dx &&\quad
           \text{$u=x^2$, $dv=e^{2x}\,dx$}\\&
   = \frac12 x^2 e^{2x} - \frac12 x e^{2x} + \frac14 e^{2x} &&\quad
           \text{integration by parts}\\&
   = \frac14(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}


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}


\section{Short Quizzes with/without Solutions}

Below is a \texttt{shortquiz} without solution.

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

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

\begin{shortquiz}
In what year did Columbus sail the ocean blue?
\begin{answers}[qz:columbus1]{4}
\Ans0 1490 &\Ans0 1491 &\Ans1 1492 &\Ans0 1493
\end{answers}
\begin{solution}
Columbus sailed the ocean blue in 1492.
\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}
Columbus sailed the ocean blue in 1492.
\end{solution}
\end{questions}
\end{shortquiz}

\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.  Might be suitable for a
limited number of questions.

\begin{quiz}{qz:discr1} 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{qz:discr1}

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

\begin{quiz}*{qz:discr2}
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{qz:discr2}


\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}{qz:TeX-l} 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{qz:TeX-l}\raisebox{3.5pt}{\eqButton{qz:TeX-l}}

\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!

\begin{quiz}*{qz:TeX-f} 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}\quad
\raisebox{-2pt}{\ScoreField{qz:TeX-f}\raisebox{3.5pt}{\eqButton{qz:TeX-f}}}


\medskip
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}*{qz:TeX-c} 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
\raisebox{-2pt}{\ScoreField{qz:TeX-c}\raisebox{3.5pt}{%
   \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
   \BS{/W 1 /S /I}%      % border width 1, inset button
   ]{qz:TeX-c}}}


\end{document}
