From 26f4947f509c2440ce28e625133a15f6a2446920 Mon Sep 17 00:00:00 2001 From: Norbert Preining Date: Thu, 13 Sep 2018 10:28:30 +0900 Subject: update acrotex --- texmf-dist/doc/latex/acrotex/aeb_man.tex | 12349 +++++++++++++++++++++++++++++ 1 file changed, 12349 insertions(+) create mode 100644 texmf-dist/doc/latex/acrotex/aeb_man.tex (limited to 'texmf-dist/doc/latex/acrotex/aeb_man.tex') diff --git a/texmf-dist/doc/latex/acrotex/aeb_man.tex b/texmf-dist/doc/latex/acrotex/aeb_man.tex new file mode 100644 index 00000000..8798115e --- /dev/null +++ b/texmf-dist/doc/latex/acrotex/aeb_man.tex @@ -0,0 +1,12349 @@ +\RequirePackage[!use=preview,!use=usebw]{spdef} +\documentclass{article} +%\usepackage{makeidx,showidx} +\usepackage[fleqn]{amsmath} +\usepackage[% + web={centertitlepage,designv, + forcolorpaper,latextoc,pro}, + exerquiz={nocorrections},aebxmp, + dljslib={ImplMulti,limitArith,nodec,satisfyEq} +]{aeb_pro} +%\usepackage{myriadpro} +\usepackage[altbullet]{lucidbry} +\usepackage{aeb_mlink} +\usepackage{longtable,colortbl} +\usepackage{graphicx} +\usepackage{multicol} +\usepackage{collectbox} + +\usepackage{xbmks} +\DeclareInitView{layoutmag={navitab:UseOutlines}} +\xbmksetup{colors={int=red},styles={intbf}} + + + +\newbox\aebbox + +\usepackage{acroman} +\usepackage[active]{srcltx} + +\setcounter{secnumdepth}{4} +\setcounter{tocdepth}{4} + + +\def\AcroBlog{{Acro\!\TeX} Blog} + +\makeatletter +\def\chgCurrLblName#1{\def\@currentlabelname{#1}} +\let\gob\@gobble +\renewcommand*\l@subsection{\@dottedtocline{2}{2em}{3.5em}} +\renewcommand*\l@subsubsection{\@dottedtocline{4}{5.5em}{1.5em}} +\renewcommand\@pnumwidth{2.55em} +\renewcommand*\l@section[2]{% + \ifnum \c@tocdepth >\z@ + \addpenalty\@secpenalty + \addvspace{1.0em \@plus\p@}% + \setlength\@tempdima{2em}%{1.5em}% + \begingroup + \parindent \z@ \rightskip \@pnumwidth + \parfillskip -\@pnumwidth + \leavevmode \bfseries + \advance\leftskip\@tempdima + \hskip -\leftskip + #1\nobreak\hfil \nobreak\hb@xt@\@pnumwidth{\hss #2}\par + \endgroup + \fi} +\makeatother + + +%\usepackage[usecmtt]{myriadpro} + +%\margins{.25in}{.25in}{24pt}{.25in} % left,right,top, bottom +%\screensize{4.19in}{4.67in} % height, width + +%\margins{.5in}{.25in}{24pt}{.25in} % left,right,top, bottom +%\screensize{4.19in}{4.92in} % height, width + +%\hoffset=20pt + +\setlongtables +\LTpre=0pt %\medskipamount +\LTpost=-2\medskipamount +%\LTpost=0pt %\medskipamount +\setlength{\mathindent}{20pt} + +\def\AEBBook{\textsl{{Acro\!\TeX} eDucation System Tools: {\LaTeX} for interactive PDF documents}} + + +%\usepackage{makeidx} +%\makeindex +%\usepackage[active]{srcltx} + +%\DeclareFontFamily{U}{wi}{} +%\DeclareFontShape{U}{wi}{m}{n}{<-> wingding}{} +%\DeclareFontFamily{U}{webd}{} +%\DeclareFontShape{U}{webd}{m}{n}{<-> webdings}{} + +%\font\zqacr=zqacr at 8pt + +\makeatletter + +\renewcommand\exlabelformat{{\exlabel\ \theeqexno.}} +\renewcommand\exlabelformatwp{{\exlabel\ \theeqexno.}} + +%\def\changelinkcolorto#1{\def\@linkcolor{#1}} +%\useFullWidthForPaper +\newdimen\totaltextwidth +\totaltextwidth=\fullscreenwidth +\advance\totaltextwidth\oddsidemargin +\renewcommand{\webheadwrapper}[1]{% + \hspace{-\oddsidemargin}% + \makebox[\totaltextwidth][s]{#1}\hss +} + +%\sectionLayout{indent=-62.5pt,fontsize=large} +%\subsectionLayout{indent=-31.25pt} +%\subsubsectionLayout{indent=0pt} + +\renewcommand\hproportionwebtitle{.75} +\universityLayout{fontsize=Large,fontfamily=sffamily} +\titleLayout{fontsize=LARGE,fontfamily=sffamily} +\authorLayout{fontsize=Large,fontfamily=sffamily} +\tocLayout{fontsize=Large,color=aeb,fontfamily=sffamily} +\sectionLayout{indent=-62.5pt,fontsize=large,color=aeb,fontfamily=sffamily} +\subsectionLayout{indent=-31.25pt,color=aeb,fontfamily=sffamily} +\subsubsectionLayout{indent=0pt,color=aeb,fontfamily=sffamily} +\subsubDefaultDing{\texorpdfstring{$\bullet$}{\textrm\textbullet}} +%\renewcommand{\paragraph} +% {\@startsection{paragraph}{4}{0pt}{12pt}{-3pt}{\bfseries}} +\renewcommand{\paragraph} + {\@startsection{paragraph}{4}{0pt}{6pt}{-3pt} + {\normalfont\normalsize\bfseries}} +\renewcommand{\subparagraph} + {\@startsection{subparagraph}{5}{\parindent}{6pt}{-3pt}% + {\normalfont\normalsize\bfseries}} +\newcommand{\aebCng}{\@ifstar{\def\aeb@checked{*}\@aebCng}{\def\aeb@checked{x}\@aebCng}}% +\newcommand\@aebCng[1][]{} +%\newcommand{\aebCng}{\@ifstar{\def\aeb@checked{*}\@aebCng}{\def\aeb@checked{x}\@aebCng}}% +%\newcommand{\@aebCng}[1][]{% +% \if\aeb@checked*\def\aeb@marker{\textcolor{blue}{aeb}~\textcolor{red}{\ding{052}}\goodbreak}\else +% \def\aeb@marker{\textcolor{red}{aeb}}\fi +% \def\argi{#1}\ifx\argi\@empty +% \marginpar{\scriptsize\aeb@marker}% +% \else\marginpar{\scriptsize\aeb@marker\goodbreak\raggedright#1}\fi} + +%\makeindex + +%\widestNumber{00.00.} + +\hfuzz=1pt + +\pdfstringdefDisableCommands{\let\!\empty} + +%\setlongtables + +\def\AcroT{Acro\!\TeX}\def\cAcroT{\textcolor{blue}{\AcroT}} +\def\AcroEB{\AcroT{} eDucation Bundle}\def\cAcroEB{\textcolor{blue}{\AcroEB}} +\def\AcroB{\AcroT{} Bundle}\def\cAcroB{\textcolor{blue}{\AcroB}} +\def\AcroFLeX{% + AcroF\kern-.1667em\lower.5ex\hbox{L}\kern-.3eme\kern-.125emX} +\def\APB{\textsf{APB}} +\def\cAPB{\textcolor{blue}{\APB}} +\def\AEB{\textsf{AeB}} +\def\cAEB{\textcolor{blue}{\AEB}} +\def\Web{\textsf{web}} +\def\PDF{\textsf{PDF}} +\def\bUrl{http://www.math.uakron.edu/~dpstory} +\definePath{\urlAcroTeXBlog}{http://www.acrotex.net/blog} + +%\newlength{\aebdimen} +\def\anglemeta#1{$\langle\textit{\texttt{#1}}\rangle$} +\def\meta#1{\textit{\texttt{#1}}} +\let\pkg\textsf +\let\env\texttt +\let\opt\texttt +\let\app\textsf +\def\AEB{\textsf{AeB}} +\def\AcroTeX{Acro\!\TeX} +\def\HTML{HTML}\def\FDF{FDF} +\def\PDF{PDF}\def\URL{URL} +\let\amtIndent\leftmargini +\def\bNH{\begin{NoHyper}}\def\eNH{\end{NoHyper}} +\def\nhnameref#1{\bNH\nameref{#1}\eNH} +\def\nhNameref#1{\bNH\Nameref{#1}\eNH} +\def\nhurl#1{\bNH\url{#1}\eNH} +\def\grayV#1{\textcolor{gray}{#1}} +\def\darg#1{\{#1\}} +\def\parboxValign{t} +\renewcommand*{\backrefalt}[4]{% + \ifcase #1\or + See page~#2.\else See pages~#2.\fi +} +\newenvironment{aebQuote} + {\list{}{\leftmargin\amtIndent}% + \item\relax}{\endlist} +\newcommand{\FmtMP}[2][0pt]{\mbox{}\marginpar{% + \raisebox{.5\baselineskip+#1}{% + \expandafter\parbox\expandafter[\parboxValign]% + {\marginparwidth}{\aebbkFmtMp#2}}}} +\def\aebbkFmtMp{\kern0pt\itshape\small + \ifusebw\color{gray}\else\color{blue}\fi + \raggedleft\hspace{0pt}}\newcommand{\BlogArticle}{% + \makebox[0pt][l]{\hspace{-1pt}\color{blue}\Pisymbol{webd}{254}% + }\raisebox{.5pt}{\ifusebw\color{black}\else + \color{red}\fi\ding{045}}} +\def\dps{$\mbox{$\mathfrak D$\kern-.3em\mbox{$\mathfrak P$}% + \kern-.6em \hbox{$\mathcal S$}}$} +\def\FitItIn{\eq@fititin} +\def\endredpoint{\FitItIn{{\large\ifusebw\color{black}\else\color{red}\fi$\blacktriangleleft$}}} + + +\hypersetup{linktocpage} + +\def\AmS{{\protect\usefont{OMS}{cmsy}{m}{n}% + A\kern-.1667em\lower.5ex\hbox{M}\kern-.125emS}} + +\def\latex/{{\protect\LaTeX}} +\def\amslatex/{{\protect\AmS-\protect\LaTeX}} +\def\tex/{{\protect\TeX}} +\def\amstex/{{\protect\AmS-\protect\TeX}} + +\definecolor{aeb}{rgb}{0.24,0.38,0.68}%bleu +\universityColor{aeb} +\tocColor{aeb} + +\makeatother + +\def\Y&Y{Y\kern-.2em{\footnotesize\&}\kern-.2emY} +\def\dps{$\mbox{$\mathfrak D$\kern-.3em\mbox{$\mathfrak P$}% + \kern-.6em \hbox{$\mathcal S$}}$} + +\title{\texorpdfstring{\LARGE +%---------------------------------% + The \AcroEB\space(AeB)% +}{%-------------------------------% + The AcroTeX eDucation Bundle for LaTeX, + Manual of Usage% +}} +\author{D. P. Story} +\subject{How to create on-line exercises and quizzes} +%\keywords{LaTeX, hyperref, PDF, exercises, quizzes} +\Keywords{LaTeX,hyperref,PDF,exercises,quizzes} +\university{{\AcroT} Software Development Team} +\email{dpstory@acrotex.net} +\versionLabel{Dated:} +\version{2018/08/16} +\copyrightyears{1999-\the\year} +\nocopyright +\prepared{2018/08/16} +\revisionLabel{Distribution Dated:} + +\copyrightStatus{True} +\copyrightNotice{Copyright (C) 1999-\the\year, D. P. Story} +\copyrightInfoURL{http://www.acrotex.net} +\authorTitle{Head of AcroTeX Developer} +\descriptionWriter{Senior Technical Writer of AcroTeX} + +%\noPartNumbers + +\DesignTitlePageTrailer +{% + ul=Copyright \copyright\ \webcopyrightyears, + ur=\thewebemail, + lr=\url{http://www.acrotex.net}, + raise=-25pt +} +\def\CMD#1{\textbackslash#1} +%\newcommand{\exPDF}[2][\expath/]{\par\ifdim\lastskip>0pt\relax\vskip-\lastskip\fi +\newcommand{\exPDF}[2][\bUrl/webeq_ex.html\#]{\par\ifdim\lastskip>0pt\relax\vskip-\lastskip\fi +\vskip\medskipamount\noindent\makebox[0pt][r] + {\raisebox{-2pt}{\color{red}\href{#1#2}{{\zqacr + b\hspace{9.5pt}}}}\enspace}\ignorespaces} + +\def\makeExBox#1{\href{run:\tutpathi/apb_#1.tex}{\scriptsize\fbox{#1}}} +\renewcommand\expoint[1]{\par\ifdim\lastskip>0pt\relax\vskip-\lastskip\fi +\vskip\medskipamount\noindent\makebox[0pt][r]{\makeExBox{#1}\enspace}\ignorespaces} + +\def\tutpath{doc/tutorial} +\def\tutpathi{tutorial} +\def\expath{../examples} + +\renewcommand{\theaebEx}{\arabic{aebEx}} +\renewcommand{\theHaebEx}{\arabic{aebEx}} + +\def\insMargin{} +\def\Ex{\par\medskip\noindent\refstepcounter{aebEx}\insMargin\gdef\insMargin{}\textbf{Example~\theaebEx:}} +\def\CmdLoc{\par\medskip\noindent\textbf{Command Location: }} +\def\EnvLoc{\par\medskip\noindent\textbf{Environment Location: }} +\def\KVP{\par\goodbreak\medskip\noindent\textbf{Key-Value Pairs: }} +\def\PD{\par\goodbreak\medskip\noindent\textbf{Parameter Description: }} +\def\Important{\par\medskip\noindent\textbf{Important: }} +\def\CmdDescription{\par\medskip\noindent\textbf{Command Description: }} + +\begin{insDLJS}[indefCompare]{compare}{Comparisons} +function indefCompare(a,b,c,F,G) { + var C, eqx; + with(Math) { + eqx = a; + if(isNaN(C = eval(F)-eval(G))) return -1; + eqx = c; + F = eval(F); + if(isNaN(G = eval(G))); + return abs( F - G - C ); + } +} +\end{insDLJS} + +\frenchspacing + +\definePath\bgPath{"C:/Users/Public/Documents/ManualBGs/Manual_BG_Print_AeB.pdf"} +\begin{docassembly} +\addWatermarkFromFile({ + bOnTop: false, + cDIPath: \bgPath +}) +\executeSave() +\end{docassembly} +\begin{document} + +\maketitle + +\pdfbookmarkx[1]{Title Page}[action={\Named{FirstPage}}]{TitlePage} +\pdfbookmarkx[1]{The eforms Manual}[action={\GoToR/F(eformman.pdf)/D[0 /Fit]},color=blue,style={bf}]{eForms} +\pdfbookmarkx[1]{Links to AcroTeX.Net}[action={/S/GoTo/D(undefined)},% + color=magenta,style={bf}]{acrotex} +\belowpdfbookmarkx{http://www.acrotex.net}[action={\URI{http://www.acrotex.net}},% + color=magenta,style={bf}]{home} +\belowpdfbookmarkx{http://blog.acrotex.net}[action={\URI{http://blog.acrotex.net}},% + color=magenta,style={bf}]{blog} + + +\newpage + +\changelinkcolorto{black} + +\tableofcontents + +\changelinkcolorto{webgreen} + +\part{Forward} + +\newtopic For the past several years (this year is \the\year), I've been writing a book +titled, +\begin{quote} +\AEBBook. +\end{quote} +The book~\cite{book:AEBB} covers {\AEB} and {\AEBP} in \emph{great detail} and includes many +examples to illustrate concepts and techniques. Numerous new examples are +available on the CD-ROM that accompanies the book. + +During the time of the writing, each of the packages covered was examined, +bugs were fixed, and many new and major features were created. Any new +features developed in the course of writing the book are documented in the +book; however, they are \emph{not included in this documentation}. You can +either buy the yet-to-be-submitted book sometime in the future, or discover +the features by studying the DTX documentation of the program files. Sorry, +it took me three years to write the book, I don't want to spend another year +on this documentation. \verb!:-{)! + +As noted in \textbf{\nhnameref{eq2db}} on page~\pageref{eq2db}, I've set up a +website that highlights the server-side scripts developed for the book (and +available on the accompanying CD-ROM). You are invited to visit them and +comment on them, if the spirit moves. + +\begin{flushright} +Dr. D. P. Story\\[3pt] +\today +\end{flushright} + +\part{Preface} + +%\section{Introduction} + +% ff, fi, fl, ffl + +The {\cAcroEB} (abbreviated {\cAEB} and read ``{\AcroT} Education +Bundle'') is a collection of {\LaTeX} macro files (briefly described +below) along with various support and sample files. The theme of {\cAEB} +is \textit{ePublication} in the \textit{education} sector using {\LaTeX} +as the authoring application and Adobe's Portable Document Format +(\textsf{PDF}) as the file format of the output document. The \cAcroB{} +should be useful to educators who want to post interactive materials for +their students on the \textsf{WWW}. + +\newtopic Currently, there are seven components to the bundle: + +\begin{questions} + +\item The \hyperref[s:web]{\pkg{web} package} is used to create an + attractive, easy-on-the-eye page layout suitable for the \textsf{WWW} + (or classroom/conference presentations). There is support for + background graphics; a {\Web} document can be re-purposed for + paper. +\item The \hyperref[s:exerquiz]{\pkg{exerquiz} package} makes + it very easy to create interactive exercises and quizzes. There are + numerous options, solutions at the end of the document, solutions + following the question, no solutions; quizzes are self marking, the + student can get immediate feedback, or get a final assessment after + the student finishes the quiz. +\item The \href{eformman.pdf#eformsPkg}{\pkg{eforms} package} provides support for + PDF form fields, and links with arbitrary actions. +\item The \href{eformman.pdf#insdljsPkg}{\pkg{insdljs} package} allows for the automatic + insertion of document level JavaScript. Document authors can use + \textsf{insdljs} to customize the processing of the + \textsf{exerquiz} quizzes. See the documentation that accompanies + the package (\texttt{insdljs.dtx}) and see also the sample file + \texttt{jqzspec.tex} for an extensive example of how to modify the + \textsf{exerquiz} macros. The \textsf{insdljs} package also has an + \texttt{execJS} environment which can be used to create executable + and ``discardable'' JavaScript; see the DTX file for + details. +% and the demo file \texttt{execJStst.tex}, which features +% an animation built completely from {\LaTeX} source lines. + Documentation for the \pkg{insdljs} package appears in the + \href{eformman.pdf#insdljsPkg}{\pkg{eforms}} reference manual + (on the Web, \href{\bUrl/eformman.pdf#insdljsPkg}{eformman.pdf}). +\item The \href{eformman.pdf#taborderPkg}{\pkg{taborder} package} supports the creation of the order + of tabbing between Acrobat annotations (fields, links, and comments). + See the part \textbf{Setting the Tab Order} in \href{eformman.pdf#taborderPkg}{eforms} + reference manual (on the Web, \href{\bUrl/eformman.pdf#taborderPkg}{eformman.pdf}) for more details. +\item The \hyperref[part:dljslib]{\pkg{dljslib} package} is used as a library of + JavaScript functions. Some types of question require special + processing. A JavaScript function written to process a + particular function can be stored in the library, then + retrieved as needed. + +% See the documentation contained in the +% file \texttt{\href{\bUrl/dljslib.dtx}{dljslib.dtx}}.% and try +% the test file for this package, +% \texttt{\href{\bUrl/jslib_ex.tex}{jslib\_ex.tex}}. +\item The \href{\bUrl/eqexam.html}{\pkg{eqexam} package} is a stand + alone {\LaTeX} package for creating exams, quizzes, homework + assignments. There are several options to re-purpose the source + document to produce a document with no solutions, solutions at end, + solutions after the questions, and solutions only. It can also be used + to create surveys, questionnaires, teacher evaluations, etc. The + package has an \texttt{email} mode and comes with a server-side script + that is used to send the data entered into the form fields to the + instructor. + +% See my \textsf{\href{\bUrl/eqexam/tex_survey.pdf}{\TeX/\LaTeX{} Survey}} for +% a demo of this feature. +\end{questions} +\handpoint The \pkg{web}, \textsf{exerquiz}, \textsf{eforms}, and \textsf{insdljs} +packages are stand alone packages, though they were designed to work +together. The \textsf{dljslib} package is a companion package to +\textsf{insdljs}. The \textsf{eqexam} package is stand alone, but uses +some code from the \textsf{exerquiz} package; \textsf{exerquiz} need not +be installed on your system to use \textsf{eqexam}, however. + +\begin{comment} +To play it safe, you should use the most recent version of +\pkg{hyperref} by Sebastian Rahtz and Heiko Oberdiek. The +\textsf{exerquiz} package makes extensive use of forms; Adobe +Reader 3.0 with Forms 3.5 at least is needed, Adobe Reader 4.0 or +above is preferred. +\end{comment} + +\handpoint Here is an important point that should be emphasized early in this +manual. \cAcroT{} only supports three ways of producing a +\textsf{PDF} file: (1) the \textcolor{blue}{Adobe Acrobat +Distiller} (version~5.0 or higher \emph{required}); (2) +\textsf{pdftex} (including \textsf{luatex}); or (3) \textsf{dvipdfm} +(including \textsf{dvipdfmx} and \textsf{xetex}). In the case of (1), you +probably use \texttt{dvips} to create a postscript file before +distilling. Some users have tried to use +\textcolor{blue}{Ghostscript} to produce a \textsf{PDF} +from \cAcroT; this will not work! (You will get the \textsf{PDF} +file, but not much functionality.) + +Please contact me at \url{dpstory@acrotex.net} should you encounter +any problems, or have suggestions to make. + +\redpoint See Section~\ref{s:start} on `\nhnameref{s:start}' below for +instructions on how to get up and running. + +\section{Getting Started}\label{s:start} + +The distribution for the {\cAcroB} comes in a single ZIP file + \texttt{acrotex.zip}. This ZIP file contains program files + (\pkg{web}, \pkg{exerquiz}, \pkg{eforms}, \pkg{insdljs}, + \pkg{dljslib}, \pkg{taborder}, and \texttt{aeb.js}), this manual, and the + \href{eformman.pdf}{\pkg{eforms}} reference manual + (\texttt{\href{\bUrl/eformman.pdf}{eformman.pdf}}). + +\subsection{Installing the Distribution} + +The following are the instructions for installing the \cAEB. + +\begin{questions} + +\item \textbf{Placement.} The ZIP file installs in a folder called + \texttt{acrotex}, so place the ZIP file in a directory in the search path + of your \LaTeX{} system where you want the \texttt{acrotex} folder to + reside. If you already have an \texttt{acrotex} folder, place the ZIP + files so that they unzip into this \texttt{acrotex} folder, \emph{unless + you are using MiK\TeX~2.8{} or later}. + +\item[] \textbf{MiK\TeX~2.8/2.9 Users.} {Mik\TeX}~2.8 (or later) provides + problems for {Acro\!\TeX} installations in that it is more particular + about where you install packages by hand. {MiK\TeX}~2.8, or later, + requires that you install the distribution in a local root TDS tree. + Review the {MiK\TeX} help page on this topic +\begin{quote} +% + \url{http://docs.miktex.org/manual/localadditions.html} +% +\end{quote} +Create a new {MiK\TeX} root folder, in my case, I created +\begin{quote} +% + \verb!C:\Users\Public\Documents\My TeX Files! +% +\end{quote} +Within the \texttt{My TeX Files} folder (you can name this folder anyway +you wish), create a \texttt{tex} folder, within the \texttt{tex} folder, +create a \texttt{latex} folder. Now copy the ZIP file to the +\texttt{latex} folder, for example, copy them into +\\[3pt]\hspace*{20pt} +% + \verb!C:\Users\Public\Documents\My TeX Files\tex\latex!\\[3pt] +% +Finally, you need to register your new root folder with MiK\TeX. Open the +{MiK\TeX} Options dialog box (accessible through the WinEdt toolbar, or +through\\[\topsep]\hspace*{20pt} +% +\texttt{Start > All Programs > MiKTeX 2.8 > Maintenance > Settings}\\[3pt]\hspace*{20pt} +\texttt{Start > All Programs > MiKTeX 2.9 > Maintenance > Settings}\\[\topsep] +% +Within this dialog box, select the \textbf{Roots} tab, then press +\textbf{Add}, and browse for your newly create \texttt{My TeX Files}. When +finished, the dialog should look like my own dialog box, as shown +in \hyperref[fig:rootstab]{Figure~\ref*{fig:rootstab}}, page~\pageref*{fig:rootstab}. + +\begin{figure}[hbt]\centering +\includegraphics[scale=.6]{figures/miktex_roots} +\caption{Roots tab of MiK{\TeX} Options}\label{fig:rootstab} +\end{figure} + +\item \textbf{Unzipping the Distribution.} Once you have found the +location to unzip the ZIP file, unzip it! + +% C:\Users\Public\Documents\My TeX Files\tex\latex + +%\item Unpack the \textsf{exerquiz} package by latexing \texttt{exerquiz.ins}. +%However, see \nameref{s:unpack} for important comments. + +\item \textbf{Unpacking the distribution.} The whole distribution can be +unpacked by latexing \texttt{acrotex.ins}. (The other \texttt{*.ins} files +are the installation files for the individual packages, +\texttt{acrotex.ins} is the combined installation file.) + +\item[] {MiK\TeX} users should not forget to refresh the file name database. + +% \item Unpack \texttt{insdljs.dtx} by latexing \texttt{insdljs.ins}. + +\end{questions} + + + +\subsection{Installing \texttt{aeb.js}} + + +The JavaScript file \texttt{aeb.js} is only needed if you use \textbf{Acrobat +Pro 8.1} or later and \textbf{Adobe Distiller} as the PDF creator. Increased +security in that version has made it necessary to install a folder JavaScript +file. The JavaScript within \texttt{aeb.js} raises the ``trust'' of certain +JavaScript methods used to import document JavaScript into the document just +after the distillation process and the newly created PDF is opened in +\textbf{Acrobat} for the first time. The installation of this file is not +needed if you use \textsf{pdftex}, or \textsf{dvipdfm} (or any of their +variations), or use a version of \textbf{Acrobat} prior to 8.1. + +The instructions for installing \texttt{aeb.js} are in the +\texttt{\href{install_jsfiles.pdf}{install\_jsfiles.pdf}}, which resides in +the \texttt{doc} folder of the \texttt{acrotex} installation. If you use +\textbf{Distiller} as your PDF creator, please refer to that document. + +After you've installed the JavaScript files, as directed by the +\texttt{\href{install_jsfiles.pdf}{install\_jsfiles.pdf}}, validate the +installation of the JavaScript files by navigating to the \texttt{examples} +subfolder and opening the file \texttt{test\_install.pdf} in \app{Acrobat}; +follow the directions contained on that one page document. + + +\begin{comment} +\paragraph*{Acrobat Pro~8.1 or later.} +Start \textbf{Acrobat Pro~8.1}\footnote{The file will cause no harm if you +install it in an earlier version of Acrobat, as early as version 7.} or +later, and open the console window \textsf{Advanced \texttt> JavaScript +\texttt> Debugger} (\texttt{Ctrl+J} for Windows or \texttt{Cmd+J} for Mac +OS). Copy and paste the following code into the window. +\begin{Verbatim}[xleftmargin=\amtIndent] +app.getPath("user","javascript"); +\end{Verbatim} +Now, with the mouse cursor on the line containing this script, press +the \texttt{Ctrl+Enter} key. This will execute this JavaScript. This +JavaScript method returns the path to where \texttt{aeb.js} should +be placed. For example, on my system, the return string is +\begin{Verbatim}[xleftmargin=\amtIndent,fontsize=\small] +/C/Documents and Settings/story/ + Application Data/Adobe/Acrobat/8.0/JavaScripts +\end{Verbatim} +Follow the path to this folder. If the \texttt{JavaScripts} folder +does not exist, create it. Finally, copy \texttt{aeb.js} +into this folder. The file is read each time Acrobat starts. + +\paragraph*{Acrobat Pro 10.1.1 for Windows only.} For this version of \textbf{Acrobat}, +things have tightened up even more. The user JavaScripts folder has moved to +\begin{Verbatim}[xleftmargin=\amtIndent,fontsize=\small] +%AppData%\Adobe\Acrobat\Privileged\10.0\JavaScripts +\end{Verbatim} +\exAeBBlogArticle{p=737}where \verb!%AppData%! is an environment variable defined by Acrobat. For details +of how to install the folder JavaScripts in the new location, see my blog +article \mlhref{http://www.acrotex.net/blog/?p=737}{Acrobat Security Changes in 10.1.1 and +Acro\!\TeX}. +\end{comment} + +\subsection{Language Localizations} + +Should you wish to customize {\cAEB} to a language other than the ones +already supported, open the file \texttt{template.def} and add in your +language customizations. + +%After reading the manual you are then ready to write your own set +%of tutorials, exams, exercises and quizzes.\enspace\dps + + +\subsection{Sample Files and Articles}\label{s:samplefiles} + +Test, example, and demo files have been moved to the \href{\bUrl/webeq_ex.html}{Example Files for +AeB} web page.\footnote{\url{\bUrl/webeq_ex.html}} References seen in this manual reside on this page; each +sample file is a PDF with the source file attached to the PDF. Files on +the \href{\bUrl/webeq_ex.html}{Example Files for AeB} web page are +referenced with the icon \raisebox{-1.5pt}{\color{red}\zqacr b\hspace{12pt}} is the margin. + +\paragraph*{{Acro\!\TeX} Blog.} The basic examples from the distribution are also available +from the {Acro\!\TeX| Blog, accessible from the page +\href{http://www.acrotex.net/blog/?cat=89}{AeB Demo Files}.\footnote{\url{http://www.acrotex.net/blog/?cat=89}} +There is another more recent collection of examples on +\href{\urlAcroTeXBlog}{\AcroTeX{} Blog}, these will be referenced in the margin using the icon %\exAeBBlogPDF +\mbox{\makebox[0pt][l]{\textcolor{blue}{\Pisymbol{webd}{254}}}% + \raisebox{-2pt}{\color{red}{{\zqacr b\hspace{9.5pt}}}}}\,, whereas +\mbox{\makebox[0pt][l]{\hspace{-1pt}\textcolor{blue}{\Pisymbol{webd}{254}}}% +\raisebox{.5pt}{\color{red}{\ding{045}}}} refers to a written blog +article. In all cases, the source file and any dependent resources are attached to the +PDF. + +% + +%\newcommand{\exAeBBlogArticle}[2][\urlAcroTeXBlog/]{\par\ifdim\lastskip>0pt\relax\vskip-\lastskip\fi +%\vskip\medskipamount\noindent\makebox[0pt][r]{% +% \makebox[0pt][l]{\textcolor{blue}{\Pisymbol{webd}{254}}}% +% \raisebox{.5pt}{\color{red}\href{#1?#2}{\ding{045}\hspace{8.5pt}}}\enspace}\ignorespaces} + +%\exPDF{indexofex} There are numerous sample/demo files that illustrate various +%features of the {\cAcroB}. View the \textsf{PDF} file +%\texttt{\href{indexofex.pdf}{indexofex.pdf}}, which is an ``Index of +%{\AcroT} Examples''. This document contains a list of all +%examples, a short description of each, and links to the \textsf{PDF} +%file and source file. + +\subsection{Package Requirements} + +If you use the Acrobat Distiller, as I do, to create a PDF document, the {\cAcroB} +now requires the use of version 5.0 or later. I've given up on trying to support +prior version of Acrobat. + +\newtopic In terms of \LaTeX, the following is a listing of package requirements: + +\begin{enumerate} + \item The \pkg{web} Package + \begin{itemize} + \item \texttt{color}: \texttt{color} is distributed with \LaTeX, but {\Web} + will use \texttt{xcolor}, if available, unless the + \texttt{noxcolor} global option is used. + \item \texttt{amssymb}: standard with \amslatex/ + \item \texttt{hyperref}: available from CTAN, get newer version + \item \texttt{eso-pic} and \texttt{everyshi}: available from CTAN + \end{itemize} + \item The \textsf{Exerquiz} Package + \begin{itemize} + \item \texttt{color}: distributed with \LaTeX + \item \texttt{verbatim}: distributed with \LaTeX + \item \texttt{hyperref}: available from CTAN, get newer version + \item \texttt{insdljs}: distributed with \AcroT + \end{itemize} + \item The \textsf{insdljs} Package + \begin{itemize} + \item \texttt{hyperref}: available from CTAN, get newer version + \item \texttt{verbatim}: distributed with \LaTeX + \item \texttt{everyshi}: available from CTAN + \end{itemize} + \item The \textsf{dljslib} Package + \begin{itemize} + \item \texttt{insdljs}: distributed with \AcroT + \end{itemize} +\end{enumerate} + +\subsection{\LaTeX ing Your First File} + +The functionality of the \texttt{shortquiz} and \texttt{quiz} +environments depends on JavaScript code that is placed at the +``document level'', to use Adobe's terminology. The applications +\textsf{pdftex} and \textsf{dvipdfm} offer direct support for +writing to this document level. For those who use the +\textcolor{blue}{Adobe Distiller}, things aren't quite so easy. + +In this section, we describe how to insert document level +Java\-Scripts into a \textsf{PDF} file, prepared from a +\LaTeX{} source that uses the \texttt{exerquiz} package. Even +though the handling and insertion of document level JavaScript is +done with the package \textsf{insdljs}, a little care must be +taken, at least in the Distiller case, when building your +{\PDF} document. + +%http://www.acrotex.net/blog/?p=803 + +\exAeBBlogPDF{p=803} Download \texttt{\href{\urlAcroTeXBlog/?p=803}{webeqtst.pdf}} from the {\AcroBlog} +website. The source file \texttt{webeqtst.tex} is attached to the PDF, save +it to your local hard drive. \gob{\exPDF{webeqtst}}Open +\texttt{webeqtst.tex} in your favorite text editor. The top lines read: +\begin{Verbatim}[xleftmargin=\amtIndent] +\documentclass{article} +\usepackage{amsmath} +\usepackage[tight,designi]{web} +\usepackage{exerquiz} +\end{Verbatim} + +\subsubsection{For Non-\textsf{dvips} Users} + +Edit the third line by inserting your driver; the choices are +\texttt{pdftex}, \texttt{dvipdfm}, \texttt{dvipdfmx}, and \texttt{xetex}. For +example, if you use \textsf{dvipdfm}, the lines should read: +\begin{Verbatim}[xleftmargin=\amtIndent] +\documentclass{article} +\usepackage{amsmath} +\usepackage[dvipdfm,tight,designi]{web} +\usepackage{exerquiz} +\end{Verbatim} +For \textsf{dvipdfm}, you \LaTeX{} the document, then hit it with +\textsf{dvipdfm}, and your ready to review your \textsf{PDF} file. The +insertion of the document level JavaScript is automatic. + +For the \textsf{pdftex} and \textsf{xetex} applications, you simply +compile with that application, and you have your nice \textsf{PDF} file, ready for +review. The insertion of the document level JavaScript is automatic. + +\redpoint Both the \textsf{pdftex} and \textsf{xetex} applications are +automatically detected so there is no need to specify them in the option list +of \pkg{web}.\endredpoint + + +\subsubsection{For Distiller Users} + +If you use the distiller, as I do, the sophisticated features of +{\AcroB} require Acrobat 5.0 or higher. + +%I've discontinued my attempt at supporting Acrobat 4.0. + +Edit the optional parameters of the \pkg{web} package by inserting your driver; the choices are +\texttt{dvips} and \texttt{dvipsone}.\footnote{The choice of driver can be placed in he \texttt{web.cfg} configuration +file, in which +case, you need not specify the driver. See \Nameref{sss:driver}.} For example, if you use \textsf{dvips}, the +lines should read: +\begin{Verbatim}[xleftmargin=\amtIndent] +\documentclass{article} +\usepackage{amsmath} +\usepackage[dvips,tight,designi]{web} +\usepackage{exerquiz} +\end{Verbatim} + +\begingroup\raggedright +\noindent When you latex the source file, you create a DVI file and one or more FDF files.\footnote{The FDF files (for +example, \texttt{exerquiz.fdf}) contain the document level JavaScript that needs to be imported into your document. They +are imported when the newly +created document is opened is Acrobat for the first time.} +You then convert your \texttt{.dvi} to \texttt{.ps} using either +\textsf{dvips} or \textsf{dvipsone}, and distill. +\par\endgroup + +\newtopic\textcolor{red}{Important:} When you distill, \emph{save the +\emph{\texttt{.pdf}} back to the same folder} in which your source file +(\texttt{.tex}) resides as this is where the \texttt{.fdf} files +reside too. Insertion of document level JavaScripts automatically +takes place when you open your newly distilled document +in the \textsf{Acrobat} application. (It is actually +\textsf{Acrobat} that imports the scripts, not the +\textsf{Distiller}.) + +\handpoint When your document is opened in \textsf{Acrobat} for +the first time, the Java\-Script contained in the \texttt{.fdf} files +(for example, \texttt{exerquiz.fdf}) is imported into the document +and is stored at the document level. + +\redpoint \textcolor{red}{Important:} \emph{Save your document}. When you +save, the JavaScripts you just imported are also saved with the +document. At this point you can move your \textsf{PDF} to another +folder, or to the web. The document does not need the +\texttt{.fdf} files any more. + +\begin{comment} +\redpoint \textbf{For Distiller~4.0--4.05 Users.} Versions prior +to~5.0 of the Acrobat product cannot import document level +JavaScript contained in a \texttt{.fdf} file. The JavaScript needs +to be inserted ``by hand''. + +The procedure is as follows: Modify the preamble and insert the \texttt{acrobativ} +option for the \textsf{exerquiz} package: +\begin{Verbatim}[xleftmargin=\amtIndent] +\documentclass{article} +\usepackage{amsmath} +\usepackage[dvips,tight,designi]{web} +\usepackage[acrobativ]{exerquiz} %<- acrobativ option +\end{Verbatim} +\noindent This suppresses all the JavaScript code generation that is used in the case +of \textsf{pdftex}, \textsf{dvipdfm} or \textsf{Distiller~5.0$^+$}. After that +change, \LaTeX{} the document, and convert +the \texttt{.dvi} file to PostScript (using \texttt{dvips} or +\texttt{dvipsone}), and distill. Now, open the new \textsf{PDF} file + in \textsf{Acrobat} (formerly known as +\textsf{Exchange}). Click on \texttt{Document > Insert Pages}, +browse, and choose the \textsf{PDF} file \textsf{eq\_dljs.pdf}, +which comes with the \cAcroB. The file is now inserted. Next, click +on \texttt{Document > Delete Pages} and delete the page you just +inserted! \textcolor{red}{Important:} Do a ``\texttt{Save As}''; now you are done! + +The \textsf{PDF} file \textsf{eq\_dljs.pdf} contains all the +standard JavaScript that goes in at the document level. In all +the other situations discussed above, you can modify the +JavaScript from the preamble, for example, in the \textsf{exerquiz} +source code we have +\begin{Verbatim}[xleftmargin=\amtIndent] +\newcommand\checkColor{["RGB", 0, .6, 0]} +\end{Verbatim} +This command is expanded when the document level JavaScript is imported into the +\textsf{PDF} file. If \cs{checkColor} has been redefined +\begin{Verbatim}[xleftmargin=\amtIndent] +\renewcommand\checkColor{["RGB", 1, 0, 0]} +\end{Verbatim} +it is this definition that is used in the expansion. This +convenience is lost for $\text{4.0} \le\text{\textsf{distiller}}\le\text{4.05}$. +You can edit \textsf{eq\_dljs.pdf} and make whatever changes you +please to the script, in terms of changing color. +\end{comment} + +There are several ways the Distiller workflow can be accomplished: +%\begin{itemize} +% \item \textbf{Through the {\LaTeX} Editor.} Some editors, WinEdt, in particular, have toolbars that can distill +% a PostScript file. (The default is to use Ghostscript, you'll have to change to Distiller.) From WinEdt, you +% can latex, convert to Postscript, and distill with a few presses of toolbar buttons. Very smooth and easy. +% \item \textbf{Do it yourself.} Some systems, most notably on Mac OS, do not have a convenient way of distilling. +% A Mac user sent in the following steps. +% \begin{enumerate} +% \item Drop the \texttt{.ps} file on Distiller. +% \item Drag the resulting .pdf file out of the folder it was +% compiled in (for example, to the desktop) +% \item Open the \texttt{.pdf} file in Acrobat. +% +% At this stage readers will be prompted for the location of the existing .fdf file for inclusion. +% +% Now, for contrast, try this: +% +% 1. Drop the .ps file on Distiller. +% 2. Open the .pdf file in Acrobat. +% 3. Save the .pdf file. +% 4. Drag the .pdf file out of the folder it was compiled in (for example, to the desktop) +% 5. Open the .pdf file. +% +% This will allow readers the opportunity to see what will happen if they fail to save the file before moving it +to another location, like the web. +% +% +% \end{enumerate} +%\end{itemize} + +\newtopic For distiller users, the +\href{http://www.math.uakron.edu/~dpstory/aeb_pro.html}{\AEB\ Pro package} +has many exciting features, functionality requires the document author use +Acrobat~7.0 or higher. + + + +\addtocontents{toc}{\protect\vspace{\medskipamount}} +\part{The Web Package}\label{s:web} + +\section{Introduction} + +The purpose of the \pkg{web} package is to create a page layout +for documents meant for screen presentation, whether over the +\textsf{WWW} or classroom/conference presentations, in +\textsf{PDF}. Such documents are \emph{not \emph{(necessarily)} +intended to be printed}; consequently, the page layout is, in some +sense, optimized for screen viewing. + +\subsection{Overview} + +The \pkg{web} package redefines \cs{maketitle} and +\cs{tableofcontents} in a more web friendly way; it colors the +section headings, and inserts \cs{bullet}s ($\bullet$) at the +\cs{subsubsection} level. This, to my eyes, is very attractive. +Additionally, certain navigation devices (a navigation bar and +some direction icons) are included in the package. + +There are options for a small collection of drivers: +\texttt{dvipsone}, \texttt{dvips}. \texttt{dvipdfm} and \texttt{pdftex}. The language +option redefines certain language dependent elements of the package +to other languages. Currently, the following options are supported: +\begin{quote} +\begin{tabular}{lll} +\texttt{dutch} & \texttt{french} & \texttt{german}\\ +\texttt{italian} & \texttt{norsk} & \texttt{russian}\\ +\texttt{spanish} & \texttt{dansk} & \texttt{polish}\\ +\texttt{finnish} & \texttt{czech} & \texttt{catalan}\\ +\texttt{brazil} & \texttt{turkish} +\end{tabular} +\end{quote} + +There is even an option for reformatting the \texttt{web} +style to a print format! + +The capabilities of the \pkg{web} package and its options are +discussed below. Any comments and suggested improvements (new +features) would be greatly appreciated. + +\subsection{Package Requirements} + +The \pkg{web} package was designed for screen presentations +tutorials, such as classroom or conference lectures, short technical +articles, etc.; consequently, the \texttt{article} class of \LaTeX{} +seems to be sufficient for these purposes. Though you can use +\pkg{web} with any of the standard classes that define the +\cs{section}, \cs{subsection} and \cs{subsubsection} commands, the +package is really meant to be used with the \texttt{article} +class. It is \textbf{strongly} suggested! + +The package heavily depends on Sebastian Rahtz' \pkg{hyperref} +package (now maintained and developed by Heiko Oberdiek). The +\pkg{web} package was developed using version 6.56 of +\pkg{hyperref}. Using prior versions of \pkg{hyperref} +\emph{may} lead to successful compilation, no guarantees offered. +It is best to work with the most recent version of +\pkg{hyperref}. + +The \textsf{color} and \textsf{amssymb} packages are also +required. The former is for obvious reasons, the later is to +provide certain navigation symbols when the \texttt{navibar} +option is invoked. + +Finally, to create quality PDF documents, type~1 fonts \emph{must} +be used. Fortunately, type~1 fonts in the Computer Modern font set +are freely available, and come with all the major +freeware, shareware and commercial \TeX{} systems. If you haven't +done so already, learn how to use the type~1 fonts. + +In this regard, I have written an article that may be of interest +to you entitled ``\textit{Using \LaTeX{} to Create Quality PDF Documents +for the WWW}'', see reference \cite{article:Story:LaTeX}. + +\section{Basic Package Options} + +To use the \pkg{web} package, insert into the preamble of +your document the following: +\begin{Verbatim}[xleftmargin=\amtIndent,commandchars=!()] +\usepackage[!meta(driver),!meta(other_options)]{web} +\end{Verbatim} +\noindent Replace \meta{other\_options} with any of the options recognized by +\pkg{web}; see \hyperref[s:ListofOpts]{Section~\ref*{s:ListofOpts}} +for a complete list of options. The first and optional argument +\meta{driver} above defines the driver to be used; for +example, +\begin{Verbatim}[xleftmargin=\amtIndent] +\usepackage[dvips]{web} +\end{Verbatim} + +\paragraph*{Driver options.}\label{para:webdrivers} Below is a list of \meta{driver} options +for the \pkg{web} package. +\bgroup\def\rf#1{{\normalfont#1}} +\begin{Verbatim}[xleftmargin=\amtIndent,commandchars=!()] +dvips dvipsone textures % !rf((DVI)-to-(PS)) +pdftex % !rf(includes the !app(lualatex) application) +dvipdfm dvipdfmx xetex % !rf((DVI)-to-(PDF)) +\end{Verbatim} +\egroup\noindent +Currently, the \pkg{web} package supports five drivers: +\texttt{dvipsone}, the dvi-to-ps converter by \Y&Y, Inc.; \texttt{dvips}, +the freeware dvi-to-ps converter; \texttt{pdftex}, the +\texttt{tex}-to-\texttt{pdf} application; \texttt{dvipdfm}, +\texttt{dvipdfmx}, and \texttt{xetex} the \texttt{dvi}-to-\texttt{pdf} +applications by Mark Wicks and subsequent +developers;\footnote{\url{http://odo.kettering.edu/dvipdfm/}}${}^{\text{\scriptsize,}}$\footnote{\url{http://scripts.sil.org/xetex}} +and the +commercial {\TeX} system for the Mac, \texttt{textures} and +\href{http://www.uoregon.edu/~koch/texshop/texshop.html}{{\TeX}shop}. + +\handpoint\textbf{Automatic driver detection.} {\AEB} now has automatic driver detection for +\textsf{pdftex} (including \textsf{luatex}) and \textsf{xetex}. Specification of these options +is no longer needed. + +\newtopic {\AEB} is better at passing the driver between its components. +When the driver is specified in the \pkg{web} package, the driver is passed to +its components (\textsf{exerquiz}, \textsf{eforms}, \textsf{insdljs}). Similarly, if \pkg{web} is not used, +exerquiz passes the driver specified to \textsf{eforms} and \textsf{insdljs}. Finally, \textsf{eforms} passes the driver +specified to \textsf{insdljs}. + +\paragraph*{A note on \app{xetex}.} +The \app{xetex} application may be set to strip out named destinations that +are not referenced within the document as a target of a `hard-wired' actions. +\app{AeB} (in particular, \pkg{exerquiz}) sets a lot of destinations (or +targets) but, in many instances, `dynamic' links are employed using the +JavaScript method \texttt{\textsl{Doc}.gotoNamedDest(\anglemeta{target})}. In +such instances, \app{xetex} may strip out these targets; the link or button +action may not perform the jump to the destination because the destination +does not exist. If this becomes an issue for your \app{xetex} installation, +the \textbf{\app{Dvipdfmx} Compatibility Flags} need to be modified. Search +for the configuration file \texttt{dvipdfmx.cfg}, open the file. Scroll down +to the line `\texttt{\%C 0x0000}', beneath it insert `\texttt{C 0x0010}', +save and close the file.\footnote{MiK\TeX{} discourages the direct editing of +the file \texttt{dvipdfmx.cfg}, instead, on the command-line prompt type and +execute `\texttt{initexmf -{}-edit-config-file dvipdfmx}' enabling you to +edit a local version of the configuration file as described above; +just enter the line `\texttt{C 0x0010}', save and close.} The documentation +for this bit field is just above the referenced line and an explanation of +the `\texttt{C 0x0010}' setting is given. + +\redpoint The package has been tested using +\verb+\documentclass{article}+ and it is \emph{strongly} +recommended that this class be used; however, {\Web} does support the +\texttt{book} class as well.\endredpoint + +%\begin{comment} +% +%\redpoint The default paper setting for \textsf{dvips} is +%\texttt{A4}, but the cropping parameters assumes \texttt{letter} +%paper size. To get the cropping of the page correct, there are +%several procedures you can follow. +% +%\begin{questions} +%\item Use the command line switch \texttt{-t letter}. +%For example, +%\begin{Verbatim}[xleftmargin=\amtIndent] +%dvips.exe -j0 -Pcm -Pams -t letter -o .ps .dvi +%\end{Verbatim} +%\item Change the default paper setting of \textsf{dvips} to +%\texttt{letter} by placing the paper size for \texttt{letter} +%first in the \texttt{config.ps} file of \textsf{dvips}: +% +%\smallskip +%\leavevmode\begin{minipage}{.45\linewidth} +%Change these lines \dots +%\begin{Verbatim}[xleftmargin=\amtIndent] +%@ A4size 210mm 297mm +%@+ %%PaperSize: A4 +% +%@ letterSize 8.5in 11in +% +%@ letter 8.5in 11in +%@+ %%BeginPaperSize: Letter +%@+ letter +%@+ %%EndPaperSize +%\end{Verbatim} +%\end{minipage} +%\hfil +%\begin{minipage}{.45\linewidth} +%\dots to these. +%\begin{Verbatim}[xleftmargin=\amtIndent] +%@ letter 8.5in 11in +%@+ %%BeginPaperSize: Letter +%@+ letter +%@+ %%EndPaperSize +% +%@ A4size 210mm 297mm +%@+ %%PaperSize: A4 +% +%@ letterSize 8.5in 11in +% +%\end{Verbatim} +%\end{minipage} +% +%\end{questions} +% +% If you find changing the command line inconvenient, you can +%include the command +%\begin{Verbatim}[xleftmargin=\amtIndent] +% \hypersetup{pdfpagescrop=53 486 389 754} +%\end{Verbatim} +%in the preamble of your document. +% +%\end{comment} + +%\makeatletter\hy@bookmarksnumberedfalse\makeatother +%\subsubsection{\texorpdfstring{}{\textbullet\space}Setting the Driver Option} +%\makeatletter\hy@bookmarksnumberedtrue\makeatother + +\subsection{Setting the Driver Option}\label{sss:driver} + +You can set your driver option in one of three ways: +\begin{itemize} + \item Pass as a local option: %\\ %[3pt] + \cs{usepackage[\meta{driver}]\darg{web}} + \item Pass as a global option: %\\ %[3pt] + \cs{documentclass[\meta{driver}]\darg{article}} + \item Create the file \texttt{web.cfg} with the single command + in it:%\\ %[3pt] +\begin{quote} + \cs{ExecuteOptions\darg{\meta{driver}}} +\end{quote} + Place the file \texttt{web.cfg} in any folder where \LaTeX\ + looks for input files. Then, you need only type + \verb+\usepackage{web}+. +\end{itemize} +Where \meta{driver} is any of the following options listed in +the paragraph \textbf{\nameref{para:webdrivers}} on page~\pageref{para:webdrivers}. + +The macros of the \pkg{web} package have been extensively +tested using the \Y&Y\ \TeX\ System for the +\texttt{dvipsone} option and a MiK\TeX\ System +(\url{www.miktex.org}) for the \texttt{dvips}, \texttt{pdftex} (which includes lua(la)tex), +\texttt{dvipdfm}, \texttt{dvipdfmx}, and \texttt{xetex} + +%\subsubsection{The \texorpdfstring{\protect\texttt{pdftex}}{pdftex} Option} +% +% +%The \texttt{pdftex} option requires \pkg{hyperref} version 6.60 +%or greater. (The most recent version is preferred.) The +%\pkg{web} and \textsf{exerquiz} packages will probably run +%correctly with slightly earlier versions, but you may see +%`underfull hbox' error messages. +% +%The \pkg{web} package uses the AMS Font set for the +%black triangle that appears in the navigation bar, see +%\hyperref[ss:naviaids]{Section~\ref*{ss:naviaids}}. +% +%The AMS Font sets comes with Mik\TeX, if you don't have +%\textsf{pdftex} configured the use them, here are some +%instructions that work for the Mik\TeX{} system. +%\begin{questions} +%\item Copy the file \texttt{amsfonts.map} from the folder +%\texttt{texmf/dvips/ams} to the folder \texttt{texmf/pdftex/base}. +%(Mik\TeX{} may have restructured the directory tree since the time +%of this documentation.) +%\item Edit the file \texttt{pdftex.cfg} to include the lines: +%\begin{Verbatim}[xleftmargin=\amtIndent] +%map +amsfonts.map % to get AMSFonts +%map standard.map % to get dings +%\end{Verbatim} +% +%\item The \texttt{pdftex.cfg} file now looks like this: +%\begin{Verbatim}[xleftmargin=\amtIndent] +%output_format 1 +%compress_level 9 +%decimal_digits 2 +%page_width 210mm +%page_height 297mm +%horigin 1in % <-- important, see 4. +%vorigin 1in % <-- important, see 4. +%map standard.map +%map +cm.map +%map +amsfonts.map +%\end{Verbatim} +%\item Take note of the settings of \texttt{horigin} and +%\texttt{vorigin}. Set these two to 1\,in\@. This will align the +%text on the page where the cropping numbers expects the text to +%be; the result will be a properly cropped page. +%\end{questions} + + +\subsection{The \texttt{tight} Option}\label{sss:webtight} + +In an effort to compact more material per page, I've introduced a +\texttt{tight} option. When this option is used, many of the list +parameters are redefined so that there is not so much space around these +environments, and between items. +\begin{Verbatim}[xleftmargin=\amtIndent,commandchars=!()] +\usepackage[!meta(driver),tight,!meta(other_options)]{web} +\end{Verbatim} + +\subsection{The \texttt{usesf} Option}\label{usesf} + +For presentations, some people like a sans serif font. Using this option +make san serif the default font style. + +\subsection{The \texttt{draft} Option}\label{draft} + +When you take this option, graphic overlays are not allowed. This +is useful when you rely heavily on graphic overlays, but during the +development phase, don't need to read and re-read your overlays. The +defined background colors will be used instead. Remove this option +to build the final version of your document. + + +\subsection{The \texttt{nobullets} Option}\label{nobullets} + +Traditionally, the subsubsections have been denoted by a bullet, by +using this option, you can force the use of numbers for the +subsubsections, This option automatically executes the +\texttt{latextoc} option. + +There is another option \texttt{forceSubSubNumbers}, which does the same thing +as nobullets. This option is included for compatibility with the {\AcroT} +Presentation Bundle (\textsf{APB}). + +\subsection{The \texttt{unicode} Option}\label{web:unicode} + +This option is passed to \pkg{hyperref}, and is placed in {\Web} as a +convenience. If \textsf{eforms} is subsequently loaded, \textsf{eforms} (and +\textsf{exerquiz}) will accept {\LaTeX} markup in the optional argument +of the form fields. See the \href{eformman.pdf}{eforms manual} +for details. + +\subsection{The \texttt{useui} Option}\label{web:useui} + +This option is passed to \textsf{eforms}, and is placed in {\Web} as +a convenience. If \textsf{eforms} is subsequently loaded, +\textsf{eforms} loads the \textsf{xkeyval} package, and key-value pairs are +defined for use in the optional argument of form and link commands. +See the \href{eformman.pdf}{eforms manual} for details. + +\subsection{The \texttt{xhyperref} Option}\label{web:xhyperref} + +The \pkg{web} package requires \pkg{hyperref} and calls it with a particular +set of options, given below. +\begin{Verbatim}[xleftmargin=\amtIndent,commandchars=!()] +\RequirePackage[% + !ameta(driver), + bookmarks,bookmarksnumbered,bookmarksopen,% + colorlinks,\aeb@useunicode,linkcolor=webgreen,% + filecolor=webbrown,citecolor=webgreen,% + urlcolor=webbrown,pagebackref,pdfpagemode=UseNone,% + pdfstartview=Fit,pdfpagelayout=SinglePage,% + !ameta(addtoHyOpts)} +\end{Verbatim} +These option choices may be overridden using the \opt{addtoHyOpts} or +\opt{addtoHyOpts*} option, described in Section~\ref*{web:addtoHyOpts} below. + +Now, if this \opt{xhyperref} option is used, the \pkg{hyperref} package is +\emph{not automatically} included by the \pkg{web} package. It is assumed +that \pkg{hyperref} will be included in the document prior to \pkg{web}. Use +the \opt{xhyperref} option if you want to completely revamp the look of a +\pkg{web} document by custom choices of the \pkg{hyperref} options. +\begin{Verbatim}[xleftmargin=\amtIndent,commandchars=!()] +\documentclass{article} +\usepackage[!ameta(Hy-options)]{hyperref} +\usepackage[xhyperref,!ameta(web-options)]{web} +... +\end{Verbatim} +This avoids possible ``option clashes'' when your choices conflict with those of \pkg{web}. + + +\subsection{The \texttt{addtoHyOpts} and \texttt{addtoHyOpts*} Options}\label{web:addtoHyOpts} + +To maximize the convenience of passing options to \pkg{hyperref}, the \pkg{web} package +provides the \opt{addtoHyOpts} option. +\bVerb\takeMeasure{\string\usepackage[\meta{web-options},addtoHyOpts=\darg{\meta{Hy-options}}]\darg{web}}% +\begin{dCmd}[commandchars=!()]{\bxSize} +\documentclass{article} +\usepackage[!meta(web-options),addtoHyOpts={!meta(Hy-options)}]{web} +... +\end{dCmd} +\eVerb The value of \opt{addtoHyOpts} is any combination of key-values that +\pkg{hyperref} offers as package options. For example, +\begin{Verbatim}[xleftmargin=\amtIndent,commandchars=!()] +\documentclass{article} +\usepackage[!meta(web-options),addtoHyOpts={pdfencoding=auto}]{web} +... +\end{Verbatim} +The \texttt{pdfencoding=auto} is useful for authors writing in the latin1 character set. The +value of \texttt{pdfencoding}, by the way, overrides the \opt{unicode} option. + +There is another option that passes its value to the \cs{hypersetup} command. +\bVerb\takeMeasure{\string\usepackage[\meta{web-options},addtoHyOpts*=\darg{\meta{Hy-options}}]\darg{web}}% +\begin{dCmd}[commandchars=!()]{\bxSize} +\documentclass{article} +\usepackage[!meta(web-options),addtoHyOpts*={!meta(Hy-options)}]{web} +... +\end{dCmd} +\eVerb The value of \opt{addtoHyOpts*} is any combination of key-values that +\pkg{hyperref} offers as package options. For example, +\begin{Verbatim}[xleftmargin=\amtIndent,commandchars=!()] +\documentclass{article} +\usepackage[!meta(web-options),addtoHyOpts={pdfencoding=auto}]{web} +... +\end{Verbatim} + +The \opt{addtoHyOpts} adds its value to the option list of \pkg{hyperref}, as +built by \pkg{web}, whereas \opt{addtoHyOpts*} passes its value to the +\cs{hypersetup} command. Both options \opt{addtoHyOpts} and +\opt{addtoHyOpts*} may appear in the option list of \pkg{web} at the same +time. + +\section{Setting Screen Size}\label{s:setscreensize} + +Beginning with version 2.0, the screen size can be set by the +author. There are two ways to do this: (1) use the macros +\cs{screensize} and \cs{margins} (These are the same +macros, slightly redefined, for setting the screen size used by +Radhakrishnan in his fine screen package \textsf{pdfscreen}.); or (2) use +a screen design option. The next two sections address each of +these in turn. + +\subsection{Custom Design}\label{cusDesign} + +There are six dimensions that need to be specified. As with +\textsf{pdfscreen}, the two commands \cs{screensize} and +\cs{margins} are used for doing so. + +The command \cs{screensize} takes two length parameters: +\begin{Verbatim}[xleftmargin=\amtIndent,commandchars=!()] +\screensize{!ameta(height)}{!ameta(width)} +\end{Verbatim} +\noindent The \ameta{width} and \ameta{height} parameters are the desired +screen size of the page. The screen version of this manual uses +\begin{Verbatim}[xleftmargin=\amtIndent] +\screensize{3.72in}{4.67in} +\end{Verbatim} +\noindent The other command, \cs{margins}, which determines the desired +margins, takes four length parameters: +\begin{Verbatim}[xleftmargin=\amtIndent,commandchars=!()] +\margins[!ameta(panel_width)]{!ameta(left)}{!ameta(right)}{!ameta(top)}{!ameta(bottom)} +\end{Verbatim} +\newtopic The values of \cs{textheight} and \cs{textwidth} are computed +based on the screen size and the margins. The margin settings for +this document are given below: +\begin{Verbatim}[xleftmargin=\amtIndent] +\margins{.25in}{.25in}{30pt}{.25in} +\end{Verbatim} +\newtopic The optional first parameter \ameta{panel\_width} is used to set +the width of the panel, if there is one. The default is \texttt{1in}. + +\begin{redpoint}\space\ignorespaces +An important comment about the third parameter +\ameta{top} is the following: as with \textsf{pdfscreen}, we put +\cs{@Topmargin=\ameta{top}}. The running header fits within the top +margin (this varies from standard \LaTeX{} practice). The +\pkg{web} package dimension \cs{web@Topmargin} is the distance +from the top of the screen down to the top of the running header. Thus, +\begin{Verbatim}[xleftmargin=\amtIndent] +\@Topmargin = \web@Topmargin + \headheight + \headsep +\end{Verbatim} +\noindent Also, \cs{web@Topmargin} can be used to adjust the +positioning of a running header, which is specified in the +\cs{margins} command. The default value of \cs{headheight} is +\texttt{8pt}, so the value of \cs{headsep} is determined by the +above equation. See the \textsf{web.dtx} file for more details. +\end{redpoint} + +\subsection{Screen Design Options}\label{sss:designoptions} + +For your convenience, I've included nine options, \texttt{designi}, +\texttt{designii},\dots \texttt{designix}. The first one roughly +corresponds to the original screen dimensions of \pkg{web}. The +dimensions of these designs options are\medskip +\begingroup\par\noindent\hfuzz=3pt\small +\begin{tabular*}{\linewidth}{>{\ttfamily}l>{\ttfamily}lc|>{\ttfamily}l>{\ttfamily}lc} +\multicolumn{1}{c}{Design Option}&\multicolumn{1}{c}{width $\times$ height}&\multicolumn{1}{c|}{AR}&% +\multicolumn{1}{c}{Design Option}&\multicolumn{1}{c}{width $\times$ height}&\multicolumn{1}{c}{AR}\\\hline +designi & {4.67in} $\times$ {3.736in}&5:4&designv &{6in} $\times$ {4.5in}&4:3\\ +designii &{5in} $\times$ {4.5in}&10:9&designvi &{4.67in} $\times$ {4.17in}&28:25\\ +designiii &{6in} $\times$ {5in}&6:5&designvii &{10in} $\times$ {7.5in}&4:3\\ +designiv &{5in} $\times$ {4in}&5:4&designviii&{6.67in} $\times$ {3.75in}&16:9\\ +&&&designix&3.75in $\times$ 6in&16:10 +\end{tabular*} +\endgroup +\newtopic Most of these design values were chosen for their visual appeal, or for some particular need. +The designs \texttt{designv} and \texttt{designvii} have an aspect ratio of 4:3, this is a standard for video displays, +while \texttt{designviii} is another one with a standard aspect ratio for wide screen computer monitors. + +\newtopic To select a particular design for your document, simply include its name amongst the option +list for the \pkg{web} package; for example, +\begin{Verbatim}[xleftmargin=\amtIndent] +\usepackage[designv]{web} +\end{Verbatim} +creates a document with dimensions of \texttt{designv}, $6\,\text{in} \times 4.5\,\text{in}$. + +\redpoint When you specify a screen design, the macros +\cs{screensize} and \cs{margins} are redefined to gobble up +their parameters. To define a custom screen size, therefore, do +not specify a screen design option for \pkg{web}.\endredpoint + +\subsection{\texorpdfstring{\protect\cs{setScreensizeFromGraphic}}{\CMD{setScreensizeFromGraphic}}}\label{setScreensizeFromGraphic} + +If a design is \emph{not specified} in the option list of \Web, you +can use a graphic to set the screen size with +\Com{setScreensizeFromGraphic}. The command takes two parameters +that correspond to the parameters of \cs{includegraphics}, and are +just passed to \cs{includegraphics}. This is useful if you have a +graphic to be used for a template but cannot be deformed to fit one +of the standard designs. The solution is to create a screen size +matching the graphic, then using that graphic as a template. Example +usage, +\begin{Verbatim}[xleftmargin=\amtIndent] +\margins{1in}{1in}{24pt}{.25in} +\setScreensizeFromGraphic{acro_30} +\template{acro_30} +\end{Verbatim} +It may become necessary with some graphics to use the +\texttt{hiresbb} option for the command \cs{includegraphics}, both in +\cs{setScreensizeFromGraphic} and \cs{template} like so, +\begin{Verbatim}[xleftmargin=\amtIndent] +\margins{1in}{1in}{24pt}{.25in} +\setScreensizeFromGraphic[hiresbb]{acro_30} +\template[hiresbb]{acro_30} +\end{Verbatim} +\newtopic This command should not be used with a panel option for the text screen +size will be adjusted for the panel, and the graphic will be +re-scaled appropriately. + +\subsection{Using \texorpdfstring{\protect\cs{addtoWebHeight} and \protect\cs{addtoWebWidth}} +{\CMD{addtoWebHeight} and \CMD{addtoWebWidth}}} + +There may be an occasion when you've chosen your design dimensions +(\texttt{designi}, \texttt{designii}, etc.), but you have determined the +dimensions provided by the selected design are not quite \emph{wide} or \emph{high} enough. +You can make adjustments to the width and height without explicitly specifying +the commands \cs{margins} and \cs{screensize} by using \cs{addtoWebHeight} and/or +\cs{addtoWebWidth}. The syntax for each is +\begin{Verbatim}[xleftmargin=\amtIndent,commandchars=!()] +\addtoWebHeight{!ameta(length)} +\addtoWebWidth{!ameta(length)} +\end{Verbatim} +These two can only be executed in the preamble, and they add (or subtract) +the specified \ameta{length} to the height and width of the page. For example, +\begin{Verbatim}[xleftmargin=\amtIndent] +\addtoWebHeight{1in} +\end{Verbatim} +adds one inch to the height of the page. This +command is roughly equivalent to executing, +\begin{Verbatim}[xleftmargin=\amtIndent,commandchars=!()] +\screensize{!ameta(current_height)+1in}{!ameta(current_width)} +\end{Verbatim} + + +\subsection{Using a panel option} + +When the \texttt{rightpanel} or \texttt{leftpanel} option is used +the page is divided into the text screen and a panel (either on the +left or right of the page). The default width of the panel is 1in +and the minimum width of the panel is 1in. + +When designing the screen using \cs{screensize} and \cs{margins}, +the panel width of the panel can be set by the first optional +parameter of \cs{screensize}, as described in +section~\ref{cusDesign}, page~\pageref*{cusDesign}. When using one +of the standard design options, the panel width is set to the +default value of 1in. To set the panel width to another value, use +\cs{panelwidth} in the preamble. \verb!\panelwidth{1.25in}! sets the +panel width to 1.25 inches. + +If you set the panel width to a length less than the minimal panel +width, the minimal panel width (1in) will be used. You can reset the +minimal panel width using \Com{minPanelWidth}. See +section~\ref{panelscreentemplate}, +page~\pageref*{panelscreentemplate}, for more details on this command. + +\section{Hyperref Options} + +The \pkg{web} package loads \pkg{hyperref} into the document +and sets some selected options of that package; therefore, +including the \pkg{hyperref} package is not needed in the +preamble of your own document. + +Any additional \pkg{hyperref} options that are needed can be +introduced into the package using \pkg{hyperref}'s +\cs{hypersetup} macro, for example, +\begin{Verbatim}[xleftmargin=\amtIndent,commandchars=!()] +\documentclass{article} +\usepackage[!ameta(options)]{web} +% Declare additional hyperref options using \hypersetup +\hypersetup{pdfpagemode=UseNone,bookmarksopen=false} +\end{Verbatim} +An alternate approach is to use the \opt{addtoHyOpts} option of \pkg{web}: +\begin{Verbatim}[xleftmargin=\amtIndent,commandchars=!()] +\documentclass{article} +\usepackage[!ameta(options),addtoHyOpts={pdfpagemode=UseNone, + bookmarksopen=false}]{web} +\end{Verbatim} +The \opt{addtoHyOpts*} option of \pkg{web} may also be used: +\begin{Verbatim}[xleftmargin=\amtIndent,commandchars=!()] +\documentclass{article} +\usepackage[!ameta(options),addtoHyOpts*={pdfpagemode=UseNone, + bookmarksopen=false}]{web} +\end{Verbatim} +The \opt{addtoHyOpts} option adds its value to the \pkg{hyperref} option of +as built by \pkg{web}, whereas, \opt{addtoHyOpts*} passes its value to the +argument of a \cs{hypersetup} command. + + +\noindent Documentation of the options that \pkg{hyperref} +recognizes can be had by either \LaTeX ing the file +\texttt{hyperref.dtx}, or by getting a copy of the \textsl{The +\LaTeX\ Web Companion} \cite{book:Goossens3} by Michel Goossens, +{\textsl{et al}}. + +\redpoint The \pkg{web} option \texttt{xhyperref} bypasses the inclusion +of the \pkg{hyperref} package. It is expected that the document author inputs +\pkg{hyperref} prior to \pkg{web}. + +\section{Running Headers and Footers} + +There are convenience commands setting the running headers and +footers; they are \cs{lheader}, \cs{cheader}, \cs{rheader}, +\cs{lfooter}, \cs{cfooter}, and \cs{rfooter}. Each of these takes a +single argument, which is the text for the header or footer in the +position desired. In the standard setup for {\Web}, \cs{lheader}, +\cs{rheader} and \cs{cfooter} are used for, respectively, the +current section title, the current page and the navigation bar (if +activated). + +You can set some basic formatting styles for the header and footer using +\Com{header\-format} and \cs{footerformat}. For example, executing +\begin{Verbatim}[xleftmargin=\amtIndent] +\headerformat{\bfseries\color{red}} +\end{Verbatim} +causes the running header to appear in bold red color. + +There are a couple of hooks for the header and footers, these are +\Com{webheadwrapper} and \Com{webfootwrapper}. These commands can be +use to stylize the entire header or footer. They can be defined to have +one argument. The argument is the content of the header or footer. For example, +\begin{Verbatim}[numbers=left,xleftmargin=\amtIndent,fontsize=\small] +\headerformat{\bfseries\color{red}} +\footerformat{\bfseries\color{red}} +\renewcommand{\webheadwrapper}[1]{\fcolorbox{red}{yellow}{% + \makebox[\linewidth-2\fboxsep-2\fboxrule][s]{#1}}} +\renewcommand{\webfootwrapper}[1]{\fcolorbox{red}{yellow}{% + \makebox[\linewidth-2\fboxsep-2\fboxrule][s]{#1}}} +\end{Verbatim} +\newtopic Lines~(1) and~(2) makes declares bold font for the header and footer. +Lines~(3) and~(4) defines a \cs{fcolorbox} with hideous red and yellow colors; +lines~(5) and~(6). Note that adjustment in the width to account for the \cs{fcolorbox} +rule width and the space surrounding the text in the \cs{fcolorbox}. + +\newtopic On occasion you may want to have no running headers at all, this can +be accomplished by saying in the preamble, or anywhere, +\verb!\lheader{}!, \verb!\cheader{}!, and/or \verb!\rheader{}!. +Another solution is to use the commands \cs{clearHeaders} and +\cs{restoreHeaders}. The command \cs{clearHeaders} first saves the current +definitions of the headers then sets the headers to the empty +header. The command \cs{restoreHeaders} restores the definitions that were in +effect when the last \cs{clearHeaders} was executed. + +\newtopic\textbf{No running headers on section pages.} +One user did not like a running header that includes a section title +on the same page where the section begins. The default behavior is +to create a running header where the section title does not appear +in the header on the same page as the section is inserted, on +subsequent pages, the section head appears, I hope. + +The two commands control this behavior, the default is \emph{to not +show} the section heading (\cs{lheader}) on the page where the +section begins. Use \Com{headersOnSectionPage} to place headers on +the same page as the beginning of a section. You can also change back to +the default behavior using \Com{noHeadersOnSectionPage} (the default). + + +\section{The Title Page and TOC} + +The title page is constructed from the values of the macros: +\cs{title}, \cs{author}, \cs{uni\-ver\-sity}, \cs{email}, and +\cs{version}. The values of some of the macros \cs{title} and +\cs{author} are also transferred to the PDFDocInfo section of the +Acrobat/Adobe Reader. (Press \texttt{Ctrl+D} while viewing a \PDF{} document +to see this information.) + +Additionally, the values of \cs{subject} and \cs{keywords}---which +do not appear on the title page---are inserted into the PDFDocInfo +section. + +\newtopic The colors of the text corresponding to \cs{title}, \cs{author} and \cs{university} on the title +page can be set by using \cs{titleColor}, \cs{authorColor} and \cs{universityColor}. +Each takes a single argument, a named color. The defaults are +\begin{Verbatim}[xleftmargin=\amtIndent] +\universityColor{blue} +\titleColor{black} +\authorColor{black} +\end{Verbatim} +For more information on defining named \textsf{colors}, see the documentation +of the color or \textsf{xcolor} packages. A simple example would be +\begin{Verbatim}[xleftmargin=\amtIndent] +\definecolor{MyOwnColor}{rgb}{0.945,0.87,0.518} +\end{Verbatim} + +\redpoint When the \texttt{extended} option is used, all colors can be +specified with \cs{selectColors}, see +\Nameref{designColor}.\endredpoint + +\subsection{Basic Information Commands}\label{ss:BIM} + +The basic information commands allows you a convenient way to enter the title and author +of the document, as well as other information. To enter this basic information, +just fill in the values of all the basic macros briefly described below. + +For example, the following is a copy of the title information for this document: +\begin{Verbatim}[xleftmargin=\amtIndent] +% \title,\author,\subject,\keywords are sent to DocInfo +\title{The Web and Exerquiz Packages Manual of Usage} +\author{D. P. Story} +\subject{How to create on-line exercises and quizzes} +\keywords{LaTeX,hyperref,PDF,exercises,quizzes} +\end{Verbatim} + +\begin{Verbatim}[xleftmargin=\amtIndent] +% \university,\email,\version are used only on title page +\university{Northwest Florida State College\\ + Department of Mathematics} +\email{dpstory@acrotex.net} +\version{1.0} +\copyrightyears{1999-2010} +\end{Verbatim} +You can optionally specify the \cs{date}. The web packages uses the value of \cs{date} +at the bottom of the title page. There is says, ``Last Revision Date: \ameta{date}''. If +the \cs{date} command is not used, the current date is used. + +\redpoint The \cs{title}, \cs{author}, \cs{subject}, \cs{keywords} +are a convenient way of entering information in the Document +Information fields---see +\begin{equation*} +\texttt{File > Document Info > General... (Ctrl+D)} +\end{equation*} +in the Acrobat/Adobe Reader.\endredpoint + +\newtopic\indent If \cs{title} contains control sequences that do not expand to the +Standard PDFDocEncoding character set, Distiller will be thrown +into a tailspin; \pkg{hyperref} defines the \cs{texorpdfstring} +macro\footnote{The code for handling PDFDocEncoding for +\pkg{hyperref} is due to Heiko Oberdiek} to avoid these kinds +of problems. For example, +\begin{Verbatim}[xleftmargin=\amtIndent] +\title{The \texorpdfstring{$e^x$}{EXP} Function} +\end{Verbatim} +\noindent The first argument is the one that is typeset (on the title page, +the title of the document will be `The $e^x$ Function'); the +second argument is the one that is sent to the title field of +DocInfo in the Adobe Reader (and will read `The EXP Function'). + +Of all the \nameref{ss:BIM}, as listed on page~\pageref*{ss:BIM}, +use \cs{texorpdfstring} only with the \cs{title} and \cs{author}; +these are the only two that are both typeset and placed in the +DocInfo field of the Adobe Reader. + +\redpoint \cs{texorpdfstring} works for \cs{section}, +\cs{subsection}, etc\@. as well.\par\medskip + +\newtopic Having entered the values of the basic information +commands, you can now type the standard sort of \LaTeX\ commands of +\cs{maketitle} and \cs{tableofcontents}: +\begin{Verbatim}[xleftmargin=\amtIndent] +\begin{document} +\maketitle +\tableofcontents +... +... +\end{document} +\end{Verbatim} + +\exAeBBlogPDF{p=803}\gob{\exPDF{webeqtst}} Use the source file for +\texttt{\href{\urlAcroTeXBlog/?p=803}{webeqtst.pdf}} as a prototype or +template for your own document. + +\redpoint When the \texttt{extended} option is in effect, the basic document +information just described can be entered through the +\cs{DeclareDocInfo} command, see page~\pageref{docinfo}.\endredpoint + +\subsection{Title Page Structure} + +The title page is divided into three parts: top, middle and bottom. +\begin{itemize} +\item \textbf{Title Top:} The content of the top is determined by the \Com{top\-Titl\-ePage} +command. (This command can be redefined, but it is not recommended.) The +\cs{topTitlePage} command expands to three elements: the university (affiliation), the title, +and the author(s), in that order vertically. These are the values of the commands \cs{university}, +\cs{title} and \cs{author} discussed in the previous section. + +\item \textbf{Title Middle:} The \Com{optionalPageMatter} command +is used to enter content into this part of the title page. This +middle part is optional; if \cs{optionalPageMatter} does +not appear in the preamble, this part of the title page is +empty. Here is an example of usage: + +\begin{Verbatim}[xleftmargin=\amtIndent] +\optionalPageMatter{% + \begin{center} + \fcolorbox{blue}{webyellow}{ + \begin{minipage}{.67\linewidth} + \noindent\textcolor{red}{\textbf{Abstract:}} This + file attempts to teach you how to create a simple + \LaTeX\ document. + \end{minipage}} + \end{center}} +\end{Verbatim} +The above definition will create the framed box seen below. + + \begin{center} + \fcolorbox{blue}{webyellow}{ + \begin{minipage}{.67\linewidth} + \noindent\textcolor{red}{\textbf{Abstract:}} This file + attempts to teach you how to create a simple \LaTeX\ document. + \end{minipage}} + \end{center} + +The \cs{optionalPageMatter} appears just below the \cs{webauthor} +and above the directory listing if there is any. + +The syntax \cs{optionalPageMatter} is\dots +\bVerb\takeMeasure{\cs{optionalPageMatter[\ameta{vspace}]\darg{\ameta{content}}}} +\begin{dCmd}[commandchars=!()]{\bxSize} +\optionalPageMatter[!ameta(vspace)]{!ameta(content)} +\end{dCmd} +\eVerb where \ameta{content} content to be displayed in middle title region, and +\texttt{[\ameta{vspace}]} consists of one (or more) \cs{vspace} commands. The default +is +\begin{Verbatim}[xleftmargin=\amtIndent] +\minimumskip\vspace{\stretch{1}} +\end{Verbatim} +The command \cs{minimumskip} expands to \cs{medskip}. + +\item \textbf{Title Bottom:} Bottom of the title page is controlled +by the contents of the command \cs{titlepageTrailer} and consists of +the values of the commands \cs{email}, \cs{version}, \texttt{copyrightyears} +Below is a rough figure depicting the location of the elements found +in the title page trailer. + +{\setlength{\tabcolsep}{0pt} +\begin{tabular*}{\linewidth}{@{\extracolsep{\fill}}lr} +\anglemeta{copyright notice} & \cs{thewebemail}\\ +\anglemeta{revision} & \cs{webversion} +\end{tabular*}} +\newtopic The definition of these elements are as follows: +\begin{Verbatim}[xleftmargin=\amtIndent,fontsize=\small] +\def\maketitle@trailer@ul{\web@copyright\ \web@copyright@symbol\ + \webcopyrightyears} +\def\maketitle@trailer@ll{\web@revision\ \@date} +\def\maketitle@trailer@ur{\thewebemail} +\def\maketitle@trailer@lr{\webversion} +\end{Verbatim} + +\begin{description} +% +% ?? The ul corner not accurate, need to address this. +% +\item The \texttt{ul} corner: The macro \cs{web@copyright} expands to `Copyright', it can be redefined, or removed by + executing \Com{nocopyright}. \cs{webcopyrightyears} expands to the argument of \cs{copyrightyears}. + +%the final element in the upper left is the email address. +%To make everything go away except for the email address, executed \Com{nocopyrightNotice}. + +\item The \texttt{ll} corner: The \anglemeta{revision} expands to +\cs{web@revision} followed by \cs{@date}. The \cs{web@revision} expands to +``Last Revision Date:'', and can be changed by using \cs{revisionLabel} +(for example \verb!\revisionLabel{Published:}!). The \cs{@date} expands to +the argument of the \cs{date} command, or if this was not used, expands +to the current date. + +\item The \texttt{ur} corner: The upper-right corner goes the email address, as enter through +the \cs{email} command. + +\item The \texttt{lr} corner: The \cs{webversion} command goes into the + lower-right corner. It expands to + \cs{web@versionlabel\;\anglemeta{version\_number}}, while, in turn, + the command \cs{web@versionlabel} expands to ``Version''. This label can be + changed by using \Com{versionLabel} (for example, + \verb!versionLabel{Attempt}!). Finally, the variable + \anglemeta{version\_number} is the number entered through the + \cs{version} command. +\end{description} +\end{itemize} + +\newtopic The font size of the title page trailer + is set by the command \cs{trailerFontSize}, the default is +\cs{footnotesize}. This command must be re-defined in the usual +way: for example, \verb!\renewcommand{\trailerFontSize}{\small}!. + + +\redpoint When using the pro option, the elements of the title page trailer +can be entered by using \Com{DesignTitlePageTrailer}, see +\Nameref{trailer}.\endredpoint + +\subsection{Redefining +\texorpdfstring{\protect\cs{maketitle}}{\textbackslash maketitle}} + +The arguments of the \Nameref{ss:BIM} macros, as just discussed, +are used to define text macros with no parameters; for example, +when you type \verb+\title{Web Package}+, the macro \cs{title} +takes its argument and defines a macro \cs{webtitle} that expands +to `Web Package'. + +You can redesign the title page to suit your needs simply by +redefining \cs{maketitle}: rearrange the macros listed in the +second column of \hyperref[table:BIM]{Table~\ref*{table:BIM}} on +the page, or include a graphic, or change the background color. +To redefine \cs{maketitle}, use the commands: +\begin{Verbatim}[xleftmargin=\amtIndent] +\renewcommand\maketitle{...your design...} +\end{Verbatim} +\noindent See the definition of \cs{maketitle} in the \texttt{web.sty} file +for an example. + +\begin{table}[hbt] +\begin{center} +\begin{tabular}{|l|l|} +\hline +\multicolumn1{|l|}{This macro} & +\multicolumn1{l|}{defines this macro} \\ +\hline +\cs{title} & \cs{webtitle} \\ +\cs{author} & \cs{webauthor} \\ +\cs{subject} & \cs{websubject} \\ +\cs{keywords} & \cs{webkeywords}\\ +\cs{university} & \cs{webuniversity} \\ +\cs{email} & \cs{webemail} \\ +\cs{version} & \cs{webversion} \\ +\cs{copyrightyears} & \cs{webcopyrightyears} \\ +\hline +\end{tabular} +\caption{The Basic Information Macros}\label{table:BIM} +\end{center} +\vspace{-\baselineskip} +\end{table} + +When making the design, it is useful to know that the {\Web} +package uses the command \cs{hypertarget} to create a named destination, +`\texttt{webtoc}', in the table of contents. Use this +\texttt{webtoc} to jump to the table of contents using +the macro \cs{hyperlink}. + +\redpoint When the \texttt{extended} option is in effect, a slight redefinition +of \cs{maketitle} occurs. See the details in section~\ref{maketitlepro}, +\Nameref{maketitlepro}. + +\subsection{The Title Page Directory}\label{titlepagedir} + +When the \texttt{usedirectory} option is taken, a directory listing +appears on the title page. The default structure of the directory is + +\makeatletter + \vbox{\begin{flushleft}{\web@formatWordDirectory\web@directory}% + \vspace{-3pt}% + \begin{itemize}\setlength{\itemsep}{-3pt}\web@formatDirectoryItems + \if\web@removeDirTOC y\else\item\relax\dirTOCItem\fi + \if\web@removeDirArticle y\else\item\relax\dirArticleItem\fi + \web@addtoDirList + \end{itemize} + \end{flushleft}} +\makeatother +There are several commands that can be used to modify the directory. +\settowidth{\aebdimen}{\cs{dirContentLink\darg{Begin \string\hyperlink\darg{\string\web@Start.1}\darg{Article}}}} +\begin{dCmd}[commandchars=!()]{\aebdimen+2\fboxsep+2\fboxrule} +\directoryName{Directory} +\tocName{Table of Contents} +\dirContentLink{Begin \hyperlink{\web@Start.1}{Article}} +\end{dCmd} +\newtopic These three define the default text strings +that appear. In the case of \cs{dirContentLink}, +there is a built-in \cs{hyperlink} to the start of +the article. +\settowidth{\aebdimen}{\cs{formatWordDirectory\darg{\string\bfseries\string\large}}} +\begin{dCmd}[commandchars=!()]{\aebdimen+2\fboxsep+2\fboxrule} +\formatWordDirectory{\bfseries\large} +\formatDirectoryItems{\bfseries} +\end{dCmd} +\newtopic The formatting of the \cs{directoryName} can be set by \cs{formatWordDirectory}, +the default definition is given above. The (global) formatting for the listing of the +items can be set using \cs{formatDirectoryItems}, the default is shown above. +\settowidth{\aebdimen}{\cs{removeDirTOC\quad\string\removeDirArticle}} +\begin{dCmd}[commandchars=!()]{\aebdimen+2\fboxsep+2\fboxrule} +\removeDirTOC!quad\removeDirArticle +\end{dCmd} +\newtopic These two commands remove the ``Table of Contents'' and +the ``Begin Article'' items from the list, respectively. + + +\settowidth{\aebdimen}{\cs{addtoDirList\darg{\meta{new\_item}}}} +\begin{dCmd}[commandchars=!()]{\aebdimen+2\fboxsep+2\fboxrule} +\addtoDirList{!meta(new_item)} +\dirTOCItem +\dirArticleItem +\end{dCmd} +\newtopic To add a new item to the end of the directory list, use \cs{addtoDirList}, the argument +is the new item. The other two commands \cs{dirTOCItem} and \cs{dirArticleItem} are commands +representing the first two default items. For example, typing +\begin{Verbatim}[xleftmargin=\amtIndent] +\addtoDirList{My home page is \url{www.example.com}} +\end{Verbatim} +in the preamble, adds this item to the end of the list. Should you want your home page listed first, you could do the +following + +\begin{Verbatim}[xleftmargin=\amtIndent] +\removeDirTOC +\removeDirArticle +\addtoDirList{My home page is \url{www.example.com}} +\addtoDirList{\dirTOCItem} +\addtoDirList{\dirArticleItem} +\end{Verbatim} + +\newtopic The following are for creating some special effects around the directory, +such as putting the directory into a multicolumn format. + +\settowidth{\aebdimen}{\cs{priorDirMatter\darg{\meta{text/commands}}}} +\begin{dCmd}[commandchars=!()]{\aebdimen+2\fboxsep+2\fboxrule} +\priorDirMatter{!meta(text/commands)} +\afterDirMatter{!meta(text/commands)} +\priorDirList{!meta(text/commands)} +\afterDirList{!meta(text/commands)} +\end{dCmd} + +Below is a partial listing of the definition of \cs{webdirectory}, the internal name +for the directory. We present the code so you can see where the prior/after commands +write to. +\begin{Verbatim}[xleftmargin=\amtIndent,commandchars=!()] +\web@priorDirMatter +\begin{flushleft}{\web@formatWordDirectory\web@directory}% +\web@priorDirList +\vspace{\vspaceAfterDirName}% +\begin{itemize} + !anglemeta(directory listing) +\end{itemize} +\web@afterDirList +\end{flushleft} +\web@afterDirMatter +\end{Verbatim} +\newtopic Contained within the code is another command, \Com{vspaceAfterDirName}, not mentioned before. +It is used to adjust vertical spacing after the directory name and +the beginning of the itemize list. + +A final command that may be useful is \Com{directoryhook}. It is used for manipulating +the directory as a whole. + +\bgroup\obeyspaces % +\settowidth{\aebdimen}{\ttfamily{ \anglemeta{code that manipulates \#1}}}% +\begin{dCmd}[commandchars=!()]{\aebdimen+2\fboxsep+2\fboxrule} +\directoryhook{ + !anglemeta(code that manipulates #1) +} +\end{dCmd} +\egroup +\newtopic The argument of \cs{directoryhook} is some \LaTeX{} code that manipulates \texttt{\#1}, within +the argument \texttt{\#1} refers to \cs{webdirectory}, the internal name of the directory. +The following example places a colored box around the directory, and centers it on the title page. + +\begin{Verbatim}[xleftmargin=\amtIndent] +\directoryhook{% + \begin{center} + \setlength{\topsep}{0pt}% + \fcolorbox{red}{webyellow}{% + \parbox{.4\linewidth}{#1}}% + \end{center} +} +\end{Verbatim} + +\exAeBBlogPDF{p=283} See the file +\texttt{\href{\urlAcroTeXBlog/?p=283}{multicol\_dir.pdf}} +for examples of many of these commands. This file is posted on the +\href{\urlAcroTeXBlog}{\AcroBlog}. + + +%\directoryhook + + +\subsection{The TOC for Web} + +The \pkg{web} style comes with its own table of contents format, +as seen in the table of contents for the screen version of this document. +The amount of indentation can be adjusted using \cs{tocindent}. The default is +\begin{Verbatim}[xleftmargin=\amtIndent] +\tocindent{20pt} +\end{Verbatim} +There is another relevant parameter, \cs{widestNumber}. The value of the +argument of this command declaration sets the amount of indentation for the +subsection numbers. The default is +\begin{Verbatim}[xleftmargin=\amtIndent] +\widestNumber{0.0.} +\end{Verbatim} +This is a template for the subsection numbers, the default is a one digit +section number and a one digit subsection number. In the preamble of this +document, I've set \cs{widestNumber\darg{0.00.}}, since some subsection +numbers have two digits. + +\newtopic The color of the heading of the table of contents is set through +\settowidth{\aebdimen}{\cs{tocColor\darg{\meta{named\_color}}}} +\begin{dCmd}[commandchars=!()]{\aebdimen+2\fboxsep+2\fboxrule} +\tocColor{!meta(named_color)} +\end{dCmd} +Specifying a color through this command at any time before the creation of the table of contents +will change the color of the heading. The default is blue. + + +\redpoint If you prefer the standard {\LaTeX}, the +\texttt{\hyperref[sss:latextoc]{latextoc}} option can be used.\endredpoint + +\subsection{The +\texorpdfstring{\protect\texttt{usedirectory}}{usedirectory} +Option}\label{sss:nodir} + +When the \texttt{usedirectory} option is specified, a short +directory appears on the first page, see \Nameref{titlepagedir} for +more details. + +\redpoint \textbf{\textcolor{red}{Important Note:}} In previous versions +of {\Web}, the directory automatically appeared, and there was a +\texttt{nodirectory} option to make it go away. Now, the directory +does not appear by default, and the option \texttt{usedirectory} +makes it appear. The \texttt{nodirectory} option is still defined, +but does nothing.\endredpoint + + +\subsection{The \texorpdfstring{\protect\texttt{latextoc}}{latextoc} +Option}\label{sss:latextoc} + +If you don't like the default design for the table of contents, +you can always recover the standard \LaTeX\ table of contents by +using the \texttt{latextoc} option with the \pkg{web} +package: +\begin{Verbatim}[xleftmargin=\amtIndent] +\usepackage[latextoc]{web} +\end{Verbatim} +\noindent Should you want to go with this option, you might consider +including +\begin{Verbatim}[xleftmargin=\amtIndent] +\hypersetup{linktocpage} +\end{Verbatim} +\noindent Look at the table of contents with and without this +\pkg{hyperref} option to decide which you prefer. + +\subsection{The \texttt{centertitlepage} Option}\label{centertitle} + +Beginning with version 5.0, there is a \texttt{centertitlepage} option +that attempts to center the title page better when the \texttt{forpaper} option +is taken. The \cs{textwidth} of the document is preserved. + +\subsection{The \texttt{centertitlepagefull} Option}\label{centertitlefull} + +When the \texttt{centertitlepagefull} option is used, the content of the title +page is centered on the page when the \texttt{forpaper} option +is taken. The \cs{textwidth} is \cs{paperwidth} minus \texttt{2\cs{coverpagemargin}}. +The default value of the \emph{command} \cs{coverpagemargin} is \texttt{1\,in}. + + +\subsection{The \texorpdfstring{\protect\cs{makeinlinetitle}}{\CMD{makeinlinetitle}} Command}\label{inlinetitle} + \aebCng[makeinlinetitle] + +For some short documents,\footnote{Short documents such as white +papers, homework assignments, for example.} a formal title page may +not be needed or desirable. In this case, use \cs{makeinlinetitle}, +the ``in-line'' title. + +\settowidth{\aebdimen}{\cs{makeinlinetitle}} +\begin{dCmd}[commandchars=!()]{\aebdimen+2\fboxsep+2\fboxrule} +\makeinlinetitle +\end{dCmd} + +\newtopic The command, which can be redefined to your needs, has the following design: +\begin{center}\setlength{\tabcolsep}{0pt} +\begin{tabular*}{\linewidth}{@{\extracolsep{\fill}}lcr} + & \cs{webtitle} &\\ +\cs{webuniversity} & \cs{webauthor} & \cs{webemail}\\ +\texttt{date} & & \cs{webversion} +\end{tabular*} +\end{center} +The table above extends the entire \cs{linewidth}. The values of \cs{webtitle}, +\cs{web\-uni\-ver\-sity}, \cs{webauthor}, \cs{webmail} and \cs{web\-ver\-sion} +are populated by their command counterparts, see \hyperref[table:BIM] +{Table~\ref*{table:BIM}}, page~\pageref*{table:BIM}. The \texttt{date}, +as appears in the lower left row, will expand to the current date, +or the value specified by the \cs{date} command. + +\newtopic Below are notes in the case the \texttt{extended} option is in effect: +\begin{itemize} + \item The basic information above can be entered through + \cs{DeclareDocInfo} command as described in + section~\ref*{docinfo}, entitled \Nameref{docinfo}. + \item If the value of the \texttt{prepared} key is not specified, then + \texttt{date} is the current date, otherwise, \texttt{date} is the one specified + as the value of the \texttt{prepared} key. + \item If the value of the \texttt{talksite} key is not specified, then + \cs{webversion} is used; but if \texttt{talksite} is specified, the value of this + key is used instead of \cs{webversion}. +\end{itemize} + +\section{Template Options}\label{ss:templates} + +The \pkg{web} Package has three options (and supporting +commands) for creating colored backgrounds, graphics backgrounds, +and various overlays. + +\subsection{The \texttt{usetemplates} Option} + +The \texttt{usetemplates} option activates the mechanism for +creating colored backgrounds and graphic overlays. A complete +discussion of the commands related to this option can be found +in the section entitled \Nameref{ss:templagemagement}. + +\redpoint See the demo file \texttt{bgtest.tex} for examples. + +\subsection{The \texttt{leftpanel} and \texttt{right\-panel} Options}\label{ss:lrpanel} + +When either of these two options is specified, a vertical panel +is created. See the section entitled \Nameref{ss:templagemagement} +for a complete discussion of the commands related to these options. + +\redpoint See the demo file \texttt{bgtest.tex} for examples. + +\subsection{The \texttt{leftpanelprt} and \texttt{right\-panelprt} Options}\label{ss:lrpanelprt} + +These two options are the same as \texttt{leftpanel} and +\texttt{right\-panel} \emph{when there is no paper option} (\texttt{forpaper}, +\texttt{forcolorpaper}). When a paper option is taken, these options do +nothing. The options are useful for creating a paneled PDF for the +screen, but the paper version that has no panel. + +\section{Navigation Aids}\label{ss:naviaids} + +The \pkg{web} package offers a couple of navigation aids to +help you move around: the \texttt{navibar} Option, and some +\hyperref[sss:diricons]{direction icons}. + +\subsection{A Navigation Bar}\label{sss:navibar} + +Use the \texttt{navibar} option of \pkg{web} to add a +navigation toolbar, as seen at the bottom of this page. +Usage: +\begin{Verbatim}[xleftmargin=\amtIndent,commandchars=!()] +\usepackage[!meta(driver),navibar]{web} +\end{Verbatim} +The result is the navigation bar you see at the bottom of the +page. + +\NaviBarOn\AddToShipoutPicture*{\NaviBarOff} + +\begin{comment} +\redpoint Here is (almost) the preamble of this document. + +\begin{Verbatim}[xleftmargin=\amtIndent] +\documentclass{article} +\usepackage[dvipsone,navibar]{web} % <- navibar option + +\hypersetup{pdfpagemode=None,bookmarksopen=false} + +\title{The Web and Exerquiz Packages Manual of Usage} +\author{D. P. Story} +\subject{How to create on-line exercises and quizzes} +\keywords{LaTeX, hyperref, PDF, exercises, quizzes} +\version{1.30}\copyrightyears{1999-2000} +\email{dpstory@uakron.edu} +\university{THE UNIVERSITY OF AKRON\\ + Mathematics and Computer Science} +\end{Verbatim} +\end{comment} + +\redpoint The toolbar can be turned on or off by the following +commands: \cs{Navi\-Bar\-On}\sCom{NaviBarOn} and +\cs{Navi\-Bar\-Off}\sCom{NaviBarOff}. The navigation toolbar at +the bottom of the page was generated by the \cs{NaviBarOn}. +\cs{NaviBarOff} was placed on the next page to turn off the bar. The +exact code used on this page is +\begin{Verbatim}[xleftmargin=\amtIndent] +\NaviBarOn\AddToShipoutPicture*{\NaviBarOff} +\end{Verbatim} + +\newtopic The colors for the navigation bar can be set with commands +\Com{navibarTextColor} and \Com{navibarBgColor}. Each take a single +argument, a named color. The default colors are \texttt{webblue} and +\texttt{webgray}, respectively. + + +\subsection{\texorpdfstring{\protect\cs{newNaviIcon}} + {\textbackslash newNaviIcon}}\label{ss:newnaviicon} + +The \cs{newNaviIcon} can be used to define a navigation icon. +The action of the icon can be to execute a menu item, perform a +hyper-jump, or execute the JavaScript code. It takes six +parameters: + +\medskip\noindent Parameters +\begin{Verbatim}[xleftmargin=\amtIndent] +#1 = m, j, or l +#2 = command name of the new navigation icon +#3 = width of icon +#4 = height of icon +#5 = text to appear in the center of the icon. +#6 = if m: named menu action, e.g., NextPage, PrevPage, etc. + if j: execute JavaScript + if l: \hyperlink{arg} or \href{arg} +\end{Verbatim} +\noindent Once the \cs{newNaviIcon} command is executed, a new icon is +defined. The name of this new icon is the value of parameter \#2. + +\redpoint \textcolor{blue}{Example:} +\begin{Verbatim}[xleftmargin=\amtIndent] +\newNaviIcon[m]{\myNext}{34pt}{10pt}{Next}{NextPage} +\newNaviIcon[j]{\jsWarning}{34pt}{10pt}{Hi}{app.alert("Hi there")} +\newNaviIcon[l]{\linkJump}{34pt}{10pt}{Go}{\hyperlink{page.1}} +\end{Verbatim} + +\newNaviIcon[m]{\myNext}{34pt}{10pt}{Next}{NextPage} +\newNaviIcon[j]{\jsWarning}{34pt}{10pt}{Hi}{app.alert("Hi there")} +\newNaviIcon[l]{\linkJump}{34pt}{10pt}{Go}{\hyperlink{page.1}} + +\noindent By typing \verb+\myNext\ \jsWarning\ \linkJump+, we get +\[ + \myNext\ \jsWarning\ \linkJump +\] +The colors for the navigation bar can be set with commands +\cs{navibarTextColor} and \cs{navibarBgColor}. + +\subsection{Direction Icons}\label{sss:diricons} + +The up arrow you see in the upper right-hand corner was +constructed using colored rules and the AMS symbol font, +\texttt{amssymb}. The uparrow icon was produced by the command: +\begin{Verbatim}[xleftmargin=\amtIndent] +\insertnaviiconhere{\ArrowUp{\hyperlink{webtoc}}} +\end{Verbatim} +The definition of \cs{ArrowUp}, which be found in the \textsf{web.dtx} file is +\begin{Verbatim}[xleftmargin=\amtIndent] +\newcommand\ArrowUp[1] +{% + \setlength{\fboxsep}{6pt}\normalsize + \raisebox{-\depth}[0pt][0pt]{% + #1{\web@colorbox@w@transparency{\web@directionIconBgColor}% + {\textcolor{\web@directionIconTextColor}{$\bigl\Uparrow$}}}}% +} +\end{Verbatim} + +\noindent Or, more generally, +\begin{Verbatim}[xleftmargin=\amtIndent] +\insertnaviiconhere{\ArrowUp{link_command}} +\insertnaviiconhere{\ArrowDown{link_command}} +\end{Verbatim} +\noindent This will insert direction icons on the current page (I +hope). + +\insertnaviiconhere{\ArrowUp{\hyperlink{toc.1}}} + +\medskip + +If you want a running direction icon you can use +\begin{Verbatim}[xleftmargin=\amtIndent] +\insertnaviiconhereafter{\ArrowUp{link_command}} +\end{Verbatim} +\noindent or +\begin{Verbatim}[xleftmargin=\amtIndent] +\insertnaviiconhereafter{\ArrowDown{link_command}} +\end{Verbatim} + + +\redpoint To discontinue a running arrow icon type +\begin{equation*} +\cs{defaultpageheader} +\end{equation*} +on the page you want the arrow(s) to disappear. + +\newtopic The colors of the direction icons by using +the commands \Com{directionIconTextColor} and +\Com{directionIconBgColor}. Each command takes a named color as its argument; +the default values are \texttt{webblue} and \texttt{webgray}, respectively. + +\subsection{\texorpdfstring{\protect\cs{panelNaviGroup}} + {\textbackslash panelNaviGroup}}\label{ss:panelnavigroup} + +When the \texttt{\hyperref[ss:lrpanel]{leftpanel}} or +\texttt{\hyperref[ss:lrpanel]{rightpanel}} options are chosen, a +(navigation) panel is created. The command \cs{panelNaviGroup} +can be used to create the standard navigation panel. + +%\exPDF{bgtest} See the sample file \texttt{bgtest.tex} for an example of usage. + +\exAeBBlogPDF{p=877} See the file \texttt{\href{\urlAcroTeXBlog/?p=877}{bgtest.pdf}}. +The source file \texttt{bgtest.tex}, attached to the PDF, offers an example +of \cs{panelNaviGroup}. This article is posted on the +\href{\urlAcroTeXBlog}{\AcroBlog}. + + +\section{The Language Options}\label{web:langopts} + +The language options redefine all of the language dependent text +macros that appear on the title page, in the table of contents, and +in the running headers. Invoke these options in the usual +way: +\begin{Verbatim}[xleftmargin=\amtIndent,commandchars=!()] +\usepackage[!meta(driver),!meta(lang_opt)]{web} +\end{Verbatim} +Here, \texttt{\meta{lang\_opt}} is one of the following values: +\begin{quote} +\begin{tabular}{lll} +\texttt{dutch} & \texttt{french} & \texttt{german}\\ +\texttt{italian} & \texttt{norsk} & \texttt{russian}\\ +\texttt{spanish} & \texttt{dansk} & \texttt{polish}\\ +\texttt{finnish} & \texttt{czech} & \texttt{catalan}\\ +\texttt{brazil} & \texttt{turkish} +\end{tabular} +\end{quote} + +The \pkg{web} and \textsf{exerquiz} packages seem to be +compatible with the \textsf{babel} package; you can use +\begin{Verbatim}[xleftmargin=\amtIndent] +\documentclass{article} +\usepackage[french]{babel} +\usepackage[dvips,french]{web} +\usepackage{exerquiz} +\end{Verbatim} +subject to the usual restrictions on these language packages. +(Don't use characters declared active by these languages within a +\cs{label}, or as a field name for a quiz.) + +\section{Paper Related Options and Commands}\label{paperoptions} + +In this section, several paper options are discussed, and one command. + +\subsection{The +\texorpdfstring{\protect\texttt{forpaper}}{forpaper} +Option}\label{sss:webforpaper} + +Some people may want to create exercises using the +\texttt{exercise} environment for a paper document. The +\texttt{forpaper} option can be used to remove the color from the +document, and to restore the standard \cs{textheight} of a standard +\texttt{article} class \LaTeX{} document. + +The \cs{textwidth} is determined from the \cs{screensize} and +\cs{margins} parameters or by the design option (see +\nameref{sss:designoptions}), \emph{if any are given}; consequently, +the line breaks are the same for the ``web'' version and the +``print'' version. If the screen dimensions are not set (by a design +option or by the \cs{screensize} and \cs{margins} commands) when +using the \texttt{forpaper} option, the standard {\LaTeX} page +layout dimensions are used for the class. + +Using the \texttt{forpaper} option with the \texttt{latexlayout} +option will give you the standard \LaTeX{} \cs{textwidth}. + +The \texttt{forpaper} option also changes the \cs{newpage} command +to \cs{par}\cs{medskip} at the end of each solution---we don't +want to waste paper now, do we? + +Finally, there is a Boolean switch \verb+\ifeqforpaper+, which you +are free to use to refine the look your \texttt{forpaper} version. + +\subsection{The +\texorpdfstring{\protect\texttt{forcolorpaper}}{forcolorpaper} +Option}\label{forcolorpaper} + +Same as the \hyperref[sss:webforpaper]{\texttt{forpaper}} option, +but the color operators are not turned off. + + +\subsection{The +\texorpdfstring{\protect\texttt{latexlayout}}{latexlayout} +Option}\label{sss:weblatexlayout} + +For those who want to go ``totally native,'' use the +\texttt{latexlayout} and \texttt{forpaper} options together. When the +\texttt{latexlayout} option is used, the page layout redefinitions of +\pkg{web} are bypassed, leaving the original layout values of the +\texttt{article} class of \LaTeX. + +\redpoint If the \texttt{latexlayout} option is taken, all templates +are turned off, and the \texttt{for\-color\-option} is executed. To remove +color, you need to explicitly take the \texttt{forpaper} option. + +\subsection{The +\texorpdfstring{\protect\texttt{uselatexparts}}{uselatexparts} +and \texorpdfstring{\protect\texttt{uselatexchapters}}{uselatexchapters} +Options} + +As described in \hyperref[partsChaptersDots]{section~\ref*{partsChaptersDots}}, +page~\pageref*{partsChaptersDots}, the {\Web} package redefines the \cs{part} +and \cs{chapter} commands for the purpose of allowing easier access to redefining +how these section elements are to appear in the document and in the table of contents. +You can bypass these definitions by using \texttt{uselatexparts} and +the \texttt{uselatexchapters} options. This may be useful if you want to use AeB +to create a paper document and you want to use that standard definitions, or perhaps +want to use another package to define the look of the table of contents or +of the \cs{part} and \cs{chapter} commands. (The other sectioning comments can be overridden +as well, but any controls provided by the \texttt{extended} option will be lost.) + +\subsection{The \texorpdfstring{\protect\cs{useFullWidthForPaper}} + {\CMD{useFullWidthForPaper}} Command} + +We introduce a command of resetting the page layout paper \emph{when +the \emph{\texttt{forpaper}} option is in effect}. The primary use +is to create standard documents for academics such as homeworks, +syllabuses or any handout to the student. + +This command is used to set the page layout to its maximum width, given +a 1 inch margin. The height is maximized after taking into account +other page parameters that effect it. The parameters \cs{marginparwidth} +and \cs{marginparsep} are set to zero; for this layout, there are no +marginal comments. The command may be redefined as desired. + +\newtopic The command should be used in the preamble, otherwise, it +has no effect. + +\section{Formatting for screen and paper} + +As we learned in \hyperref[paperoptions] +{Section~\ref*{paperoptions}}, {\Web} can format a document in a for +screen or for paper. The {\Web} package provides several commands and +environments for changing content as needed. + +When the \texttt{forpaper} option is used, the switch +\cs{ifeqforpaper}\sCom{ifeqforpaper} is set to true. You can use +this switch, to get different content for the printed page or the +screen page, or you can use the convenience command \cs{prtscr}: + +\settowidth{\aebdimen}{\cs{prtscr\darg{\meta{print\_text}}\darg{\meta{screen\_text}}}} +\begin{dCmd}[commandchars=!()]{\aebdimen+2\fboxsep+2\fboxrule} +\prtscr{!meta(print_text)}{!meta(screen_text)} +\end{dCmd} +\CmdDescription This command expands to \meta{print\_text} if the \texttt{forpaper} option +is taken and to \meta{screen\_text} if not. + +The \cs{prtscr} command is useful for small changes in content, not +involving verbatim text or paragraph breaks. {\Web} defines two additional environments, +\texttt{forpaper} and \texttt{forscreen}. +\settowidth{\aebdimen}{\cs{begin\darg{forscreen}}} +\begin{dCmd}[commandchars=!()]{\aebdimen+2\fboxsep+2\fboxrule} +\begin{forscreen} +.... +.... +.... +\end{forscreen} +\end{dCmd} + +\EnvLoc Anywhere. + +\newtopic Use the \texttt{forscreen} environment to insert commands or content meant only for +the screen. + +\settowidth{\aebdimen}{\cs{begin\darg{forpaper}}} +\begin{dCmd}{\aebdimen+2\fboxsep+2\fboxrule} +\begin{forpaper} +.... +.... +.... +\end{forpaper} +\end{dCmd} + +\EnvLoc Anywhere. + +\newtopic Use the \texttt{forpaper} environment to insert commands +or content meant only for the paper document. + +\newtopic Another command, \cs{NewPage}, is useful for formatting +the same document for print as well as screen + +\settowidth{\aebdimen}{\cs{NewPage}} +\begin{dCmd}{\aebdimen+2\fboxsep+2\fboxrule} +\NewPage +\end{dCmd} + +\CmdLoc Anywhere. + +\CmdDescription This command expands to \cs{newpage} if the +\texttt{forpaper} option is \emph{not taken}, and does nothing, +otherwise. Useful for inserting page breaks in the screen version +that are not needed in the paper version. + +\section{Template Building and Management}\label{ss:templagemagement} + +The {\Web} package has a template building capability. +You can conveniently create backgrounds for your page, insert an +arbitrary number of graphic overlays, create a left or right +(navigation) side panel, define your own navigation icons that +appear in the panel, and write material that will appear in a +panel. + +%\exPDF{bgtest} The demo file for the template feature is \texttt{bgtest.tex}. + +\exAeBBlogPDF{p=877} See the file \texttt{\href{\urlAcroTeXBlog/?p=877}{bgtest.pdf}}. +The source file \texttt{bgtest.tex}, attached to the PDF, +is demo file for the template feature. This article +is posted on the \href{\urlAcroTeXBlog}{\AcroBlog}. + + +\subsection{Template options} + +As with pdfscreen by Radhakrishnan C. V., we shall have the two +options, \texttt{leftpanel} and \texttt{rightpanel}. In addition to +these two, there is the \texttt{usetemplates} option. Use the +option \texttt{usetemplates} if you want to use colored backgrounds +or overlays without a left or right panel. + +The template, or overlay, capability of the \textsf{Web Package} +requires the use of two \LaTeX{} Packages: \texttt{everyshi.dtx}, +by Martin Schr\"oder, and \texttt{eso-pic.dtx}, by Rolf +Niepraschk. If any of the three template options +(\texttt{usetemplates}, \texttt{leftpanel} or +\texttt{rightpanel}) are used, the \textsf{eso-pic package} is +automatically included by \pkg{web}. The \textsf{eso-pic +package}, in turn, inputs the \textsf{everyshi} package. These two +packages need to be present on your system, unpacked, and in the +search path of \LaTeX. + +Templates, or overlays, are available for the all driver options. + +\subsection{Text Screen Template} + +You can specify a graphic that will be overlaid onto the text +screen, that portion of the screen to which {\LaTeX} content is +written. If a panel option has not been specified, this is the +whole screen; otherwise, it is that portion of the screen outside +the panel. + +If one of the options \texttt{usetemplates}, \texttt{leftpanel} or +\texttt{rightpanel} is specified, the commands +\begin{Verbatim}[xleftmargin=\amtIndent,commandchars=!()] +\template{!meta(graphics_file_name)} +\textBgColor{!meta(named_color)} +\end{Verbatim} +insert a background graphic and a background color, +respectively, onto the text screen region. The \cs{template} command +will rescale the graphic to cover the entire text screen region. + +Additional graphics can be overlayed with the \cs{AddToTemplate} +command. +\begin{Verbatim}[xleftmargin=\amtIndent,commandchars=!()] +\AddToTemplate{!meta(template_name)} +\end{Verbatim} +The command takes one argument, the \meta{template\_name}. +Define an overlay, +\begin{Verbatim}[xleftmargin=\amtIndent,commandchars=!()] +\newcommand\myTemplate +{% + !anglemeta(commands to insert an overlay) +} +\end{Verbatim} +\noindent the \meta{template\_name} for this template is \texttt{myTemplate}. (Note that there +is no backslash.) To add this template to the list graphics to be overlayed onto the page, +we would type +\begin{Verbatim}[xleftmargin=\amtIndent] +\AddToTemplate{myTemplate} +\end{Verbatim} + +\redpoint \textcolor{blue}{Example:} Insert the ``\AcroT'' logo in lower-left corner, offset by~36pt +in the $x$ and $y$ directions. +\begin{Verbatim}[xleftmargin=\amtIndent] +\newcommand\AEBLogo +{% + \put(36,36){\includegraphics{acrotexlogo}}% +} +\AddToTemplate{AEBLogo} +\end{Verbatim} +\noindent Because the \textsf{Web Package} uses \textsf{eso-pic}, the +commands will be executed within a \texttt{picture} environment. +Within the \texttt{picture} environment, the reference point of the text +screen is the lower-left corner. The above code puts the +``\AcroT'' logo at coordinates of \texttt{(36,36)} relative to the +lower-left corner. The units are measured in (\TeX) points. + +\redpoint \textcolor{blue}{Example:} Center the logo within the text screen region. +\begin{Verbatim}[xleftmargin=\amtIndent] +\newcommand\AEBLogoCenter +{% + \ifnum\arabic{page}>1\relax + \parbox[b][\paperheight][c]{\textscreenwidth} + {\centering\includegraphics{acrotexlogo}}% + \fi +} +\AddToTemplate{AEBLogoCenter} +\end{Verbatim} + +\noindent +See the section titled \Nameref{sss:templatemanage} for details of +how to manage your templates. + +\subsection{Panel Screen Template}\label{panelscreentemplate} + +When the \texttt{leftpanel} or \texttt{rightpanel} +option is specified, a (navigation/logo) panel is created. The commands +\begin{Verbatim}[xleftmargin=\amtIndent,commandchars=!()] +\paneltemplate{!meta(graphics_file_name)} +\panelBgColor{!meta(named_color)} +\end{Verbatim} +\noindent set the overlay graphic and the background color, respectively. +The graphic is rescaled to fit the panel region. + +Once the panel and its background have been defined, contents and +form elements can be placed on top of the panel. The command \cs{buildpanel} can +be used for this purpose. For example, from the sample file +\texttt{bgtest.tex}, +\begin{Verbatim}[xleftmargin=\amtIndent] +\buildpanel +{% + \href{http://www.math.uakron.edu/} + {\includegraphics[scale=.4]{uakron}} + \par\vspace{\stretch{1}} + \href{http://www.math.uakron.edu/~dpstory/acrotex.html} + {\rotatebox{-90}{\aebLogo}} + \par\vspace{\stretch{1}} + \panelNaviGroup % defined in web +} +\end{Verbatim} +\noindent The content of the panel is stacked from top to bottom.\footnote{The command \cs{aebLogo} +is defined in the file, \texttt{bgtest.tex}.} + +\redpoint Additional overlays can be added with +\cs{AddToPanelTemplate}. The command may not be as useful as the panel overlay can +always be rebuilt using \cs{buildpanel}.\endredpoint + +\newtopic The minimal width for the panel is set through the \aebCng[minPanelWidth] +\Com{minPanelWidth} command, the default size is 1in; that is, +\verb!\minPanelWidth{1in}! is executed by the package at start up. + +\settowidth{\aebdimen}{\cs{minPanelWidth\darg{\meta{length}}}} +\begin{dCmd}[commandchars=!()]{\aebdimen+2\fboxsep+2\fboxrule} +\minPanelWidth{!meta(length)} +\end{dCmd} + +\CmdLoc You can reset the minimal width by executing the +command in the preamble before the \cs{screenwidth} and \cs{margins} +commands. Or, place it in the \texttt{web.cfg}. + +\subsection{Template Management}\label{sss:templatemanage} + +In order to change backgrounds or templates, on any page, re-issue +any one of the commands \cs{template} or \cs{textBgColor} (for the +screen text region), or \cs{paneltemplate} or \cs{textBgColor} +(for the panel region). + +The panel overlay can be redesigned with \cs{buildpanel}, or some of the +command components that make up the panel overlay can be redefined. + +Templates that are inserted into the output stream using +either \cs{AddToTemplate} or \cs{AddToPanelTemplate} can also be +redefined on any page. + +Templates, created by either \cs{AddToTemplate} or +\cs{AddTo\-Panel\-Template}, can also be \emph{disabled} or \emph{enabled} +individually. For example, if the \texttt{AEBLogoCenter} template +has been overlayed using the command +\begin{Verbatim}[xleftmargin=\amtIndent] +\AddToTemplate{AEBLogoCenter} +\end{Verbatim} +\noindent the template can be disabled (turned off) by typing +\begin{Verbatim}[xleftmargin=\amtIndent] +\disableTemplate{AEBLogoCenter} +\end{Verbatim} +\noindent on any page. (\textcolor{red}{Note:} The effects of this command +may be not be seen until the following page.) Turn the template +on by typing +\begin{Verbatim}[xleftmargin=\amtIndent] +\enableTemplate{AEBLogoCenter} +\end{Verbatim} +\noindent on any page. + +For the panel region, there are commands for \emph{disabling} +(\cs{disablePanelTemplate}) and \emph{enabling} (\cs{enablePanelTemplate}) as +well. Each of these takes a \meta{template\_name} as an argument. + +There are a number of commands for \emph{clearing} backgrounds and +templates. +\begin{Verbatim}[xleftmargin=\amtIndent] +\ClearTextTemplate +\ClearPanelTemplate +\end{Verbatim} +\noindent These two clear background colors and background graphics. +\begin{Verbatim}[xleftmargin=\amtIndent] +\ClearBuildPanel +\end{Verbatim} +\noindent This command will clear the build panel as well as the graphics +and field elements that lay on top of the panel created by the +\cs{buildpanel} command. +\begin{Verbatim}[xleftmargin=\amtIndent] +\ClearAllTemplates +\end{Verbatim} +\noindent The command \cs{ClearAllTemplates} is equivalent to executing \cs{ClearTextTemplate} and +\cs{ClearPanelTemplate}. +\begin{Verbatim}[xleftmargin=\amtIndent] +\ClearTextTemplateBuffer +\ClearPanelTemplateBuffer +\end{Verbatim} +\noindent The commands will clear all overlays, including overlays created by +\cs{Add\-To\-Template} and \cs{Add\-To\-Panel\-Template}. + +\redpoint See the documentation file, \texttt{web.dtx}, for exact definitions of the +commands in this section. + +% \subsubsection{Parameters used in Template Building}\label{sss:partemp} + +\section{The \texttt{extended} or \texttt{pro} Option}\label{webpro} + +Version 5.0 of {\Web} introduces the \texttt{pro}, which encompasses many new +features. The \opt{pro} option has a preferred alias of \opt{extended}. The +\opt{extended} option uses the very fine package \texttt{xkeyval} by +Hendri Adriaens, which enables developers to create commands with key-value +pairs. + +\newtopic The following new features are provided by the \texttt{extended} option: +\begin{questions} + \item \cs{DeclareDocInfo}: A data structure for setting various document properties. + \item A slightly re-designed \cs{maketitle}. Also, increased control over + the placement of the elements of the title page. + \item Extensive control over the display of \cs{section}, \cs{subsection}, + \cs{subsubsection} headings. Now color, fonts, size and so on can easily + be set. + \item A choice of using section numbers (the default) or no sections, or dings. + \item A single data structure to set virtually all colors. +\end{questions} +Details provided in subsequent sections. + +\subsection{\texorpdfstring{\protect\cs{DeclareDocInfo}}{\CMD{DeclareDocInfo}}}\label{docinfo} + +The preamble of your document should contain a number of keys that +identify the document, including the title and author of the +document. Some of this information is used to construct the +title page, some is placed in the {\PDF}, to be displayed in the +`Description' tab of the \textbf{Document Properties} dialog box, which +is accessed through the \texttt{Ctrl+D} accelerator key, or through +the menu system \texttt{File > Document Properties...} (for version 8, +this is \texttt{File > Properties...}). + +Information is passed through the \cs{DeclareDocInfo} command which +takes a number of key-value pairs. This is a simple \textsf{xkeyval} +interface to many of the text macros that are defined in \Web. + +\settowidth{\aebdimen}{\cs{DeclareDocInfo\darg{\meta{KV-pairs}}}} +\begin{dCmd}[commandchars=!()]{\aebdimen+2\fboxsep+2\fboxrule} +\DeclareDocInfo{!meta(KV-pairs)} +\end{dCmd} + +\CmdLoc Place in the preamble. + +\KVP The following is a description of the key value pairs. +\begin{enumerate} + \item \texttt{title}: The title of the document. + \item \texttt{author}: The author or authors of the document. + \item \texttt{subject}: The subject of the presentation. Optional, this appears only in the + `Description' tab of the \textbf{Document Properties}. + \item \texttt{keywords}: A list of keywords that describe your document. Optional, this appears only in the + `Description' tab of the \textbf{Document Properties}. Some search engines use this field. + \item \texttt{university}: The university or company the author represents. + \item \texttt{email}: The email address of the author. This appears on the title page, and becomes + an email link. + \item \texttt{version}: The version number of the document. + \item \texttt{versionLabel}: Text that precedes the version number. The default is \texttt{Version}. + \item \texttt{talkdate}: Date of the presentation. + + The fields \texttt{version} and \texttt{talkdate} occupy the + same position on the title page. If the \texttt{talkdate} is + specified, then the talk date will appear on the title page, if + \texttt{talkdate} is not specified, then \texttt{version} will + appear. Both \texttt{version} and \texttt{talkdate} can be + specified, but in this case, it is \texttt{talkdate} that will + appear. The \texttt{version} can be used for version + management. + + \item \texttt{talkdateLabel}: Text that precedes the date of the document. The default text for the talkdate label + is \texttt{Presented:}. + \item \texttt{talksite}: Site of the presentation. This field can be used for generally anything, for + example, you could specify your web site. + \item \texttt{copyrightyears}: Year(s) of the copyright of this publication, defaults to this year. + \item \texttt{prepared}: The date of preparation of the + document, defaults to the day the file was compiled (\LaTeX ed). + This was formerly the last revision date. + \item \texttt{preparedLabel}: The label that precedes the date \texttt{prepared}. The default string + value is \texttt{Prepared:}. The old default was \texttt{Last Revision Date:}, and will remain so + if the \texttt{extended} option is not taken. + \item \texttt{copyrightStatus}: If the \textsf{aebxmp} package is loaded for advanced metadata, + this key allows you to set the copyright status. Possible + values \texttt{True}, \texttt{False}, or blank (no value, or the key not listed at all) + corresponding to \textsf{Copyrighted}, \textsf{Public Domain} and + \textsf{Unknown}, respectively. The values of this key are case sensitive, so you must enter + \texttt{True} and \texttt{False}, with the first letter capitalized. If \textsf{aebxmp} is + not loaded, specifying this key does nothing. + \item \texttt{copyrightNotice}: If the \textsf{aebxmp} package is loaded for advanced metadata, + this key allows you to set copyright notice, short text describing the copyright, perhaps, +\begin{Verbatim}[xleftmargin=\amtIndent] +copyrightNotice={Copyright D. P. Story, 2009--2012} +\end{Verbatim} + If \textsf{aebxmp} is not loaded, specifying this key does nothing. + \item \texttt{copyrightInfoURL}: If the \textsf{aebxmp} package is loaded for advanced metadata, + this key allows you to set the copyright info url, a url to + a page on the web containing a more detailed description of the copyright. If \textsf{aebxmp} is + not loaded, specifying this key does nothing. + \item \texttt{authors}: A list of authors, \emph{each enclosed in braces}. + Names of individual authors can be accessed using the JavaScript \texttt{info.Authors} + property: the first author is \texttt{info.Authors[0]}; the second + author is \texttt{info.Authors[1]}, etc. +\begin{Verbatim}[xleftmargin=\amtIndent] +authors={D. P. Story}{J\u00FCrgen Gilg} +\end{Verbatim} +Notice the use of unicode to create a u-umlaut (\"{u}). + \item \texttt{Keywords}: Similar to keywords, but note the capital `K'. Then + \texttt{Keywords} is used to list the keywords, they are inserted into the + metadata as an array. The individual keywords can be accessed through a special + JS function, \texttt{aKeywords()}, defined by the \textsf{aebxmp} package. The syntax + is the same as \texttt{keywords}: +\begin{Verbatim}[xleftmargin=\amtIndent] +Keywords={AcroTeX.Net,XMP,E4X,Adobe Acrobat,JavaScript} +\end{Verbatim} +If you execute \texttt{aKeywords(0)}, the string \texttt{"AcroTeX.Net"} is returned. +Executing \texttt{aKeywords(4)} returns \texttt{"JavaScript"}, while executing +\texttt{aKeywords(5)} returns \texttt{undefined}. + \item \texttt{authortitle}: The \texttt{authortitle} is a field that appears + on the \textsf{Additional Metadata} dialog box. It can be used for whatever purpose you wish. +\begin{Verbatim}[xleftmargin=\amtIndent] +authortitle={Programming and Development, AcroTeX.Net} +\end{Verbatim} + \item \texttt{descriptionwriter}: This key fills a field on the +\begin{Verbatim}[xleftmargin=\amtIndent] +descriptionwriter={A good, well-liked guy} +\end{Verbatim} + \textsf{Additional Metadata} dialog box. For example + \item \texttt{customProperties}: Acrobat allows for the creation of + custom properties which are accessible through the \texttt{info} + object. The value of this key consists of one or more property + definition(s) enclosed in braces. Each property definition has two + required key-value pairs, \texttt{name} and \texttt{value}. The + \texttt{name} needs to be a simple name consisting of letters and + numbers (not starting with a number). The \texttt{value} string + can be any string. See the example following: +\begin{Verbatim}[xleftmargin=\amtIndent] +customProperties={name=Developer,value={D. P. Story, Esq.}} + {name=Motivator,value=J\u00FCrgen Gilg} +\end{Verbatim} +Executing \texttt{this.info.Developer} returns the value of +\texttt{"D. P. Story, Esq."}, while, \texttt{this.info.Motivator} returns +\texttt{"J\"{u}rgen Gilg"}. + +\end{enumerate} + +\Ex\label{exDeclareDocInfo} Example of usage of \Com{DeclareDocInfo} can +be found in +\hyperref[fig:declaredocinfo]{Figure~\ref*{fig:declaredocinfo}}, +page~\pageref*{fig:declaredocinfo}. +\paragraph*{Discussion of \texttt{keywords} versus \texttt{Keywords}.} \texttt{Keywords} will overwrite +\texttt{keywords}; the value of \texttt{keywords} is passed to +\pkg{hyperref} which enters them as a single string, while +\texttt{Keywords} enters the keywords. as an array. There is no need to +have both \texttt{keywords} and \texttt{Keywords}. +\paragraph*{Discussion of \texttt{author} versus \texttt{authors}.} Similarly, +\texttt{authors} overwrites \texttt{author}, individual authors names can +be accessed; however, unlike \texttt{keywords}/\texttt{Keywords}, it may +make sense to use both \texttt{author} and \texttt{authors}. The +\pkg{web} package takes a copy of the value of \texttt{author} and uses +it in the title page. It is possible to have two versions of the author's +names, one for presentation and one for the PDF info. +\begin{Verbatim}[xleftmargin=\amtIndent] +author={Dr. D. P. Story, Herr J. Gilg}, +authors={D. Story,J. Gilg}, +\end{Verbatim} +You can do the same thing, with the \texttt{author} key only by using +the \cs{texorpdfstring} command of \texttt{hyperref}: +\begin{Verbatim}[xleftmargin=\amtIndent] +author={\texorpdfstring{Dr. D. P. Story, Herr J. Gilg} + {D. Story,J. Gilg}}, +\end{Verbatim} +The difference is that with \texttt{authors}, individual authors are accessible +through the JavaScript command \texttt{this.info.Authors}. +\begin{figure}[ht] +\footnotesize\centering +\begin{dCmd*}{.9\linewidth} +\DeclareDocInfo +{ + title=My First Presentation, + author=D. P. Speaker, + university=My University, + email=dpspeaker@myu.edu, + talkdate={Dec.\ 17, \the\year}, + talksite=The Talking University, + subject=On the Theory of AcroTeX, + keywords={AcroTeX.Net,XMP,E4X,Adobe Acrobat,JavaScript}, + copyrightStatus=False, + copyrightNotice={Copyright D. P. Story, 2009--\the\year}, + copyrightInfoURL=http://www.acrotex.net, + authors={D. P. Story}{J\u00FCrgen Gilg}, + Keywords={AcroTeX.Net,XMP,E4X,Adobe Acrobat,JavaScript}, + authortitle={Programming and Development, AcroTeX.Net}, + descriptionwriter={A good, well-liked guy}, + customProperties={name=Developer,value={D. P. Story, Esq.}} + {name=Motivator,value=J\u00FCrgen Gilg} +} +\end{dCmd*} +\caption{The \protect\cs{DeclareDocInfo} Command}\label{fig:declaredocinfo} +\end{figure} + +\handpoint \textbf{Two tricks of importance:} When the value contains a +comma, then the whole value should be delimited by matching braces, +as in the \texttt{talkdate} key-value in the +\textbf{Example~\ref*{exDeclareDocInfo}} above. The \pkg{hyperref} +command \Com{texorpdfstring} is handy for giving alternate wording, when +some of the {\LaTeX} commands do not transfer to the {\PDF}'s \textbf{Document Properties}. +For example, the title might have been ``A Discussion of $e^x$''; this title should appear +in \cs{DeclareDocInfo} as follows: +\begin{Verbatim}[xleftmargin=\amtIndent] +title=A Discussion of \texorpdfstring{$e^x$}{exp(x)}, +\end{Verbatim} +\noindent Now the phrase, ``A Discussion of exp(x)'' will appear in +the `Title' field of the \textbf{Document Properties}. + +%\exPDF{web_pro} The demo file \texttt{web\_pro} illustrates this command. + +\exAeBBlogPDF{p=1112} Download \texttt{\href{\urlAcroTeXBlog/?p=1112}{web\_pro.pdf}} +from the {\AcroBlog} website. The source file \texttt{web\_pro.tex} is +attached to the PDF, illustrates this command. + + +\subsection{\texorpdfstring{\protect\cs{DeclarePageLayout}}{\CMD{DeclarePageLayout}}}\label{pagelayout} + +The \Com{DeclarePageLayout} command gathers together many page +layout parameters, both for {\LaTeX} and for {\Web}, into one +convenient package of key-value pairs. + +\CmdLoc Place in the preamble. + +\KVP The following is a description of the key value pairs. +\begin{enumerate} +\item \texttt{design}: This key sets the \texttt{screensize} + according to preset dimensions, permissible values are + \texttt{designi}, \texttt{designii}, \texttt{designiii}, + \texttt{designiv}, \texttt{designv}, \texttt{designvi}, + \texttt{designvii}, \texttt{designviii}, and \texttt{designix}. These correspond to the + package options of the same names. This key is ignored if one of the + design options was taken as a {\Web} option. This key sets both the + \cs{screensize} and \cs{margins} commands. +\item \texttt{screensizeOf}: This key sets the \texttt{screensize} + only (does not change the margins), possible values are + \texttt{designi}, \texttt{designii}, \texttt{designiii}, + \texttt{designiv}, \texttt{designv}, \texttt{designvi}, + \texttt{designvii}, \texttt{designviii}, and \texttt{designix}. Use this key, in + combination with the \texttt{margins} key, to use a standard design + \texttt{screensize}, but with different margins. +\item \texttt{screensize}: Sets the \texttt{screensize} by executing + the \cs{screensize} command. The key takes two dimensions as + parameters: +\begin{Verbatim}[xleftmargin=\amtIndent,commandchars=!()] +screensize={!meta(height)}{!meta(width)} +\end{Verbatim} +The \texttt{screensize} key sets the screen to a height of +\meta{height} and a width of \meta{width}. This key is +ignored if a design option has been taken in the {\Web} option list, +or if the \cs{screensize} command has already been executed. +\item \texttt{margins}: Sets the dimensions of the margins of the + screen page. The key takes four dimensions as parameters: +\begin{Verbatim}[xleftmargin=\amtIndent,commandchars=!()] +margins={!meta(left)}{!meta(right)}{!meta(top)}{!meta(bottom)} +\end{Verbatim} +Here \meta{left}, \meta{right}, \meta{top}, and +\meta{bottom} are the dimensions of the margins of the screen +page. These are the same arguments as the \cs{margins} command. This +key is ignored if a design option has been taken in the {\Web} +option list, or if the \cs{margins} command has already been +executed. +\item \texttt{headheight}: Sets the standard page layout parameter + \cs{headheight}. The default is \texttt{8pt}. +\item \texttt{topmargin}: Sets the position of the running header. + The default is 8pt for screen sizes, and the {\LaTeX} default is the + \texttt{forpaper} option is taken. You can say +\begin{Verbatim}[xleftmargin=\amtIndent,commandchars=!()] +topmargin=\prtscr{!meta(paper_dim)}{!meta(screen_dim)} +\end{Verbatim} +To get a \texttt{topmargin} value that works for paper and screen. +(Perhaps you have a border running around the page, and you need to +reposition the header below the border.) This repositioning differs +depending on whether you compile with the \texttt{forpaper} option, +or not. + +\item \texttt{additionalheadsep}: Additional separation between the + running header and the beginning of the text. This parameter + modifies \cs{headsep}, which is computed automatically by the + \pkg{web} package. Use \texttt{additionalheadsep} to add in a + little bit more, if the calculation does not yield good results. The default + value is 0pt. + +\item \texttt{marginparsep}: The horizontal distance between body and + marginal notes. The default is 11pt. When the page size is designed for + viewing on a computer, the margins are often times quite small, and + marginal notes are typically not used. You can use a conditional to give + two values one for screen and one for paper. See the \texttt{topmargin} + key. + +\item \texttt{marginparwidth}: The width of marginal notes. The default is .25in. + When the page size is designed for viewing on a computer, + the margins are often times quite small, and marginal notes are typically not used. + You can use a conditional to give two values one for screen and one for paper. + See the \texttt{topmargin} key. + +\item \texttt{marginparpush}: The minimal vertical space between + successive marginal notes. The default is 5pt. + +\item \texttt{footskip}: Vertical distance separating the baseline + of the last line and the baseline of the footer. The default is + 30pt. + +\item \texttt{webfootskip}: Same as \texttt{footskip}, but the + \texttt{webfootskip} is measured up from the bottom edge of the + document. The default is 4pt. + +\item \texttt{panelwidth}: Sets the panel width. If not specified, + the minimal panel width of 1in is used. Panels appear when either + \texttt{leftpanel} or \texttt{rightpanel} is taken in the option + list of \Web. This key executes the \cs{panelwidth} command. + +\item \texttt{panelsep}: Sets the separation between the text screen + and the panel. The default is 10pt. +\end{enumerate} + +\subsection{The Title Page: + \texorpdfstring{\protect\cs{maketitle}}{\CMD{maketitle}}}\label{maketitlepro} + +In this section, we described the enhanced features for controlling the title page. + +\subsubsection{The Title Page Structure} + +The title page is divided into three parts: top, middle and bottom. +\begin{itemize} +\item \textbf{Title Top:} The content of the top is determined by the \Com{top\-Titl\-ePage} +command. (This command can be redefined, but it is not recommended.) The +\cs{topTitlePage} command expands to three elements: the university (affiliation), the title, +and the author(s), in that order vertically. These are the values of the keys \texttt{university}, +\texttt{title} and \texttt{author} that appear in the \cs{Declare\-Doc\-Info} command. + +\item \textbf{Title Middle:} The \Com{optionalPageMatter} command +is used to enter content into this part of the title page. This middle +part is optional; if \cs{optionalPageMatter} does not +appear in the preamble, then this part of the title page is empty. + +\item \textbf{Title Bottom:} Bottom of the title page is controlled by the contents +of the command \cs{titlepageTrailer} and consists of some of the +document information entered in the \cs{Declare\-DocInfo} command. +By default, \cs{titlepageTrailer} lists the values of the +\cs{DeclareDocInfo} keys \texttt{email}, \texttt{talkdate}, +\texttt{talksite}, and \texttt{copy\-right\-years}, as described above. The +font size of this bottom part is set by the command \cs{trailerFontSize}, the +default is \cs{footnotesize}. This command can be re-defined in the +usual way, for example, +\begin{Verbatim}[xleftmargin=\amtIndent] +\renewcommand{\trailerFontSize}{\scriptsize} +\end{Verbatim} +\end{itemize} + +\newtopic \hyperref[fig:titlepage]{Figure~\ref*{fig:titlepage}}, page~\pageref*{fig:titlepage}, shows the basic +composition of the title page of an {\AEB} document. The title page elements are described as they relate to the +key-values of \nameref{docinfo}, described on page~\pageref{docinfo}. +\begin{itemize} + \item At the very top is the value of the \Indextt{university} key. The color of this + element can be set using the \Indextt{universityColor} key of \hyperref[designColor]{\Com{selectColors}}, + page~\pageref{designColor}. + \item Next comes the value of \Indextt{title}, its color is controlled using the \Indextt{titleColor} + key of \hyperref[designColor]{\cs{selectColors}}. + + \item The author follows, which is the value of \Indextt{author}. The color is set by + \Indextt{authorColor} of \hyperref[designColor]{\cs{selectColors}}. + \item The {\AEB} logo is inserted using \Com{optionalPageMatter}. Normally, + this macro does nothing unless it is defined. In this example, we have +\begin{Verbatim}[fontsize=\small] +\optionalPageMatter +{% + \begin{center} + \begin{minipage}{.67\linewidth} + \centering\includegraphics[scale=.5]{AeB_Logo} + \end{minipage} + \end{center} +} +\end{Verbatim} + \item Finally comes the \Com{titlepageTrailer}, a macro that can + be redefined (see the package file \texttt{web.dtx} for its definition. This + macro places the other elements at the bottom of the page: + \begin{itemize} + \item The copyright year and email address, as given by + \Com{email}. The color of the email address is set by + \Indextt{urlColor} through the command + \hyperref[designColor]{\cs{selectColors}}. This color + actually sets the color of all external \textsf{URL}s. + \item To the right, on the first line of the title page trailer is the value of \Com{talksite}. + The color is the default color for text. + \item In the lower left is the date of the last revision of the document. The color is the default color for + text. + \item In the lower right is the date the talk was given. The color is the default color for text. + \end{itemize} +\end{itemize} +Not shown in Figure~\ref*{fig:titlepage} is the title page directory, which is turned off by default. + +\begin{figure}[ht] +\setlength{\fboxsep}{0pt} +\centering\fbox{\includegraphics[width=.5\linewidth]{figures/titlepage1}} +\caption{The Title Page}\label{fig:titlepage} +\end{figure} + +\newtopic The title page layout is, of course, defined by the standard +\Com{maketitle} command, which has been redefined by the \texttt{extended} option. +In {\Web}, the \cs{maketitle} has different behaviors, one for screen and one for paper. + +\subsubsection{Greater Control of the Top Title Page}\label{top} + +The three elements of the top title page are the values of the keys +\texttt{university}, \texttt{title} and \texttt{author}. Values of these keys +are declared in the command \cs{DeclareDocInfo}. The \texttt{extended} option +defines three commands \cs{universityLayout}, \cs{titleLayout}, and +\cs{authorLayout}, to format these three keys in a variety of ways. + +%\handpoint A working example of the commands that follow can be found in \texttt{aebpro\_ex2.tex}. + +\exAeBBlogPDF{p=1242} See the file +\texttt{\href{\urlAcroTeXBlog/?p=1242}{aebpro\_ex2.pdf}}. The source file +\texttt{aebpro\_ex2.tex}, attached to the PDF, is a working example of the +commands that follow. + +\settowidth{\aebdimen}{\cs{universityLayout\darg{\meta{KV-pairs}}}} +\begin{dCmd}[commandchars=!()]{\aebdimen+2\fboxsep+2\fboxrule} +\universityLayout{!meta(KV-pairs)} +\titleLayout{!meta(KV-pairs)} +\authorLayout{!meta(KV-pairs)} +\end{dCmd} + +\CmdLoc Place these optional commands in the preamble. + +\KVP Each of these commands have a number of key-value pairs. The +first thirteen are the same that appear in the description of +\cs{sectionLayout}, \mlNameref{secHead}. The rest are unique to +these three commands. In the descriptions below, the word `element' +refers to the values of the keys \texttt{university}, +\texttt{title} and \texttt{author}. + +\begin{enumerate} +\item \texttt{fontfamily}: Font family to use with this element, + permitted values are \texttt{rmfamily}, \texttt{sffamily}, \texttt{ttfamily}. + +\item \texttt{fontseries}: Font series to use, possible values are \texttt{bfseries} and \texttt{mdseries}. + +\item \texttt{fontshape}: Font shape to use: \texttt{upshape}, \texttt{itshape}, \texttt{scshape}, \texttt{slshape}. + +\item \texttt{fontsize}: Font size to use with this element, recognized values are \texttt{tiny}, + \texttt{script\-size}, +\texttt{footnotesize}, \texttt{small}, \texttt{normalsize}, + \texttt{large}, \texttt{Large}, \texttt{LARGE}, \texttt{huge}, \texttt{Huge}. + +\item \texttt{halign}: Alignment of this element within its enclosing \cs{parbox}, permissible + values are \texttt{l} (left aligned), \texttt{c} (centered), \texttt{r} (right aligned). See \hyperref[tutex17] + {Example~\ref*{tutex17}} for a visualization of the effects of the \texttt{halign} key. + +\item \texttt{color}: The color of the section title, this can be any named color. The default is blue +for \texttt{title}, and black otherwise. + +\item \texttt{special}: Through this key, you can a specify predefined layout for the title elements. Permissible + values are \texttt{shadow}, \texttt{framebox}, \texttt{colorbox}, \texttt{fcolorbox}, + \texttt{frame\-box\-fit}, \texttt{color\-box\-fit}, \texttt{fcolor\-box\-fit}, \texttt{custom}, \texttt{default}. + +\item[] Custom titles can be created by specifying a value of + \texttt{custom}. In this case, {\Web} uses + \Com{customUniversity}, \Com{customTitle} and \Com{customAuthor}. + These are macros that take one argument, the code for designing the + title. The title is referred to as \texttt{\#1}. Depending on how + these custom titles are defined, the other keys may not be + obeyed. + +\item \texttt{framecolor}: The color of the frame surrounding the subject when the \texttt{special} + key has a value of \texttt{framebox}, \texttt{fcolorbox} \texttt{frameboxfit} or \texttt{fcolorboxfit}. + +\item \texttt{bgcolor}: The background (fill color) of the box enclosing this element, when + \texttt{special} has a value of \texttt{colorbox}, \texttt{fcolorbox}, \texttt{colorboxfit} + or \texttt{fcolorboxfit}. + +\item \texttt{shadowcolor}: The color of the shadow, when \texttt{special} has a value of \texttt{shadow}. + +\item \texttt{beforeskip}: The amount of skip before the title element. + +\item \texttt{afterskip}: The amount of skip after the title element. + +\item \texttt{usefont}: Through this key it is possible to specify +an arbitrary font and font size. The key takes five parameters, for +example, +\begin{Verbatim}[xleftmargin=\amtIndent] +usefont={OT1}{cmdh}{m}{n}{{16}{16pt}} +\end{Verbatim} +The first four are the arguments of the {\LaTeX}'s \cs{usefont}, encoding, family, series and shape. The last argument +are the arguments of the {\LaTeX}'s \cs{fontsize}, size and baselineskip. + +\item[] If the fifth parameter is empty, no font size is specified, the current default sizes are used. + + +%\item \texttt{reset}: This key attempts to reset changes to their defaults. Permissible values are +% \texttt{font} (to reset the font changes only), or \texttt{all} (to reset all the keys). + +\item \texttt{hproportion}: Each of the three elements (university, title, author) lie in their own +\cs{parbox}, the width of this box is determined by the value of this key, as a proportion of the +total \cs{linewidth}. The default for all three is .7. This value can be set to get more or less +``natural'' line breaks, without having to insert a new line with a `\verb!\\!'. See \hyperref[tutex17] +{Example~\ref*{tutex17}} for a visualization of the effects of the \texttt{hproportion} key. + +\item \texttt{xhalign}: The \cs{parbox} of each of the three elements are also placed in a \cs{makebox}, additional +control over positioning can be had by setting this key, which sets the positioning parameter of \cs{makebox}. +The default value for \texttt{xhalign} is \texttt{c}, the element is centered. See \hyperref[tutex17] +{Example~\ref*{tutex17}} for a visualization of the effects of the \texttt{xhalign} key. +\end{enumerate} + +%\exPDF{web_pro} The demo file \texttt{web\_pro} illustrates this command. + +%\exPDF{webpro_titlepg} The file \texttt{webpro\_titlepg} shows the structure of the title page. + +\newtopic Just above the \textbf{Title Top} is a skip that can be \aebCng[aboveTopTitleSkip] +used to push the top down. The default value of this skip is +\texttt{0pt}, but this can be changed through +\cs{aboveTopTitleSkip}. + +\settowidth{\aebdimen}{\cs{aboveTopTitleSkip\darg{\meta{skip}}}} +\begin{dCmd}[commandchars=!()]{\aebdimen+2\fboxsep+2\fboxrule} +\aboveTopTitleSkip{!meta(skip)} +\end{dCmd} + +\newtopic There is one other title page parameter that effects the layout. + +\settowidth{\aebdimen}{\cs{topTitlePageProportion\darg{0..1}}} +\begin{dCmd}[commandchars=!()]{\aebdimen+2\fboxsep+2\fboxrule} +\topTitlePageProportion{0..1} +\end{dCmd} + +\CmdLoc Place this (optional) command in the preamble. + +\PD The top part of the title page is enclosed in a big \cs{parbox} +with depth set to a proportion of \cs{textheight}. +\cs{topTitlePageProportion} is used to set this proportion. The +argument of this command should be a number between 0 and 1, +obviously a value of 0 makes no sense. The default value is set by +the {\Web} package to .33, i.e., the default is +\verb!\topTitlePageProportion{.33}!. + +\begin{figure}[ht] +\setlength{\fboxsep}{0pt} +\centering\fbox{\includegraphics[width=.5\linewidth]{figures/titlepage}} +\caption{The Title Page Layout Structure}\label{fig:titlepage1} +\end{figure} + +\Ex\label{tutex17} \hyperref[fig:titlepage1]{Figure~\ref*{fig:titlepage1}} +gives a representation of the page layout of the title page. The +big \cs{parbox} of depth equal to the proportion of +\cs{textheight} set by \cs{topTitlePage\-Proportion} is +shown as a blue box. Each of the three top title elements are +enclosed in a \cs{makebox}, shown in yellow. Inside this +\cs{makebox}, the top title elements are placed in a \cs{parbox}, +shown in gray. The image shown in +\hyperref[fig:titlepage1]{Figure~\ref*{fig:titlepage1}} came about +as a result of the following commands in the preamble: +\begin{pCmd*}{fontsize=\small}{254pt} +\topTitlePageProportion{.5} +\universityLayout{halign=l,color=red} +\titleLayout{halign=r,xhalign=r,hproportion=.4} +\authorLayout{color=webbrown} +\end{pCmd*} + +\medskip +In \hyperref[fig:titlepage1] +{Figure~\ref*{fig:titlepage1}}, notice that the +\texttt{university} is left aligned within its \cs{parbox}. For +\texttt{title}, the proportion is changed from the default of .7 +to .4, this is manifested by the shorter gray box (which +represents the underlying \cs{parbox}); \texttt{halign} and +\texttt{xhalign} are both set to \texttt{r}, so the title appears +right aligned within its \cs{parbox}, and the \cs{parbox} is right +aligned within its \cs{makebox}, understand? Finally, for the +\texttt{author} key, we change only the color. Swave! + +\subsubsection{Greater Control over Title Page Trailer}\label{trailer} \aebCng[trailer] + +The pro option defines the command \Com{DesignTitlePageTrailer} that takes a +number of key-value pairs to describe the title page trailer. The use of this +command is not needed unless you want something in the trailer other than the default +information.\settowidth{\aebdimen}{\cs{DesignTitlePageTrailer\darg{\meta{KV-pairs}}}} +\begin{dCmd}[commandchars=!()]{\aebdimen+2\fboxsep+2\fboxrule} +\DesignTitlePageTrailer{KV-pairs} +\end{dCmd} + +\KVP The key-value pairs are described below: +\begin{enumerate} + \item \texttt{ul}: The text in the upper left corner of the trailer, the default is +\begin{Verbatim}[xleftmargin=\amtIndent] +\web@copyright\ \web@copyright@symbol\ + \webcopyrightyears\ \thewebemail +\end{Verbatim} + \item \texttt{ur}: The text in the upper right corner of the trailer, + the default is \cs{aeb@talksite}, as defined by the \cs{talksite} + command or the \texttt{talksite} key of the \cs{DeclareDoc\-Info} + command. + \item \texttt{ll}: The text in the lower left corner of the trailer, + the default is \cs{aeb@Prepared}, as defined by the \cs{prepared} + command or the \texttt{prepared} key of the \cs{De\-clare\-Doc\-Info} + command. + \item \texttt{lr}: The text in the lower right corner of the trailer, + the default is \cs{webversion}, as defined by the \cs{version} + command, by the \texttt{version} key, or by the \texttt{talkdate} key. + If \texttt{version} and \texttt{talkdate} both have values, + \texttt{talkdate} is used. + \item \texttt{textColor}: The default color of the text. The default is black. + \item \texttt{bgColor}: The background of the trailer. This is a named color. The default is there is no color. + \item \texttt{borderColor}: The border color of the trailer. This is a named color. If specified, then + \texttt{bgColor} must have a named color too, otherwise, this + key does nothing. The default is that there is no border color. + \item \texttt{fboxsep}: The previous two keys use \cs{colorbox} and \cs{fcolorbox}. You can adjust + the parameters \cs{fboxsep} through this key. The default is 3pt. + \item \texttt{fboxrule}: The width of the rule created when there are values for + \texttt{bgColor} and for \texttt{borderColor}. This key sets the value of \cs{fboxrule}. The default + is .4pt. + \item \texttt{graphic}: The value of this key is the base name of a graphic to be used as the background + of the trailer. The graphic is rescaled to the width and the height of the trailer. It also reduces + \cs{linewidth} so that the text is \cs{fboxsep} from the borders. The default is no graphic. + If the key graphic is specified, then \texttt{bgColor} and \texttt{borderColor} are ignored. + + \item[] If the \textsf{graphicxbox} package is loaded, AeB uses this package to place the graphic. + In this case, the \texttt{borderColor} key is obeyed; whereas, it is not obeyed without the + \textsf{graphicxbox} package. + + \item \texttt{namedgraphic}: This key requires the use of \textsf{graphicxsp}, and Acrobat Distiller. + Use \textsf{graphicxsp} to embed a graphic and give it a symbolic name \anglemeta{mygraphic}. + If you then say \texttt{namedgraphic=\anglemeta{mygraphic}}, the graphic is used without re-embedding the graphic. + The advantage of this method is that the graphic can be used and re-used in the document, without + significantly increasing file size. + + \item[] If the \textsf{graphicxbox} package is loaded, AeB uses this package to place the named graphic. + In this case, the \texttt{borderColor} key is obeyed; whereas, it is not obeyed without the + \textsf{graphicxbox} package. + + \item \texttt{raise}: A key that takes a dimension as its value. The trailer will be raised or + lowered by the amount specified. For example, \texttt{raise=-10pt} lowers the trailer 10pt from its natural + position. + + \item \texttt{fontSize}: Set the font size of the text, the default is \cs{footnotesize}. This key + simply redefines \cs{trailerFontSize}. + + \item \texttt{formatting}: Any additional formatting you wish + that does not cause trouble; for example, + \verb!formatting=\bfseries!. +\end{enumerate} + +%\exPDF{web_pro} The demo file \texttt{web\_pro} illustrates this command. + +\exAeBBlogPDF{p=1112} The demo file \texttt{\href{\urlAcroTeXBlog/?p=1112}{web\_pro.pdf}} +illustrates this command. + + +\subsection{The Table of Contents} + +The pro option also defines \Com{tocLayout} for controlling the +title of the table of contents. + +\settowidth{\aebdimen}{\cs{tocLayout\darg{\meta{KV-pairs}}}} +\begin{dCmd}[commandchars=!()]{\aebdimen+2\fboxsep+2\fboxrule} +\tocLayout{!meta(KV-pairs)} +\end{dCmd} + +\newtopic The key-value pairs are the same as layout commands for the section titles, see +\mlNameref{secHead}. + +\CmdLoc Place this command in the preamble. + +\settowidth{\aebdimen}{\cs{selectTocDings\darg{\meta{KV-pairs}}}} +\begin{dCmd}[commandchars=!()]{\aebdimen+2\fboxsep+2\fboxrule} +\selectTocDings{!meta(KV-pairs)} +\end{dCmd} + +\newtopic When the \cs{noSectionNumbers} command is used (\Nameref{secHead}), the entries in the table of +contents have no section number. You can define a ding for each of the three +levels of the table of contents with this command. The key-value entries in the +\cs{selectTocDings} command are ignored if \cs{noSectionNumbers} is not in effect. + +\CmdLoc Place this (optional) command in the preamble. + +\KVP The following are the recognized key-value pairs: + +\begin{enumerate} +\item \texttt{dDing}: The ding for the first (section) level entry.\\Example, +\verb!dDing=\ding{072}!. +\item \texttt{ddDing}: The ding for the second (subsection) level entry. +\item \texttt{dddDing}: The ding for the third (subsubsection) level entry. +\item \texttt{dDingColor}: The (named) color for the ding of the first level entry. The default is red. +\item \texttt{ddDingColor}: The (named) color for the ding of the first level entry. The default is blue. +\item \texttt{dddDingColor}: The (named) color for the ding of the first level entry. The default is webgreen. + +\end{enumerate} + +%\exPDF{web_pro} The demo file \texttt{web\_pro} illustrates this command. + +\exAeBBlogPDF{p=1112} The demo file \texttt{\href{\urlAcroTeXBlog/?p=1112}{web\_pro.pdf}} +illustrates this command. + + +\subsection{Selecting Colors}\label{designColor} + +The \cs{selectColors} command can be used to set the color of most all elements of +the document that have a color attribute. + +\settowidth{\aebdimen}{\cs{selectColors\darg{\meta{KV-pairs}}}} +\begin{dCmd}[commandchars=!()]{\aebdimen+2\fboxsep+2\fboxrule} +\selectColors{!meta(KV-pairs)} +\end{dCmd} + +\CmdLoc There are no restrictions on this command. In the preamble, +it will set the defaults for the entire document. + +\KVP Each of the following keys take a named color. Many of these keys have a +command interface as well, these are also noted. +\begin{enumerate} +\item \texttt{universityColor}: The color of the value of the \cs{university} + declaration (refer to page~\pageref{docinfo}). The value of + \cs{university} appears on the title page. The default is blue. +\item \texttt{titleColor}: The color of the value of the \cs{title} declaration + (see page~\pageref{docinfo}). + The value of \cs{title} appears on the title page. The default is black. +\item \texttt{authorColor}: The color of the value of the \cs{author} declaration + (see page~\pageref{docinfo}). + The value of \cs{author} appears on the title page. The default is black. +\item \texttt{textBgColor}: The background color of the text screen. The default is white. +\item \texttt{panelBgColor}: The background color of the navigation panel. The default is white. +\item \texttt{urlColor}: The color of an \textsf{URL} link. The default is webbrown. +\item \texttt{linkColor}: The color of a link. The default is webgreen. +\item \texttt{fileColor}: The color of a link to a local file. The default is webbrown. +\end{enumerate} +There are several other colors as well, these can be set through their interface, see +\hyperref[secHead]{Section~\ref*{secHead}}, page~\pageref*{secHead}, for a discussion of +the commands \cs{sectionLayout}, \cs{sub\-sec\-iion\-Layout} and \cs{sub\-sub\-sec\-tion\-Layout}. + +%\exPDF{web_pro} The demo file \texttt{web\_pro} illustrates this command. + +\exAeBBlogPDF{p=1112} The demo file \texttt{\href{\urlAcroTeXBlog/?p=1112}{web\_pro.pdf}} +illustrates this command. + + +\subsection{Section Headings}\label{secHead} + +The {\Web} package uses the section heading commands \cs{section}, \cs{subsection}, and \cs{sub\-sub\-section}, but the +\texttt{extended} option modifies their definitions so that the document author can easily design how the section titles +look. + +\settowidth{\aebdimen}{\cs{noSectionNumbers}} +\begin{dCmd}[commandchars=!()]{\aebdimen+2\fboxsep+2\fboxrule} +\noSectionNumbers +\end{dCmd} +\newtopic The command \Com{noSectionNumbers} causes {\Web} to remove the usual +numbering system for a {\LaTeX} document. This may be useful when +preparing a document for presentation, and a numbering system is not +needed. The default is to use section numbers. + +\CmdLoc The use of this command is restricted to the preamble. The +decision must be made for the whole document at the beginning of the +document. + +\settowidth{\aebdimen}{\cs{subsubsectionLayout\darg{\meta{KV-pairs}}}} +\begin{dCmd}[commandchars=!()]{\aebdimen+2\fboxsep+2\fboxrule} +\sectionLayout{!meta(KV-pairs)} +\subsectionLayout{!meta(KV-pairs)} +\subsubsectionLayout{!meta(KV-pairs)} +\end{dCmd} + +\CmdLoc No restriction on the use of this command. In the preamble, you set the layout +for sections for the whole document. In the body of the document, changes occur immediately +starting with the next relevant section. + +\KVP Each of these takes the same key-value pairs. +\begin{enumerate} +\item \texttt{fontfamily}: Font family to use for section titles, + permitted values are \texttt{rmfamily}, \texttt{sffamily}, \texttt{ttfamily}. +\item \texttt{fontseries}: Font series to use for the section title, values are \texttt{bfseries} and + \texttt{mdseries}. +\item \texttt{fontshape}: Font shapes to use for the section title, values are \texttt{upshape}, \texttt{itshape}, + \texttt{scshape}, \texttt{slshape}. +\item \texttt{fontsize}: Font size of the section title, permissible values are \texttt{tiny}, \texttt{scriptsize}, +\texttt{foot\-note\-size}, \texttt{small}, \texttt{normalsize}. + \texttt{large}, \texttt{Large}, \texttt{LARGE}, \texttt{huge}, \texttt{Huge}. +\item \texttt{halign}: Alignment of the section title, permissible + values are \texttt{l} (left aligned), \texttt{c} (centered), \texttt{r} (right aligned). +\item \texttt{ding}: You can specify a ding to display where the section number is usually placed; e.g., + \verb+ding=\ding{066}+. + +\item \texttt{color}: The color of the section title, this can be any named color. The default is blue. + +\item \texttt{special}: Through this key, you can a specify predefined layout for the section titles. Permissible + values are \texttt{shadow}, \texttt{framebox}, \texttt{colorbox}, \texttt{fcolorbox}, + \texttt{frame\-box\-fit}, \texttt{color\-box\-fit}, \texttt{fcolorbox\-fit}, \texttt{custom}, \texttt{default}. + +\item[] Custom section heads can be used by specifying a value of \texttt{custom}. In this + case, {\Web} uses the values of \Com{customSecHead}, \Com{custom\-Sub\-sec\-Head} and + \Com{custom\-Sub\-sub\-sec\-Head}. Each of these macros take one argument, the code for designing + the title. The title is referred to as \texttt{\#1}. Depending on how these custom section titles + are defined, the other keys may not be obeyed. + +% See an \hyperref[customHeadEx] +% {Example~\ref*{customHeadEx}} below; there are other examples in the demo files. + +\item \texttt{framecolor}: The color of the frame surrounding the subject when the \texttt{special} + key has a value of \texttt{framebox}, \texttt{fcolorbox} \texttt{frameboxfit} or \texttt{fcolorboxfit}. + +\item \texttt{bgcolor}: The background (fill color) of the box enclosing the section title, when + \texttt{special} has a value of \texttt{colorbox}, \texttt{fcolorbox}, \texttt{colorboxfit} + or \texttt{fcolorboxfit}. + +\item \texttt{shadowcolor}: The color of the shadow, when \texttt{special} has a value of \texttt{shadow}. + +\item \texttt{beforeskip}: The amount of skip before the section title. + +\item \texttt{afterskip}: The amount of skip after the section title. + +\item \texttt{usefont}: Through this key it is possible to specify +an arbitrary font and font size. The key takes five parameters, for +example, +\begin{Verbatim}[xleftmargin=\amtIndent] +usefont={OT1}{cmdh}{m}{n}{{16}{16pt}} +\end{Verbatim} +The first +four are the arguments of the {\LaTeX}'s \cs{usefont}, encoding, +family, series and shape. The last argument are the arguments of the +{\LaTeX}'s \cs{fontsize}, size and baselineskip. + +\item[] If the fifth parameter is empty, no font size is specified, the current default sizes are used. + +\item \texttt{numdingcolor}: The color of the section number or ding, if defined. The default is blue. + +\item \texttt{reset}: This key attempts to reset changes to their defaults. Permissible values are + \texttt{font} (to reset the font changes only), or \texttt{all} (to reset all the keys). +\end{enumerate} + +\Ex\label{tutex7} The following example sets the section +title with shadows: text is red and shadow is blue. We center the +title horizontally, and specify an after skip of \texttt{12pt}. +\begin{dCmd*}{.5\linewidth} +\sectionLayout{% + afterskip=12pt, + halign=c, + color=red, + shadowcolor=blue, + special=shadow +} +\end{dCmd*} +\noindent Similarly for \Com{subsectionLayout} and \Com{subsubsectionLayout}. + +% \expoint{ex7} Use \texttt{apb\_ex7.tex} to explore the section layout commands. + +\settowidth{\aebdimen}{\cs{subsubsectionLayout\darg{\meta{length}}}} +\begin{dCmd}[commandchars=!()]{\aebdimen+2\fboxsep+2\fboxrule} +\shadowhoffset{!meta(length)} +\shadowvoffset{!meta(length)} +\end{dCmd} +\newtopic When \texttt{$\text{special} = \text{shadow}$}, shadowing is +obtained by typesetting the text twice with different colors. The +amount of horizontal and vertical offset are controlled by these two +commands. The defaults are \verb!\shadowhoffset{.2ex}! and +\verb!\shadowvoffset{-.2ex}!. + +\newtopic The interface for writing custom section layouts are the following three +commands. + +\settowidth{\aebdimen}{\cs{customSubsubsecHead\darg{\anglemeta{tex\_code}}}} +\begin{dCmd}[commandchars=!()]{\aebdimen+2\fboxsep+2\fboxrule} +\customSecHead{!anglemeta(tex_code)} +\customSubsecHead{!anglemeta(tex_code)} +\customSubsubsecHead{!anglemeta(tex_code)} +\end{dCmd} +\CmdLoc Use in the preamble or before a section head. + +\PD These three commands are used to write custom section, +subsection and subsubsection layouts. Here, the parameter \anglemeta{tex\_code} is +{\TeX} code for laying out the section titles, and should use +\texttt{\#1} to represent the section title. + +\Ex\label{customHeadEx} The following definitions can appear +anywhere, they are global unless appearing in a group. +This puts a colored box around the section title, which +is assumed to appear in one line. We use the internal color names +for the \texttt{color} (\cs{aeb@sectioncolor}) and \texttt{bgcolor} +(\cs{aeb@sectionbgcolor}) keys, in this way, the title will obey the +values of these keys. This particular custom head obeys the +\texttt{halign} key as well. +\begin{dCmd*}{\linewidth} +\makeatletter +\customSecHead{\vbox{\colorbox{\aeb@sectionbgcolor} + {\color{\aeb@sectioncolor}#1}}} +\sectionLayout{% + special=custom, + halign=l, + bgcolor=red, + color=white +} +\makeatother +\end{dCmd*} +\noindent The above code is a simplified version of the \texttt{colorboxfit}, +a value of the \texttt{special} key. + +%\exPDF{web_pro} The demo file \texttt{web\_pro} illustrates these commands. + +\exAeBBlogPDF{p=1112} The demo file \texttt{\href{\urlAcroTeXBlog/?p=1112}{web\_pro.pdf}} +illustrates these commands. + +%\expoint{ex7} See \texttt{apb\_ex7.tex} for a working example of custom section +%head layout. + +%\Important It is important to remark that between slides \texttt{@} +%is made into a `letter', and reset to `other' at the beginning of +%the next slide. This makes it convenient to make these definitions +%between slides. In the preamble, however, such a definition must be +%between \cs{makeatletter} and \cs{makeatother}. + +\section{On Parts, Chapters, and Final Dots}\label{partsChaptersDots} + +The {\Web} package has several commands for customizing the \cs{part} and +\cs{chapter} commands. + +\subsection{The \texorpdfstring{\protect\cs{part}}{\CMD{part}} command} + +The appearance of the part title can be controlled by \cs{formatPartTitle}. + +\settowidth{\aebdimen}{\cs{customSubsubsecHead\darg{\anglemeta{tex\_code}}}} +\begin{dCmd}[commandchars=!()]{\aebdimen+2\fboxsep+2\fboxrule} +\formatPartTitle{!anglemeta(tex_code)} +\noPartNumbers +\end{dCmd} + +\newtopic The argument of \anglemeta{tex\_code} consists of formatting commands; within the +argument \texttt{\#1} represents the title. The command \cs{noPartNumbers} +is a convenience macro to turn off all part number, if you want to create +a document that has no part numbers, such as this document. + +The default argument for \cs{formatPartTitle} + +\begin{Verbatim}[xleftmargin=\amtIndent,fontsize=\small] +\large\bfseries + \ifnum \c@secnumdepth >\m@ne + \partname~\thepart:\space +\fi#1 +\end{Verbatim} +\newtopic This typesets as {\large\bfseries Part I: The Web Package}, for example. You can +modify the basic definition to introduce colors, fonts, sizes of your choice, and +even special effects; for example, the declaration +\begin{Verbatim}[xleftmargin=\amtIndent,fontsize=\small] +\formatPartTitle{\fbox{\large\bfseries + \ifnum \c@secnumdepth >\m@ne + \partname~\thepart:\space +\fi#1}} +\end{Verbatim} +gives a part title like this, {\large\bfseries\fbox{Part I: The Web Package}} + +\newtopic +A companion comment for changing the format of a part title, is \cs{tocPartTitle}, +which modifies how the part title appears in the table of contents. + +\settowidth{\aebdimen}{\cs{tocPartTitle\darg{\cs{thepart}\cs{hspace\darg{1em}\#1}}}} +\begin{dCmd}[commandchars=!()]{\aebdimen+2\fboxsep+2\fboxrule} +\tocPartTitle{!anglemeta(tex_code)} +\tocPartTitle{\thepart\hspace{1em}#1} +\end{dCmd} + +\newtopic Again, within the argument of \cs{tocPartTitle}, \texttt{\#1} refers to the +text of the part title. The default definition is given above also. + +\redpoint Finer control over the formatting of the \cs{part} command can be obtained by redefining +\cs{web@makeparthead} or \cs{web@makesparthead}, the latter one for \cs{part*}.\endredpoint + +\subsection{The \texorpdfstring{\protect\cs{chapter}}{\CMD{chapter}} command} + +The \cs{chapter} command is available in the \texttt{book} and \texttt{report} classes. +There are several defined in the {\Web} package for getting a little control over these. + + +\long\def\formatChapterNumber#1{\def\web@formatChapterNumber{#1}} +\formatChapterNumber{\large\bfseries + \@chapapp\space\thechapter\par\nobreak} +\long\def\formatChapterTitle#1{\def\web@formatChapterTitle##1{#1}} +\formatChapterTitle{% + \interlinepenalty\@M + \noindent\hspace{1em}\large\bfseries#1\par\nobreak +} + +\settowidth{\aebdimen}{\cs{formatChapterNumber\darg{\anglemeta{tex\_code}}}} +\begin{dCmd}[commandchars=!()]{\aebdimen+2\fboxsep+2\fboxrule} +\formatChapterNumber{!anglemeta(tex_code)} +\formatChapterTitle{!anglemeta(tex_code)} +\end{dCmd} + +\newtopic The argument of \ameta{tex\_code} consists of formatting commands; within the +argument \texttt{\#1} represents the title. + +The default definitions for these are + +\begin{dCmd*}{.85\linewidth} +\formatChapterNumber{\large\bfseries + \@chapapp\space\thechapter\par\nobreak} +\formatChapterTitle{% + \interlinepenalty\@M + \noindent\hspace{1em}\large\bfseries#1\par\nobreak +} +\end{dCmd*} +\newtopic These are slighly modified versions of what is found in \texttt{book.cls}. + +\redpoint A finer control can be obtained over the \cs{chapter} command +formatting by redefining \cs{web@makechapterhead} or +\cs{web@makeschapterhead}, the latter one is used for \cs{chapter*}.\endredpoint + +\subsection{The \texorpdfstring{\protect\cs{noFinalDot}}{\CMD{noFinalDot}} Command}\label{nofinaldot} + +The default behavior for the {\Web} package is to place a dot (.) at the end of the section +number in both the body of the document and in the table of contents. Thus, +this section is numbered as \textcolor{blue}{\ref*{nofinaldot}.} (note the final dot following +the section number). This section will appear in the table of contents the same way. The default +behavior of all (that I know of) standard {\LaTeX} classes is not to place this final +dot (.) at the end of the section number. To revert to this behavior, use the +\Com{noFinalDot} command in the preamble. + +%---------------------- Exerquiz -----------------------------------% + +\addtocontents{toc}{% + \par\vskip6pt\vskip0pt plus .25\vsize\penalty-1000 \vskip0pt plus-.25\vsize} + +%\addtocontents{toc}{\par\protect\vspace{\bigskipamount}\kern0pt\vspace{-\medskipamount}} +\part{The Exerquiz Package}\label{s:exerquiz} + +%The \textsf{exerquiz} package contains a series of macros for +%creating on-line exercises, short quizzes (with or without +%solutions), and longer quizzes that are graded using JavaScript. + +%\section{Overview} + +The \textsf{exerquiz} package provides environments for creating +the following interactive elements in a \textsf{PDF} file. + +\begingroup +\def\mylabel#1{\hfil\hyperref[#1]{\large$\bullet$}\ } +\begin{list}{} +{\usecounter{questionno}\setlength{\parsep}{0pt}\setlength{\topsep}{0pt} +\renewcommand{\makelabel}{\mylabel} +\settowidth{\labelwidth}{\normalfont\bfseries00.\ }% +\setlength{\itemindent}{0pt}\setlength{\labelsep}{0pt}}% + +\item[ss:online] \begin{NoHyper}\nameref{ss:online}\end{NoHyper}: +Macros for creating on-line exercises. + +\item[ss:QuizIR] \begin{NoHyper}\nameref{ss:QuizIR}\end{NoHyper}: +Macros for creating interactive quizzes with immediate feedback. + + +%\item[ss:QuizS] \begin{NoHyper}\nameref{ss:QuizS}\end{NoHyper}: +%Macros for creating quizzes with immediate feedback +%and a link to the solutions to the quizzes. + +\item[ss:GradedQuizzes] +\begin{NoHyper}\nameref{ss:GradedQuizzes}\end{NoHyper}: +Macros for creating quizzes graded by Java\-Script, with an option +to have the quizzes corrected using JavaScript. + +\end{list} +\endgroup + +\noindent In each of the quiz environments, you can pose multiple +choice, math fill-in, or text fill-in questions. + +The \textsf{exerquiz} provides the above listed environments for +the \texttt{dvips\-one}, \texttt{dvips}, \texttt{textures}, \texttt{pdftex} (including +lua(la)tex), \texttt{dvipdfm}, \texttt{dvipdfmx}, and \texttt{xetex} options. The package +automatically detects \textsf{pdftex} and \textsf{xetex}, and passes the driver name to +all subordinate packages, \textsf{eforms} and \textsf{insdljs}. + +There are options for reformatting the exercises to a print +format, for excluding the solutions to the exercises, for writing +the solutions to the exercises so they follow the question, and +for different languages, and much more. + +The \textsf{exerquiz} also allows you to rearrange the order and +location of the solutions to the exercises and quizzes, to +redefine many running headers, to customize the exercises and +quizzes, and to use the \texttt{exercise} environment to create +a new environment with its own counter, or with no counter at all. + +All the above mentioned macros and the options of the package are +discussed in this section. + +\section{\protect\textsf{Exerquiz} and Acrobat JavaScript} + +\textsf{Exerquiz} now uses the \textsf{insdljs} Package to insert +Document level Java\-Scripts into the \textsf{PDF} file. The quizzes +created using the \texttt{shortquiz} or \texttt{quiz} environment are +graded, marked and scored using these inserted JavaScript functions. + +Because the package \textsf{insdljs} is already loaded, it is easy +for the document author to develop JavaScripts that can be called +from the standard \textsf{Exerquiz} commands. The ability to write +JavaScript, therefore, right in the \LaTeX{} document gives a +unique programming flair to \textsf{Exerquiz}. + +\section{Package Requirements} + +The \textsf{exerquiz} package is independent of the \pkg{web} +package; however, \textsf{exerquiz} utilizes \pkg{hyperref} +just as \pkg{web} does. Use the latest version of +\pkg{hyperref}. In addition to the \textsf{color} package, +also used by \pkg{web}, \textsf{exerquiz} also uses the +\textsf{verbatim} package. This is used to write verbatim +solutions to exercises and quizzes to certain auxiliary files. + +Results from the quizzes created by the \texttt{shortquiz} and +\texttt{quiz} environments are evaluated using document level +JavaScripts. These JavaScripts are inserted into the final +\textsf{PDF} file using the \textsf{insdljs} package. This package +makes it easy for the package writer or document author to write +JavaScripts. + +The \textsf{exerquiz} package uses \emph{form features} of +\textsf{PDF} that \pkg{web} does not use. For the interactive +features to properly work, use \textcolor{blue}{Adobe Reader +5.0} or higher. + +\section{Basic Package Options}\label{ss:exbasicusage} + +Place in the preamble of your document +\begin{Verbatim}[xleftmargin=\amtIndent] +\usepackage{exerquiz} +\end{Verbatim} + +\redpoint to use \textsf{exerquiz} with the \pkg{web} package, specify, +\begin{Verbatim}[xleftmargin=\amtIndent,commandchars=!()] +\usepackage[!meta(driver),!meta(web_options)]{web} +\usepackage[!meta(eq_options)]{exerquiz} +\end{Verbatim} +A complete list of the options recognized by \textsf{exerquiz} can be +found in \hyperref[s:ListofOpts]{Section~\ref*{s:ListofOpts}}, page~\pageref*{s:ListofOpts}; they are +also discussed below. + +The driver options for the \pkg{web} package are \texttt{dvipsone}, +\texttt{dvips}, \texttt{pdftex}, \texttt{dvipdfm} and \texttt{textures}. +No driver option with \textsf{exerquiz} is needed if you are using the +\pkg{web} package, \textsf{exerquiz} inherits the driver option from +the \pkg{web} package. + +For the \texttt{dvipdfm} option to work properly you +will need \textsf{dvipdfm}, version 0.12.7b or later, and +\pkg{hyperref}, version 6.68a or later. + +\redpoint To use \pkg{hyperref} and \textsf{exerquiz} with +\texttt{dvips}, specify, +\begin{Verbatim}[xleftmargin=\amtIndent,commandchars=!()] +\usepackage[dvips,!meta(hy_options)]{hyperref} +\usepackage[dvips,!meta(eq_options)]{exerquiz} +\end{Verbatim} + +\redpoint To use \pkg{hyperref} and \textsf{exerquiz} with +\texttt{pdftex} or \texttt{xetex}, specify, +\begin{Verbatim}[xleftmargin=\amtIndent,commandchars=!()] +\usepackage[!meta(hy_options)]{hyperref} +\usepackage[!meta(eq_options)]{exerquiz} +\end{Verbatim} +Both \pkg{hyperref} and \pkg{exerquiz} automatically detect the \app{pdflatex} +and \app{xelatex} applications so specification of the driver is not required. + +\redpoint To use \pkg{hyperref} and \textsf{exerquiz} with +any other driver, specify, +\begin{Verbatim}[xleftmargin=\amtIndent,commandchars=!()] +\usepackage[!meta(driver),!meta(hy_options)]{hyperref} +\usepackage[!meta(driver),!meta(eq_options)]{exerquiz} +\end{Verbatim} +the \meta{driver} for both \pkg{hyperref} and \pkg{exerquiz}. + +\redpoint To use \pkg{hyperref} and \textsf{exerquiz}, specify, +\begin{Verbatim}[xleftmargin=\amtIndent] +\usepackage[!meta(pdfs_options)]{pdfscreen} +\usepackage{exerquiz} +\end{Verbatim} +\makebox[0pt][r]{\raisebox{-2pt}{\color{red}\href{{\bUrl/tutorial/webeq/eq_pdfs.zip}}{{\zqacr + b\hspace{9.5pt}}}}\enspace}\ignorespaces +See the sample file \texttt{eq\_pdfs.tex} already set up for use +with \textsf{pdfscreen}, obtained by downloading the zipped file +\texttt{\href{\bUrl/tutorial/webeq/eq_pdfs.zip}{eq\_pdfs.zip}}. + + +\paragraph*{Some \app{xetex} issues.} +In recent versions of \app{xetex}, the application may be set to strip out +named destinations that are not referenced within the document as a target of +a `hard-wired' link; this is an optimization feature. The \pkg{exerquiz} +package sets a lot of destinations (or targets) but, in some instances, +`dynamic' links are employed using the JavaScript method +\texttt{\textsl{Doc}.gotoNamedDest(\anglemeta{target})}. In such instances, +\app{xetex} may strip out these targets; the link or button action may not +perform the jump to the destination because the destination does not exist. +If this becomes an issue for your \app{xetex} installation, the +\textbf{\app{Dvipdfmx} Compatibility Flags} needs to be modified. Search for +the configuration file \texttt{dvipdfmx.cfg} and open the file. Scroll down +to the line `\texttt{\%C 0x0000}', beneath it insert `\texttt{C 0x0010}', +save and close the file.\footnote{MiK\TeX{} discourages the direct editing of +the file \texttt{dvipdfmx.cfg}, instead, execute the line of code +`\texttt{initexmf -{}-edit-config-file dvipdfmx}' at the \app{Windows} +command-line prompt, and edit a local version of the configuration file as +described above.} The documentation for this bit field is just above the +referenced line and an explanation of the `\texttt{C 0x0010}' setting is +given. + + +\begin{comment} +\subsection{The \texorpdfstring{\protect\texttt{pdftex}}{pdftex} +Option}\label{ss:pdftexerquiz} + +The \textsf{exerquiz} package is independent of the \pkg{web} +package. Therefore, you can create your own page layout package +and use \textsf{exerquiz} to help you create exercises and +quizzes. Of course, \pkg{hyperref} must be used. + +%\redpoint Using \textsf{exerquiz} with \pkg{hyperref} or +%\textsf{pdfscreen} + +Should you want to use the \textsf{exerquiz} package using +\textsf{pdftex} without the \pkg{web} package, use the +\texttt{pdftex} option: +\begin{Verbatim}[xleftmargin=\amtIndent] +\usepackage[pdftex,]{hyperref} +\usepackage[pdftex]{exerquiz} +\end{Verbatim} +\noindent In particular, +\textsf{pdfscreen}\footnote{CTAN:macros/latex/contrib/supported/pdfscreen}, +a screen design package written for \textsf{pdftex} by C. V. +Radhakrishnan, has been tested and works correctly with +\textsf{exerquiz}. For example, +\begin{Verbatim}[xleftmargin=\amtIndent] +\usepackage[screen,article,sidebar]{pdfscreen} +\usepackage[pdftex]{exerquiz} +\end{Verbatim} +\noindent See the sample file \texttt{eq\_pdfs.tex} already set up for use +with \textsf{pdfscreen}, obtained by downloading the zipped file +\texttt{\href{\bUrl/tutorial/webeq/eq_pdfs.zip}{eq\_pdfs.zip}}. + +\subsection{The \texttt{dvipdfm} Option}\label{ss:dvipdfm} + +Should you want to use the \textsf{exerquiz} package without +the \pkg{web} package, in this case, the usage is +\begin{Verbatim}[xleftmargin=\amtIndent] +\usepackage[dvipdfm,]{hyperref} +\usepackage[dvipdfm]{exerquiz} +\end{Verbatim} + +%\subsection{The \texttt{dvi\-windo} Option}\label{ss:dviwindo} +% +%Beginning with version 1.3 of \pkg{web} and \textsf{exerquiz}, +%\textsf{dviwindo} (the \texttt{.dvi} previewer by +%\href{http://www.yandy.com/}{\Y&Y, Inc.}) is supported. This +%means that hypertext links will be active from within the +%\textsf{dviwindo} previewer---as well as from within the Adobe +%Reader after the file has been converted to \textsf{pdf}. +% +%Should you want to use the \textsf{exerquiz} package without +%the \pkg{web} package, in this case, the usage is +%\begin{Verbatim}[xleftmargin=\amtIndent] +% \usepackage[dviwindo,]{hyperref} +% \usepackage[dviwindo]{exerquiz} +%\end{Verbatim} + + +\redpoint \textbf{\textcolor{red}{Important Note:}} \emph{Only} +the \texttt{exercise} environment (this is the material described in +\hyperref[ss:online]{Section~\ref*{ss:online}}) is supported by +these two options. None of the quiz environments can be used with +these two options at this time. \Y&Y{} users need to use the +\texttt{dvipsone} option if the quiz environment is needed. +\end{comment} + +\subsection{The Language Option}\label{sss:exerquizlangopts} + +The \hyperref[web:langopts]{language option}, available in the +\pkg{web} package, can be invoked even when the \pkg{web} package is +not used.\footnote{Otherwise, the language option is introduced as an +option of the \pkg{web} package.} Currently, language options supported are +\begin{quote} +\begin{tabular}{lll} +\texttt{dutch} & \texttt{french} & \texttt{german}\\ +\texttt{italian} & \texttt{norsk} & \texttt{russian}\\ +\texttt{spanish} & \texttt{dansk} & \texttt{polish}\\ +\texttt{finnish} & \texttt{czech} & \texttt{catalan}\\ +\texttt{brazil} & \texttt{turkish} +\end{tabular} +\end{quote} +For example, with \pkg{hyperref}, you could use: +\begin{Verbatim}[xleftmargin=\amtIndent,commandchars=!()] +\usepackage[!meta(driver),!meta(hy_options)]{hyperref} +\usepackage[!meta(driver),french]{exerquiz} +\end{Verbatim} +\meta{driver} is any of the supported drivers. + +\redpoint\textbf{\textcolor{red}{Unicode required for \texttt{turkish} and \texttt{russian} options:}} When using the +\texttt{turkish} or the \texttt{russian} option, without using the \pkg{web} +package, use the \texttt{unicode} option for \pkg{hyperref}, like so,\footnote{The +\pkg{web} package passes the \texttt{unicode} option to +\pkg{hyperref} when using the \texttt{turkish} or \texttt{russian} option through the \pkg{web} +option list so there is no need to explicitly use the \texttt{unicode} +option.}\def\1{\hspace*{-\amtIndent}} +\begin{Verbatim}[xleftmargin=\amtIndent,commandchars=!()] +\usepackage[!meta(driver),!meta(hy_options),unicode]{hyperref} +\usepackage[!meta(driver),turkish]{exerquiz} +!1or +\usepackage[!meta(driver),russian]{exerquiz} +\end{Verbatim} +%\noindent This is because the word for ``Table of Contents'' is ``{\.I}{\c +%c}indekiler'' in Turkish. For {\.I}\c{c}indekiler to appear +%correctly in the bookmarks, hyperref needs the \texttt{unicode} +%option.\footnote{The glyph {\.I} (latin capital letter I with dot above) is in the Latin Extended-A group, +%unicode \texttt{U+0130}.} + +\subsection{The +\texorpdfstring{\protect\texttt{forpaper{\protect\normalfont\protect\space and }forcolorpaper}}{forpaper and +forcolorpaper} + Options}\label{sss:exquizforpaper} + +The \texttt{forpaper} or \texttt{forcolorpaper} option, also available in the +\textsf{\hyperref[sss:webforpaper]{web}} package, is needed in the +\textsf{exerquiz} package if you are are using \textsf{exerquiz} +without \pkg{web}. The option is invoked in the usual way. +\begin{Verbatim}[xleftmargin=\amtIndent,commandchars=!()] +\usepackage[!meta(driver),!meta(hy_options)]{hyperref} +\usepackage[!meta(driver),forpaper]{exerquiz} +\end{Verbatim} +\noindent See the discussion of the \texttt{\hyperref[sss:webforpaper]{forpaper}} on +page~\pageref{sss:webforpaper} given earlier. + +\subsection{The \texttt{preview} Option}\label{sss:preview} + +The \textsf{exerquiz} package can generate a large number of form +fields: buttons, check boxes, radio buttons, and text fields. These +are PDF objects and cannot be seen in a dvi previewer. By using +the \texttt{preview} option, the bounding rectangles of the form +objects are surrounded with rules, which outline the form fields +and make their positions visible. + +This option may help you to fine tune the positions of the form +fields. The option is for developmental use only. When you are +satisfied with the positioning and are ready to publish, remove +this option. + +\redpoint This option is not useful with the \texttt{pdftex} option, as +\textsf{pdftex} does not (normally) produce a dvi file. + +\subsection{The \texttt{nodljs} Option}\label{sss:nodljs} + +If you are creating a document that is meant to be printed or your +document only has exercises and solutions in it (which do not +require JavaScript), the size of the document can be reduced +significantly by using the \texttt{nodljs} option. This option is +just passed on to the \textsf{insdljs} package. + +% \subsubsection{The \texttt{acrobativ} Option}\label{sss:acrobativ} +% +% If the document author is using the \texttt{dvips} or the \texttt{dvipsone} option +% but has only Acrobat~4.0 or~4.05, then the document level JavaScripts need +% to be inserted manually. Therefore, we need to turn off the automatic inclusion of JavaScript. +% This option does exactly that; it is equivalent to the \texttt{nodljs} option. + +\subsection{The \texttt{exercisesonly} Option}\label{sss:noquizzes} + +If the document author only uses the \texttt{exercise} environment, then all +the document level JavaScripts of \texttt{exerquiz} are not needed. Use either +one of these two equivalent options to exclude the insertion of the JavaScripts. + +This is a convenience option that simply calls the \texttt{nodljs} option described above. + +\begin{comment} +\subsection{The \texttt{de\-bug} Option}\label{sss:debug} + +Developing JavaScript functions can be tricky. Quite often, it is +useful to insert some code lines that will help you in debugging a +particular function or a set of functions. For example, you might +want to verify that the parameters being passed to a function are +the correct ones, or that the return value is correct. You can +have Acrobat write the values to its console like so: +\begin{Verbatim}[xleftmargin=\amtIndent] +console.println("Function myFunc"); +console.println("Parameters: x = " x + ", y = " + y ); +console.println("Return Value: retnValue = " + retnValue); +\end{Verbatim} +\noindent In the above code, I have used the +\texttt{console.println()} method, which is only available in the +Acrobat application, not the Reader. For the Reader, one could +use \texttt{app.alert()}, but this method is not well-suited for +monitoring values of a large number variables as the script +executes. If you don't have the full Acrobat, the \texttt{debug} +option will not be useful. + +\textsf{Exerquiz} just passes this option on to the +\textsf{insdljs} package. Additional details on the debug option +can be found there. Within the \texttt{insDLJS} environment, you +can place debugging code lines as follows: +\begin{Verbatim}[xleftmargin=\amtIndent] +function myFunc(x,y) +{ + retnValue = x + y; +\db console.println("Function myFunc");\db% +\db console.println("Parameters: x = " x + ", y = " + y );\db% +\db console.println("Return Value: retnValue = " + retnValue);\db% + return retnValue; +} +\end{Verbatim} +\noindent Any line that begins with \cs{db} and ends with \cs{db} is a +debugging line. These lines will be included if the \texttt{debug} option +is taken; otherwise they are removed. The `\texttt{\%}', is +the comment character within the \texttt{insDLJS} environment, and prevents, +in this case, the introduction of a carriage return. +\end{comment} + +\subsection{The \texttt{allowrandomize} Option}\label{ss:allowrandomize} + +Use this option to load in the macros to randomize the choices +of a multiple choice question. See \hyperref[s:random]{Section~\ref*{s:random}}, +\Nameref{s:random} for details. + +\subsection{The \texttt{unicode} Option}\label{eq:unicode} + +This option is passed to \pkg{hyperref}, and is placed in {\Web} as a +convenience. If \textsf{eforms} is subsequently loaded, \textsf{eforms} (and +\textsf{exerquiz}) will accept {\LaTeX} markup in the optional argument +of the form fields. See the \href{eformman.pdf}{eforms manual} +for details.\footnote{eforms manual on Web: \url{\bUrl/eformman.pdf}}\edef\fnEForms{\thefootnote} + +\subsection{The \texttt{useui} Option}\label{eq:useui} + +This option is passed to \textsf{eforms}, and is placed in {\Web} as +a convenience. If \textsf{eforms} is subsequently loaded, +\textsf{eforms} loads the \pkg{xkeyval} package, and key-value pairs are +defined for use in the optional argument of form and link commands. +See the \href{eformman.pdf}{eforms manual} for details.${}^\text{\fnEForms}$ + +\subsection{The \texttt{usesumrytbls} Option}\label{eq:usesumrytbls} + +When this option is taken, the code for creating quiz summary tables is input. +See \hyperref[s:sumrytbl]{Section~\ref*{s:sumrytbl}}, page~\pageref*{s:sumrytbl} for details. + +\subsection{The \texttt{contsolns} Option}\label{eq:contsolns} + +When this option is taken, a message appears in the right running footer +that a solution has crossed the page boundary and that the solution +continues on the next page. Further documentation can be found in +\texttt{contsolns.pdf} in the \texttt{doc} folder, the demo file for this +feature is \texttt{contsolns\_ex.tex}, found in the \texttt{examples} +folder. + +\section{The \texttt{exercise} Environment}\label{ss:online} + +The \textsf{exerquiz} package defines \texttt{exercise} and +\texttt{solution} environments, the latter being nested inside the +former. With these environments, you can create questions +(exercises) with solutions. Solutions are written +\texttt{verbatim} to the auxiliary file \cs{jobname.sol}, then +input back in near the end of the document. A hypertext link is +created to connect the exercise with the solution. + +An exercise with \hyperref[sss:exwparts]{multiple parts} can also +be defined, with hypertext links to the solutions of the +individual parts of the exercise. + +The \texttt{exercise} environment has its own counter +(\texttt{eqexno}), but there is an \hyperref[sss:eqexno]{option} +for using another counter, or no counter at all. This may be +useful for creating a numbered example environment. + +There is an option for placing the +\hyperref[sss:solutionsafter]{solutions immediately after} the +statement of the problem. This, again, may be useful for an +example environment where you want the solution to the example to +follow the statement, rather than being hypertext-linked to the +solution. + +Finally, there is an option for \hyperref[sss:hide]{hiding +solutions}, in the following sense: When the hidden option is +used, the solutions are commented out rather then being written to +the \verb+\jobname.sol+ file. Additionally, there is a global +option, \texttt{nohiddensolutions}; in this case, when you +re-\LaTeX, the solutions are written to \verb+\jobname.sol+, and +input back into the document. + +\subsection{Basic Usage}\label{ss:basicexer} + +The syntax for the \texttt{exercise} and \texttt{solution} +environments is as follows: +\begin{Verbatim}[xleftmargin=\amtIndent] +\begin{exercise} +Your Question. +\begin{solution} +The Solution to Your Question +. . . . . . . . . . . . . . . +. . . . . . . . . . . . . . . +. . . . . . . . . . . . . . . +\end{solution} +\end{exercise} +\end{Verbatim} +\noindent Here is an example of the usage. + +\begin{exercise}\label{ex:int}% +Evaluate the integral \(\displaystyle\int x^2 e^{2x}\,dx\). +\begin{solution} +We evaluate by \textit{integration by parts}: +\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} + +The code for this is + +\begin{Verbatim}[xleftmargin=\amtIndent] +\begin{exercise}\label{ex:int}% +Evaluate the integral \(\displaystyle\int x^2 e^{2x}\,dx\). +\begin{solution} +We evaluate by \texttt{integration by parts}: +\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$}\\& +... lines removed ... + = \frac14(2x^2-2x+1)e^{2x} &&\quad + \text{simplify!} +\end{alignat*} +\end{solution} +\end{exercise} +\end{Verbatim} +\exAeBBlogPDF{p=803} See the source file for the PDF +\texttt{\href{\urlAcroTeXBlog/?p=803}{webeqtst.pdf}} for a complete +listing of this exercise. + + +%\noindent See the demo file \textsf{webeqtst.tex} for a complete listing of this exercise. + + +\redpoint Questions and solutions are kept together \textit{\`a la +Knuth}. The solutions are written to the file +\cs{jobname.sol} verbatim then input back using +\cs{includeexersolutions}. + + +\redpoint You can redefine the counter to include the section +number. For example, the code +\begin{Verbatim}[xleftmargin=\amtIndent] +\renewcommand{\theeqexno}{\thesection.\arabic{eqexno}} +\end{Verbatim} +\noindent can be placed in the preamble of your document. In this +case, the above exercise would appear as +\textsf{Exercise~\thesection.\ref*{ex:int}}. + +\redpoint The usual cross-referencing mechanisms for \LaTeX, i.e., +using \cs{ref} and \cs{pageref}, work as expected. + +\medskip\noindent +For example, the label `\verb+\label{ex:int}+' was placed +just after the \verb+\begin{exercise}+ on the previous page. Let us now +reference Exercise~\ref{ex:int}, on page~\pageref{ex:int}. +\begin{quote} +\begin{Verbatim}[xleftmargin=\amtIndent] +let us now reference Exercise~\ref{ex:int}, +on~\pageref{ex:int}. +\end{Verbatim} +\end{quote} +\noindent Of course, the nicer looking variations can be done as well. +For example, see \hyperref[ex:int]{\textsf{Exercise~\ref*{ex:int}}}. +\begin{center} +\verb+\hyperref[ex:int]{\textsf{Exercise~\ref*{ex:int}}}+ +\end{center} +\noindent The \texttt*-form of \cs{ref} was used to turn off the +redundant link creation. (\pkg{hyperref} would normally make +the \cs{ref} macro into a link.) + +\redpoint An `\textsf{Exercise}' that is also a hypertext link +appears in the default color \textcolor{webgreen}{green}; if an +`\textsf{Exercise}' is not a link, it appears in \textcolor{blue} +{blue}. (The word `\textsf{Exercise}' is not a link if it is an +\hyperref[sss:exwparts]{exercise with parts}, or if the +\texttt{\hyperref[sss:nosolutions]{nosolutions}} option is used. +Finally, if the \texttt{web} option +\texttt{\hyperref[sss:webforpaper]{forpaper}} is used, color is +turned off and `\textsf{Exercise}' appears in black. + +\redpoint\textbf{\textcolor{red}{Caveat:}} There is one problem +you might watch for. There is an optional argument to the +\texttt{solution} environment. When \LaTeX{} searches the source +looking for the optional parameter, which may not exist, it expands +macros looking for a `\texttt['. This causes problem when you have +a solution that begins with a math display environment and \LaTeX{} +prematurely expands such an environment. + +\begin{exercise} +Write an equation of a line that crosses the $x$- and $y$-axes at 1. +\begin{solution}[] +\begin{equation*} +\boxed{x+y=1} +\end{equation*} +\end{solution} +\end{exercise} + +\noindent To prevent \LaTeX{} errors that will stop the compilation, +just place the empty optional argument `\texttt{[]}' prior to the math environment. The code for +the previous exercise is +\begin{Verbatim}[xleftmargin=\amtIndent] +\begin{exercise} +Write an equation of a line that crosses +the $x$- and $y$-axes at 1. +\begin{solution}[] +\begin{equation*} +\boxed{x+y=1} +\end{equation*} +\end{solution} +\end{exercise} +\end{Verbatim} + + +\noindent This is only necessary if the solution \textbf{does not} begin with text. + +\subsubsection{Exercises with Parts: The \texttt{exercise*} Environment}\label{sss:exwparts} + +Beginning with version 6.07, the \texttt{exercise*} environment is used to create exercises with multiple +parts.\footnote{For users of exerquiz, this is equivalent +to the \texttt*-option with the \texttt{exercise} environment. The \texttt{exercise*} environment is the preferred form +but the \texttt*-option works as before.} + +A companion environment to \texttt{exercise*} is the +\texttt{parts} environment, used to enclose the multiple parts of +the question. The \texttt{parts} environment takes one optional +argument, the number of columns to be used. The argument must be a +positive integer greater than 1, in this case, a tabular +environment is used, with the number of columns equal to the +specified argument. If no optional parameter is given, then a list +environment is used. + +\begin{Verbatim}[xleftmargin=\amtIndent] +\begin{exercise*} +Preamble for your multi-parted question. +\begin{parts} % begin listing of the parts +\item First question. +\begin{solution} +Solution to first question. +\end{solution} +... +... +\item Final question. +\begin{solution} +Solution to the final question. +\end{solution} +\end{parts} % end listing of parts +\end{exercise*} +\end{Verbatim} + +\exAeBBlogPDF{p=803} The following exercise illustrates this option. +This example appears in \texttt{\href{\urlAcroTeXBlog/?p=803}{webeqtst.pdf}}. + + +%\noindent The following exercise illustrates this option. \texttt{\href{\bUrl/webeq_ex.html\#webeqtst}{webeqtst.tex}}. + +\begin{exercise*} +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 Find the velocity, $v$, of the particle at any time +$t$.\label{item:part} +\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*} + +\noindent There is also an option for listing multi-parts questions in tabular form. + +%\makeatletter +%\@ifundefined{@xtabularcr}{\let\save@@xtabularcr\@xarraycr} +% {\let\save@@xtabularcr\@xtabularcr} +%\def\eq@xtabularcr{\@ifnextchar[{\save@@xtabularcr} +% {\eqe@tab@parts@rowsep}}% +%\def\eqe@tab@parts@rowsep{\save@@xtabularcr[\eqparts@tabrowsep]}% +%\def\eqe@tab@parts@rowsep{\save@@xtabularcr +% \noalign{\expandafter\kern\eqparts@tabrowsep}}% +% +%\makeatother + +\begin{exercise*}\relax\label{ex:tabular} +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 $1/z$ +\begin{solution} +$\displaystyle\frac{1}{z}=\frac{1}{z}\frac{\bar{z}}{\bar{z}} + =\frac{\bar{z}}{z\bar{z}}=\frac{\bar{z}}{|z|^2}$ +\end{solution} +\end{parts} +\end{exercise*} + +\noindent The syntax is the same as an exercise with multiparts. +\begin{Verbatim}[xleftmargin=\amtIndent] +\begin{exercise*} % <- star indicates multipart +Simplify each... +\begin{parts}[2] % <- optional argument indicates tabular +\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} +& +... +\end{solution} +\end{parts} +\end{exercise*} +\end{Verbatim} + +\redpoint This problem style does not obey the +\texttt{solutionsafter} option. (See the section entitled +\Nameref{sss:solutionsafter}). + +\exAeBBlogPDF{p=803} The demo PDF +\texttt{\href{\urlAcroTeXBlog/?p=803}{webeqtst.pdf}} +contains this particular example. + + +%\exPDF{webeqtst} The sample file +%\texttt{\href{\bUrl/webeq_ex.html\#webeqtst.tex}{webeqtst.tex}} +%contains this particular example. + +\subsection{Options of the \texttt{exercise} Environment} + +\subsubsection{Leaving Vertical Space instead of a +Solution}\label{sss:leavevspace} + +The \texttt{exercise} environment can be used for test +construction. Initially, you may want to pose a questions and +leave space beneath for the student to write in an answer. + +\newtopic The \texttt{solutions} environment has an optional parameter for +inserting a vertical space. +\begin{Verbatim}[xleftmargin=\amtIndent] +\begin{exercise} +This is the question. +\begin{solution}[1in] % <-- optional vertical skip +This is the solution. +\end{solution} +\end{exercise} +\end{Verbatim} + +\noindent This vertical space only appears when the +\texttt{\hyperref[sss:nosolutions] {nosolutions}} option is in +effect. + +Within the context of test construction, write the test (including +the solutions), then publish it with the \texttt{nosolutions} +option (leaving vertical spaces as appropriate), then publish the +key with the \texttt{\hyperref[sss:solutionsafter] +{solutionsafter}} option.\footnote{If \texttt{solutionsafter} and +\texttt{nosolutions} both appear in the option list, +\texttt{solutionsafter} overrides \texttt{nosolutions}.} + +\redpoint The optional parameter for the solution is ignored for +exercises with parts having a tabular format +(\hyperref[ex:tabular]{Example~\ref{ex:tabular}} is an example of +a tabular multipart exercise). + + +\subsubsection{Hiding some Solutions}\label{sss:hide} + +A subset of the solutions can be hidden by using the `\texttt{h}' +option. This option is an option of the \texttt{exercise} +environment, as well as an option of \cs{item}, when there is an +exercise with parts. For example, the following code +\begin{Verbatim}[xleftmargin=\amtIndent] +\begin{exercise}[h] % <- hide solution +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{exercise} +\end{Verbatim} +\noindent +yields the following exercise. + +\begin{exercise}[h] % <- hide solution +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{exercise} + +Notice that there is no hypertext link to the solution; indeed, +the solution was not even written to the \cs{jobname.sol} file. + +The `\texttt{h}' option works with exercises with parts as well. +Just apply the `\texttt{h}' option to the \cs{item}: + +\begin{Verbatim}[xleftmargin=\amtIndent] +\begin{exercise*} +A particle has position $s=t^2 - 5t + 1$ at time $t$. +\begin{parts} + +\item Find the velocity, $v$, at time $t$. +\begin{solution} +$v = 2t-5$. +\end{solution} + +% This solution will not be included in the solutions +% section at the end of the document. +\item[h] Find the acceleration, $a$, at time $t$. +\begin{solution} +$a = 2$. +\end{solution} +\end{parts} +\end{exercise*} +\end{Verbatim} + +\noindent The results of this code follow: + +\begin{exercise*} +A particle has position $s=t^2 - 5t + 1$ at time $t$. +\begin{parts} + +\item Find the velocity, $v$, at time $t$. +\begin{solution} +$v = 2t-5$. +\end{solution} + +\item[h] Find the acceleration, $a$, at time $t$. +\begin{solution} +$a = 2$. +\end{solution} +\end{parts} +\end{exercise*} + +Part (a) is hypertext linked to its solution, whereas part (b) is +blue, indicating there is no link there. + +\redpoint Multipart exercises in the tabular format behave the same way; use +\cs{item[h]} to ``hide'' a solution. + +\redpoint There is also an `\texttt{H}' option as well. Specifying +`\texttt{H}' also hides the solutions. See the next two sections for a discussion +of revealing the solutions marked by either `\texttt{h}' or `\texttt{H}' to understand +the distinction between the two. + + +\subsubsection{The \texttt{nohiddensolutions} Option}\label{sss:nohideopt} + +Hidden solutions can be included in the document by either +removing the `\texttt{h}' option everywhere and re-\LaTeX ing, or +by simply using the \texttt{nohiddensolutions} of +\textsf{exerquiz}. +\begin{Verbatim}[xleftmargin=\amtIndent] +\usepackage[nohiddensolutions]{exerquiz} +\end{Verbatim} + +\noindent This option overrides the local `\texttt{h}' option throughout the +document. + +\redpoint When the \texttt{solutionsafter} option of \textsf{exerquiz} is invoked, +the hidden solutions are also revealed. To keep the solutions hidden, in this case, +you should use `\texttt{H}' option instead of `\texttt{h}'. See the next section. + +\subsubsection{The \texttt{noHiddensolutions} Option}\label{sss:noHideopt} + +In addition to the `\texttt{h}', you can also use the `\texttt{H}' +option with exercises. The solution will be hidden with +`\texttt{H}', but will not be revealed when either the +\texttt{nohiddensolutions} or the \texttt{solutionsafter} +options are used. + +The `\texttt{H}' option can be overridden by using the +\texttt{noHiddensolutions} of \textsf{exerquiz}. +\begin{Verbatim}[xleftmargin=\amtIndent] +\usepackage[noHiddensolutions]{exerquiz} +\end{Verbatim} +This option overrides the `\texttt{H}' and `\texttt{h}' options throughout +the document. + +\subsubsection{The \protect\texttt{exercise} environment Counter}\label{sss:eqexno} + +The counter for the \texttt{exercise} environment is \texttt{eqexno}, +and will number your exercises consecutively throughout the +document. Should you want the counter to be reset after each +\texttt{section}, place in the preamble of your document +the following lines: +\begin{Verbatim}[xleftmargin=\amtIndent] +\makeatletter +\@addtoreset{eqexno}{section} +\makeatother +\end{Verbatim} + +\subsubsection{The +\texorpdfstring{\protect\texttt{nosolutions}}{nosolutions} +Option}\label{sss:nosolutions} + +Some educators may initially want to post a series of exercises on the +Web without the solutions. Then, at a later date, repost the +exercises with the solutions included. For this application there +is the \texttt{nosolutions} option for the \textsf{exerquiz} +package. +\begin{Verbatim}[xleftmargin=\amtIndent] +\documentclass{article} +\usepackage[pdftex]{web} % dvipsone, dvips or dvipdfm +\usepackage[nosolutions]{exerquiz} +\end{Verbatim} +\noindent For this kind of application, it might make sense to publish the exercises +with the \texttt{forpaper} option. + + +\subsubsection{The +\texorpdfstring{\texttt{solutions\-after}}{solutionsafter} +Option}\label{sss:solutionsafter} + +For additional flexibility with how you want the solutions to the +exercises presented, there is a \texttt{sol\-u\-tions\-af\-ter} option +with \textsf{exerquiz}. Should you invoke this option, +\begin{Verbatim}[xleftmargin=\amtIndent] +\documentclass{article} +\usepackage[dvipsone]{web} % dvips or pdftex +\usepackage[solutionsafter]{exerquiz} +\end{Verbatim} +\noindent the solutions to the exercises appear just \emph{after} the +exercise question. For example, + +\SolutionsAfter +\begin{exercise} +Let $V$ be a vector space, show that the zero vector, $\mathbf 0$, is +unique. +\begin{solution} +Let $\mathbf 0'$ be a vector that satisfies the axiom of being a +zero of the vector space $V$. We want to show $\mathbf 0=\mathbf +0'$. Since $\mathbf 0$ is a zero, we have $\mathbf 0 + \mathbf 0'=\mathbf +0'$. But we are assuming $\mathbf 0'$ is a zero vector as well, +hence, $\mathbf 0' + \mathbf 0=\mathbf 0$. Finally, +\[ + \mathbf0' = \mathbf0 + \mathbf0' = \mathbf0' + \mathbf0 = \mathbf0 +\] +and this completes the proof. +\end{solution} +\end{exercise} +\SolutionsAtEnd + +As you can see in the above example, the word \textit{Solution:} is typeset +at the beginning of the solutions. The command \Com{renameSolnAfterTo} can be used +for conveniently changing the solution after label, for example, +\verb!\renameSolnAfterTo{\textbf{Proof:}}! changes the label to \textbf{Proof:}, +and \verb!\renameSolnAfterTo{}! produces no label. These changes will be local +to the group in which they are made, or global of there they are not made in a group. + +The command \cs{resetSolnAfterToDefault} sets the label text back to +the default. The default label is +\begin{Verbatim}[xleftmargin=\amtIndent] +\newcommand{\eq@exsolafterDefault}{\textit{Solution}:} +\end{Verbatim} + + +\newtopic The option \texttt{solutionsafter} is global; all exercises are +typeset this way---unless you change it within the document using +the macros \cs{SolutionsAfter} and \cs{Solutions\-At\-End}. This +manual was typeset without the \texttt{solutionsafter} option. The +above example was typeset as follows: +\begin{Verbatim}[xleftmargin=\amtIndent] +\SolutionsAfter % show solution following exercise +\begin{exercise} +Let $V$ be a vector space, show ... +\begin{solution} +............ +\end{solution} +\end{exercise} +\SolutionsAtEnd % turn back on solutions at end of document +\end{Verbatim} + +\noindent Normally, a typical document might have all solutions at the end +of the document (the default behavior), or all solutions following +each exercise (\texttt{solutionsafter} option). Mixtures of these two +types can be obtained by using the two commands +\cs{Solutions\-After} and \cs{Solutions\-At\-End}. + +\newtopic This feature might be an easy way of typsetting examples. See the example +in the section entitled \Nameref{sss:redesignex}. + +\redpoint The \texttt{solutionsafter} option has no effect on +multipart exercises in \textit{tabular form}; I haven't been +able to find a convenient way of displaying the solutions after +the questions when the questions are in tabular form.\endredpoint + +%\exPDF{webeqtst} See the file \texttt{\href{\bUrl/webeq_ex.html\#webeqtst}{webeqtst.pdf}} for examples. + +\exAeBBlogPDF{p=803} See the file \texttt{\href{\urlAcroTeXBlog/?p=803}{webeqtst.pdf}} from the {\AcroBlog} +website for examples. + + +\subsubsection{Moving the Solution Set} + +The solution set, by default, comes last in the file. You can +move its positioning by including the command +\cs{includeexersolutions} at any point \emph{after} the last +exercise. You'll note that I have moved the solutions in this +file \emph{before} the \nameref{references} section, as indicated, for +example, by its position in the table of contents. + +\subsubsection{Grouping the solutions at end}\label{ss:grpEx} + +Historically, solutions to exercises appearing at the end of the file +\emph{are not grouped}. This means that a color change or a definition made +in one solution, for example, may affect all subsequent solutions. + +You can now declare \cs{makeExSolnsLocalOn} or \cs{makeExSolnsLocalOff} +anywhere in the document to turn on grouping for all exercises that follow, +or to turn off this feature again. The default is \cs{makeExSolnsLocalOff}. + + +\subsection{Redesigning the +\texorpdfstring{\protect\texttt{exercise}}{exercise} +Environment}\label{sss:redesignex} + +You can customize the \texttt{exercise} environment to suit your +own needs. To customize, you need to change some or all of the +following six commands. In the listing below, the \LaTeX{} definition +of each follows a short description. +\begin{questions} + \item \cs{exlabel}: This command expands to the name of the exercise label, + the default string is `Exercise'. +\begin{Verbatim}[xleftmargin=\amtIndent] +\newcommand\exlabel{Exercise} +\end{Verbatim} + \item \cs{exlabelformat}: Typesets the exercise + label; use it to introduce additional type style such as + boldface, italic, small caps, etc. +\begin{Verbatim}[xleftmargin=\amtIndent] +\newcommand\exlabelformat{% + {\scshape\exlabel\ \theeqexno.}} +\end{Verbatim} + \item \cs{exlabelsol}: Expands to the name of the exercise + label in the solutions section. Usually its value is the same + as \cs{exlabel}. +\begin{Verbatim}[xleftmargin=\amtIndent] +\newcommand\exlabelsol{\exlabel} +\end{Verbatim} + \item \cs{exsllabelformat}: The format of the solutions label, + \verb+\bfseries\exlabel+ is the default. +\begin{Verbatim}[xleftmargin=\amtIndent] +\newcommand\exsllabelformat + {\noexpand\textbf{\exlabelsol\ \theeqexno.}} +\end{Verbatim} + \item \cs{exrtnlabelformat}: This is the label you click on to + return from the solution of the exercise. +\begin{Verbatim}[xleftmargin=\amtIndent] +\newcommand\exrtnlabelformat{\exlabelsol\ \theeqexno} +\end{Verbatim} + \item \cs{exsectitle}: The section title of the solutions to + the exercises. +\begin{Verbatim}[xleftmargin=\amtIndent] +\newcommand\exsectitle{Solutions to \exlabel s} +\end{Verbatim} + \item \cs{exsecrunhead}: The running header for the solution + section for the exercises. +\begin{Verbatim}[xleftmargin=\amtIndent] +\newcommand\exsecrunhead{\exsectitle} +\end{Verbatim} +\end{questions} + +\redpoint The counter \texttt{eqexno} is used to count exercises. +When an \texttt{exercise} environment starts, this counter is +incremented. The value of this counter is used in +the definitions of \cs{exlabelformat}, \cs{exsllabelformat} and +\cs{exrtnlabelformat}. Still, the use of \texttt{eqexno} is +optional; for example, you might want to state a problem just as `Special +Exercise', without an associated exercise number. + +Below is an example of redefining the \texttt{exercise} +environment. We define a \texttt{problem} environment based on +the \texttt{exercise} environment. + +\begin{Verbatim}[xleftmargin=\amtIndent] +\newenvironment{problem}{% +\renewcommand\exlabel{Problem} +\renewcommand\exlabelformat{\textbf{\exlabel\ \theeqexno.}} +\renewcommand\exsllabelformat + {\noexpand\textbf{\exlabel\ \theeqexno}} +\renewcommand\exrtnlabelformat{$\blacktriangleleft$} +\renewcommand\exsecrunhead{\exsectitle} +\begin{exercise}}{\end{exercise}} +\end{Verbatim} + +\newenvironment{problem}{% +\renewcommand\exlabel{Problem} +\renewcommand\exlabelformat{\textbf{\exlabel\ \theeqexno.}} +\renewcommand\exsllabelformat + {\noexpand\textbf{\exlabel\ \theeqexno.}} +\renewcommand\exrtnlabelformat{$\blacktriangleleft$} +\renewcommand\exsecrunhead{Solutions to Problems} +\begin{exercise}}% +{\end{exercise}} + +\noindent See any standard \LaTeX{} reference on how to define a new +environment, for example \cite{book:Goossens1}. + +\newtopic Here is an example of the new \texttt{problem} environment:\medskip + +\begin{problem} +This is a question. +\begin{solution} +This is the solution. +\end{solution} +\end{problem} + +\noindent +The code for this problem was simply: +\begin{Verbatim}[xleftmargin=\amtIndent] +\begin{problem} +This is a question. +\begin{solution} +This is the solution. +\end{solution} +\end{problem} +\end{Verbatim} + +\redpoint Two of these commands, \cs{exsllabelformat} and +\cs{exrtnlabelformat}, must be handled with special care. Formatting such +as \cs{textbf} or \cs{scseries} must be preceded by a \cs{noexpand}. These +commands are written to a file, and must be prevented from expanding. + +When you use the \texttt{exercise} environment, the counter +\texttt{eqexno} is automatically incremented by default. The +\texttt{exercise} does have an optional argument for inserting +your own counter. +\begin{Verbatim}[xleftmargin=\amtIndent,commandchars=!()] +\begin{exercise}[!ameta(ctr)] +....................... +\end{exercise} +\end{Verbatim} +\noindent Where \ameta{ctr} is a counter already defined. This option is +useful if you want to use the \texttt{exercise} environment to +create a new environment with its own numbering scheme, as the +following example illustrates. + +This example demonstrates how to define an \texttt{example} +environment with its own counter. For examples, we don't want the +solutions to appear at the end of the file, so we'll use +the commands \cs{SolutionsAfter} and \cs{SolutionsAtEnd}. All changes are +local. +\begin{Verbatim}[xleftmargin=\amtIndent] +% put a counter in preamble +\newcounter{exampleno} +\newenvironment{example}{% +\renewcommand\exlabel{Example} +\renewcommand\exlabelformat + {\textbf{\exlabel\ \theexampleno.}} +\renewcommand\exrtnlabelformat{$\square$} +\SolutionsAfter +\begin{exercise}[exampleno]}% +{\end{exercise} +\SolutionsAtEnd} +\end{Verbatim} + + +\newcounter{exampleno} +\newenvironment{example}{% +\renewcommand\exlabel{Example} +\renewcommand\exlabelformat{\textbf{\exlabel\ \theexampleno.}} +\renewcommand\exrtnlabelformat{$\square$} +\SolutionsAfter +\begin{exercise}[exampleno]}% +{\end{exercise} +\SolutionsAtEnd} + +\noindent Now we simply type +\begin{Verbatim}[xleftmargin=\amtIndent] +\begin{example} +What is $2+2$? +\begin{solution} +It is well known that $2+2=4$. +\end{solution} +\end{example} +\end{Verbatim} +\newtopic to obtain + +\begin{example} +What is $2+2$? +\begin{solution} +It is well known that $2+2=4$. +\end{solution} +\end{example} + +\noindent The changes are local to the new \texttt{example} environment. If +we have another exercise, we get a correctly numbered exercise. + + +\begin{exercise} +What is $2+2$? +\begin{solution} +It is well known that $2+2=4$. +\end{solution} +\end{exercise} + +\redpoint The command \cs{exsolafter} typesets the solution label +to the exercise in the case the \texttt{solutionsafter} option is in effect. +The default definition of \cs{exsolafter} is `\verb+\textit{Solution}:+'. +You can redefine it as follows: +\begin{Verbatim}[xleftmargin=\amtIndent] +\renewcommand\exsolafter{\textit{L\"osung}:} +\end{Verbatim} +\noindent The command \cs{renameSolnAfterTo} is a convenience macro for changing this label. +We can redefine the label above like so: +This redefinition yields: +\begin{Verbatim}[xleftmargin=\amtIndent] +\renameSolnAfterTo{\textit{L\"osung}:} +\end{Verbatim} + +\renewenvironment{example}{% +\renewcommand\exlabel{Example} +\renewcommand\exsolafter{\textit{L\"osung}:} +\renewcommand\exlabelformat{\textbf{\exlabel\ \theexampleno. }} +\renewcommand\exrtnlabelformat{$\square$} +\SolutionsAfter +\begin{exercise}[exampleno]}% +{\end{exercise} +\SolutionsAtEnd} + +\begin{example} +What is $2+2$? +\begin{solution} +It is well known that $2+2=4$. +\end{solution} +\end{example} + +\redpoint There is a special option to the \texttt{exercise} +environment as well, +\begin{Verbatim}[xleftmargin=\amtIndent] +\begin{exercise}[0] +....................... +\end{exercise} +\end{Verbatim} +When the optional argument is \texttt{0} rather than a counter. In +this case, no counter is associated with the environment. For +example, +\begin{Verbatim}[xleftmargin=\amtIndent] +\newenvironment{project}{% +\renewcommand\exlabel{Project} +\renewcommand\exlabelformat{\textbf{\exlabel. }} +\renewcommand\exsllabelformat + {\noexpand\textbf{\exlabel\ Hint:}} +\renewcommand\exrtnlabelformat{$\blacktriangleleft$} +\begin{exercise}[0]}% +{\end{exercise}} +\end{Verbatim} + +\newenvironment{project}{% +\renewcommand\exlabel{Project} +\renewcommand\exlabelformat{\textbf{\exlabel. }} +\renewcommand\exsllabelformat + {\noexpand\textbf{\exlabel\ Hint:}} +\renewcommand\exrtnlabelformat{$\blacktriangleleft$} +\renewcommand\exsecrunhead{Hints to Projects} +\begin{exercise}[0]}% +{\end{exercise}} + +\noindent Thus, we obtain, + +\begin{project} +Find a shorter proof of \textsf{Fermat's Last Theorem}. Do not +look at the project hints until you have finished the +project. +\begin{solution} +There, you didn't need my help after all. +\end{solution} +\end{project} + +\noindent The code: +\begin{Verbatim}[xleftmargin=\amtIndent] +\begin{project} +Find a shorter proof of \textsf{Fermat's Last Theorem}. Do not +look at the project hints until you have finished the project. +\begin{solution} +There, you didn't need my help after all. +\end{solution} +\end{project} +\end{Verbatim} + +\noindent Note that the solutions are typeset at the end of the file in the +`Solutions to Exercises' section. At this time, there is no +feature for sorting out these different types of environments; +they are all \texttt{exercise} environments, which is what they are. + +\section{The \texttt{shortquiz} Environment}\label{ss:QuizIR} + +The \texttt{shortquiz} environment is used to create multiple +choice question and math/text fill-in questions with immediate +response. The discussion of math and text fill-in questions is +post-phoned to \hyperref[s:oQ]{Section~\ref*{s:oQ}}, entitled +\nameref{s:oQ}. The environment allows redefinition to customize +the look of your quizzes. (See +\mlNameref{sss:redefinesq}.) + +% The presentation of the answers will either be in a \texttt{list} +% or a \texttt{tabular} environment, depending on the parameter +% \texttt{num\_cols}. (A \texttt{list} is used if \texttt{num\_col} +% is set to~1.) + +\subsection{Basic Usage}\label{BasicUsage} + +The syntax for the environment (\texttt{tabular} version) is as +follows: + +\def\T#1{\makebox[0pt][l]{\hspace*{200pt}\% #1}} +\def\1{\T{begin shortquiz}} +\def\2{\T{begin proposed answers}} +\def\3{\T{a wrong answer}} +\def\4{\T{the right answer}} +\def\5{\T{end listing of answers}} +\def\6{\T{end shortquiz}} +\begin{Verbatim}[xleftmargin=\amtIndent,commandchars=!()] +!1\begin{shortquiz}[!meta(base_name)] +...Question goes here... +!2\begin{answers}{!meta(num_cols)} +... +!3\Ans0 !anglemeta(an incorrect answer) & +... +!4\Ans1 !anglemeta(a correct answer) & +... +!5\end{answers} +!6\end{shortquiz} +\end{Verbatim} +The optional \meta{base\_name} is used to build names of the form fields associated with +this quiz; if one is not provided, a \meta{base\_name} is automatically created. The name +must be unique to the entire document. + +The parameter \meta{num\_cols} is the number of +columns you want to typeset for your multiple choice responses. The +environment sets up a \texttt{tabular} environment if +\meta{num\_cols} is greater than~1, and a \texttt{list} +environment if \texttt{num\_cols} is~1. + +This type of quiz is suitable for asking a short series of +question of the reader, perhaps after explaining some concept. +Quizzes can be used to direct the reader's attention to an +important point. + +\redpoint Here is an example of the \texttt{shortquiz} +environment. Responses are graded without comment using +JavaScript. + +\begin{shortquiz} +Which of the following is the $\dfrac{d}{dx}{\sin(x^3)}$? +\begin{answers}{4} +\Ans0 $\sin(3x^2)$ & \Ans0 $\cos(x^3)$ & \Ans1 $3x^2\cos(x^3)$ & +\Ans0 $3x^2\cos(3x^2)$ \\ +\end{answers} +\end{shortquiz} + +\noindent The verbatim listing follows: +\begin{Verbatim}[xleftmargin=\amtIndent] +\begin{shortquiz} % begin shortquiz environment +Which of the following is the $\dfrac{d}{dx}{\sin(x^3)}$? +\begin{answers}{4} % 4 columns of answers + \Ans0 $\sin(3x^2)$ & % \Ans0 is a false answer + \Ans0 $\cos(x^3)$ & + \Ans1 $3x^2\cos(x^3)$ & % \Ans1 is the correct answer + \Ans0 $3x^2\cos(3x^2)$ +\end{answers} % end answers environment +\end{shortquiz} % end shortquiz environment +\end{Verbatim} +If \texttt{num\_cols} is greater than 1, the +\texttt{answers} sets up a \texttt{tabular} environment, +\texttt{p\darg{\meta{width}}} to sets up the column widths. The \cs{parbox}es are +typeset ragged right. + + +\redpoint Below is a two-column example in which the posed +alternatives are rather long. The \texttt{answers} environment +produces is a nicely aligned set of paragraphs. + +\goodbreak +\begin{shortquiz} +Which of the following best describes Augustin Cauchy? +\begin{answers}{2} +\Ans0 He developed the Calculus while his University was closed +for the plague. & % Newton +\Ans0 Given credit for first using the functional notation +$f(x)$.\\ % Euler +\Ans0 He created the ``bell-shaped curve'' and first used the +method of +least squares. & % Guass +\Ans1 He first formulated a precise +definition of the limit and continuity of a function. \\ % Cauchy +\Ans0 Gave a rigorous definition of the definite integral---an +integral +that now bears his name. & % Riemann +\Ans0 His notation for the derivative and the integral is used +even to this day. % Leibniz +\end{answers} +\end{shortquiz} + +\noindent Here is the same example in which the \texttt{num\_cols} is set +to~1; in this case, a \texttt{list} environment is used. + +\begin{shortquiz} +Which of the following best describes Augustin Cauchy? +\begin{answers}{1} +\Ans0 He developed the Calculus while his University was closed +for the plague. % Newton +\Ans0 Given credit for first using the functional notation +$f(x)$. % Euler +\Ans0 He created the ``bell-shaped curve'' and first used the +method of +least squares. % Guass +\Ans1 He first formulated a precise +definition of the limit and continuity of a function. % Cauchy +\Ans0 Gave a rigorous definition of the definite integral---an +integral +that now bears his name. % Riemann +\Ans0 His notation for the derivative and the integral is used +even to this day. % Leibniz +\end{answers} +\end{shortquiz} + +%\exPDF{webeqtst} See the sample file +%\texttt{\href{\bUrl/webeq_ex.html\#webeqtst} {webeqtst.tex}} for +%examples. + +\exAeBBlogPDF{p=803} See the file \texttt{\href{\urlAcroTeXBlog/?p=803}{webeqtst.pdf}} from the {\AcroBlog} +website for examples. + + +\newtopic\indent The space between the label and the text of a multiple +choice question change be adjusted using two commands, +\Com{setMClabelsep} and \Com{resetMClabelsep}. The default +horizontal space between the label and text is a hard space `\verb!\ !'. +The first command takes as its argument +anything that creates a horizontal white space, for example, +\verb!\setMClabelsep{\quad}! or \verb!\setMClabelsep{\kern20pt}!. If +\cs{setMClabelsep} is set in a group, its value will revert to the +default on exit from the group. The second command +\cs{resetMClabelsep} resets the space back to its default `\verb!\ !'. + +The space above the beginning of the \texttt{answer} environment can be +adjusted using the length \Com{aboveanswersSkip}. The default value for +this is +\begin{Verbatim}[xleftmargin=\amtIndent] +\setlength\aboveanswersSkip{3pt} +\end{Verbatim} +and this can be reset to any desired vertical skip. + + +\subsubsection{\texttt{shortquiz} with Radio Buttons}\label{sqwRadio} + +The short quizzes (with multiple choices) can also be laid out using +radio buttons rather than typeset lettering. Use a +\texttt{shortquiz*} environment, with an optional argument the value +of which is a unique name (which will be used to construct the +titles of the radio buttons).\footnote{In previous versions of \textsf{exerquiz}, there was a +\texttt*-option that was use to signal the use of radio buttons. This option is still +available, but the shortquiz* environment is preferred.} If you do not provide an optional +argument name, one will programmatically be provided for you. + +\newtopic For example, the following code + +\begin{Verbatim}[xleftmargin=\amtIndent] +\begin{shortquiz*}[KublaKhan1] +Was it in Xanadu did Kubla Kahn a stately pleasure dome decree? +\begin{answers}{4} +\Ans1 True & \Ans0 False +\end{answers} +\end{shortquiz*} +\end{Verbatim} +\noindent yields the following question: + +\begin{shortquiz*}[KublaKhan2] +Was it in Xanadu did Kubla Kahn a stately pleasure dome decree? +\begin{answers}{4} +\Ans1 True & \Ans0 False +\end{answers} +\end{shortquiz*} +\noindent Check the functionality of this question, and contrast it with +the same question. + +\sqTurnOffAlerts \sqCorrections + +\begin{shortquiz*}[KublaKhan3] +Was it in Xanadu did Kubla Kahn a stately pleasure dome decree? +\begin{answers}{4} +\Ans1 True & \Ans0 False +\end{answers} +\end{shortquiz*} +\noindent We have inserted two new commands prior to this last +short quiz \cs{sqTurnOffAlerts} and \cs{sqCorrections} to change +response feedback. The former turns off the alerts and the latter +turns on the corrections: check for a correct answer and an cross +for an incorrect answer. (It doesn't make sense to +\cs{sqTurnOffAlerts} without \cs{sqCorrections}; +\cs{sqCorrections} can be used without turning off the alerts.) + +\redpoint These two commands only apply to a short quiz that uses radio buttons. +You can reverse these two commands with \cs{sqTurnOnAlerts} and +\cs{sqNoCorrections}, respectively. These settings are the +defaults of the \texttt{shortquiz} with check boxes. + +\subsubsection{\texttt{shortquiz} with Solutions}\label{ss:QuizS} + +Another type of quiz that is easy to implement in PDF is the +multiple choice quiz with immediate response with solution given. +This too is a \texttt{shortquiz} environment: +\begin{Verbatim}[xleftmargin=\amtIndent,commandchars=!()] +\begin{shortquiz} +...Question goes here... +\begin{answers}!anglemeta(dest){!meta(num_cols)} +... +\Ans0 !anglemeta(an incorrect answer) & +... +\Ans1 !anglemeta(a correct answer) & +... +\end{answers} +\begin{solution} + !anglemeta(solution to correct answer) +\end{solution} +\end{shortquiz} +\end{Verbatim} + +\newtopic The \anglemeta{name} takes on two forms, in either case, it is used to create a hypertext jump to +the solution. The first form of \anglemeta{name} is an explicit named +definition `\texttt{[\meta{named\_dest}]}', where \meta{named\_dest} is a +word selected by the document author for a ``named destination.'' The other +form is the star-form `\texttt{*}', when the star-form is used, +\textsf{exerquiz} automatically generates the name. Use the +`[\meta{named\_dest}]' form when you want to refer to a solution in another +part of the document; otherwise, use `\texttt{*}' for convenience. + +\newtopic As before, \meta{num\_cols} is the number of columns to +typeset the answers in. + +\newtopic The following example illustrates the quiz with +solution. + +%\renewcommand\sqslrtnlabel{\string\raisebox{1pt}{$\blacktriangleleft$}Return to Quiz} + +\begin{shortquiz} +Define a function $f(s)=4s^3$ and another function +$F(t)=t^4$. Is $F$ an antiderivative of $f$? +\begin{answers}[quiz:anti]{4} +\Ans1 Yes &\Ans0 No +\end{answers} +\begin{solution} +The answer is `Yes'. The definition requires that +\[ + F'(x) = f(x) \quad\text{for all $x$,} +\] +well, let's check it out. + +The definition of $f$ is $f(s)=4s^3$ and so $f(x)=4x^3$. +The definition of $F$ is $F(t)=t^4$ and so, by the rules of +differentiation, $F'(t)=4t^3$. Thus, $F'(x)=4x^3$. Therefore, +\[ + F'(x) = 4x^3 = f(x)\quad\text{for all $x$,} +\] +as required by the definition. +\end{solution} +\end{shortquiz} + +\newtopic The verbatim listing that uses the explicit form of the destination, shown +in bold font. +\begin{Verbatim}[xleftmargin=\amtIndent,commandchars=!()] +\begin{shortquiz} +Define a function $f(s)=4s^3$ and another +function $F(t)=t^4$. Is $F$ an antiderivative of $f$? +\begin{answers}!textbf([quiz:anti]){4} +\Ans1 Yes &\Ans0 No +\end{answers} +...solution not shown... +\end{solution} +\end{shortquiz} +\end{Verbatim} + +\newtopic Here is a listing of the same quiz using the \texttt{*} to +automatically assign a destination label. +\begin{Verbatim}[xleftmargin=\amtIndent,commandchars=!()] +\begin{shortquiz} +Define a function $f(s)=4s^3$ and another +function $F(t)=t^4$. Is $F$ an antiderivative of $f$? +\begin{answers}!textbf(*){4} +\Ans1 Yes &\Ans0 No +\end{answers} +...solution not shown... +\end{solution} +\end{shortquiz} +\end{Verbatim} + + + +\subsubsection{The \texorpdfstring{\protect\cs{bChoices}/\-\protect\cs{eChoices}} + {\textbackslash bChoices/\textbackslash eChoices} Commands}\label{bChoices} + + +Beginning with \textsf{exerquiz} version~6.03, the command pair +\cs{bChoices} and \cs{eChoices} are defined to help lay out +the list of choices for a multiple choice question. 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 is twofold: +\begin{questions} + +\item 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); + +\item To lay out the alternatives in a uniform manner, which will +make it easy to develop techniques of randomizing the +alternatives. + +\end{questions} +Here is an example of usage: +\begin{Verbatim}[xleftmargin=\amtIndent] +\begin{answers}{4} %<- 4 columns +\bChoices[2] %<- use only first 2 columns + \Ans0 a choice\eAns %<- choices delimited by + \Ans1 another choice\eAns % \Ans...\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 Note that the choices begin with the \cs{Ans} macro +followed by a 0 or 1, as described in the previous pages. The +end of the choice is delimited by the \cs{eAns} command (which is +undefined, but is used as a argument delimiter). Note that it is +not necessary (and would be a mistake) to place the column +delimiter~`\texttt\&', or the end of line +command~`\texttt{\string\\}', this is done by the \cs{bChoices} +command. + +The commands \cs{bChoices} and \cs{eChoices} can be used within +the \texttt{answers} environment as part of a \texttt{shortquiz} or a +\texttt{\hyperref[ss:GradedQuizzes]{quiz}} environment. + +Concerning the example above, 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 columns 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 \texttt{answers} or \texttt{manswers} is changed to 1, the +optional argument of \cs{bChoices} is ignored, and the +alternatives are typeset in a one column list environment. + +By changing the two parameters (the one for \cs{answers} and the +one for \cs{bChoices}) you can easily modify how the +alternatives are typeset. + +\redpoint \cs{rowsep}: Space between rows (or items in list environment) +can be adjusted with the \cs{rowsep} command. If you +say \verb+\rowsep{3pt}+, an additional \texttt{3pt} space is added +between rows or items in a list environment. The default is \texttt{0pt}. The default is +controlled through the command \cs{rowsepDefault}, like so, +\begin{Verbatim}[xleftmargin=\amtIndent] +\rowsepDefault{0pt} +\end{Verbatim} +\noindent For example, +\begin{Verbatim}[xleftmargin=\amtIndent] +\begin{answers}{4} +\rowsep{3pt} +\bChoices[2] + \Ans0 a choice\eAns + \Ans1 another choice\eAns + \Ans0 still another choice\eAns + \Ans0 another\eAns + \Ans0 incoming\eAns +\eChoices +\end{answers} +\end{Verbatim} +\noindent Do not place this command inside the +\cs{bChoices}/\cs{eChoices} pair, the above example shows +the optimal placement, just before \cs{bChoices}. This +separation {\cs{rowsep}} is reset to the default at the end of the +listing. To get a uniform separation between rows across the +document, redefine \cs{rowsepDefault} in the preamble, like so, +\begin{Verbatim}[xleftmargin=\amtIndent] +\rowsepDefault{3pt} +\end{Verbatim} + + +\redpoint No commands should appear \textit{between} the pair +\cs{bChoices} and \cs{eChoices} and \textit{outside} an +\cs{Ans} and \cs{eAns} pair. All such tokens are gobbled up. + +\newtopic\textcolor{red}{Limitations:} The command \cs{eAns} acts as +a macro parameter delimiter: Everything between \cs{Ans} and \cs{eAns} +is taken in as the argument of a macro; therefore, verbatim content +generated by \cs{verb} is not permitted by {\LaTeX}. If you want +your choices to contain verbatim text, use the style as described in +\Nameref{BasicUsage}. + +\subsubsection{The +\texorpdfstring{\protect\texttt{questions}}{questions} Environment} + +The \texttt{questions} environment was designed to work with the +\texttt{quiz} environment---taken up in +\hyperref[ss:GradedQuizzes]{Section~\ref*{ss:GradedQuizzes}} +below---but it works equally well with \texttt{shortquiz}. + +Using the \texttt{questions} environment, quizzes defined by +\texttt{shortquiz}, with/without solutions, can be +mixed together and combined to make a ``mini-quiz''. For example, + +\begin{shortquiz} Determine the LCD for each of the following. +\begin{questions} +\item $\dfrac{3x}{2y^2z^3}-\dfrac2{xy^3 z^2}$. +\begin{answers}{2} +\bChoices + \Ans0 $\text{LCD}=2xy^5z^5$\eAns + \Ans0 $\text{LCD}=2y^3 z^3$\eAns + \Ans1 $\text{LCD}=2x y^3 z^3$\eAns + \Ans0 $\text{LCD}=2 x y^3 z^5$\eAns +\eChoices +\end{answers} +\item $\dfrac{x+y}{3 x^{3/2}y^2}-\dfrac{x^2+y^2}{6 x y^4}$. +\begin{answers}[quiz:LCB]{2} +\bChoices + \Ans0 $\text{LCD}=18 x^{3/2}y^4$\eAns + \Ans1 $\text{LCD}=6x^{3/2}y^4$\eAns + \Ans0 $\text{LCD}=18 x y^4$\eAns + \Ans0 $\text{LCD}=6 x y^4$\eAns +\eChoices +\end{answers} +\begin{solution} +If you erred on this one, more than likely it was on the +appropriate multiplicative constant: 6 not 18. At least +that's what I'm betting on. + +The instructions of the LCD Algorithm said to \textit{completely +factor the denominator}. Here's a list of the factors +\[\def\us#1#2{\underbrace{#2}_{\text{#1 term}}} + \us{first}{3, x^{3/2}, y^2}\,,\,\us{second}{2, 3, x, y^4} +\] +Let's rearrange them +\[ + 2, 3, 3, x, x^{3/2}, y^2, y^4 +\] +Now drop duplicate factors---that's the 3. Oops! I did mention +dropping identical factors, didn't I? +\[ + 2, 3, x, x^{3/2}, y^2, y^4 +\] +Now, group together all terms which have the same base, then drop, +from each of these groups all terms but the one with the highest +power. We obtain then, +\[ + 2, 3, x^{3/2}, y^4 +\] +The LCD is the product of same: +\[ + \text{LCD}=(2)(3) x^{3/2} y^4 = 6 x^{3/2} y^4. +\] +{\it Solution Notes\/}: Alternative (a) will work as a common +denominator, but it is not the least common denominator. If you +use (a), you will be working with larger numbers than is really +necessary. +\end{solution} +\end{questions} +\end{shortquiz} + +\noindent The first question is given without a solution, the second has a +solution attached to it. An abbreviated verbatim listing follows. + +\begin{Verbatim}[xleftmargin=\amtIndent] +\begin{shortquiz} +Determine the LCD for each of the following. +\begin{questions} +\item $\dfrac{3x}{2y^2z^3}-\dfrac2{xy^3 z^2}$. +\begin{answers}{2} +... +\end{answers} +\item $\dfrac{x+y}{3 x^{3/2}y^2} + -\dfrac{x^2+y^2}{6 x y^4}$. +\begin{answers}[quiz:LCB]{2} +... +\end{answers} +\begin{solution} +If you erred on this one, ... ... +\end{solution} +\end{questions} +\end{shortquiz} +\end{Verbatim} + +\Important The questions environment can be nested three deep. + +\newtopic Between items, you can say \Com{pushquestions}, make a comment, to continue +with more questions, type \Com{popquestions}. Here is an example without using \texttt{shortquiz} environment. + +\begin{questions} + \item This is my first question. + \item This is my second question. +\pushquestions +We now begin a multipart question. +\popquestions + \item Answer each of the following: + \begin{questions} + \item First part of the question. +\pushquestions +Be sure to concentrate on this next question, its a hard one; recall that $1+1=2$. +\popquestions + \item Second part of the question. + \begin{questions} + \item This is a subpart of this part. +\pushquestions +The questions environment can be nested up to three deep. +\popquestions + \item This is a second subpart of this part. + \end{questions} + \end{questions} + \item This is the fourth question. +\end{questions} +The color of the item labels is set by the command \cs{quesNumColor}. The command take one +argument, a named color. The default is \verb!\quesNumColor{blue}!. + + +\newtopic A partial listing of the above environment is presented below. +\begin{Verbatim}[xleftmargin=\amtIndent] +\begin{questions} + \item This is my first question. + \item This is my second question. +\pushquestions +We now begin a multipart question. +\popquestions + \item Answer each of the following: +... +\end{questions} +\end{Verbatim} + +\subsection{Options of the \texttt{shortquiz} Environment}\label{sq:opts} + +\subsubsection{The +\texorpdfstring{\protect\texttt{forpaper}}{forpaper} Option} + +The \texttt{forpaper} option has already been described. The +solutions to \texttt{short\-quiz} questions are not typeset on +separate pages, but are separated by a \cs{medskip}. + +Following up on the pre-test angle discussed in +``\mlnameref{sss:redefinesq}'', page~\pageref*{sss:redefinesq}, a single +document can be constructed that can be published on-line, or +published for paper distribution. This feature may be useful to +some educators. + + + +\subsubsection{The \texttt{solutionsafter} Option} + +The \texttt{solutionsafter} option works as described for the +\texttt{exercise} environment. The option just sets a Boolean +switch. This switch can be controlled with +\cs{Solutions\-After} and \cs{SolutionsAtEnd}. Here is a simple +example. + +\SolutionsAfter +\begin{shortquiz} +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. Some say he discovered +San Salvatore, others say he first sited Cat Island in the +Bahamas. +\end{solution} +\end{shortquiz} +\SolutionsAtEnd +In the example above, \cs{SolutionsAfter} was placed before the \texttt{shortquiz} environment and +the \cs{SolutionsAtEnd} was placed just after. + +This option may be useful in publishing an answer key to a multiple +choice quiz. The quiz and solutions can be created together. The +quiz can be published, then later, the quiz with complete +solutions. + + +\subsubsection{The \texorpdfstring{\texttt{proof\-ing}}{proofing} +Option}\label{sss:proofing} + +For proofreading, use the \texttt{proofing} option of +\textsf{exerquiz}. +\begin{Verbatim}[xleftmargin=\amtIndent] +\usepackage[proofing]{exerquiz} +\end{Verbatim} + +\noindent When used, a symbol, defined by the command \cs{proofingsymbol}, +will mark the correct answers, as defined in your source file. The +command \cs{proofingsymbol} may be redefined, its definition is +\begin{Verbatim}[xleftmargin=\amtIndent] +\newcommand\proofingsymbol{\textcolor{webgreen}{$\bullet$}} +\end{Verbatim} +\noindent +This option works for the +\texttt{\hyperref[ss:GradedQuizzes]{quiz}} environment defined +below +(\hyperref[ss:GradedQuizzes]{page~\pageref*{ss:GradedQuizzes}}), +as well. + +\subsubsection{The \texttt{showgrayletters} Option}\label{showgraylettersOpt} \aebCng[showgrayletters] + +When \texttt{showgrayletters} is used, the form field check boxes +that appear in a \texttt{quiz} or in a \texttt{shortquiz} will have a gray capital letter +\texttt{A}, \texttt{B}, \texttt{C}, etc. underneath it. This letter +can then be referred to in the text or the solution. + +This option is global and is controlled by a switch, \cs{ifaebshowgrayletters}. The gray letter feature can be turned on +and off locally: To turn on this feature, insert the command \Com{graylettersOn} at some appropriately chosen point in +the document; to turn off the gray letter feature insert \Com{graylettersOff}. + +\newtopic In support of the \texttt{showgrayletters} option is a new command \Com{REF}. +\cs{REF} acts like the {\LaTeX} command \cs{ref} with the hyperref modifications, but it converts +the reference to uppercase. When \cs{ref} would typeset the letter `a', for example, \cs{REF} +would typeset the letter `A'. \cs{REF}, like \cs{ref}, typesets a hyperref link. Hyperref defines a +\texttt{*} version of \cs{ref}; \cs{ref*} typesets the reference, but does not create a link; +\cs{REF*} does the same. When \cs{aebshowgraylettersfalse} is in effect, \cs{REF} does not capitalize +the reference. + +The \texttt{showgrayletters} feature and the \cs{REF} command work equally +well for the \texttt{quiz} environment. + +\redpoint Below is an example of this. + +\graylettersOn + +\begin{shortquiz*}[TestSQ] +Answer this if you can! +\begin{answers}{2} +\bChoices + \Ans0\label{testsqFirst} This is a possible answer.\eAns + + \Ans1\label{testsqSecond} Try this one (the correct one)\eAns + + \Ans0 This is an answer.\eAns + + \Ans0 Another alternative.\eAns +\eChoices +\end{answers} +\end{shortquiz*} + +\noindent Reference both (\REF{testsqFirst}) and (\REF*{testsqSecond}). + +\graylettersOff + +\newtopic The code is +\begin{Verbatim}[xleftmargin=\amtIndent,fontsize=\small] +\graylettersOn +\begin{shortquiz*}[TestSQ] +Answer this if you can! +\begin{answers}{2} +\bChoices + \Ans0\label{testsqFirst} This is a possible answer.\eAns + \Ans1\label{testsqSecond} Try this one (the correct one).\eAns + \Ans0 This is an answer.\eAns + \Ans0 Another alternative.\eAns +\eChoices +\end{answers} +\end{shortquiz*} +\noindent Reference both (\REF{testsqFirst}) and (\REF*{testsqSecond}). +\graylettersOff +\end{Verbatim} +\newtopic Notice that the gray letters was not turned to off +until after the usage of \cs{REF}. + +\textcolor{red}{\Important} The gray letters are typeset into the document. Do not +use a background color for the checkboxes as this color will cover +up the gray letters. The default background color checkboxes is +transparent, keep it that way. + +\newtopic The command \Com{insertGrayLetters} is used to insert the gray letters; +this command can be redefined as desired. See the source file \texttt{exerquiz.dtx}. +Also see the definition of \Com{bottomOfAnsfStack}. + +\subsubsection{Moving the Solution Set} + +The solution set, by default, comes last in the file. You can move +its positioning by including the command \cs{includequizsolutions} +at any point \emph{after} the last quiz (created by the \texttt{shortquiz} and \texttt{quiz} environments). You'll note +that I +have moved the solutions in this file before the +\nameref{references} section, as indicated, for example, by its +position in the table of contents. + +\subsubsection{Grouping the solutions at end}\label{ss:grpQzs} + +Historically, solutions to quizzes (created by the \env{shortquiz} and +\env{quiz} environments) appearing at the end of the file \emph{are not +grouped}. This means that a color change or a definition made in one solution +may affect all subsequent solutions. + +You can now declare \cs{makeQzSolnsLocalOn} or \cs{makeQzSolnsLocalOff} +anywhere in the document to turn on grouping for all quizzes that follow, or +to turn off this feature again. The default is \cs{makeQzSolnsLocalOff}. + +\subsection{Redesigning the +\texorpdfstring{\protect\texttt{shortquiz}}{shortquiz} +Environment}\label{sss:redefinesq} + +The \texttt{shortquiz} environment can be redesigned to better suit +your needs. In the paragraphs below, we describe how you can change +titles and form elements. + + +\subsubsection{Changing Titles} + +You can temporarily change the title for the \texttt{shortquiz} +environment by redefining the macro \cs{sqlabel}; for example, the +default definition of this macro is +\begin{Verbatim}[xleftmargin=\amtIndent] +\newcommand\sqlabel{\textcolor{red}{Quiz.}} +\end{Verbatim} +\noindent The syntax for redefining \cs{sqlabel} is +\begin{Verbatim}[xleftmargin=\amtIndent] +\renewcommand\sqlabel{...new code goes here...} +\end{Verbatim} +\noindent You can redefine the \textit{default} label as well; the +default label is the title label that \texttt{short\-quiz} uses when +\cs{sqlabel} is \textit{not present}. The default label is +\verb+\eq@sqlabel+ and must be redefined using the macro +\cs{renewcommand}. The best place for this to be done is the +preamble. The syntax: +\begin{Verbatim}[xleftmargin=\amtIndent] +\makeatletter % make `at'=@ a normal letter +\renewcommand\eq@sqlabel{...new code goes here...} +\makeatother % make `at'=@ something special(other) +\end{Verbatim} +\noindent To change the entire document to use `Exam' instead of `Quiz', +make the following changes in the preamble: +\begin{Verbatim}[xleftmargin=\amtIndent] +\makeatletter +% change default quiz title to 'Exam' +\renewcommand\eq@sqlabel{\textcolor{red}{Exam.}} +% change quiz solutions return label +\renewcommand\eq@sqslrtnlabel{End Soln} +% change solutions label +\renewcommand\eq@sqsllabel{% + \string\textbf{Solution to Exam:}} +\renewcommand\eq@sqslsectitle{Solutions to Exams} +% change default running header for solutions +\renewcommand\eq@sqslsecrunhead{Solutions to Exams} +\makeatother +\end{Verbatim} + +% ?? Did not document \sqsolafter + +\redpoint The above commands are `global'---they are in effect +throughout the entire document. You can temporarily change these +labels using the \cs{sqlabel}, \cs{sqslrtnlabel}, \cs{sqsllabel} and +\cs{sqslsectitle}. Note that you cannot temporarily change the running label +\cs{eq@qslsecrunhead}, this should be set in the +preamble. + +Should you want to make a series of multiple choice questions +(using the \texttt{questions} environment) and combine them into a +sort of review or pretest, a useful idea would be to number the +solutions. The counter that maintains the question number is +called \texttt{questionno}. You can then, for example, define +\begin{Verbatim}[xleftmargin=\amtIndent] +\renewcommand\eq@sqsllabel{% + \string\textbf{Solution to Question \thequestionno:}} +\end{Verbatim} + +%\exPDF{webeqtst} See the sample file +%\texttt{\href{\bUrl/webeq_ex.html\#webeqtst}{webeqtst.tex}} +%for examples. + +\exAeBBlogPDF{p=803} See the file \texttt{\href{\urlAcroTeXBlog/?p=803}{webeqtst.pdf}} from the {\AcroBlog} +website for examples. + + +\subsubsection{Modifying Form Elements}\label{sqMFE1} + +For quizzes that use radio buttons (see page~\pageref{sqwRadio} +above), the appearance of the radio buttons can be controlled +using the ``every'' mechanism as described in the document +\href{eformman.pdf}{eFormMan.pdf} on +\textit{\href{eformman.pdf}{eForm Support}} for the \cAcroB. +The radio buttons can be modified using the command \cs{everysqRadioButton}. + +Prior to the short quiz below, the following command was executed + +\begin{Verbatim}[xleftmargin=\amtIndent] +\everysqRadioButton{\BC{.690 .769 .871}\BG{.941 1 .941}} +\end{Verbatim} + +\sqTurnOffAlerts \sqCorrections +\everysqRadioButton{\BC{.690 .769 .871}\BG{.941 1 .941}} + +\begin{shortquiz*}[KublaKhan3] +Was it in Xanadu did Kubla Kahn a stately pleasure dome decree? +\begin{answers}{4} +\Ans1 True & \Ans0 False +\end{answers} +\end{shortquiz*} + +\everysqRadioButton{} +\sqTurnOnAlerts\sqNoCorrections + +\noindent Return to the defaults, if desired, by then emitting +\begin{Verbatim}[xleftmargin=\amtIndent] +\everysqRadioButton{} +\end{Verbatim} + +\redpoint The short quiz can also have fill-in questions and +various other controls, these are described in +Section~\ref{s:oQsq}, \nameref{s:oQsq}. There too, methods of +modifying the appearance of the form elements are discussed. + +\subsection{\texorpdfstring{\protect\cs{titleQuiz}}{\CMD{titleQuiz}} + and \texorpdfstring{\protect\cs{fancyQuizHeaders}}{\CMD{fancyQuizHeaders}}}\label{titleQuizSQ} + +%\exPDF{title_quiz}The demo file for these features is \texttt{title\_quiz.tex}. + +\exAeBBlogPDF{p=908} See the file \texttt{\href{\urlAcroTeXBlog/?p=908}{title\_quiz.pdf}} from the {\AcroBlog} +website for examples. + + + +\subsubsection{\texorpdfstring{\protect\cs{titleQuiz}}{\CMD{titleQuiz}}} + +To assign a title to your short quiz use \Com{titleQuiz}. This title +appears just after the typeset word ``Quiz''. + +\fancyQuizHeaders +\titleQuiz{Two Question MC} +\begin{shortquiz}\label{myCoolSQ} +Answer each of these to the best of your ability. +\begin{questions} +\item Math is fun. +\begin{answers}*{4} +\Ans1 True & \Ans0 False\\ +\end{answers} +\begin{solution} + The answer is true, of course, math is fun! +\end{solution} + +\item Statistics is fun. +\begin{answers}*{4} +\Ans0 True & \Ans1 False\\ +\end{answers} +\begin{solution} + The answer is false, statistics is interesting but not fun. +\end{solution} +\end{questions} +\end{shortquiz} + +\noindent The partial verbatim code for the above quiz follows: + +\begin{Verbatim}[xleftmargin=\amtIndent] +\titleQuiz{Two Question MC} +\begin{shortquiz}\label{myCoolSQ} +Answer each of these to the best of your ability. +\begin{questions} +... +\end{questions} +\end{shortquiz} +\end{Verbatim} + +\restoreDefaultQuizHeaders + +\noindent The format of the title is controlled by the command \Com{titleQuizfmt}, +the default definition is \verb!\newcommand\titleQuizfmt{\bfseries}!. The value +of the \cs{titleQuiz} command can act as an argument for \cs{titleQuizfmt} if you redefine +\cs{titleQuizfmt} to have an argument. For example, +\begin{Verbatim}[xleftmargin=\amtIndent] +\renewcommand\titleQuizfmt[1]{\bfseries(#1)} +\end{Verbatim} +Now, the title will appear in a set of parentheses. The title and formatting are enclosed +in a \cs{mbox}, so font and style changes are localized to that \cs{mbox}. + +\newtopic If a quiz does not have a title, as defined by \cs{titleQuiz}, the title defaults to +an empty title. + +\newtopic The definition of \cs{titleQuiz} is such that the command \cs{makeatletter} is executed +before the argument for \cs{titleQuiz} is read. This means that the special character +`\texttt{@}' can be used within the argument of \cs{titleQuiz}. For example, the \texttt{shortquiz} +environment maintains a text macro \cs{@shortquizCnt} which contains the current short quiz +count number. Thus you can say \verb!\titleQuiz{Short Quiz \@shortquizCnt}!, the title of +the short quiz will include a short quiz number as well. + +The \cs{titleQuiz} is used for quizzes as well as with short quizzes. It is possible to have +different formatting for each of these two environments by using the \Com{ifQuizType} +command. The command takes two arguments: +\begin{Verbatim}[xleftmargin=\amtIndent,commandchars=!()] +\ifQuizType{!anglemeta(quiz_code)}{!anglemeta(shortquiz_code)} +\end{Verbatim} +For example, we could define \cs{titleQuizfmt} as follows: +\begin{Verbatim}[xleftmargin=\amtIndent] +\renewcommand\titleQuizfmt{\ifQuizType{\bfseries}{\slshape}} +\end{Verbatim} +or with an argument, as mentioned above, you could define \cs{titleQuizfmt} with an argument, +like so, +\begin{Verbatim}[xleftmargin=\amtIndent] +\renewcommand{\titleQuizfmt}[1]{% + \ifQuizType{\bfseries(#1)}{\slshape[#1]}} +\end{Verbatim} + +\subsubsection{\texorpdfstring{\protect\cs{titleQuiz*}}{\CMD{titleQuiz*}}} + +For \texttt{shortquiz} environment---not for the \texttt{quiz} +environment---there is a `\texttt*' optional first parameter. When +the `\texttt*' option is taken, the quiz label (\cs{sqlabel}) is +redefined to be the title of the quiz text. + +%\exPDF{title_quiz} The \texttt{title\_quiz.tex} demo file illustrates the `\texttt{*}' option. + +\exAeBBlogPDF{p=908} See +\texttt{\href{\urlAcroTeXBlog/?p=908}{title\_quiz.pdf}} demo file illustrates +the `\texttt{*}' option. + + +\newtopic Thus, if we title a quiz with the `\texttt{*}', we get + +\titleQuiz*{My Cool Quiz} +\begin{shortquiz} +Answer each of these to the best of your ability. +\begin{questions} +\item Math is fun. +\begin{answers}{4} +\Ans1 True & \Ans0 False\\ +\end{answers} +\item Statistics is fun. +\begin{answers}{4} +\Ans0 True & \Ans1 False\\ +\end{answers} +\end{questions} +\end{shortquiz} +The formatting is that defined by the \cs{titleQuizfmt}, which is \cs{bfseries}. In addition +to the \Com{ifQuizType} command, there is also the \cs{ifstaroption} command. It takes two +parameters +\begin{Verbatim}[xleftmargin=\amtIndent,commandchars=!()] +\ifstaroption{!ameta(code if \titleQuiz*)}{!ameta(otherwise)} +\end{Verbatim} +This allows us to not only format for quizzes, but for short quizzes, with or without +the `\texttt*' option. If we redefine \cs{titleQuizfmt} to be +\begin{Verbatim}[xleftmargin=\amtIndent] +\renewcommand{\titleQuizfmt}{\ifQuizType{\bfseries}% + {\ifstaroption{\color{red}}{\bfseries}}} +\end{Verbatim} +we format the quiz title as \cs{bfseries} is either a quiz or a +short quiz without `\texttt*' option, and as \verb!\color{red}! with +a short quiz with the `\texttt*' option. The results are seen in the next quiz, +with this redefinition: + +\renewcommand{\titleQuizfmt}{\ifQuizType{\bfseries}% + {\ifstaroption{\color{red}}{\bfseries}}} + +\titleQuiz*{My Swave Quiz} +\begin{shortquiz} +Answer each of these to the best of your ability. +\begin{questions} +\item Math is fun. +\begin{answers}{4} +\Ans1 True & \Ans0 False\\ +\end{answers} +\item Statistics is fun. +\begin{answers}{4} +\Ans0 True & \Ans1 False\\ +\end{answers} +\end{questions} +\end{shortquiz} + +\subsubsection{Cross-Referencing} + +Quizzes and shortquizzes conform to the cross-referencing system of +{\LaTeX}. For example, we used the label \verb!\label{myCoolSQ}! in the +last quiz, the one on page~\pageref{myCoolSQ}. The title of the quiz is +\nameref{myCoolSQ}. The code for the past two sentences is +\begin{Verbatim}[xleftmargin=\amtIndent] +For example, we used the label \verb!\label{myCoolSQ}! in the +last quiz, the one on page~\pageref{myCoolSQ}. The title of +the quiz is \nameref{myCoolSQ}. +\end{Verbatim} +%\noindent If the shortquiz does not have a title, as defined by the \cs{titleQuiz} command, a generic label of +%`Quiz' is generated. The default label name is +%\begin{Verbatim}[xleftmargin=\amtIndent] +% \newcommand\eq@defaultShortQuizLableName{Quiz} +%\end{Verbatim} +%\noindent This definition can be change using \cs{renewcommand}. + + +\subsubsection{\texorpdfstring{\protect\cs{fancyQuizHeaders}}{\CMD{fancyQuizHeaders}}} + +The \Com{fancyQuizHeaders} command, a companion feature to \Com{titleQuiz}, enhances +the labeling of the quiz in the solutions section of the document. If +\cs{fancyQuizHeaders} is executed in the preamble, or prior to a quiz, the solution header has the +following default format: + +\newtopic{\color{blue}Two Question MC: Question 1.} The answer is true, of course, math is fun! + +\newtopic The above assumes the title of the quiz is the one given in the previous section. + +\newtopic When a quiz has no title, the header reverts to +\textcolor{blue}{Solution to Quiz:} followed by the question number. + +\redpoint You can turn off fancy quiz headers by using +\Com{restoreDefaultQuizHeaders}. + +\newtopic You can modify the fancy headers with a combination of setting \Com{setsolnspace} +and/or redefining the command \Com{eq@fancyQuizHeadersfmt}. First +\cs{setsolnspace}: This is a hook into the space immediately +following the header. To insert a \cs{medskip} after the header, for example, you +can say \verb!\setsolnspace{\par\medskip\noindent}! a +\cs{medskip} is created after the solution header and the solution +above appears as + +\newtopic{\color{blue}Two Question MC: Question 1.}\par\medskip\noindent The answer is true, of course, math is fun! + +\newtopic The definition of \cs{eq@fancyQuizHeadersfmt} is +\begin{Verbatim}[xleftmargin=\amtIndent] +\def\eq@fancyShrtQuizHeadersfmt{\eq@fancyQuizHeadersfmt} +\end{Verbatim} +The \Com{eq@fancyQuizHeadersfmt} is the \texttt{quiz} counterpart to +this \texttt{shortquiz} construct. The fancy short quiz solutions header +defaults to the same header used for a quiz. You can copy +and paste the definition of \cs{eq@fancyQuizHeadersfmt} into the definition +of the command \cs{eq@fancyShrtQuizHeadersfmt}, then modify as described in +\Nameref{fancyQuizHeadersQ}. + +%See the section \Nameref{fancyQuizHeadersQ} for a full discussion of this topic. + +% \subsection{Graded Quizzes using JavaScript} +\section{The \texttt{quiz} Environment}\label{ss:GradedQuizzes} + +Use the \texttt{quiz} environment to create graded quizzes. In +this case, several (many) questions are bundled together. The +student takes the quiz and responses are recorded by +JavaScript. Upon completion of the quiz, the total score is +reported to the student. + +The \texttt{quiz} environment can generate multiple choice +questions and math/text fill-in questions. The discussion of math +and text fill-in questions is postponed to \hyperref[s:oQ] +{Section~\ref*{s:oQ}} on page~\pageref*{s:oQ} + + +There are two types of quizzes, the +\hyperref[sss:QuizwLinks]{link-style} and +\hyperref[sss:QuizwChecks]{form-style}. +In \hyperref[ss:correct]{Section~\ref*{ss:correct}}, we see that +the \texttt{quiz} environment can also correct the quizzes. + +The quiz environment takes one required parameter, the +\meta{base\_name}, which is a string. +\begin{Verbatim}[xleftmargin=\amtIndent,commandchars=!()] +\begin{quiz}{!meta(base_name)} +... +\end{quiz} +\end{Verbatim} +\textcolor{red}{\Important} The \pkg{exerquiz} package uses the +\meta{base\_name} to build Acrobat form fields, and also JavaScript +variables; therefore, there are restrictions on the choice of the +name. The name must be a (JavaScript) \emph{identifier}, the rules to +be an identifier are these. +\begin{quote} +The first character shall be a letter, an underscore (\texttt{\_}), +or a dollar sign (\texttt{\$}); subsequent characters may be any +letter or digit, or an underscore or a dollar sign. +\end{quote} +Do not use other symbols, like a colon (\texttt{\:}) or a period as part of the field name, +these will confuse the JavaScript interpreter, and may cause the quiz not to function as +designed. + + +The \texttt{quiz} environment consists of a series of nested +environments. Inside the \texttt{quiz} environment is the +\texttt{questions} environment (an enumerated list), and within +that environment is the \texttt{answers} environment. +Symbolically, we can express this as +\[ + \mbox{\texttt{quiz}} \supseteq + \mbox{\texttt{questions}} \supseteq + \mbox{\texttt{answers}} +\] +The term `answers' is, perhaps, not sufficiently descriptive; +`alternatives' would be more appropriate, but it requires more +typing. \verb!{:-{)! + +\redpoint The \texttt{answers} environment requires one parameter, +the \texttt{num\_cols}. If \texttt{num\_cols} is~1, a +\texttt{list} environment is created; otherwise, a +\texttt{tabular} environment is used. + +This (\texttt{tabular}) environment has the following syntax: + +\begin{Verbatim}[xleftmargin=\amtIndent,commandchars=!()] +\begin{quiz}{!meta(base_name)} +The preamble to the questions goes here. +\begin{questions} +\item State first question.... +\begin{answers}{4} % <- num_cols = 4 +\Ans0 ... &\Ans1 ... &\Ans0 ... &\Ans0 ... +\end{answers} +... +\item n th question.... +\begin{answers}{4} % <- 4 column format +\Ans0 ... &\Ans1 ... &\Ans0 ... &\Ans0 ... +\end{answers} +\end{questions} +\end{quiz} +\end{Verbatim} + +\redpoint Following the quiz, or anywhere in the document, place +the macro \cs{ScoreField}, defined in \textsf{exerquiz}, to +display the results of the quiz: +\begin{Verbatim}[xleftmargin=\amtIndent,commandchars=!()] +\ScoreField{!meta(base_name)} +\end{Verbatim} +\noindent\textcolor{red}{\bfseries Important.} The value of the parameter of +the macro \cs{ScoreField} must match the \meta{base\_name} +defined in the argument of the \texttt{quiz} environment. + +\redpoint There is a convenience macro, \cs{currQuiz}, that holds the name +of the current quiz. Thus, we could have instead typed: +\begin{Verbatim}[xleftmargin=\amtIndent] +\ScoreField\currQuiz +\end{Verbatim} + +\noindent Read the paragraph entitled \Nameref{sss:scorefield} for more +details on this macro. + +%An alternative to \cs{ScoreField} is to use \cs{TextField}. +%a macro defined by \pkg{hyperref}. See more details later. %?? + +\begin{comment} +The \textsf{exerquiz} macro \cs{eqScore} is a text macro that +expands to the phrase `Score:'. (It expands to `Punkte:' with the +\texttt{german} language option and `Score :' with the +\texttt{french}.) + + +The \cs{TextField} macro takes two arguments, we need only the +first---the second is left empty. This \cs{TextField} can be +modified by changing the options; the layout of the field can be +changed as well using the \cs{LayoutTextField}. For more +information see the paragraphs on \nameref{ss:modoutputfield} +beginning on page~\pageref{ss:modoutputfield}. There are +extensive examples on how to set up the \cs{TextField} in the +paragraph \nameref{sss:modtextfield} on +page~\pageref{sss:modtextfield}, with examples following on +page~\pageref{sss:exampltextfield}. +\end{comment} + +\subsection{Options of the \texttt{quiz} Environment} + +In addition to the options listed in the section \ref{sq:opts}, page \pageref*{sq:opts}, the following is +designed for quizzes. + +\subsubsection{The option +\texorpdfstring{\protect\texttt{noquiz\-solutions}}{noquizsolutions}}\label{sss:noquizsolutions} + +For online quizzing, where results are stored in some way (database, +e-mail, text file) the presence of the solutions in the same file as the +questions is a breach in security of the quiz. Using the +\texttt{noquizsolutions} removes the solutions to a \texttt{quiz} and +\texttt{shortquiz} from the document under construction. + + +\subsection{The \texttt{answers} Environment}\label{answersQuiz} + +The simplest type of question that can be posed is the multiple choice question. +For this question type, the \texttt{answers} environment is used. The basic syntax +is + +\begin{Verbatim}[xleftmargin=\amtIndent,commandchars=!()] +\item A question +\begin{answers}!anglemeta(dest){!meta(num_cols)} +\Ans[!meta(partial_pts)]{0|1}.... +\end{answers} +\end{Verbatim} + +\newtopic The \anglemeta{dest}, an optional argument, is a name used to create a hypertext jump to +the solution; it has two forms: \texttt{[\meta{named\_dest}]}, an explicit +``named destination.''; and the \texttt{*}-form, \textsf{exerquiz} automatically +generates the name. Use \meta{named\_dest} when you want to refer to a solution +in another part of the document; otherwise, use \texttt{*}, for convenience. + +If either the \texttt{[\meta{named\_dest}]} or \texttt{*} is used, a +\texttt{solution} environment should follow. + +\newtopic The \meta{num\_cols} is the number of columns to +typeset the answers in. When \meta{num\_cols} is 1, the answers are set +in a list environment; otherwise, a tabular environment is used. In the latter case, +the usual table syntax is used. (Use \texttt{\&} to separate columns, and \verb!\\! to +terminate a row.) + +\newtopic The \cs{Ans} command has one required argument, a 1 to mark that this +answer is a correct answer, and a 0 to mark that this answer is not true. \cs{Ans} +also has an optional argument to pass partial points rewarded for a wrong answer. + +\newtopic This environment is illustrated extensively in this section. See also the +\texttt{manswers} environment, \Nameref{manswersQuiz}, for posting questions with multiple +correct answers. + +\subsection{Basic Usage} + +In this section we discuss the two \texttt{quiz} styles: +\nameref{sss:QuizwLinks} and \nameref{sss:QuizwChecks}. + +A paragraph is devoted to some modifications that can be made at +the beginning and end of the quiz. In addition, a +\texttt{\hyperref[sss:proofing]{proofing}} option is also +described. + +\subsubsection{Link-Style Quiz}\label{sss:QuizwLinks} + +%\renewcommand\bqlabel{Begin Exam} +%\renewcommand\eqlabel{End Exam} + +%There are actually two variations on this type of quiz, one uses +%links, the other uses radio button fields. + +This style uses links to record the choices to the alternatives. +The link method takes up less space in the pdf file than does the +form-style. + +Below is an example of a link-style quiz. Instructions should be +given to guide the student in operating the quiz correctly. + +\medskip\noindent\textcolor{red}{Instructions.} You must click on +`Begin Quiz' to initialize the quiz. Not doing so brings forth +an error message. When finished, click on `End Quiz'. + +\begin{quiz}{qzdiscrl} +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}\par +\ScoreField\currQuiz +%\TextField[name=qz:discr,width=3in,default=\eqScore]{} + +\redpoint While you are taking the test, and before you click on +`End Quiz', you can change your answers. + +%A message box comes out, +%gives you your original choice, and asks you whether you really +%want to change your answer. + +\begin{Verbatim}[xleftmargin=\amtIndent] +\begin{quiz}{qzdiscrl} % qzdiscrl=base_name +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}\par +\ScoreField\currQuiz % matching quiz field name +\end{Verbatim} + +\redpoint The convenience text macro, \cs{currQuiz}, contains the name +of the current quiz. This macro can be used as the argument of +\cs{ScoreField}. + +\subsubsection{Form-Style Quiz}\label{sss:QuizwChecks} + +You may be thinking that such a quiz format---one in which the +student cannot see the choices made---is not very good. It is +perhaps adequate for two or three quick questions. For a longer +quiz format, one would like to see a ``checkbox'' format. +A quiz with a checkbox format can be obtained using the +\texttt{quiz*} environment:\footnote{In previous versions of \textsf{exerquiz}, there was a \texttt*-option +for this purpose. The \texttt{quiz*} has replaced the \texttt*-option and is the preferred method, though +the \texttt*-option is still defined so as not to break previous code.} +\begin{Verbatim}[xleftmargin=\amtIndent,commandchars=!()] +\begin{quiz*}{!meta(base_name)} +... +...same format as before... +... +\end{quiz*} +\end{Verbatim} + +\noindent Here is the same sample quiz with the form-style option. The only +change in the code is the insertion of the \texttt*-option. + +\medskip\noindent\textcolor{red}{Instructions.} You must click on +`Begin Quiz' to initialize the quiz. Not doing so, brings forth +an error message. When finished, click on `End Quiz'. + + +\begin{quiz*}{qzdiscrf} +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{qzdiscrf} + +\redpoint Before completing the quiz, a student can easily change +alternatives. + +\redpoint This type is more suitable for longer quizzes. The +choices the student makes are visually recorded for the student to +review and change before clicking on `End Quiz'. A partial +verbatim listing: +\begin{Verbatim}[xleftmargin=\amtIndent] +\begin{quiz*}{qzdiscrf} +Using the discriminant, $b^2-4ac$, respond to each of the +following questions. +\begin{questions} +............. +............. +\end{questions} +\end{quiz*}\par +\ScoreField{qzdiscrf} +\end{Verbatim} + +%\exPDF{webeqtst} See the sample file +%\texttt{\href{\bUrl/webeq_ex.html\#webeqtst} {webeqtst.tex}} +%and for examples. + +\exAeBBlogPDF{p=803} See the file \texttt{\href{\urlAcroTeXBlog/?p=803}{webeqtst.pdf}} from the {\AcroBlog} +website for examples. + + +\subsubsection{Using Circular Radio Buttons with MC Questions} + +As seen with the examples of the previous section, the form-type quizzes +have a rectangular check box for the user to make his selection. Acrobat also +offers a circular radio button that can be used to make a multiple choice. + +To create circular radio buttons for a MC question execute \Com{useMCCircles} before +the quiz, or, perhaps, in the preamble of your document. + +To return to the default rectangular choice boxes, execute \Com{useMCCRects}. This +setting is the default, there is no need to executed it unless +\cs{useMCCircles} has already been executed. + +Executing \cs{useMCCircles} does not affect the \texttt{manswers} +environment, page~\pageref*{manswersQuiz}), so you can have circular radio +buttons for multiple choice, and rectangular choice boxes for multiple +selection problems. + +%\exPDF{quiz_w_circ} The sample file \texttt{quiz\_w\_circ.tex} illustrates these two commands. + + +\exAeBBlogPDF{p=914} The demo file \texttt{\href{\urlAcroTeXBlog/?p=914}{quiz\_w\_circ.pdf}} +illustrates these two commands. + + + +\subsubsection{Overriding the `quiztype' Parameter} + +You can globally declare that all quizzes to be a link-type or +form-type by using the command \Com{quiztype}. Placing +\verb+\quiztype{f}+ in the preamble (or prior to any quiz) will +cause all quizzes following that command to be form-type quizzes. +Similarly, executing \verb+\quiztype{l}+ will produce all link-type quizzes. + +You can make the environments revert back to their normal behavior by using +the command \Com{defaultquiztype}, which cancels out the \cs{quiztype} command. + +%\exPDF{quizpts} The sample file \texttt{\href{\bUrl/webeq_ex.html\#quizpts} +%{quizpts.tex}} illustrates these collections of commands. + +\exAeBBlogPDF{p=1054} The demo file \texttt{\href{\urlAcroTeXBlog/?p=1054}{quizpts.pdf}} +illustrates these collections of commands. + + + +\newtopic \emph{Within a quiz}, you can say \Com{useForms}, to change the style to a visible checkbox +for multiple choice or multiple selection questions; use \Com{useLinks} to change +the style to links with alphabetized alternatives. Using \cs{restoreFLTypeDefault} +restores the next multiple choice/selection question back to the default determined +by the quiz environment (\texttt{quiz} versus \texttt{quiz*}), or as set by the +\cs{quiztype} command. + +\subsubsection{The BeginQuiz and EndQuiz Form Buttons}\label{sss:FormButton} + +The default setup the \texttt{quiz} environment is to have +hypertext links for the `Begin Quiz' and `End Quiz'. You can also +redefine this linking and use a form button instead +Prior to your quiz, use the following code, if desired. +\begin{Verbatim}[xleftmargin=\amtIndent] +\useBeginQuizButton +\useEndQuizButton +\end{Verbatim} + +\useBeginQuizButton\useEndQuizButton +%\makeatletter +%\renewcommand\eq@beginQuiz{\eq@BeginQuizButton} +%\renewcommand\eq@endQuiz{\eq@EndQuizButton} +%\makeatother + + +\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} +\item Who originally wrote \LaTeX? +\begin{answers}4 +\Ans0 Knuth &\Ans1 Lamport &\Ans0 Carlisle &\Ans0 Rahtz +\end{answers} +\end{questions} +\end{quiz}\quad\ScoreField{qzTeXf} + +\medskip +\noindent Revert back to link-style as follows: +\begin{Verbatim}[xleftmargin=\amtIndent] +\useBeginQuizLink +\useEndQuizLink +\end{Verbatim} + +\useBeginQuizLink\useEndQuizLink + +\noindent The commands \cs{useBeginQuizButton} and \cs{useEndQuizButton} each +have an optional argument that can be used to modify the appearance +of the buttons. +\begin{Verbatim}[xleftmargin=\amtIndent] +\useBeginQuizButton[\textColor{0 0 1}] +\end{Verbatim} +\noindent would create a `Begin Quiz' button with blue text for the button label. + +\subsubsection{The \texorpdfstring{\texttt{proof\-ing}}{proofing} +Option}\label{ss:proofing} + +For proofreading, use the \texttt{proofing} option of +\textsf{exerquiz}. +\begin{Verbatim}[xleftmargin=\amtIndent] +\usepackage[proofing]{exerquiz} +\end{Verbatim} +\noindent When used, a symbol, defined by the command \cs{proofingsymbol}, +will mark the correct answers, as defined in your source file. The +command \cs{proofingsymbol} can be redefined, its definition is +\begin{Verbatim}[xleftmargin=\amtIndent] +\newcommand\proofingsymbol{\textcolor{webgreen}{$\bullet$}} +\end{Verbatim} +\noindent +This option works for the \texttt{\hyperref[ss:QuizIR]{shortquiz}} +environments defined above +(\hyperref[ss:QuizIR]{page~\pageref*{ss:QuizIR}}), as well. + +\subsubsection{The \texttt{showgrayletters} Option} \aebCng[showgrayletters] + +The showgrayletters option is valid for the \texttt{quiz} and \texttt{shortquiz} environments. +See the section entitled \Nameref{showgraylettersOpt} for a detailed explanation +of this option. + +\subsubsection{Setting the Threshold}\label{threshold} + +The default behavior of the \texttt{quiz} environment is that a +student can begin the quiz and finish the quiz without answering +any or all of the questions. This is called a \texttt{lowThreshold} +and is the default behavior. + +The document author can set a \texttt{highThreshold} by re-defining +the \cs{minQuizResp} macro. The default definition is +\begin{Verbatim}[xleftmargin=\amtIndent] +\newcommand\minQuizResp{lowThreshold} +\end{Verbatim} +\noindent However, if you make the definition +\begin{Verbatim}[xleftmargin=\amtIndent] +\renewcommand\minQuizResp{highThreshold} +\end{Verbatim} +\noindent the student is required to answer all the questions of a +quiz. + +Actually, \texttt{lowThreshold} and \texttt{highThreshold} are +JavaScript functions that are called when the ``End +Quiz'' button is clicked. If the threshold is not met, an alert box +appears informing the user of this. + +The document author can write a custom threshold function and place +its name in the \cs{minQuizResp} macro. See the \textsf{exerquiz} +source code---in either \textsf{exerquiz.dtx} or +\textsf{exerquiz.sty}---for the \texttt{highThreshold()} function +for an example of how to do this. + +\subsection{The \texttt{manswers} Environment}\label{manswersQuiz} + +Beginning with \textsf{Exerquiz} v.6.2, the \texttt{manswers} +environment is defined to support multiple selection questions. +(\texttt{manswers} stands for multiple answers). This is in contrast +with the \texttt{answers} environment in which there is only one +correct answer; for \texttt{manswers}, there are several correct +answers. + +%\exPDF{manswers} See the example file for this feature is \texttt{manswers.tex}. + +\exAeBBlogPDF{p=903} See the example file for this feature is \texttt{\href{\urlAcroTeXBlog/?p=903}{manswers.pdf}}. + +\newtopic\indent The syntax is the same as that of the \texttt{answers} environment, +\mlNameref{answersQuiz}. Below is example fragment, taken from \texttt{manswers.tex} + + +\begin{Verbatim}[xleftmargin=\amtIndent] +\item\PTs{5} Select which people were the President + of the United States. +\begin{manswers}{4} + \bChoices[2] + \Ans[-1]{0} Henry Clay\eAns + \Ans[-1]{0} Ben Franklin\eAns + \Ans[1.5]{1} Andrew Jackson\eAns + \Ans[1.5]{1} Ronald Reagan\eAns + \Ans[-1]{0} George Meade\eAns + \Ans[2]{1} Grover Cleveland\eAns + \Ans[-1]{0} John Jay\eAns + \Ans[-1]{0} Paul Revere\eAns + \eChoices +\end{manswers} +\end{Verbatim} + +\newtopic The arguments of the \cs{Ans} command is the same as +those of \cs{Ans} in the \texttt{answers} environment. + +\newtopic When the \cs{ScoreField} is used to display results, a manswers +question is correct if and only if all correct answers are checked, and none +of the incorrect answers are checked. + +When the \cs{PointsField} is used (see \Nameref{sss:asignPts}), and +points are assigned, as in the above code fragment, the optional +argument of \cs{Ans} is used to assign points for each response (if +there is no optional argument, it defaults to 0). When a student +selects a choice, the point value in the optional argument is added +to the point score. In the case of choosing \texttt{Ronald Reagan}, +1.5 points are added to the point score, while -1 point is added to +the point score for choosing \texttt{John Jay}. The minimal point +score for each question is zero, unless \cs{negPointsAllowed} command +is executed in the preamble, see \Nameref{negPtsAllowed}. + + +\subsection{Correcting the Quizzes with JavaScript}\label{ss:correct} + +%\makeatletter\eq@nocorrectionsfalse\makeatother +\CorrectionsOn + +Beginning with \textsf{exerquiz}, version 1.2, you can now correct +quizzes created by the \texttt{quiz} environment. To correct the +quizzes, simply include an additional element into your quiz, a +correction button. The correction button with +\cs{CorrButton}. + +\redpoint The following is a link-style quiz. + +% \begin{center} +% \noindent\fcolorbox{blue}{webyellow}{% +% \begin{minipage}{.965\linewidth}% +% \noindent\textcolor{red}{\textbf{Instructions:}} Click on +% `\textcolor{webgreen}{Begin Quiz}' to initialize the quiz. +% When finished, click on `\textcolor{webgreen}{End Quiz}'. +% Then, click on the `Correct' button. +% % To grade your quiz, press the `Correct' button. +% \end{minipage} +% }% +% \end{center} + +\begin{quiz}{qzdiscr1l} 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}\par +\ScoreField{qzdiscr1l}\CorrButton{qzdiscr1l}% + +\medskip +%\fcolorbox{blue}{webyellow}{% +% \begin{minipage}{.975\linewidth}% + \noindent\textcolor{red}{\textbf{Legend:}} + A \textcolor{webgreen}{\ding{52}} indicates a + 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}} + +\begin{comment} + \begin{center} + \fcolorbox{blue}{webyellow}{% + \begin{minipage}{.95\linewidth} + \noindent\textcolor{red}{\textbf{Legend:}} + 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} +\end{comment} + +\medskip +A partial verbatim listing of this quiz follows: +\begin{Verbatim}[xleftmargin=\amtIndent] +\begin{quiz}{qzdiscr1l} Using the discriminant, $b^2-4ac$, +respond to each of the following questions. +\begin{questions} +............................ +............................ +............................ +\end{questions} +\end{quiz} + +\ScoreField{qzdiscr1l}\CorrButton{qzdiscr1l} +\end{Verbatim} + + +\redpoint The macro \cs{CorrButton} is used to create a nice +``correction'' button. JavaScript is used to correct the quiz. +The only required argument is the field label that uniquely +defines the field in which the total score is placed. See the +section entitled \mlNameref{sss:CorrButton} for more details on how +to use this macro. + +\redpoint The \cs{CorrButton} will not work until the user has +clicked on `End Quiz'. The user can re-take the quiz simply by +clicking on `Begin Quiz', the form fields and JavaScript variables +will be cleared. + +\redpoint It is possible to take this form data and submit it to a +CGI script for processing. (The data can be saved to a database, +for example.) However, there is no built-in capability for this +in the \textsf{exerquiz} package. + +\symbolchoice{check} + +\medskip + +\noindent The same quiz can be written in form-style simply by inserting the +\texttt*-option. + +\medskip\noindent\textcolor{red}{Instructions.} You must click on +`Begin Quiz' to initialize the quiz. Not doing so, brings forth +an error message. When finished, click on `End Quiz'. + +\begin{quiz*}{qzdiscr1f} 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\CorrButton\currQuiz + +\redpoint In the partial verbatim listing that follows, notice the field +name has been changed from \texttt{qzdiscr1l}, which is the name of the +quiz previous to his one, to \texttt{qzdiscr1f}. Different quizzes must +have unique field names. + +\begin{Verbatim}[xleftmargin=\amtIndent] +\begin{quiz*}{qzdiscr1f} Using the discriminant, $b^2-4ac$, +respond to each of the following questions. +\begin{questions} +............................ +............................ +............................ +\end{questions} +\end{quiz*}\quad\ScoreField\currQuiz\CorrButton\currQuiz +\end{Verbatim} + +\redpoint Notice that in this example, the \cs{ScoreField} and the +\cs{CorrButton} are positioned following the `End Quiz'; this makes +the design more compact and nicer looking. + +\subsubsection{The +\texorpdfstring{\protect\texttt{nocorrections}}{nocorrections} +Option}\label{sss:nocorrections} + +Including the corrections adds quite a bit more JavaScript code to +the \texttt{.pdf} document, this feature is `on' by default. If +you have a document in which you do not want to have the option of +offering corrected quizzes, then just specify +\texttt{nocorrections} in the option list of \textsf{exerquiz}. + +There are also a couple of macros you can use to override the option switch, they are +\cs{CorrectionsOn} and \cs{CorrectionsOff}. Each remains in +effect until the other is invoked. + +\redpoint If the \texttt{nocorrections} option is taken, then the \cs{CorrButton} +does not appear for a quiz. + +\subsubsection{Showing Partial Credit Markup}\label{showcreditmarkup} + +When a quiz is corrected, it is possible to show how much credit was given. + +%\exPDF{pc_test} The demo file for this feature is \texttt{pc\_test.tex}. + +\exAeBBlogPDF{p=881} The demo file for this feature is +\texttt{\href{\urlAcroTeXBlog/?p=881}{pc\_test.pdf}}. + + +%\exPDF{pc_test1} The example file \texttt{pc\_test1.tex} illustrates +%how to have a multiple selection problem and a grouped problem with +%no partial credit. The student must get all parts correct to get +%full credit for that problem, otherwise, no credit is assigned. + +\exAeBBlogPDF{p=884} The example file +\texttt{\href{\urlAcroTeXBlog/?p=884}{pc\_test1.pdf}} illustrates +how to have a multiple selection problem and a grouped problem with +no partial credit. The student must get all parts correct to get +full credit for that problem, otherwise, no credit is assigned. + + +\newtopic Place the command \Com{showCreditMarkup} before a quiz you want the +partial credit markup. The command \Com{hideCreditMarkup} hides this +markup (it switches off the previous \cs{show\-Credit\-Mark\-up}); place +this command before a quiz for which you don't want the markup. The +default is not to show any partial credit markup. + +When a question item introduces a series of question, but poses no question itself, +place \Com{multipartquestion} prior to that item, for example +\begin{Verbatim}[xleftmargin=\amtIndent] +\multipartquestion +\item\PTs{6} Answer each of these questions +\begin{question} + \item\PTs{3} Answer this + \item\PTs{3} Answer that +\end{question} +\end{Verbatim} +Other relevant commands are \cs{aeb@creditmarkup} and +\cs{aeb@creditmarkupfmt}; the first one defines a little text field to +hold the partial-credit data and the second one sets the placement of the +text field. These can be redefined if the default definitions are not to +your liking. The markup in red that appears in the left margin shows the +number of points the student received for that problem, for example +\texttt{\textcolor{red}{3\,pts}}. The string \texttt{pts} (and its singular +counterpart, \texttt{pt}) is language dependent, in English it refers to +``points'' (or ``point''). You can change this string to an abbreviation +of points (point) using the commands commands \Com{ptsLabel} and +\Com{ptLabel}. The default definitions are \verb!\ptsLabel{pts}! and +\verb!\ptLabel{pt}!, respectively. + +\newtopic\textbf{\textcolor{red}{Important:}} Adobe Reader 5.0 or +later is required for this feature. + +\subsection{Quizzes with Solutions} + +In addition to scoring and marking the quizzes, you can also +(optionally) provide solutions as well. To enter a solution to a +multiple choice question, use a \texttt{solution} environment, and +attach a named destination to the \texttt{answers} environment. +A partial verbatim listing follows the next example. + +%\ifeqforpaper\else\NoPeeking\fi + + +\begin{quiz*}{qzTeXl} Answer each of the following. Passing +is 100\%. + +\begin{questions} + +\hfuzz=2pt + +\item Who created \TeX? +\begin{answers}[knuth]{4}% +\Ans1 Knuth &\Ans0 Lamport &\Ans0 Carlisle &\Ans0 Rahtz +\end{answers} +\begin{solution} +Yes, Donald Knuth was the creator of \TeX. +\end{solution} + +\item Who originally wrote \LaTeX? +\begin{answers}[lamport]{4} +\Ans0 Knuth &\Ans1 Lamport &\Ans0 Carlisle &\Ans0 Rahtz +\end{answers} +\begin{solution} +Yes, Leslie Lamport was the creator of \LaTeX. +\end{solution} +\end{questions} +\end{quiz*}\quad\ScoreField\currQuiz\CorrButton\currQuiz + +\AllowPeeking + +After the quiz is completed and the corrections button is pressed, +the corrections appear. The correct answer has a green filled +circle or a green check; this circle is now outlined by a green +rectangle to indicate that this is a link to the solution. Click on +the green dot and jump to the solution! + +Solutions do not have to appear. Some problems can have solutions, +while others do not. The ones with the solutions have the green +boundary to indicate a link to the solution. + +Here is a partial listing of the above example. + +\begin{Verbatim}[xleftmargin=\amtIndent] +\begin{quiz*}{qzTeXl} Answer each of the following. +Passing is 100\%. +\begin{questions} +\item Who created \TeX? +\begin{answers}[knuth]4 +\Ans1 Knuth &\Ans0 Lamport &\Ans0 Carlisle &\Ans0 Rahtz +\end{answers} +\begin{solution} +Yes, Donald Knuth was the creator of \TeX. +\end{solution} +.... +\end{questions} +\end{quiz*}\quad\ScoreField\currQuiz\CorrButton\currQuiz +\end{Verbatim} + +\redpoint Notice that in the \texttt{answers} environment, an +optional parameter \texttt{[knuth]} appears. The value of this +parameter is a unique name for the solution to the quiz. Notice as well that +the \texttt{solution} environment follows, and is not nested +within the \texttt{answers} environment. + + +\subsection{How to Modify the \texttt{quiz} Environment} + +There are four ways the appearance of the quizzes can change: + +\begingroup +\def\mylabel#1{\hfil\hyperref[#1]{\large$\bullet$}\ } +\begin{list}{} +%{\normalfont\bfseries\arabic{questionno}.\ }% +{\usecounter{questionno}\setlength{\parsep}{0pt}\setlength{\topsep}{0pt} +\renewcommand{\makelabel}{\mylabel} +\settowidth{\labelwidth}{\normalfont\bfseries00.\ }% +\setlength{\itemindent}{0pt}\setlength{\labelsep}{0pt}}% +\item[sss:quiztitles] change the titles +\item[sss:ckappear] change the `check' appearance +\item[sss:scorefield] change the text field in which the score appears, +\item[sss:CorrButton] change the appearance of the `Correction' button. +\end{list} +\par\endgroup + +\noindent This section discusses each of these four in turn. + +\subsubsection{The Quiz Titles}\label{sss:quiztitles} + +It is possible to redefine the quiz titles and other labels if +desired. + +\redpoint Locally: +\begin{Verbatim}[xleftmargin=\amtIndent] +\renewcommand\bqlabel{Begin Exam} +\renewcommand\eqlabel{End Exam} +\end{Verbatim} + +\redpoint Globally: +\begin{Verbatim}[xleftmargin=\amtIndent] +\makeatletter +\renewcommand\eq@bqlabel{Begin Exam} +\renewcommand\eq@eqlabel{End Exam} +\makeatother +\end{Verbatim} + +\subsubsection{The check appearance}\label{sss:ckappear} + +The appearance of the `check' can be chosen using the +\cs{symbolchoice} macro of the \textsf{exerquiz} package. The +permissible values for the argument of \cs{symbolchoice} are +\texttt{check} (the default), \texttt{circle}, \texttt{cross}, +\texttt{diamond}, \texttt{square}, and \texttt{star}. + +This quiz was generated by inserting +\verb+\symbolchoice{diamond}+ before the quiz. The multiple choice field +is actually a radio button field. The appearance of these radio buttons can +be modified using the command \cs{everyqRadioButton}. + +\begin{Verbatim}[xleftmargin=\amtIndent] +\symbolchoice{diamond} +\everyqRadioButton{\textColor{0 0 1} + \BC{.690 .769 .871}\BG{.941 1 .941}} +\end{Verbatim} + +\symbolchoice{diamond} +\everyqRadioButton{\symbolchoice{diamond}\textColor{0 0 1}\BC{.690 .769 .871}\BG{.941 1 .941}} + + +\begin{quiz*}{qzTeX} 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\ScoreField{qzTeX}\CorrButton{qzTeX} + +\noindent If desired, we can return to the defaults: +\begin{Verbatim}[xleftmargin=\amtIndent] +\symbolchoice{check} % restore the default +\everyqRadioButton{} +\end{Verbatim} + +\symbolchoice{check} % restore the default +\everyqRadioButton{} + +\redpoint The \cs{symbolchoice} can also be introduced into the flow of the code through +the \cs{every\-qRadio\-Button}: +\begin{Verbatim}[xleftmargin=\amtIndent] +\everyqRadioButton{\symbolchoice{diamond}\textColor{0 0 1} + \BC{.690 .769 .871}\BG{.941 1 .941}} +\end{Verbatim} +\noindent After the quiz, we could return to the defaults by +\begin{Verbatim}[xleftmargin=\amtIndent] +\everyqRadioButton{} +\end{Verbatim} + +\redpoint See the document \texttt{\href{eformman.pdf}{eformman.pdf}} for complete +documentation on how to modify a field using the optional first argument, and +how to use the ``every'' command.\footnote{eforms manual on Web: +\url{\bUrl/eformman.pdf}}\xdef\fnEFormi{\thefootnote} + +\subsubsection{Change color of Correction Marks} + +The colors used to mark the quiz can be changed by redefining the +commands \cs{check\-Color}, \cs{crossColor} and \cs{correctColor} in +the \textit{preamble} or before. Below are the +defaults: +\begin{Verbatim}[xleftmargin=\amtIndent] +\renewcommand\checkColor{["RGB", 0, .6, 0]} +\renewcommand\crossColor{color.red} +\renewcommand\correctColor{["RGB", 0, .6, 0]} % webgreen +\end{Verbatim} +\noindent The colors are inserted into the field using JavaScript, so the color definitions +are in the color space of the JavaScript object model. + + +\subsubsection{The `Correction' Button}\label{sss:CorrButton} + +The `Correction' button is defined by the \cs{CorrButton} has two +parameters. +\begin{Verbatim}[xleftmargin=\amtIndent] +\CorrButton[mod_appear]{field_name} +\end{Verbatim} +The second parameter is the field name that contains the total score for the +quiz (see the above examples). It also has one optional argument that can be +used to modify the appearance of the button. + +Also defined is the \cs{eqButton} command, which performs the same function as +\cs{CorrButton}; use of \cs{eqButton} is discouraged in favor of \cs{CorrButton}. + +In addition to the optional parameter to modify the appearance of +\cs{CorrButton}, there is also a ``global'' mechanism for modifying the +appearance of the button field. These are + +\paragraph*{Global Modification:} \cs{everyButtonField} and \cs{everyCorrButton} + +\newtopic The first one modifies the appearance of every quiz button field, the second can be used +to modify all \cs{CorrButton}s. + +\redpoint See the document \texttt{\href{eformman.pdf}{eformman.pdf}} for complete +documentation on how to modify a field using the optional first argument, and +how to use the ``every'' command.${}^{\text{\fnEFormi}}$\def\fnEFormi{\thefootnote} + + + +% \begin{table}[hbt] +% \setlength{\extrarowheight}{1mm} +% \setlength{\tabcolsep}{2mm} +% \begin{center} +% \makeatletter +% \begin{tabular}{|l|l|l|l|} +% \hline +% \multicolumn1{|l|}{Local} & +% \multicolumn1{l|}{Global} & +% \multicolumn1{l|}{Default} & +% \multicolumn1{l|}{Description}\\ +% \hline +% \cs{BC} &\cs{eq@BC} & 1 0 0 & border color\\ +% \cs{BG} &\cs{eq@BG} & .7529 .7529 .7529 & face color\\ +% \cs{CA} &\cs{eq@CA} & Correct & button text\\ +% \cs{RC} &\cs{eq@RC} & My Answers! & rollover\\ +% \cs{AC} &\cs{eq@AC} & Please! & pushed text \\ +% \cs{DA} &\cs{eq@DA} & /Helv 10 Tf 0 g & text format\\ +% \cs{BS} &\cs{eq@BS} & /W 1 /S /B & button spec\\ +% \hline +% \end{tabular} +% \caption{\protect\cs{CorrButton} Parameters}\label{table:CorrButton} +% \end{center} +% \vspace{-\baselineskip} +% \end{table} +% +% +% The macros listed in the first column of \autoref{table:CorrButton} +% are permitted in the optional parameter field of +% \cs{CorrButton}---there is not parameter checking, \TeX\ or +% Distiller/Reader will find the errors. +% +% The meaning of these values is beyond the scope of this manual. +% Refer to the internet article ``Pdfmarks: Links and Forms'', +% \cite{article:Story:Pdfmarks}, for details; in particular, see the +% ``Forms'' article. + +\subsubsection{The Score Field}\label{sss:scorefield} + +The score field is the text field to which the quiz (and its +underlying JavaScript) reports the score. This field can be +constructed using the \cs{ScoreField} macro +\begin{Verbatim}[xleftmargin=\amtIndent] +\ScoreField[mod_appear]{field_name} +\end{Verbatim} +\noindent In the simplest case, \cs{ScoreField} takes one argument, as above, +the \texttt{field\_name} of the associated quiz. The expansion of \cs{ScoreField} +produces a \texttt{read-only} text field that is 1.5 inches in +width with a red border. The initial text that appears in the +field is the expansion of the macro \cs{eqScore}. The expansion of +\cs{eqScore} depends on the language option: \cs{eqScore} expands +to `Score:' by default, to `Punkte:' for the \texttt{german} +option and to `Score :' for the \texttt{french} option. + +The macro \cs{ScoreField} also has an optional parameter that can +be used to modify the appearance of the text field. Should the +document author want to change the basic look of the text field produced +by \cs{ScoreField}, just introduce the changes through this +optional parameter. + +In addition to the optional parameter for modifying the appearance of +the text field, \cs{Score\-Field}, there is also a ``global'' mechanism for +modifying the appearance of the button field. These are + +\newtopic\textbf{Global Modification:} \cs{everyeqTextField} and \cs{everyScoreField} + +\newtopic The first one modifies the appearance of every quiz text field, the second can be used +to modify all \cs{ScoreField}s. + +\redpoint See the document \texttt{\href{eformman.pdf}{eformman.pdf}} for complete +documentation on how to modify a field using the optional first argument, and +how to use the ``every'' command.${}^{\text{\fnEFormi}}$\def\fnEFormi{\thefootnote} + + +\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[\BC{0 0 1}]{qzTeXc}% + \CorrButton[\BC{0 0 1}% blue border color + \CA{TeX}% Button text + \RC{Users}% rollover text + \AC{Group}% pushed text + \textFont{TiRo}% text font: Times Roman + \textSize{10}% text size: 10 point + \textColor{0 0 1}% times roman, 10 pt, blue text + \W{1}\S{I}% border width 1, inset button + ]{qzTeXc} + +\noindent The new part is the customized scoring and correction button. Here +is a verbatim listing of the \cs{ScoreField} and \cs{CorrButton} +macros. +\begin{Verbatim}[xleftmargin=\amtIndent] +\ScoreField[\BC{0 0 1}]{qz:TeXc}% + \CorrButton[\BC{0 0 1} % blue border color + \CA{TeX} % Button text + \RC{Users} % rollover text + \AC{Group} % pushed text + \textFont{TiRo} % text font: Times Roman + \textSize{10} % text size: 10 point + \textColor{0 0 1} % blue text + \W{1}\S{I} % border width 1, inset button + ]{qz:TeXc} +\end{Verbatim} + +%\exPDF{webeqtst} This example---as well as others---appears in +%\texttt{\href{\bUrl/webeq_ex.html\#webeqtst}{webeqtst.tex}}, a +%test file that accompanies the \cAcroB. + +\exAeBBlogPDF{p=803} This example---as well as others---appears in +\texttt{\href{\urlAcroTeXBlog/?p=803}{webeqtst.pdf}}, a demo file from the +{\AcroBlog} + + + +\subsection{\texorpdfstring{\protect\cs{titleQuiz}}{\CMD{titleQuiz}} + and \texorpdfstring{\protect\cs{fancyQuizHeaders}}{\CMD{fancyQuizHeaders}}}\label{titleQuiz} + +%\exPDF{title_quiz} The demo file for these features is \texttt{title\_quiz.tex}. + +\exAeBBlogPDF{p=908} The demo file for these features is +\texttt{\href{\urlAcroTeXBlog/?p=908}{title\_quiz.pdf}}. + + +\subsubsection{\texorpdfstring{\protect\cs{titleQuiz}}{\CMD{titleQuiz}}} + +To assign a title to your quiz use \Com{titleQuiz}. This title appears just after +the `Begin Quiz' button + +\fancyQuizHeaders +\titleQuiz{Two Question MC} +\begin{quiz}{MyMCQuiz}\label{MyMCQuiz} +Answer each of these to the best of your ability. +\begin{questions} +\item Math is fun. +\begin{answers}*{4} +\Ans1 True & \Ans0 False\\ +\end{answers} +\begin{solution} + The answer is true, of course, math is fun! +\end{solution} + +\item Statistics is fun. +\begin{answers}*{4} +\Ans0 True & \Ans1 False\\ +\end{answers} +\begin{solution} + The answer is false, statistics is interesting but not fun. +\end{solution} +\end{questions} +\end{quiz}\quad\ScoreField\currQuiz\CorrButton\currQuiz + +\noindent The partial verbatim code for the above quiz follows: + +\begin{Verbatim}[xleftmargin=\amtIndent] +\titleQuiz{Two Question MC} +\begin{quiz}{MyMCQuiz}\label{MyMCQuiz} +Answer each of these to the best of your ability. +\begin{questions} +... +\end{questions} +\end{quiz}\quad\ScoreField\currQuiz\CorrButton\currQuiz +\end{Verbatim} + +\restoreDefaultQuizHeaders + +\noindent The format of the title is controlled by the command \Com{titleQuizfmt}, +the default definition is \verb!\newcommand\titleQuizfmt{\bfseries}!. The value +of the \cs{titleQuiz} command can act as an argument for \cs{titleQuizfmt} if you redefine +\cs{titleQuizfmt} to have an argument. For example, +\begin{Verbatim}[xleftmargin=\amtIndent] +\renewcommand\titleQuizfmt[1]{\bfseries(#1)} +\end{Verbatim} +Now, the title will appear in a set of parentheses. The title and formatting are enclosed +in a \cs{mbox}, so font and style changes are localized to that \cs{mbox}. + +\newtopic If a quiz does not have a title, as defined by \cs{titleQuiz}, the title defaults to +an empty title. + +\newtopic The definition of \cs{titleQuiz} is such that the command \cs{makeatletter} is executed +before the argument for \cs{titleQuiz} is read. This means that the special character +`\texttt{@}' can be used within the argument of \cs{titleQuiz}. For example, the \texttt{quiz} +environment maintains a text macro \cs{\@quizCnt} which contains the current quiz +count number. Thus you can say \verb!\titleQuiz{Quiz \@quizCnt}!, the title of +the quiz will include a short quiz number as well. + + +\newtopic The \cs{titleQuiz} is used for short quizzes as well as +with quizzes. It is possible to have different formatting for each +of these two environments by using the \Com{ifQuizType} command. The +command takes two arguments: +\begin{Verbatim}[xleftmargin=\amtIndent,commandchars=!()] +\ifQuizType{!anglemeta(quiz_code)}{!anglemeta(shortquiz_code)} +\end{Verbatim} +For example, we could define \cs{titleQuizfmt} as follows: +\begin{Verbatim}[xleftmargin=\amtIndent] +\renewcommand\titleQuizfmt{\ifQuizType{\bfseries}{\slshape}} +\end{Verbatim} +or with an argument, as mentioned above, you could define \cs{titleQuizfmt} with an argument, +like so, +\begin{Verbatim}[xleftmargin=\amtIndent] +\renewcommand{\titleQuizfmt}[1]{% + \ifQuizType{\bfseries(#1)}{\slshape[#1]}} +\end{Verbatim} + +\subsubsection{Cross-Referencing} + +Quizzes and short-quizzes conform to the cross-referencing system +of {\LaTeX}. For example, we used the label \verb!\label{MyMCQuiz}! in the last quiz, the one +on page~\pageref{MyMCQuiz}. The title of the quiz is \nameref{MyMCQuiz}. The code for the past +two sentences is +\begin{Verbatim}[xleftmargin=\amtIndent] +For example, we used the label \verb!\label{MyMCQuiz}! in the +last quiz, the one on page~\pageref{MyMCQuiz}. The title of the +quiz is \nameref{MyMCQuiz}. +\end{Verbatim} +\noindent If the quiz does not have a title, as defined by the \cs{titleQuiz} command, a generic label of +`Quiz' is generated. The default label name is +\begin{Verbatim}[xleftmargin=\amtIndent] +\newcommand\eq@defaultQuizLableName{Quiz} +\end{Verbatim} +\noindent This definition can be change using \cs{renewcommand}. + +\subsubsection{\texorpdfstring{\protect\cs{fancyQuizHeaders}}{\CMD{fancyQuizHeaders}}}\label{fancyQuizHeadersQ} + +The \Com{fancyQuizHeaders} command, a companion feature to \Com{titleQuiz}, enhances +the labeling of the quiz in the solutions section of the document. If +\cs{fancyQuizHeaders} is executed in the preamble, or prior to a quiz, the solution header has the +following default format: + +\begin{quote} +\newtopic{\color{blue}Two Question MC: Question 1.} The answer is true, of course, math is fun! +\end{quote} + + +\newtopic The above assumes the title of the quiz is the one given in the previous section. + +\newtopic When a quiz has no title, the header reverts to +\textcolor{blue}{Solution to Quiz:} followed by the question number. + +\redpoint You can turn off fancy quiz headers by using +\Com{restoreDefaultQuizHeaders}. + +\newtopic You can modify the fancy headers with a combination of setting \Com{setsolnspace} +and/or redefining the command \Com{eq@fancyQuizHeadersfmt}. First +\cs{setsolnspace}: This is a hook into the space immediately +following the header. To insert a \cs{medskip} after the header, for example, you +can say \verb!\setsolnspace{\par\medskip\noindent}! a +\cs{medskip} is created after the solution header and the solution +above appears as + +\begin{quote} +\newtopic{\color{blue}Two Question MC: Question 1.}\par\medskip\noindent The answer is true, of course, math is fun! +\end{quote} + + +\newtopic The definition of \cs{eq@fancyQuizHeadersfmt} is +\begin{Verbatim}[xleftmargin=\amtIndent,fontsize=\small] +\def\eq@fancyQuizHeadersfmt{{\protect\color{blue}\protect + \textbf{\ifx\aebTitleQuiz\@empty\ifnum\@eqquestiondepth>0 + Solution to Quiz:\fi\else + \aebTitleQuiz:\protect\ + \ifnum\@eqquestiondepth=0\else + Question\fi + \fi\space + \ifcase\@eqquestiondepth + \ifx\aebTitleQuiz\@empty Solution to Quiz:\fi\or + \arabic{eqquestionnoi}.\or + \arabic{eqquestionnoi}(\alph{eqquestionnoii})\or + \arabic{eqquestionnoi}(\alph{eqquestionnoii})% + (\roman{eqquestionnoiii})% + \fi}}% +} +\end{Verbatim} +Ugly isn't it. We need to set the header in all cases: with or without a title; +multiple questions within a \texttt{questions} environment, or a single question +with no \texttt{questions} environment. + +\newtopic A simple re-definition might be +\begin{Verbatim}[xleftmargin=\amtIndent,fontsize=\small] +\def\eq@fancyQuizHeadersfmt{{\protect\color{blue}\protect + \textbf{\ifx\aebTitleQuiz\@empty + \ifnum\@eqquestiondepth>0 + Solution to Quiz\fi\else + \aebTitleQuiz\protect\ + \ifnum\@eqquestiondepth=0\else\\Question% + \fi\fi\space + \ifcase\@eqquestiondepth + \ifx\aebTitleQuiz\@empty Solution to Quiz\fi + \or\arabic{eqquestionnoi}.\or + \arabic{eqquestionnoi}(\alph{eqquestionnoii})\or + \arabic{eqquestionnoi}(\alph{eqquestionnoii})% + (\roman{eqquestionnoiii})% + \fi}}% +} +\end{Verbatim} + +\noindent The colons (\texttt{:}) are removed and a \verb!\\! inserted in the fourth +line; that line now reads, in part, \verb!\else\\Question\fi!, instead of +\verb!\else Question\fi!. + +\newtopic The results of these changes, in combination with the earlier +change of +\begin{Verbatim}[xleftmargin=\amtIndent] +\setsolnspace{\par\medskip\noindent} +\end{Verbatim} +\noindent are + +\begin{quote} +\newtopic{\color{blue}Two Question MC\\Question 1.}\par\medskip\noindent The answer is true, of course, math is fun! +\end{quote} + +\newtopic Other (minor) changes such as color, style, font can be done in this way. + +\newtopic As a reminder, you can use the web package's switch, \Com{ifeqforpaper} to further +refine these headers. You can have one style of solution headers for paper, and another +style for the screen. + +\subsection{Adding Points to a Quiz}\label{sss:asignPts} + +%The discussion of this topic can be found in \Nameref{sss:asignPts}. + +%\subsubsection{Assigning Points}\label{sss:asignPts} + +The questions on a quiz, especially a quiz meant for credit, may +not have the same weight. A point scheme, therefore, has been +created; several additional text fields in support have also been +defined. + +Here is a simple two question example to illustrate: + +\begin{quiz*}{mathquiz} Answer each of the following. Passing +is 100\%.\hfill\smash{\GradeField[\rectH{30bp}\rectW{30bp}\textSize{0}]\currQuiz} + +\begin{questions} + +\PTsHook{($\eqPTs^{\text{pts}}$)} + +\item\PTs{4} If $\lim_{x\to a} f(x) = f(a)$, then we say that $f$ is\dots +\begin{answers}{4} +\Ans0 differentiable &\Ans1 continuous &\Ans0 integrable +\end{answers} + +\item\PTs{6} Name \emph{one} of the two people recognized as a founder of +Calculus.\\[1ex] +\RespBoxTxt{0}{0}{4}{Isaac Newton}{Newton}{Gottfried Leibniz}{Leibniz}% +\CorrAnsButton{Isaac Newton or Gottfried Leibniz} + +\end{questions} +\end{quiz*}\quad\ScoreField\currQuiz\CorrButton\currQuiz + +\noindent +Answers: \AnswerField\currQuiz + +\medskip\noindent +Points: \PointsField\currQuiz\ Percent: \PercentField\currQuiz + +%\exPDF{quizpts} See the sample file +%\href{\bUrl/webeq_ex.html\#quizpts}{quizpts.tex} for a more +%elaborate version of this question, as well as the source code. + +\exAeBBlogPDF{p=1054} See source file for the PDF +\texttt{\href{\urlAcroTeXBlog/?p=1054}{quizpts.pdf}} for a more elaborate +version of this question, as well as the source code. + + +\begin{questions} +\item \verb+\PTs#1+: This macro takes one argument, the number of +points to be assigned to the current problem. Place this command +immediately after the \cs{item} in the \textsf{questions} environment. +For example, in the above quiz we had +\begin{Verbatim}[xleftmargin=\amtIndent] +\item\PTs{6} Name \emph{one} of the two people recognized + as a founder of Calculus. +\end{Verbatim} +\item \verb+\PTsHook#1+: This macro, which takes one argument, can +be used to typeset the points assigned. and is called by +\cs{PTs}. The argument is what is to be typeset. The value +assigned the current problem by \cs{PTs} is contained within the +macro \cs{eqPTs}. In the quiz above, we had +\begin{Verbatim}[xleftmargin=\amtIndent] +\PTsHook{($\eqPTs^{\text{pts}}$)} +\end{Verbatim} + +\item There are three other commands that create text fields to +display results from a quiz with points assigned: +\begin{itemize} + \item \verb+\PointsField[#1]#2+: The number of points earned for the quiz, the + total points are also reported. The parameter \texttt{\#2} is the base name + of the quiz. + \item \verb+\PercentField[#1]#2+: The percentage score for the + quiz. The parameter \texttt{\#1} is the base name of the quiz. + \item \verb+\GradeField[#1]#2+: The letter grade of the + performance on the quiz. The parameter \texttt{\#2} is the + base name of the quiz. The values placed in this field are determined + by the macro \cs{eqGradeScale}. +\end{itemize} +\item \cs{eqGradeScale}: This macro sets the grade scale of a quiz, the default +definition is +\begin{Verbatim}[xleftmargin=\amtIndent] +\newcommand\eqGradeScale{"A",[90, 100],"B",[80,90], + "C",[70,80],"D",[60,70],"F",[0,60]} +\end{Verbatim} +\noindent The ways things are defined now, there can be only one grade scale +per document. The value of \cs{eqGradeScale} is a matrix with an +even number of elements. The odd numbered elements are the grades; +the even number elements are intervals of percentages (percentages +of the total number of points on the quiz). If the percentage of +the score falls into a particular range, the corresponding grade +is assigned. + +\item[] Note, obviously, you can redefine this command. The +letter grades do not actually have to be grades, they can be little +messages to the student upon completion of the quiz. + +\begin{Verbatim}[xleftmargin=\amtIndent] +\renewcommand\eqGradeScale{% + "Excellent Work.",[90, 100], + "Solid Effort.",[80,90], + "Fair.",[70,80], + "Needs improvement, better work expected.",[60,70], + "Learning still in progress.",[0,60] +} +\end{Verbatim} +\end{questions} + +\subsubsection{\texorpdfstring{\protect\cs{negPointsAllowed}}{\CMD{negPointsAllowed}}}\label{negPtsAllowed} + +The \texttt{answers} and \texttt{manswers} environments allow for partial credit, +and even assigning of negative points for wrong answers (see \Nameref{manswersQuiz}); +consequently, it is possible for a student taking a quiz to get a +negative points for the quiz. By default \textsf{exerquiz} reports a point score of zero +to \cs{PointsField} if the points are negative. + +If you want exerquiz to report the true point score, use the command +\cs{neg\-Points\-Allowed} in the preamble. This will allow the reporting +of a negative point total. + +%\exPDF{manswers} See the example file for this feature \texttt{manswers.tex}. +%Compare the results of when the default behavior is used, versus +%the results when \cs{negPointsAllowed} is used in the preamble. + +\exAeBBlogPDF{p=903} See the source file for the PDF \texttt{\href{\urlAcroTeXBlog/?p=903}{manswers.pdf}}. +Compare the results of when the default behavior is used, versus +the results when \cs{negPointsAllowed} is used in the preamble. + +\subsection{Floating a Quiz}\label{floatQuiz} + +The quiz structure is to have a `Begin Quiz' button or link at the +beginning of the quiz and an `End Quiz' button or link at the end. +In some settings, you might want to place the `Begin Quiz' button on +another page, with, perhaps, some instructions. For this purpose +\textsf{exerquiz} defines five commands \Com{DeclareQuiz}, +\Com{floatQuiz}, \Com{startQuizHere}, \Com{endQuizHere} and +\Com{dockQuiz}. + +The \cs{DeclareQuiz} command takes one argument, which is the name +of the quiz, for example \verb!\DeclareQuiz{myQuiz}!. This command +takes it argument and creates a text macro \cs{currQuiz}, which +expands to the quiz name. \cs{currQuiz} can then be used in the +\texttt{quiz} environment command argument for the quiz name. This +makes it easy to change the names without having to search through +and make all changes. + +The command \cs{floatQuiz} declares the current quiz, as set by the +\cs{DeclareQuiz} command, is floating, which means the `Begin Quiz' and +`End Quiz' link-text or buttons are separated from their usual placement +and are allowed to ``float.'' The third command \cs{startQuizHere} +inserts the `Begin Quiz' link text or form button, while the +\cs{endQuizHere} command inserts the `End Quiz' link or form button. + +\newtopic For example, + +\DeclareQuiz{myQuiz} +\useBeginQuizButton[\CA{Start}\RC{the}\AC{Quiz}\BC{}\W0] +\useEndQuizButton[\CA{End}\RC{the}\AC{Quiz}\BC{}\W0] +\floatQuiz + +\begin{flushleft} +\fcolorbox{blue}{webyellow}{\begin{minipage}{.67\linewidth} +Solve each of the following problems. To begin the quiz, +click on the \startQuizHere\space button. +\end{minipage}} +\end{flushleft} + +\begin{quiz}{\currQuiz} +Answer these questions truthfully. +\begin{questions} + \item Do you understanding the concept of \cs{floatQuiz}? + \begin{answers}{4} + \Ans1 Yes & \Ans0 No + \end{answers} + \item Do you understanding the concept of \cs{dockQuiz}? + \begin{answers}*{4} + \Ans0 Yes & \Ans1 No + \begin{solution} + You can't understand it until I explain it! + \end{solution} + \end{answers} +\end{questions} +\end{quiz}\ScoreField\currQuiz\CorrButton\currQuiz + +\begin{flushleft} +\fcolorbox{blue}{webyellow}{\begin{minipage}{.67\linewidth} +After you have finished the quiz, click on the +\endQuizHere\space button. Click the\ \smash[b]{\CorrButton[\CA{Correct}\RC{the}\AC{Quiz}\S{S}\BC{}\W0]\currQuiz}\ button +if you +wish and your quiz will be marked. Click on the choice with +the green border to jump to the solution. +\end{minipage}} +\end{flushleft} +\dockQuiz + +\newtopic To return to the default behavior of the quiz environment +place \cs{dockQuiz} following the quiz. Quizzes that come +after the \cs{dockQuiz} will then have the standard quiz format. + +%\exPDF{floatquiz} See the example file \texttt{floatquiz.tex} for the {\LaTeX} code of the above example. + +\exAeBBlogPDF{p=897} See the source file for the PDF +\texttt{\href{\urlAcroTeXBlog/?p=897}{floatquiz.pdf}} for the {\LaTeX} code +of the above example. + + +\section{Objective Style Questions}\label{s:oQ} + +Beginning with version~2.0 of \textsf{exerquiz}, objective style +questions can be posed. Single questions can be posed in the +\texttt{\hyperref[ss:oquestion]{oQuestion}} environment, +multiple questions can be placed in either the \texttt{shortquiz} +or the \texttt{quiz} environments. This section discusses this +type of question and all of its supporting commands. + + +\subsection{Math and Text Questions} + +\textsf{Exerquiz} distinguishes between two types of open ended or objective +questions: +\begin{questions} +\item A mathematical question that requires a mathematical expression +as the answer. +\item A question that requires a text answer. +\end{questions} + +\redpoint The demo file \texttt{jquiztst.tex} is an important +source of examples and instruction for the mathematical type +question; additionally, the file \texttt{jtxttst.tex} has many +examples for the text type question. + + +\subsubsection{The Mathematical Question} + +At this stage in the development of \textsf{exerquiz}, a +(mathematical) question can be posed that requires an answer that +is a function of one or more declared variables $x$, $y$, $z$, etc. +Thus, when the declared variables $x$, $y$, $z$ are given a value, +the answer is reduced to a number. +%\begin{questions} +%\item A question that has a numerical value. +%\item 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. +%\end{questions} +%Thus, only questions whose answers can be reduced to numerical +%values can be posed. + +For example, the answer to the question ``Differentiate $\frac +d{dx} \sin^2(x)$'', is a function in one variable $x$, it can be +evaluated numerically and can, therefore, be posed: + +\begin{oQuestion}{ex1} +\redpoint Differentiate $\dfrac d{dx} \sin^2(x) = +$\space\RespBoxMath{2*sin(x)*cos(x)}{4}{.0001}{0}{1} +\end{oQuestion} + +\smallskip +See \Nameref{ss:respbox} for details. + +In contrast, consider the question: ``Name the probability +distribution popularly referred to as the `bell-shaped curve' ''. +The answer to this question cannot be reduced to a numerical +value. This question can be posed as an \hyperref[sss:oTxtQ]{text +objective question}, or, it does lend itself to a multiple choice +question, however. + +\subsubsection{The Text Question}\label{sss:oTxtQ} + +You can also pose questions that require a text answer: + +\redpoint\begin{oQuestion}{exTxt2} +Name the probability +distribution popularly referred to as the ``bell-shaped curve''.\\ +\RespBoxTxt{0}{0}{4}{Normal}{Normal Distribution}{Gaussian}{Gaussian Distribution} +\end{oQuestion} + +See \Nameref{ss:respboxtxt} for details. + +\subsection{The \texttt{oQuestion} Environment}\label{ss:oquestion} + +The \texttt{oQuestion} environment is a very simple environment +for posing a \textit{single} question and will be used in this +section to discuss in detail the macros for posing mathematical +and text open questions. + +The syntax for the \texttt{oQuestion} environment is +\begin{Verbatim}[xleftmargin=\amtIndent,commandchars=!()] +\begin{oQuestion}{!ameta(field_name)} + !ameta(A math or text open ended question.) +\end{oQuestion} +\end{Verbatim} +\noindent The environment takes one required argument, a unique name for the question. +This name, \texttt{field\_name}, is used by other supporting +macros. + +\subsubsection{\texorpdfstring{\protect\cs{RespBoxMath}} +{\textbackslash RespBoxMath}: The Math Question}\label{ss:respbox} + +%\subsubsection{\texorpdfstring{\protect\cs{RespBox}, +%\protect\cs{Resp\-BoxNT}}{\textbackslash RespBox, \textbackslash +%RespBoxNT}} + +The \cs{RespBoxMath} command is used for posing an objective +question. This command must appear in the \texttt{oQuestion}, +\texttt{short\-quiz} or \texttt{quiz} environments. In this +section we discuss only the \texttt{oQuestion} environment. + +The following is a \hypertarget{minExample}{minimal example}. +Additional enhancements will be discussed in subsequent sections. + +\begin{oQuestion}{sine1} +\redpoint Differentiate $\dfrac d{dx} \sin^2(x) = +\RespBoxMath{2*sin(x)*cos(x)}{4}{.0001}{[0,1]}$ +\end{oQuestion} +\par\medskip\noindent +The code for the above example is +\begin{Verbatim}[xleftmargin=\amtIndent] +\begin{oQuestion}{sine1} +\redpoint Differentiate $\dfrac d{dx} \sin^2(x) = +\RespBoxMath{2*sin(x)*cos(x)}{4}{.0001}{[0,1]}$ +\end{oQuestion} +\end{Verbatim} +\noindent The \cs{RespBoxMath} need not appear in math mode. The definition +of the \cs{redpoint} command, a command written for this document follows. +\begin{Verbatim}[xleftmargin=\amtIndent] +\newcommand\redpoint{\par\removelastskip\vskip\medskipamount + \noindent\makebox[\parindent][l]{\large + \color{red}$\blacktriangleright$}} +\end{Verbatim} + +\newtopic You can also pose multivariate questions as well, for example + +\begin{oQuestion}{multivariate} +\redpoint $\dfrac{\partial}{\partial y} {4 x^2 y^3 } + = \RespBoxMath{12*x^2*y^2}(xy){4}{.0001}{[0,1]x[0,1]}$ +\end{oQuestion} +\par\medskip\noindent +The code for the above example is +\begin{Verbatim}[xleftmargin=\amtIndent] +\begin{oQuestion}{multivariate} +\redpoint $\dfrac{\partial}{\partial y} {4 x^2 y^3 } + = \RespBoxMath{12*x^2*y^2}(xy){4}{.0001}{[0,1]x[0,1]}$ +\end{oQuestion} +\end{Verbatim} +\noindent See the file \texttt{multivar.tex} for more examples +quizzes involving multivariate problems. + +The algorithm used for determining the correctness of the answer +entered by the user is very simple: The user's answer and the +correct answer are evaluated at randomly selected points in an +interval, then compared. If any of the comparisons differ by more +than a pre-selected amount, an $\epsilon$ value, if you will, the +user's answer is declared incorrect; otherwise, it is considered +correct.\footnote{The idea for evaluating user input in this way +comes from Drs.\ Wlodzimierz Bryc and Stephan Pelikan of The +University of Cincinnati.} + +\newtopic The command \cs{RespBoxMath} takes ten parameters, +five optional and five required:%\hypertarget{respboxargs}{} +\begin{dCmd}{.67\linewidth} +\RespBoxMath[#1]#2(#3)[#4]#5#6#7#8[#9]*#10 +\end{dCmd} +\paragraph*{Parameters:}\label{paraRespBox} +\begin{description} +\item[\ttfamily\#1 :] Optional parameter used to modify the appearance of the + text field. See the section entitled \nameref{sss:CorrButton} for examples, and \textsf{exerquiz.dtx} + for a listing of all controlling macros. +\item[\ttfamily\#2 :] The correct answer to the question. + This must be a numerical value, or a function of one or more variable(s). + +\item[\ttfamily\hypertarget{paraRespBoxThree}{\#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)}. + +Beginning with version 5.5 of \textsf{exerquiz}, 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. +When a type is not specified explicitly, \texttt{"r"} is assumed. +The variables must be either of the old style (no commas, no +typing) or the new style. Do not mix the styles. + +See the \hyperlink{exofT}{example} in \Nameref{enhancements} +of the section below and see the demo file \texttt{integer\_test.tex} to +demonstrate the new method for specifying variables, found in the +\texttt{dljslib\_examples} folder. + +\textbf{Multi-letter variables.} Beginning with v8.0 (2017/08/08) support for +multi-letter variables and appearance replacement is added. Within the +\texttt{\#3}, use the following notation: +\begin{Verbatim}[xleftmargin=\amtIndent] +(x\rpl{alpha}{y}z) +\end{Verbatim} +This declares three variables, \texttt{x}, \texttt{alpha}, and \texttt{z}. +What in fact is taking place is that \texttt{alpha} is replaced by \texttt{y} +and processing continues from there. + +\textbf{Alternate appearances.} Additionally, there is now a scheme for +replacing the variables with alternate appearances. +\begin{Verbatim}[xleftmargin=\amtIndent] +(x\rpl{alpha->\\u03B1}{y}z) +\end{Verbatim} +The arrow notation (\texttt{->}) tells \pkg{exerquiz} to replace +\texttt{alpha} with the unicode character \verb~\u03B1~ (note the double +backslash above), which is the Greek letter alpha ($\alpha$). You can +separate the variables with commas and use the type specification as well. +But as noted above, use either the old style (no commas) or the new style +(with commas), \emph{never mix the two together in one argument.} + +Below is a simple example of multi-letter variables with appearance replacement. Enter +\texttt{alpha} for $\alpha$ and \texttt{theta} for $\theta$. +\begin{oQuestion}{oQ2} +\begin{equation*} + \dfrac{\partial}{\partial\theta}\alpha \sin(\theta)= + \RespBoxMath[\rectW{1.5in}]{alpha cos(theta)}(\rpl{alpha->\\u03B1}{x}\rpl{theta->\\u03B8}{y}) + {3}{0.0001}{[0,3.14]x[0,3.14]} +\end{equation*} +\end{oQuestion} +The verbatim listing for this question follows: +\begin{Verbatim}[xleftmargin=\amtIndent,fontsize=\small] +\begin{oQuestion}{oQ2} +\begin{equation*} + \dfrac{\partial}{\partial\theta}\alpha \sin(\theta)= + \RespBoxMath[\rectW{1.5in}] + {alpha cos(theta)} + (\rpl{alpha->\\u03B1}{x}\rpl{theta->\\u03B8}{y}) + {3}{0.0001}{[0,3.14]*2} +\end{equation*} +\end{oQuestion} +\end{Verbatim} + +\exAeBBlogPDF{p=1330} See the file +\texttt{\href{\urlAcroTeXBlog/?p=1330}{ml-vars.pdf}} for a demonstration of +multi-letter variables and alternate appearances. + + +\item[\ttfamily\#4 :] Optional, a named destination to the solution to the + question. There are two forms: the \texttt{[mydest]} an explicit + destination for the solution to the problem, or a `\texttt*', in which + case, the name is \texttt{[\string\curr@quiz.\string\thequestionno]} is + automatically assigned. + +If this parameter appears, a solution must follow the +question, enclosed in a \texttt{solution} environment. + + +\item[\ttfamily\#5 :] The number of samples points to be used, usually 3 or 4 is +sufficient. +\item[\ttfamily\#6 :] Precision required, a \emph{non-negative} + ``$\epsilon$'' value, if you will. If the precision is set to zero, + \texttt{reldiffCompare} is used as the default compare, and the precision + is set to a small positive value, \text{1E-14}, by default. The small + value is may reset with \cs{defaultRDPrecision}. The default definition, + \verb!\defaultRDPrecision{1E-14}!. + +\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 `\texttt{x}', + \texttt{[0,2]x[1,2]x[3,4]}. + + +\textbf{Interval repetition.} Beginning with v8.0 (2017/08/08), +\pkg{exerquiz} allows \emph{interval repetition}. It is not unusual that the +cartesian product of the same interval is needed, eg, +\texttt{[0,1]x[0,1]x[0,1]}; rather than typing those repetitive interval +specifications, you can simple use the notation \texttt{[0,1]*3}. The general +syntax for an interval is now \texttt{\ameta{interval}*\ameta{num}}; the +`\texttt{*\ameta{num}}' portion is optional, \ameta{num} is an positive +integer. Note that `\texttt{*\ameta{num}}' follows the interval +specification, this is \emph{vitally important} for the correct parsing of +the expression. + +The notation may be mixed in with additional interval + specifications; thus, for example, `\texttt{[0,1]*3x[1,2]x[2,3]*2}' expands to + `\texttt{[0,1]x[0,1]x[0,1]x[1,2]\penalty0x\penalty0[2,3]x[2,3]}'. + +\exAeBBlogPDF{p=1330} See the file +\texttt{\href{\urlAcroTeXBlog/?p=1330}{ml-vars.pdf}} for a demonstration of +interval repetition. + + +\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 :]\label{paraRespBoxNine} This optional parameter is the name of a customized +comparison function. + +Beginning with version 5.5 of \textsf{exerquiz}, this argument can also be +a JavaScript object with at most two properties: \texttt{priorParse} and +\texttt{comp}. \texttt{priorParse} is used to insert additional JavaScript +into \texttt{ProcResp} prior to processing the user's answer; this allows +additional ``filtering'' of the user's response. The value of +\texttt{priorParse} can either be a single function, or an array of +functions. These functions take \texttt{UserAns} as its argument and +return either \texttt{null}, if \texttt{UserAns} is not acceptable, or +\texttt{true}, if it is ok for processing. The value of \texttt{comp} is +the name of the function to be used to compare answers. + +See the demo file \texttt{integer\_tst.tex} for examples of usage. + +%There is a built-in filter function, \texttt{requireForm}, that may be quite useful +%for filtering out responses that that are not of a specified form. See + +\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} + +\redpoint For the above example, +\begin{Verbatim}[xleftmargin=\amtIndent] +\RespBoxMath{2*sin(x)*cos(x)}{4}{.0001}{[0,1]} +\end{Verbatim} +\noindent no optional parameter is specified. The correct answer written in +valid JavaScript is given by \verb+2*sin(x)*cos(x)+; evaluation of the +user's answer is done by randomly selecting 4 points from the +interval $[\,0,1\,]$; if the evaluation at any of the 4 points +differs from the evaluation of the correct answer at the same +point by more than $\epsilon=0.0001$, the user's answer is +considered wrong. + +Once you choose the question to ask, you must then select the +values of the parameters for \cs{RespBoxMath}. + +\noindent\redpoint \textbf{Some Comments}: +\begin{questions} +\item The correct answer can be written either with valid JavaScript, +or in the same syntax a user would enter the answer with. The +functions and operators are pretty much as expected. See the +demo file \textsf{jquiztst.tex} for some discussion how authors +and users should enter their answers. + +\item The interval from which the sample points are taken +needs to be chosen with care. The interval must, obviously, be a +subset of the domain of the answer function. Choose an interval +away from any singularities the answer may have. + +%\item The JavaScript of Acrobat 5.0 does have exception +%handling, but this has not been incorporated into the code yet. +%Taking advantage of this new capability will be my next project. +%Exception handling will give the code protection against user's +%entering spurious answers. For example, based on the correct +%answer, the author chooses the interval $[\,0,1\,]$, but the user +%enters a function whose domain does not contain the interval, such +%as \verb=(x-1)^(1/2)=. +\end{questions} + +%\exPDF{jquiztst} See the file \href{\bUrl/webeq_ex.html\#jquiztst} +%{jquiztst.pdf} for various examples of the math questions. + +\exAeBBlogPDF{p=810} See the PDF file +\texttt{\href{\urlAcroTeXBlog/?p=810}{jquiztst.pdf}} for various examples of +the math questions. + +\newtopic\indent +By using the optional first parameter, you can modify the appearance +of the field ``locally.'' There is also a ``global'' mechanism as well: + +\newtopic\textbf{Global Modification:} \cs{everyeqTextField}, \cs{everyRespBoxMath} + +\newtopic The first one modifies the appearance of every quiz text field, +and the second can be used to modify all fields created using +\cs{RespBoxMath}. + +\redpoint See the document \href{eformman.pdf}{eformman.pdf} for complete +documentation on how to modify a field using the optional first +argument, and how to use the ``every'' command.\footnote{eforms manual on Web: \url{\bUrl/eformman.pdf}} + +\subsubsection{\texorpdfstring{\protect\cs{RespBoxTxt}}% + {\textbackslash RespBoxTxt}: The Text Question}\label{ss:respboxtxt} + +You can also pose a question that takes a simple text response. The +basic command for posing this type of question is +\cs{RespBoxTxt}. Consider the example given +earlier: +\begin{oQuestion}{exTxt1} +\redpoint Name the probability +distribution popularly referred to as the ``bell-shaped curve''.\\ +\mbox{\strut\RespBoxTxt{0}{0}{4}{Normal}{Normal Distribution}% +{Gaussian}{Gaussian Distribution}} +%\raisebox{-3bp}{\RespBoxTxt{0}{0}{4}{Normal}{Normal Distribution}% +%{Gaussian}{Gaussian Distribution}} +\end{oQuestion} + +The underlying JavaScript compares the user's response against +acceptable alternatives, as supplied by the author of the +question. If there is a match, the response is deemed correct. + +The code for this example is +\begin{Verbatim}[xleftmargin=\amtIndent] +\begin{oQuestion}{exTxt1} +\redpoint Name the probability distribution popularly +referred to as the ``bell-shaped curve''.\\ +\RespBoxTxt{0}{0}{4}{Normal}{Normal Distribution}% +{Gaussian}{Gaussian Distribution} +\end{oQuestion} +\end{Verbatim} + +\noindent The command \cs{RespBoxTxt} takes five or more parameters. +\begin{Verbatim}[xleftmargin=\amtIndent,commandchars=!()] +\RespBoxTxt[#1]#2#3[#4]#5!ameta(list of alternatives) +\end{Verbatim} +\noindent\textbf{\hypertarget{paraRespBoxTxt}{Parameters:}} +\begin{description} +\item[\ttfamily\#1 :] Optional parameter used to modify the appearance of the + text field. See the section entitled \nameref{sss:CorrButton}, + page~\pageref*{sss:CorrButton} for examples, and + \textsf{exerquiz.dtx} for a listing of all controlling macros. +\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} +See the JavaScript function \texttt{eqFilter} in \texttt{exerquiz.dtx} for the +program code details. Additional filtering options may be added. + +\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} +See the JavaScript function \texttt{compareTxt} in \texttt{exerquiz.dtx} for the +program code details. + +\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. If +the fourth parameter is a `\texttt*', then an automatic naming scheme +is used instead. +\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} + +%\exPDF{jtxttst} See the file \href{\bUrl/webeq_ex.html\#jtxttst} +%{jtxttst.pdf} for examples of the differences between various combinations +%of filtering rules and comparison methods. + +\exAeBBlogPDF{p=813} See the PDF file +\texttt{\href{\urlAcroTeXBlog/?p=813}{jtxttst.pdf}} for examples of the +differences between various combinations of filtering rules and comparison +methods. + + +\newtopic By using the optional first parameter, you can modify the appearance +of the field ``locally''. There is also a ``global'' mechanism as well: + +\newtopic\textbf{Global Modification:} \cs{everyeqTextField} and \cs{everyRespBoxTxt} + +\newtopic The first mechanism modifies the appearance of every quiz text +field, the second can be used to modify all fields created using +\cs{RespBoxTxt}. + +\redpoint See the document \href{eformman.pdf}{eFormMan.pdf} on +\textit{\href{eformman.pdf}{eForm Support}} for complete +documentation on how to modify a field using the optional first +argument, and how to use the ``every'' command.\footnote{eforms manual on Web: \url{\bUrl/eformman.pdf}} + +\subsubsection{\texorpdfstring{\protect\cs{RespBoxTxtPC}}% + {\textbackslash RespBoxTxtPC}: The Text Question with Partial Credit}\label{ss:respboxtxtpc} + +\textsf{Exerquiz} can now create text fill-in questions that awards +credit each time one of the key words are found in the student's input string. + +\newtopic The command \cs{RespBoxTxtPC} is the one that creates a text fill-in question. Its +syntax is +\begin{Verbatim}[xleftmargin=\amtIndent,fontsize=\small,commandchars=!()] +\RespBoxTxtPC[#1]#2[#3]#4[!meta(num1)]{!meta(word1)}...[!meta(num_n)]{!meta(word_n)} +\end{Verbatim} +The new command \cs{RespBoxTxtPC} behaves differently than \cs{RespBoxTxt}. +JavaScript performs a regular expression search for each word listed (the word, +can be a regular expression), if the word is found (the search is successful), the total credit +for this problem is incremented by the amount associated with the word. + +\medskip\noindent\textbf{\hypertarget{paraRespBoxTxtPC}{Parameters:}} +\begin{enumerate} +\item[\ttfamily\#1:]Optional parameter used to modify the appearance of the + text field. +\item[\ttfamily\#2:]This required parameter is a number indicating +the filtering method to be used. Permissible values of this parameter are +\begin{enumerate} + \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[\ttfamily0:] The author's and user's answers are converted to + lower case, any white space and non-word characters are removed. + \item[\ttfamily1:] The author's and user's answers are converted to + lower case, any white space is removed. + \item[\ttfamily2:] The author's and user's answers are stripped of + white space. + \item[\ttfamily 3:] Same as -1, but a case insensitive search is performed. + \emph{This is the recommended value for this function.} +\end{enumerate} +See the JavaScript function \texttt{eqFilter} in \texttt{exerquiz.dtx} for +program code details. Additional filtering options may be added. + +\textbf{Recommendation:} For \cs{RespBoxTxtPC}, use either~-1 +(case sensitive search) or~3 (case insensitive search). + +\item[\ttfamily\#3:] 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. If the third parameter is a `\texttt*', then an automatic +naming scheme is used instead. +\item[\ttfamily\#4:] This required parameter is the +number of alternative answers that are acceptable. The alternative +answers are listed immediately after this parameter. +\item[]The parameters that follow \texttt{\#4} are of the form +\texttt{[\meta{num}]\darg{\meta{word}}}. The \texttt{[\meta{num}]} is the amount of credit +the user gets if his answer contains \meta{word}. Actually, +\texttt{\meta{word}} can be a regular expression so that a more sophisticated +search criteria can be set up. This is illustrated in the examples above, +and explained below. + +A \cs{RespBoxTxtPC} question is deemed correct (and marked with a green rectangle, +in the case of a quiz) if at least one of the words is found. + +If a word does not have a partial credit \texttt{[\meta{num}]} before it, that word has a partial +credit of zero, and may as well not be included in the list of words. +\end{enumerate} + +%\exPDF{jtxttst_pc} The demo file for this section is \texttt{jtxttst\_pc.tex}. +%The file contains extensive examples, and discusses techniques of searching +%using regular expressions. + +\exAeBBlogPDF{p=296} The demo file for this section is +\texttt{\href{\urlAcroTeXBlog/?p=296}{jtxttst\_pc.pdf}}. The file contains +extensive examples, and discusses techniques of searching using regular +expressions. + + + +\subsection{Some Enhancements}\label{enhancements} + +There are several enhancements to the math (using \cs{RespBoxMath}) +and text (using \cs{Resp\-Box\-Txt}) open-ended question beyond the +minimal examples given earlier. These enhancements can be used +within the \texttt{oQuestion}, the \texttt{shortquiz}, and the +\texttt{quiz} environments. + +\subsubsection{Including an Answer Key with \texorpdfstring +{\protect\cs{CorrAnsButton}}{\textbackslash CorrAnsButton}} + +The correct solution can be included in the question as well; just include +the command \cs{Corr\-Ans\-Button}. This command takes one parameter, the correct +answer that will be viewed when the user clicks on the button. + +The example below also illustrates the (optional) third parameter of +\cs{RespBoxMath}. Here we pose the question in the variable $t$ rather +than the default variable of $x$. +\begin{oQuestion}{sine2} +\redpoint Differentiate\\[1ex] +$\dfrac d{dt} \sin^2(t) =$ +\RespBoxMath{2*sin(t)*cos(t)}(t){4}{.0001}{0}{1}\kern1bp\CorrAnsButton{2*sin(t)*cos(t)} +\end{oQuestion} + +\medskip\noindent +The listing follows: +\begin{Verbatim}[xleftmargin=\amtIndent] +\begin{oQuestion}{sine2}\\[1ex] +\redpoint Differentiate $\dfrac d{dt} \sin^2(t) =$ +\RespBoxMath{2*sin(t)*cos(t)}(t){4}{.0001}{0}{1}\kern1bp +\CorrAnsButton{2*sin(t)*cos(t)} +\end{oQuestion} +\end{Verbatim} + +\noindent The \cs{CorrAnsButton} takes one parameter, the correct answer. +This answer is (usually) the same as the one given as the second +argument (the optional argument is the first) in the \cs{RespBoxMath} +command. + +\redpoint The \cs{CorrAnsButton} also controls access to the (optional) solution, see +the next section. + +\subsubsection{Including a Solution}\label{inclsoln} + +In addition to a correct answer, you can also include a solution +to the question. Insert the optional fourth parameter---fourth for both +\cs{RespBoxMath} and \cs{RespBoxTxt}---into the parameter list giving the name of +the destination to the solution. Follow the question by a \texttt{solution} +environment containing the solution. + +The user \texttt{Shift-Click}s on the \cs{CorrAnsButton} button to jump +to the solution. + +\begin{oQuestion}{sine3} +\redpoint Differentiate\\[1ex] +$\dfrac d{dt} \sin^2(t) =$ +\RespBoxMath{2*sin(t)*cos(t)}(t)[sine3]{4}{.0001}{0}{1}\kern1bp\CorrAnsButton{2*sin(t)*cos(t)} +\begin{solution} +\[ + \frac d{dx}\sin^2(x) = 2\sin(x)\cos(x) = \sin(2x) +\] +\end{solution} +\end{oQuestion} + +\medskip\noindent +The listing follows: +\begin{Verbatim}[xleftmargin=\amtIndent] +\begin{oQuestion}{sine3}\\[1ex] +\redpoint Differentiate $\dfrac d{dt} \sin^2(t) =$ +\RespBoxMath{2*sin(t)*cos(t)}(t)[sine3]{4}{.0001}{0}{1}\kern1bp +\CorrAnsButton{2*sin(t)*cos(t)} +\begin{solution} +\[ + \frac d{dx}\sin^2(x) = 2\sin(x)\cos(x) = \sin(2x) +\] +\end{solution} +\end{oQuestion} +\end{Verbatim} + +\redpoint The \cs{CorrAnsButton} works the same way for the \texttt{shortquiz} and +the \texttt{quiz} environments. + +\newtopic Actually, \cs{CorrAnsButton} has an optional argument. The full syntax is +\settowidth{\aebdimen}{\cs{CorrAnsButton\darg{\meta{display\_answer}}*\darg{\meta{JS\_function}}}} +\begin{dCmd}[commandchars=!()]{\aebdimen+2\fboxsep+2\fboxrule} +\CorrAnsButton{!meta(display_answer)}*{!meta(JS_function)} +\end{dCmd} +\newtopic When the \texttt* is detected following the \meta{display\_answer}, the \meta{JS\_function} +is used to evaluate \meta{display\_answer}, before displaying it. There is +one built-in function called \texttt{EvalCorrAnsButton}, the definition of +which is +\begin{Verbatim}[xleftmargin=\amtIndent] +function EvalCorrAnsButton(fieldname,theanswer) +{ + theanswer = eval(theanswer); + DisplayAnswer(fieldname,theanswer); +} +\end{Verbatim} +Other JavaScript functions may be defined using the \texttt{insDLJS} environment, then +passed to \cs{CorrAnsButton} with the optional argument. + +An example of this optional parameter is + +\begin{oQuestion}{add1} +\redpoint Perform the indicated operation, and enter +result into the box.\\[1ex] +$ \text{9} + \text{8} =$ +\RespBoxMath{9 + 8}{1}{.0001}{[0,1]}\kern1bp\CorrAnsButton{9 + 8}*{EvalCorrAnsButton}\kern1bp +\sqTallyBox +\end{oQuestion} + +\medskip\noindent +The listing follows: +\begin{Verbatim}[xleftmargin=\amtIndent] +\begin{oQuestion}{add1} +\redpoint Perform the indicated operation, and enter +result into the box.\\[1ex] +$ 9 + 8 = $ +\RespBoxMath{9 + 8}{1}{.0001}{[0,1]}\kern1bp + \CorrAnsButton{9 + 8}*{EvalCorrAnsButton}\kern1bp +\sqTallyBox +\end{oQuestion} +\end{Verbatim} + + +\subsubsection{Including a Tally Box} + +The macro \cs{sqTallyBox} is used to keep a running total of the +number of wrong answers a user has entered into the response box. + +For example, + +\begin{oQuestion}{sine4} +\redpoint \hypertarget{exofT}{Differentiate}\\[1ex] +$\dfrac d{dx} \sin^2(x) =$ +\RespBoxMath{2*sin(x)*cos(x)}{4}{.0001}{0}{1}\kern1bp\CorrAnsButton{2*sin(x)*cos(x)}\kern1bp +\sqTallyBox +\end{oQuestion} + +\medskip\noindent +The listing follows: +\begin{Verbatim}[xleftmargin=\amtIndent] +\begin{oQuestion}{sine4} +\redpoint Differentiate\\[1ex] +$\dfrac d{dx} \sin^2(x) =$ +\RespBoxMath{2*sin(x)*cos(x)}{4}{.0001}{0}{1}\kern1bp +\CorrAnsButton{2*sin(x)*cos(x)}\kern1bp +\sqTallyBox +\end{oQuestion} +\end{Verbatim} + +\redpoint The tally box can be used within the \texttt{oQuestion} +and \texttt{shortquiz} environments; in the \texttt{quiz} +environment, no tally box is used. + +\subsubsection{Clearing the Fields} + +For the \texttt{oQuestion} and the \texttt{shortquiz} +environments, you can clear the response box fields by placing +insert \cs{sqClearButton}. + + +\begin{oQuestion}{sine5} +\redpoint Differentiate\\[1ex] +$\dfrac d{dx} \sin^2(x) =$ +\RespBoxMath{2*sin(x)*cos(x)}{4}{.0001}{0}{1}\kern1bp\CorrAnsButton{2*sin(x)*cos(x)}\kern1bp +\sqTallyBox\kern1bp\sqClearButton +\end{oQuestion} + + +\medskip\noindent +The listing follows: +\begin{Verbatim}[xleftmargin=\amtIndent] +\begin{oQuestion}{sine5} +\redpoint Differentiate\\[1ex] +$\dfrac d{dx} \sin^2(x) =$ +\RespBoxMath{2*sin(x)*cos(x)}{4}{.0001}{0}{1}% +\CorrAnsButton{2*sin(x)*cos(x)}\kern1bp +\sqTallyBox\kern1bp\sqClearButton +\end{oQuestion} +\end{Verbatim} + +\newtopic Notice that I've inserted a \cs{kern1bp} to separate the +two fields \cs{sqTallyBox} and \cs{sq\-Clear\-Button}. This is to keep +their borders from overlapping. + +\subsection{More on Math Fill-in Questions}\label{s:moremath} + +This section covers rules for author and user input into a math fill-in question. + +\subsubsection{Comments on Authoring}\label{s:mathauthoring} + +When authoring a math fill-in, that is, when using \cs{RespBoxMath} to +construct a question, several things must be kept in mind. + +\begin{itemize} + \item The \hyperref[paraRespBox]{second parameter} of \cs{RespBoxMath}, +\begin{Verbatim}[xleftmargin=\amtIndent] +\RespBoxMath[#1]#2(#3)[#4]#5#6#7#8[#9]*#10 +\end{Verbatim} + is the correct answer parameter. You need not compute the + correct answer, you can let the JavaScript of exerquiz do that. + For example, if the answer is $\sqrt{2}$ you can enter + \texttt{sqrt(2)}. All the rules of entering user input outlined + in the next section on + \begin{NoHyper}`\nameref{ss:userinput}'\end{NoHyper} holds for + this second parameter as well. + + \item[] If you choose to restrict user input in some way, perhaps using the \texttt{limitArith} + option of \textsf{dljslib}, these limitations only apply to the user input, not to the author's + input in parameter \texttt{\#2}. See \Nameref{limitArith} for more information on how to limit + arithmetic operations. + + \item The question must posed so as to make it clear to the student what is expected + by way of input into the text field, an expression, an equation, and so on. + +\end{itemize} + +\subsubsection{Comments on User Input}\label{ss:userinput} + +When responding to a Math Fill-in question, the student responds by typing +in an answer. The following notation is expected by \textsf{exerquiz}. + +\begin{itemize} +\item Use \texttt{*} to indicate multiplication: Type \texttt{4*x} for $4x$. + +\item[] If the \texttt{ImplMulti} option of the \textsf{dljslib} package is taken, then the + student need only type in \texttt{4x} for $4x$. Exerquiz attempts to + insert the multiplication symbol \texttt{*} by parsing the user input. + For information on, see the section on \Nameref{ImplMulti}. + +\item Use \verb|^| to indicate powers: Type \verb|4*x^3| for +$4x^3$; \verb|12*x^-6| for $12x^{-6}$. Again, if the \texttt{ImplMulti} option is taken, +entering \verb|12x^-6| is sufficient. + +\item Use parentheses to delimit the argument of a function; that is, type +\texttt{sin(x)}, rather than \texttt{sin~x}. + +\item Use parentheses to define the \textit{scope} of an operation: Type \verb|4*x*(x^2+1)^3| for $4x(x^2+1)^3$; + \verb|4^(2*x+1)| for $4^{2x+1}$; \verb|(sin(x))^2| for $(\sin(x))^2$. \textit{Do not} type an expression like + \verb|sin^2(x)| for $\sin^2(x)$, type \verb|(sin(x))^2| instead. + +\item[] If the \texttt{ImplMulti} option of the \textsf{dljslib} package is taken, + the use of \texttt{*} is unnecessary, but also the simplified notation for powers + of functions is supported, now you can type \verb|sin^2(x)| for $\sin^2(x)$. + +\item Brackets \texttt{[ ]} or braces \texttt{\{ \}} can be used +to delimit mathematical expressions. + +\item Functions that are recognized: +\begin{itemize} + \item Trig: \texttt{sin}, \texttt{cos}, \texttt{tan}, \texttt{cot}, \texttt{sec}, \texttt{csc}. + \item Inverse Trig: \texttt{arcsin} (or \texttt{asin}) , \texttt{arccos} (or \texttt{acos}), + \texttt{arctan} (or \texttt{atan}). + \item Logarithms: \texttt{ln} for natural logs, and \texttt{log} for common logs. + For example, \texttt{ln(x)} or \texttt{log(x)}. + \item Exponential: The natural exponential function, $e^x$, + can be entered as \texttt{exp(x)} or as \verb|e^x|. + \item The absolute function, \texttt{abs($\cdot$)} can also be written + in the usual way \texttt{|$\cdot$|}; thus, you can type either + \texttt{abs(x)} or \texttt{|x|}. + \item Misc.: \texttt{sqrt}, usage \texttt{sqrt(x)} for $\sqrt{x}$ (or, use + exponential notation: \verb|x^(1/2)|). + \item[] When the \texttt{combinatorics} option of \textsf{dljslib} is taken, the binomial coefficient function + \texttt{C(n,r)}, the permutation function \texttt{P(n,r)}, and the factorial function + \texttt{fact}, are defined. See \Nameref{combinatorics} for additional details. +\end{itemize} +\end{itemize} +A variation of these listings should appear as instructions to the student on how to enter +math fill-in questions. + +\newtopic When a user enters a response, some attempt is made to +determine whether the response is a valid mathematical expression. +For example, if \texttt{san(x)} is entered, the function `\texttt{san}' will +not be recognized as a valid mathematical function; an error +message is generated, and the user is not penalized for a possible +typing error. The JavaScript routines will also check for +unbalanced parentheses; thus, \verb|((x^4+1) + sin(x)^2| will be +flagged as a syntax error. + +\Important The student must use the variables declared for the +problem when entering mathematical expressions. If the problem +statement involves the variable $x$, then \texttt{x} must be used; +if the problem statement uses $t$, then \texttt{t} must be used. +To enter an expression using $t$ when an expression with variable $x$ is expected will, +no doubt, result in missed problem. + +\subsection{The \texttt{shortquiz} Environment}\label{s:oQsq} + +The objective question (with or without the presence of a +correction box, \cs{corr\-Ans\-Button} or a tally box \cs{sqTallyBox}) +can be mixed in with multiple choice questions. + +Solutions to the questions can also be included using a +\texttt{solution} environment. Click on the ``Ans'' button to get +the answer to a question; shift-click on the ``Ans'' button to get +the solution. + +\begin{shortquiz}[oQsq] +Answer each of the following. Passing is 100\%. + +\begin{questions} +\item If $f$ is differentiable, then $f$ is continuous. +\begin{answers}{4} +\Ans1 True & \Ans0 False +\end{answers}\hfill\sqTallyBox + +\item $\displaystyle\frac d{dx} \sin^2(x) =$ +\RespBoxMath{2*sin(x)*cos(x)}[sinsqx]{4}{.0001}{0}{1}% +\hfill\CorrAnsButton{2*sin(x)*cos(x)}% +\kern1bp\sqTallyBox +\begin{solution} +\[ + \frac d{dx}\sin^2(x) = 2\sin(x)\cos(x) = \sin(2x) +\] +\end{solution} + +\item Name \emph{one} of the two people recognized as a founder of +Calculus.\vadjust{\kern3pt}\newline +\RespBoxTxt{2}{0}[newton]{5}% +{Isaac Newton}{Newton}{I. Newton}{Gottfried Leibniz}{Leibniz}\hfill +\CorrAnsButton{Isaac Newton or Gottfried Leibniz}\kern1bp\sqTallyBox +\end{questions} +\begin{solution} +Yes, Isaac Newton and Gottfried Leibniz are considered founders of +Calculus. +\end{solution} +\end{shortquiz}%\hfill +%\begin{flushright} +%\sqClearButton\kern1bp\sqTallyTotal +%\end{flushright} + +\redpoint When using objective questions within a +\texttt{shortquiz} environment, you must give a unique field name +as an optional argument of the environment. The listing of this +example follows: + +\begin{Verbatim}[xleftmargin=\amtIndent] +\begin{shortquiz}[oQsq] % <-- unique field name +Answer each of the following. Passing is 100\%. +\begin{questions} + +\item If $f$ is differentiable, then $f$ is continuous. +\begin{answers}{4} +\Ans1 True & \Ans0 False +\end{answers}\hfill\sqTallyBox + +\item $\displaystyle\frac d{dx} \sin^2(x) =$ +\RespBoxMath{2*sin(x)*cos(x)}[sinsqx]{4}{.0001}{0}{1}% +\hfill\CorrAnsButton{2*sin(x)*cos(x)}% +\kern1bp\sqTallyBox +\begin{solution} +\[ + \frac d{dx}\sin^2(x) = 2\sin(x)\cos(x) = \sin(2x) +\] +\end{solution} + +\item Name \emph{one} of the two people recognized +as a founder of Calculus.\vadjust{\kern3pt}\newline +\RespBoxTxt{2}{0}[newton]{5}{Isaac Newton}{Newton}{I. Newton}% +{Gottfried Leibniz}{Leibniz}\hfill +\CorrAnsButton{Isaac Newton or Gottfried Leibniz}% +\kern1bp\sqTallyBox +\begin{solution} +Yes, Isaac Newton and Gottfried Leibniz are considered +founders of Calculus. +\end{solution} +\end{questions} +\end{shortquiz} +\begin{flushright} +\sqClearButton\kern1bp\sqTallyTotal %<-- total tally +\end{flushright} +\end{Verbatim} + +\noindent\textbf{Example Notes:} +\begin{itemize} +\item Note the optional argument gives this collection of +questions a common base name. All supporting macros use this name. +\item The named destination to the solution is entered with parameter +\texttt{\#5} of the command \hyperref[paraRespBox]{\cs{RespBoxMath}}, and with parameter +\texttt{\#4} of \hyperlink{paraRespBoxTxt}{\cs{RespBoxTxt}}. +\item In this example, another built-in macro, +\cs{sqTallyTotal} was used. This macro creates a text field that +accumulates the totals of all the tally boxes. +\end{itemize} + +\redpoint The \texttt{shortquiz} environment can also be used for +a single objective question. Just don't use the +\texttt{questions} environment within. + +\begin{Verbatim}[xleftmargin=\amtIndent,commandchars=!()] +\begin{shortquiz}[anExample] + !ameta(an objective style question) +\end{shortquiz} +\end{Verbatim} + + +\subsection{The \texttt{quiz} Environment}\label{s:oQquiz} + +Objective questions can be mixed in with multiple choice questions +within the \texttt{quiz} environment. When posing an objective +style question in the \texttt{quiz} environment, use +\cs{RespBoxMath} and \cs{RespBoxTxt}, and optionally include +the \cs{CorrAnsButton} button and the \cs{AnswerField} text field. + +Since the evaluation of the quiz is delayed until the user has +finished the quiz, the \cs{sqTally\-Box} macro is not applicable here. + +\begin{quiz*}{oQq} +Answer each of the following. Passing is 100\%. + +\begin{questions} +\item If $f$ is differentiable, then $f$ is continuous. +\begin{answers}{4} +\Ans1 True & \Ans0 False +\end{answers} + +\item $\displaystyle\frac d{dx} \sin^2(x) =$ +\RespBoxMath{2*sin(x)*cos(x)}[sinsqx2]{4}{.0001}{0}{1}% +\hfill\CorrAnsButton{2*sin(x)*cos(x)}% +\begin{solution} +\[ + \frac d{dx}\sin^2(x) = 2\sin(x)\cos(x) = \sin(2x) +\] +\end{solution} + +\item Name \emph{one} of the two people recognized as a founder of +Calculus.\vadjust{\kern3pt}\newline +\RespBoxTxt{2}{0}[leibniz]{5}{Isaac Newton}{Newton}{I. Newton}{Gottfried Leibniz}{Leibniz}\hfill +\CorrAnsButton{Isaac Newton or Gottfried Leibniz} +\begin{solution} +Yes, Isaac Newton and Gottfried Leibniz are considered +founders of Calculus. +\end{solution} + +\end{questions} +\end{quiz*}\quad\ScoreField{oQq}\CorrButton{oQq} + +\noindent Answers: \AnswerField{oQq} + +\redpoint The buttons created by \cs{CorrAnsButton} are hidden +until the user ends the quiz (and gets scored) and clicks on the +corrections button (\cs{CorrButton}). The \cs{Corr\-Ans\-Button} should +not be included if there is no \cs{CorrButton}. + +\redpoint Pressing on the ``Ans'' button populates the text +field created by \cs{AnswerField} with the author's correct answer. +If there is a solution to the problem, the ``Ans'' button +is outlined in green. Shift-click on the ``Ans'' button to jump to +the solution. + +\redpoint The \texttt{quiz} environment requires a field name. +This same name is used by the objective style question as well. + +\medbreak + +The listing for the above example follows. + +\begin{Verbatim}[xleftmargin=\amtIndent] +\begin{quiz*}{oQq} +Answer each of the following. Passing is 100\%. +\begin{questions} + +\item If $f$ is differentiable, then $f$ is continuous. +\begin{answers}{4} +\Ans1 True & \Ans0 False +\end{answers} + +\item $\displaystyle\frac d{dx} \sin^2(x) =$ +\RespBoxMath{2*sin(x)*cos(x)}{4}{.0001}{0}{1}% +\hfill\CorrAnsButton{2*sin(x)*cos(x)}% + +\item Name \emph{one} of the two people recognized +as a founder of Calculus.\vadjust{\kern3pt}\newline +\RespBoxTxt{2}{0}[leibniz]{5}{Isaac Newton}{Newton}{I. Newton}% +{Gottfried Leibniz}{Leibniz}\hfill +\CorrAnsButton{Isaac Newton or Gottfried Leibniz} +\begin{solution} +Yes, Isaac Newton and Gottfried Leibniz are considered +founders of Calculus. +\end{solution} +\end{questions} +\end{quiz*}\quad\ScoreField{oQq}\CorrButton{oQq} + +\noindent Answers: \AnswerField{oQq} +\end{Verbatim} + +\noindent The \cs{AnswerField} has the following syntax: +\settowidth{\aebdimen}{\cs{AnswerField[\anglemeta{field\_opts}]\darg{\meta{base\_name}}}}% +\begin{dCmd}[commandchars=!()]{\aebdimen+2\fboxsep+2\fboxrule} +\AnswerField[!anglemeta(field_opts)]{!meta(base_name)} +\end{dCmd} +\noindent The parameter \anglemeta{field\_opts} is the typical optional +parameter for all \textsf{eform} fields; it is used to change the appearance +of the field. The parameter \meta{base\_name} is the (base) name of the quiz +this field will hold the answers for. + +You may have \cs{AnswerField} commands on several pages---possibly for +different quizzes. By using the command \cs{resetAnsFieldOnClose}, the +answer field for the current quiz will be cleared when the page containing +it closes. You can revert back to the default behavior (answer fields not cleared) by executing +\cs{noResetAnsFieldOnClose}. + +\redpoint There are some additional grade reporting and statistical fields +defined: \textsf{exerquiz} defines \cs{PointsField}, \cs{PercentField}, and \cs{GradeField}. +The demo file \texttt{quizpts.tex} illustrates these commands; see also +the section below entitled \nameref{sss:asignPts}. + +\subsubsection{The Prompt Button} + +In addition to the \cs{CorrAnsButton}, the document author can +provide a prompt button (probably not the best descriptive term). + +For some quizzes, the author might want to ask a series of +questions where the answer to one question depends on the correct +answer of a previous question. In this situation, you'd like to +provide the correct answer so the student can make a good run at +the next question. The \cs{@PromptButton} not only provides the +answer to the question but it also makes the corresponding math +fill-in read only, so that the student cannot change the answer +already provided. + +Ideally, the student first enters an answer, and once satisfied +with the answer, can then get the correct answer for future +questions. + +%\redpoint See the demo file \texttt{prompt\_tst.tex} for an example of usage. + +\exAeBBlogPDF{p=888} See the demo file \texttt{\href{\urlAcroTeXBlog/?p=888}{prompt\_tst.pdf}} from the {\AcroBlog} +for an example of usage. + +\subsubsection{Grouped Math/Text Fill-in Questions}\label{grouped} + +\textsf{Exerquiz} defines a grouping environment, \texttt{mathGrp}, +for math fill-in and \emph{text fill-in} questions where the response to the question +might require entering text into multiple math fill-in fields. + +When you use the \texttt{mathGrp} environment to enclose a set of +related math questions, you need to use the \cs{CorrAnsButtonGrp} +button, instead of the \cs{CorrAnsButton} button. The required +argument for this button is a comma delimited list of the answers +that appear within the grouped questions. The answers should be +listed in the same order {\TeX} processes the math (or text) +questions. The group of questions is processed as if it were a +single question. + +\redpoint For example\dots + +\noindent \begin{minipage}{\linewidth} +\useBeginQuizButton[\textColor{0 0 1}\CA{Begin}\AC{}\RC{}\rectW{}] +\useEndQuizButton[\textColor{0 0 1}\CA{End}\AC{}\RC{}\rectW{}] +\begin{quiz*}{grpExample}\PTsHook{($\eqPTs^{\text{pts}}$)}\PTs{3} +Compute the following cross product: +\begin{equation*} +\def\vi#1{\setlength{\fboxrule}{0pt}\setlength{\fboxsep}{1bp} +\fbox{\RespBoxMath[\rectW{11bp}\Q{1}\textSize{0}]{#1}{1}{.0001}{[0,1]}}} +% + (3\vec i - 2\vec j) \times (\vec i + 5\vec k) = \begin{mathGrp}\PTs*{1} + \vi{-10}\,\vec i + \vi{-15}\, \vec j + \vi{2}\,\vec k + \end{mathGrp}\tag*{\CorrAnsButtonGrp{-10,-15,2}} +% +\end{equation*} +\end{quiz*}\ $\underset{\text{ScoreField}}{\underbrace{\ScoreField[\DV{}\V{}\rectW{1in}]\currQuiz}}$% + \kern1bp$\underset{\text{PointsField}}{\underbrace{\PointsField[\rectW{1in}]\currQuiz}}$\CorrButton[\CA{Correct}\AC{}\RC{}]\currQuiz + \hfill Ans: \AnswerField[\rectW{.5in}]\currQuiz +\end{minipage} + +\medskip\noindent +\textbf{Notes:} +\begin{questions} +\item[\color{blue}\ding{042}] If you miss any one of the three +answers, the \texttt{ScoreField} reports back `\texttt{Score: 0 +out of 1}'. There is only one question there, to get it correct, +you must answer all three inputs correctly. + +\item[\color{blue}\ding{042}] Points can be assigned to the individual + responses and a score is given based on the validity of the inputs and + the corresponding points. There is a default JavaScript function that + scores the results. The author can define a custom JavaScript function + to have a more ``exotic'' method of evaluating the group. See the + test file \texttt{grp\_test.tex} for details. + +\item[\color{blue}\ding{042}]Notice that after you take the quiz +and click on ``Correct'' button, the ``Ans'' button appears (as +usual). If you click repeatedly on this ``Ans'' button, you can +cycle through all answers to this question; the response box is +highlighted (or put in focus) and the answer appears in the answer +field provided. +\end{questions} + +\redpoint See the demo file \texttt{grp\_test.tex} for the source +code of this example, as well as more technical details of the +\texttt{mathGrp} environment. + +\subsection{Modifying Form Elements} + +All form elements have a first optional parameter for modifying their appearance, +and they have an associated ``every'' command for global modifications as well. + +\begin{center} +\setlength{\extrarowheight}{1mm} +\setlength{\tabcolsep}{2mm} +\begin{longtable}{|>{\ttfamily}l|>{\PBS\raggedright}p{.5\linewidth}|} +\hline +\multicolumn2{|c|}{\bfseries Global Modification Commands} \\ +\hline +\endfirsthead +\hline +\multicolumn2{|c|}{\bfseries Global Modification Commands} \\ +\hline +\endhead +\hline +\endfoot +\multicolumn2{|c|}{For the \texttt{shortquiz} Environment} \\ +\hline +\cs{Ans} & \cs{everysqRadioButton}\\ +\cs{sqTallyBox} &\cs{everysqTallyBox}\\ +\cs{sqTallyTotal}& \cs{everysqTallyTotal}\\ +\cs{sqClearButton}&\cs{everysqClearButton}\\\hline +\multicolumn2{|c|}{For the \texttt{quiz} Environment} \\ \hline +\cs{useBeginQuizButton}&\cs{everyBeginQuizButton}\\ +\cs{useEndQuizButton}&\cs{everyEndQuizButton}\\ +\cs{Ans} & \cs{everyqRadioButton}\\ +\cs{ScoreField}&\cs{everyScoreField}\\ +\cs{CorrButton}&\cs{everyCorrButton}\\ +\cs{AnswerField}&\cs{everyAnswerField}\\ +\cs{PointsField}&\cs{everyPointsField}\\ +\cs{PercentField}&\cs{everyPercentField}\\ +\cs{GradeField}&\cs{everyGradeField}\\\hline +\multicolumn2{|c|}{For Both Environments} \\ \hline +\cs{RespBoxMath}&\cs{everyRespBoxMath}\\ +\cs{RespBoxTxt}&\cs{everyRespBoxTxt}\\ +\cs{CorrAnsButton}&\cs{everyCorrAnsButton} +\end{longtable} +\end{center} + +\handpoint In additional to these, there are other ``every'' commands that effect +the appearance of the various buttons and text fields. The two commands +\cs{everyCorrButtonField} and \cs{every\-eqText\-Field} are executed before every +\texttt{exerquiz} button and text field (respectfully). These can be used to give +a general uniform appearance for all the short quiz or quiz form elements; use +the more specific version, as listed in the above table, to make additional refinements +in appearance. + +\redpoint See the document \href{eformman.pdf}{eformman.pdf} (relative link +\href{eformman.pdf}{eformman.pdf}) for complete documentation on how to +modify a field using the optional first argument, and how to use the +``every'' mechanism. + +\subsection{Inserting additional action and format scripts}\label{ss:AddActScripts} + +Global changes in \emph{appearance}, as just discussed, is accomplished using +any of the \cs{every\ameta{cmdname}} family of commands; however, that device +cannot, by design, change any of the actions \pkg{exerquiz} has defined. +S everal key-value pairs are used to insert JavaScript code into response +boxes, multiple choice, and multiple selection fields. +\settowidth{\aebdimen}{\cs{addToAction*\darg{\ameta{key}}\darg{\ameta{code}}}}% +\begin{dCmd}[commandchars=!()]{\aebdimen+2\fboxsep+2\fboxrule} +\AddAAFormat{!ameta(code)} +\AddAAKeystroke{!ameta(code)} +\AddAAMouseUpMC{!ameta(code)} +\AddAAMouseUpMS{!ameta(code)} +\setActionKeys{!ameta(KV-pairs)} +\addToAction*{!ameta(key)}{!ameta(code)} +\end{dCmd} +\newtopic +The command \cs{setActionKeys} is a special command used to process the +KV-pairs of the \pkg{eforms} package. It only accepts these four keys: +\cs{AddAAFormat}, \cs{AddAAKeystroke}, \cs{AddAAMouseUpMC}, and +\cs{AddAAMouseUpMC}. + + +\begin{description} + \item[\cs{AddAAFormat\darg{\ameta{code}}}] This is an \pkg{eforms} KV, + discussed an some detail on page~\pageref{para:ProcRespSetNum} that can be + specified in the optional argument of any response boxes to affect the + field locally, or globally through the \cs{setActionKeys} command. + \item[\cs{AddAAKeystroke\darg{\ameta{code}}}] Text fields have a keystroke + event (or trigger) that executes JavaScript each time a keystroke is + made into the field. The \pkg{exerquiz} key \cs{AddAAKeystroke} adds + its argument (\ameta{code}) to the keystroke event of all response boxes + (\cs{RespBoxMath}, \cs{RespBoxTxt}, and \cs{RespBoxTxtPC}). + + To distinguish between \env{shortquiz} (and \env{oQuestions}) and + \env{quiz} environments, use the methods explained below in the + description of the \cs{AddAAMouseUpMC} key. + + Should you want code that is specialized to these individual types, you can use + some internal macros to distinguish these three cases. +\begin{Verbatim}[xleftmargin=\amtIndent,commandchars=!(),fontsize=\small] +\setActionKeys{\AddAAKeystroke{% + \ifx\annot@subtype\annot@subtype@rbm!ameta(rbm-code)\else + \ifx\annot@subtype\annot@subtype@rbt!ameta(rbt-code)\else + \ifx\annot@subtype\annot@subtype@rbtpc!ameta(rbtpc-code)\fi + \fi\fi}} +\end{Verbatim} + Within the argument of \cs{setActionKeys} the character `\texttt{@}' is an ordinary letter, + so it can be used freely. + + Within this keystroke event, script executed prior this additional + \ameta{code} defines a JavaScript variable \texttt{retn}, which has a value + of \texttt{true} (if the response is judged correct), \texttt{false} (if + the response is judged incorrect), or \texttt{null} (if there is a syntax + error). The \ameta{code} may use this variable. + + \item[\cs{AddAAMouseUpMC\darg{\ameta{code}}}] This key adds its + \ameta{code} to the mouse up event of items (\cs{Ans}) of a multiple + choice (MC) question. Both \env{shortquiz} and \env{quiz} environments + are affected. + + You can distinguish between the \env{shortquiz} and \env{quiz} + environments by comparing \cs{eqQuizType} with \cs{isSQZ} or \cs{isQZ}. + For example, +\begin{Verbatim}[xleftmargin=\amtIndent,commandchars=!()] +\setActionKeys{\AddAAMouseUpMC{% + \if\eqQuizType\isQZ!ameta(qz-code)\else!ameta(sqz-code)\fi}} +\end{Verbatim} + + \item[\cs{AddAAMouseUpMS\darg{\ameta{code}}}] This key adds its + \ameta{code} to the mouse up event of items (\cs{Ans}) of a multiple + selection (MS) question. Both \env{shortquiz} and \env{quiz} + environments are affected. As with \cs{AddAAMouseUpMC}, distinguish + between the environments \env{shortquiz} and \env{quiz} by comparing + \cs{eqQuizType} with \cs{isSQZ} or \cs{isQZ}, as shown above. +\end{description} + In the case of both \cs{AddAAMouseUpMC} and \cs{AddAAMouseUpMS}, you + can distinguish between a correct response and an incorrect response + using the command \cs{Ans@choice}, which expands to 1 when correct + alternative (radio button or check box) is pressed, and expands to 0 + otherwise. For example, +\begin{Verbatim}[xleftmargin=\amtIndent,commandchars=!()] +\setActionKeys{\AddAAMouseUpMC{% + \if\Ans@choice1!ameta(true-code)\else!ameta(false-code)\fi}} +\end{Verbatim} +\cs{AddAAKeystroke}, \cs{AddAAMouseUpMC}, and \cs{AddAAMouseUpMC} don't work +as local arguments of \cs{RespBoxMath}, \cs{RespBoxTxt}, and +\cs{RespBoxTxtPC}; however, \cs{AddAAFormat} can be passed within the option +list of these response box commands, the local option command over rights the +global command. + +Remove any of the actions earlier declared by passing the empty argument, +\begin{Verbatim}[xleftmargin=\amtIndent,commandchars=!()] +\setActionKeys{\AddAAMouseUpMC{}} +\end{Verbatim} +Now, there is no added code to the mouse up action of the multiple choice +fields that appear afterwards. + +The only command yet to be discussed is \cs{addToAction*}. Suppose we earlier +declared, +\begin{quote}\ttfamily +\cs{setActionKeys\darg{\string\AddAAFormat}\darg{\ameta{code\SUB1}}} +\end{quote} +and later in the document we want to \emph{append} +additional script (\ameta{code\SUB2}). To accomplish this, expand the command, +\begin{quote}\ttfamily +\cs{addToAction\darg{\string\AddAAFormat}\darg{\ameta{code\SUB2}}} +\end{quote} +Now the code executed for each response box +is \ameta{code\SUB1}\ameta{code\SUB2}. However, if you wish to \emph{prepend} the \ameta{code\SUB2}, then +expand \cs{addToAction} using the star-option, +\begin{quote}\ttfamily +\cs{addToAction*\darg{\string\AddAAFormat}\darg{\ameta{code\SUB2}}} +\end{quote} +The code executed for any response box is \ameta{code\SUB2}\ameta{code\SUB1}. + +It should ever be kept in mind that changing the value of a key with +\cs{setActionKeys} is \cs{addToAction} affects all response boxes thereafter, +\emph{unless these changes occur in a group}. Thus, the following change, +\begin{Verbatim}[xleftmargin=\amtIndent,commandchars=!()] +\begin{oQuestion}{oQ1} +\addToAction{\AddAAFormat}{\r!ameta(code)}% +It is well known that + $ 1 + 16 = \RespBoxMath{17}{1}{.0001}{[0,1]}$ +\end{oQuestion} +\end{Verbatim} +only affects that problem, and none other. + +\newtopic +\textbf{Important/A little beg.} Any changes to the action script passed to +the component elements of the \env{oQuestion}, \env{shortquiz}, and +\env{quiz} environments \emph{should not impact} the basic functionality of the +environments. + +\subsection{The correct-type math problem} + +The traditional way of posing a mathematical objective-style question is to use +the \cs{RespBoxMath} command, which presents an empty text field for the student to enter +the answer. However, an alternate approach is to pre-populate the field and ask the student +to edit the expression provided to obtain a correct answer. +\collectboxto{\aebbox}{}\bgroup +\begin{minipage}{\linewidth-\mathindent} +\begin{Verbatim}[fontsize=\small,commandchars={!@$}] +\RespBoxMath[!textbf@\DV{cos(4x)}\V{cos(4x)}$] + {4xcos(2x^2)}{2}{.001}{[0,1]} +\end{Verbatim} +\end{minipage}\egroup + +\medskip\noindent\begin{oQuestion}{} +Edit the expression to obtain the correct answer: +\begin{align*} + &\dfrac{d}{dx}\sin(2x^2)=\RespBoxMath[\DV{cos(4x)}\V{cos(4x)}]{4xcos(2x\string^2)}{2}{.001}{[0,1]}\\[3pt] + &\usebox{\aebbox} +\end{align*} +\end{oQuestion} +The field is initially populated by an incorrect answer (a very common mistake), the student needs to +correct the answer. + +\exAeBBlogPDF{p=1335} Refer to the {\AcroTeX} Blog article +\href{\urlAcroTeXBlog/?p=1335}{Correcting a math problem} for additional +examples. The article also discusses the use of multi-letter variables in +this context of a correct-type question. + +\subsection{Evaluating Equivalent Expressions} + +The \hypertarget{EquivExpr}{\cs{RespBoxMath}} macro, and its underlying JavaScript code, is designed to +determine the correctness of an answer, numerical or symbolic. We can pose +such questions as ``find the derivative'' of this function or ``find the (definite or +indefinite) integral'' of that function, and so on. This is all accomplished +by randomly choosing numbers from a specified interval and evaluating both +the user's and author's answer to the question; if they are close to each +other, then the user's answer is called correct. The system works pretty well. + +The \textsf{exerquiz} scheme does not perform well with such questions as +``fully simplify the radical \verb!sqrt(72)!,'' or ``factor the polynomial +\verb!2x^2-4x+2!;'' in both cases, the student can simply type in +the given expression and \textsf{exerquiz} will call them equal. Indeed +it is true that \verb!sqrt(72)! equates to \verb!sqrt(72)! and the polynomial \verb!2x^2-4x+2! +equates to \verb!2x^2-4x+2!, as is shown by evaluating randomly +selected numbers from an interval, \textsf{exerquiz}-style! + +\newtopic To illustrate, we use the problem of simplifying +\verb!sqrt{72}!. + +\begin{shortquiz}[simplfyIllus] +Simplify the following radial expression by factoring out all perfect squares. + +\newcommand{\Msgi}{"We are expecting a simplification of the radical."} +\newcommand{\Msgii}{"Write the simplification in standard form, numerical constants first."} + +\begin{questions} +\item Simplify $\sqrt{72}$ by factoring out all perfect squares. +\begin{equation*} + \sqrt{72} = \RespBoxMath{6sqrt(2)}{1}{.0001}{[0,1]}[{% + priorParse:\Array(nodec,% + \preDenyForm(% + /sqrt\refac{\reany+}\redigit+/,\Msgii),% + \preReqForm(% + /\rechrclass{+-}*\redigit+sqrt\refac{\reany+}/,\Msgi)% + ),% + postParse:\Array(\postDenyForm(/sqrt(\refac{72}|\refac{8})/)% + )% + }]\CorrAnsButton{6sqrt(2)}\kern1bp\sqTallyBox +\end{equation*} +\end{questions} +\end{shortquiz} +\noindent\texttt{Exerquiz} performs its magic by a combination of the +usual \textsf{exerquiz} processing and new pre- and post-parsing +techniques, where appropriate code is passed through of the ninth +parameter of \cs{RespBoxMath}. + +\newtopic The verbatim listing follows.\label{verbReqForm} +\begin{Verbatim}[numbers=left,xleftmargin=\amtIndent,fontsize=\small] +\item Simplify $\sqrt{72}$ by factoring out all perfect squares. +\begin{equation*} + \sqrt{72} = \RespBoxMath{6sqrt(2)}{1}{.0001}{[0,1]}[{% + priorParse:\Array(nodec,% + \preDenyForm(% + /sqrt\refac{\reany+}\redigit+/,\Msgii),% + \preReqForm(% + /\rechrclass{+-}*\redigit+sqrt\refac{\reany+}/,\Msgi)% + ),% + postParse:\Array(\postDenyForm(/sqrt(\refac{72}|\refac{8})/))% + }]\CorrAnsButton{6sqrt(2)}\kern1bp\sqTallyBox +\end{equation*} +\end{Verbatim} +It becomes a bit complicated here. \verb!:-)! The ninth parameter can take a +JavaScript object as its value (The object is opened on line~(3) with a left +brace (\verb!{!) and is closed in line~(11) with a right brace (\verb!}!). +This object has three properties: \texttt{comp} for defining the compare function +(not used in this example); \texttt{priorParse}, which is used to inspect the +user's input to filter out unwanted responses prior to evaluation; \texttt{postParse} is used +to look at the user's answer \emph{after} the \textsf{exerquiz} +evaluation of random points stage. At the \texttt{postParse} stage, it has already +been determined if the user's answer is correct or incorrect, \texttt{postParse} only applies +to answers that are \emph{correct}. + +\paragraph*{The \texttt{priorParse} property.} See also the (brief) description +of \texttt{priorParse} as part of the \hyperref[paraRespBoxNine]{ninth parameter}, +page~\pageref*{paraRespBoxNine}. There are new two built-in filter functions which +are accessed through the helper commands \cs{preDenyForm} and \cs{preReqForm}. As shown +in the verbatim text, they are both enclosed in \cs{Array()}. +\begin{itemize} + \item \cs{preDenyForm}: The idea behind this filter function is to define regular expressions + which if the pattern is present, processing would stop for the user input, and an alert + message would appear; that is, we \emph{deny} the user the use of certain defined patterns. + There is no penalty, the user has a chance to change his/her + answer. \cs{preDenyForm} takes up to two arguments, enclosed in parentheses: +\begin{Verbatim}[xleftmargin=\amtIndent,fontsize=\small] +\preDenyForm(regexp|array_regexps, cMsg) +\end{Verbatim} +The first argument is a regular expression or an array of regular expressions. +The second argument, \texttt{cMsg}, is a string that will be displayed in the alert +box if the pattern or patterns appear in the user's answer. + +When the first argument is an array of regular expressions, the same +message (\texttt{cMsg}) will appear if any one of the patterns is present. +The command may be repeated using additional regular expressions with different +warning messages. + +Let's have a look at the above example, +\begin{Verbatim}[numbers=left,firstnumber=4,xleftmargin=\amtIndent,fontsize=\small] +priorParse:\Array(nodec,% + \preDenyForm(% + /sqrt\refac{\reany+}\redigit+/,\Msgii),% + \preReqForm(% + /\rechrclass{+-}*\redigit+sqrt\refac{\reany+}/,\Msgi)% +),% +\end{Verbatim} +In line~~(4) we begin with \cs{Array} followed by \textsf{dljslib} filter function +\texttt{nodec}, this function denies the use of decimal numbers, it is important +in this problem but not our central focus. In line~(5) we begin with \cs{preDenyForm}, +the arguments are on line~(6). The correct answer is \texttt{6sqrt(2)}, we want +to force the student write the answer in this form, not, for example, as +\texttt{sqrt(2)6} or \texttt{sqrt(2)*6}, while correct, it bad form. (We will deny them bad form!) +This will deny them even if not correct, for example, if the student enters +\texttt{sqrt(3)4}. + +To make it easier on the document author, I've defined a series of ``helper commands,'' +and oh, by the way, you should know how to use regular expressions. Let's now examine +line~(6). First argument is a single regular expression, the second is a command that defines +the string message to be exhibited if this pattern is found (try it on the working example above +to see what the message is). + +Let's now look at the regular expression (\texttt{/.../} in line~(6). +\begin{Verbatim}[numbers=left,firstnumber=6,xleftmargin=\amtIndent,fontsize=\small] +/sqrt\refac{\reany+}\redigit+/ +\end{Verbatim} +We take each in turn. +\begin{itemize} + \item \texttt{sqrt\cs{refac(\cs{reany+)}}}: we search for the string \texttt{sqrt} + followed by the pattern \cs{refac(\cs{reany+)}}. \cs{refac} defines literal parentheses, within + these parentheses can by anything \cs{reany+}. The whole sequence expands + to the pattern `{\def\\{\eqbs\eqbs}\texttt{sqrt\refac{\reany+}}}'. + \item \cs{redigit+}: This command is a macro for one or more digits, it expands + to `{\def\\{\eqbs\eqbs}\texttt{\redigit+}}'. + \item Summarizing, we deny the student from typing in a square root of + anything followed by one or more digits. +\end{itemize} + +\item \cs{preReqForm}: This is the positive version of \cs{preDenyForm}. It uses +the same syntax +\begin{Verbatim}[xleftmargin=\amtIndent,fontsize=\small] +\preReqForm(regexp|array_regexps, cMsg) +\end{Verbatim} +The first argument is a regular expression or an array of regular expressions, the patterns +are ones that we wish to see in the user's answer. If the user's answer does not +fit into any of the patterns, an alert is emitted using the optional string +declared in the second argument, \texttt{cMsg}. The second argument is option, there +is a default, generic string message that will be shown. + +As with \cs{preDenyForm}, let's take a close look at the regular expression. +\begin{Verbatim}[xleftmargin=\amtIndent,fontsize=\small] +\rechrclass{+-}*\redigit+sqrt\refac{\reany+}/ +\end{Verbatim} +\begin{itemize} + \item \cs{rechrclass(+-)*} defines a character class consisting of the characters + `\texttt{+-}' the \texttt{*} means zero or more occurrences. (Probably I should use \texttt{?} instead of + \texttt{*}, + meaning 0 or 1 occurrences.) It expands to + `{\def\\{\eqbs\eqbs}\texttt{\rechrclass{+-}*}}'. + \item \cs{redigit+} describes one or more digits, this would expand to + `{\def\\{\eqbs\eqbs}\texttt{\redigit+}}'. + \item sqrt\cs{refac(\cs{reany+)}} is the same as before, it describes + the square root of anything expression. +\end{itemize} +\item[] The \cs{preReqForm} only searches for the specified patterns. For example, +the responses \texttt{sin(PI/2)6sqrt(2)} and \texttt{6sqrt(2)x} pass both the +\cs{preDenyForm} (no digits follow the square root), +and pass the \cs{preReqForm} because both answers have (or do not have) the patterns; +in the former case, the answer is judged correct, and in the latter case, incorrect. +You can try to improve the pattern like so +\begin{Verbatim}[xleftmargin=\amtIndent,fontsize=\small] +/\rebstr\rechrclass{+-}*\redigit+sqrt\refac{\reany+}\reestr/ +\end{Verbatim} +The \cs{rebstr} (begin string anchor) expands to `\texttt{\^}' and +represents the beginning of the line, while \cs{reestr} (end string anchor) +expands to `\texttt{\$}' represents the end of the line. In this case, the user's answer +is required to begin with an optional plus or minus, followed by one or +more digits, followed by a square root, followed by the end of the line. +\end{itemize} + +\newtopic Here is that same short quiz with the above changes (and \texttt{*} replaced by +\texttt{?}). + +\begin{shortquiz}[simplfyIllus1] +Simplify the following radial expression by factoring out all perfect squares. + +\newcommand{\Msgi}{"We are expecting a simplification of the radical."} +\newcommand{\Msgii}{"Write the simplification in standard form, numerical constants first."} + +\begin{questions} +\item $\sqrt{72}$ +\begin{equation*} + \sqrt{72} = \RespBoxMath{6sqrt(2)}{1}{.0001}{[0,1]}[{% + priorParse:\Array(nodec,% + \preDenyForm(% + /sqrt\refac{\reany+}\redigit+/,\Msgii),% + \preReqForm(% + /\rebstr\rechrclass{+-}?\redigit+sqrt\refac{\reany+}\reestr/,\Msgi)% + ),% + postParse:\Array(\postDenyForm(/sqrt(\refac{72}|\refac{8})/)% + )% + }]\CorrAnsButton{6sqrt(2)}\kern1bp\sqTallyBox +\end{equation*} +\end{questions} +\end{shortquiz} +Now try \texttt{sin(PI/2)6sqrt(2)} or \texttt{6sqrt(2)x}, and other aberrant variations. + +\paragraph*{The \texttt{postParse} property.} After the +\texttt{priorParse} stage, \texttt{exerquiz} checks the answer for correctness, +against the author's answer, using randomly selected numbers. After that comes +the \texttt{postParse} event. The syntax is the same except there is no warning +message. +\begin{Verbatim}[xleftmargin=\amtIndent,fontsize=\small] +\preReqForm(regexp|array_regexps) +\end{Verbatim} +If the user's \emph{answer is correct} at this stage \textit{and} fits +into one of the patterns as defined by the regular expressions, the answer +will then be marked wrong. + +Let's look at the post parse code for this example, from line~(10) +on page~\pageref*{verbReqForm}, we see, +\begin{Verbatim}[numbers=left,firstnumber=10,xleftmargin=\amtIndent,fontsize=\small] +postParse:\Array(\postDenyForm(/sqrt(\refac{72}|\refac{8})/))% +\end{Verbatim} +Even though there is not an array of filter functions, a filter function +with arguments must always be enclosed in an array. + +Within the array, we execute our \cs{postDenyForm}, it has only one +argument, a single regular expression: +\verb!/sqrt(\refac{72}|\refac{8})/!.\footnote{The use of alternation here is +not needed, an answer involving \texttt{sqrt(72)} would have been filtered out by the +\cs{preReqForm} filter, do you know why?} There are three ``correct +answers'' to this problem, they are \texttt{sqrt(72)}, \texttt{3sqrt(8)}, +and \texttt{6sqrt(2)}, this latter one being the only correct answer to +this question, for the instructions were to factor out \emph{all} perfect +squares. The regular expression here catches any answer containing +\texttt{sqrt(72)} or \texttt{3sqrt(8)} and marks it wrong. \verb!:-(! + +\paragraph*{List of RegExp helper macros.} +\begin{Verbatim}[xleftmargin=\amtIndent,fontsize=\small] +\def\refac#1{\\(#1\\)}\def\rediv{\\/}\def\repow{\\^} +\def\redigit{\\d}\def\rechrclass#1{[#1]}\def\reany{.} +\def\remul{[\\*]}\def\rebstr{\\^}\def\reestr{\\$} +\end{Verbatim} + +\exAeBBlogPDF{p=1020} Refer to the source file of +\texttt{\href{\urlAcroTeXBlog/?p=1020}{equiv\_expr.pdf}} for working +examples. Additional examples will (eventually) appear on the +\href{\urlAcroTeXBlog}{\AcroTeX{} Blog}. + + +\section{Randomizing the Multiple Choices}\label{s:random} + +Beginning with version~6.1 of \textsf{exerquiz}, the choices of a +multiple choice question can be randomized. The \texttt{random.tex} +macro file by Donald Arseneau is used for this purpose. + +%\exPDF{randomize} The demo file for this section is \texttt{randomize.tex}. + +\exAeBBlogPDF{p=901} The demo file for this section is +\texttt{\href{\urlAcroTeXBlog/?p=901}{randomize.pdf}}. + +\newtopic The randomization is only allowed if the \texttt{allowrandomize} +option of \textsf{exerquiz} is used; otherwise, no randomization +can occur. + +The randomization is only defined for choices listed between the +pair \cs{bChoices} and \cs{eChoices} (see \Nameref{bChoices}). The +command \cs{bChoices} now takes two optional key-value arguments: +\begin{itemize} + \item \texttt{nCols=\anglemeta{num}}: The number of columns to create, as described + on page~\pageref{bChoices}. You can also use the old style by specifying just + \anglemeta{num}. Thus, \cs{bChoices[nCols=2]} and \cs{bChoices[2]} + are equivalent. + \item \texttt{random=\anglemeta{\upshape true|false}}: Specify this option to randomize choices. + You can use the key word \texttt{random} instead of + \texttt{random=true}. For example, the following commands will randomize the + choices, \cs{bChoices[random]}, \cs{bChoices[nCols=2,random]}, or + \cs{bChoices[2,random]}. The default is to not randomize the + choices. +\end{itemize} + +\newtopic The following is an example of the \texttt{random} option of \cs{bChoices}. +\begin{Verbatim}[xleftmargin=\amtIndent] +\begin{shortquiz} +This is a quiz. +\begin{questions} + \item Try to guess the correct answer. + \begin{answers}{3} + \bChoices[nCols=2,random] + \Ans0 1 a choice\eAns + \Ans1\label{eq} 2 another choice\eAns + \Ans0 3 still another choice\eAns + \Ans0 4 another\eAns + \Ans0 5 incoming\eAns + \Ans0 6 more choices\eAns + \Ans0 7 another still\eAns + \Ans0 8 too many\eAns + \Ans0 9 choices\eAns + \eFreeze + \Ans0 10 None of these\eAns + \eChoices + \end{answers} +\end{questions} +\end{shortquiz} +\end{Verbatim} + +\newtopic Note the presence of the command \Com{eFreeze}. Any of +the items listed after \cs{eFreeze} are not randomized, and are +placed at the end of the list. So, for the example above, the first +nine items will be randomized, whereas, the last item (None of +these) will placed at the end of the list. + +\newtopic Additional, there are five other commands that support the +randomization feature.\settowidth{\aebdimen}{\ttfamily\string\saveRandomSeed\quad\string\inputRandomSeed}% +\begin{dCmd}[commandchars=!()]{\aebdimen+2\fboxsep+2\fboxrule} +\saveRandomSeed!quad\inputRandomSeed +\end{dCmd} + +\newtopic A pseudo-random sequence of numbers requires an initial \emph{seed +value}. The example file \texttt{random.tex} creates, by default, a +seed value based on the date and time (the number of minutes since +midnight); consequently, after every minute, the random sequence +will change. By setting the value of the count register \cs{randomi}, +the document author can also set the initial seed of the pseudo-random +sequence. + +The command \cs{saveRandomSeed} will write the last seed used in the +source file to an auxiliary file (\cs{jobname\_rt.sav}), while the +command \cs{inputRandomSeed} inputs the seed stored in the +\cs{jobname\_rt.sav} back into the beginning of the source file. +These two commands should be placed in the preamble. + +By invoking both of these commands, a new pseudo-random sequence will be generated +each time the source file is compiled. + +Assuming a \cs{jobname\_rt.sav} has already been created, by +invoking the command \cs{inputRandomSeed} only (and not +\cs{saveRandomSeed}), the seed already saved will be used for every +subsequent compiling of the source document. Using the same seed is +necessary in two situations: +\begin{enumerate} + \item When the quiz contains one or more \cs{label} commands, using the same + seed gives you the same sequence every time you latex the document. This will + give the auxiliary files a chance to come up to date so that any referencing of the label + will be accurate. + + \item When creating an online (or paper) quiz with randomization, which later you publish + the solutions to, it is important that the randomization for the + quiz document is the same as that for the solution document. By + using \cs{inputRandomSeed} (rather than \cs{save\-Ran\-dom\-Seed}), you + get the same sequence for the solution document (unless you modify the + source file, adding or removing questions that have randomization). +\end{enumerate} + +\newtopic\textcolor{red}{Things to look for:} If \textsf{exerquiz} is not rearranging the order +of the choices as you expect it to, it could be that +\textsf{exerquiz} is reading an old \texttt{.sav} file. Either delete that file +in your source folder, or comment out \cs{inputRandomSeed} in your document. + +\settowidth{\aebdimen}{\cs{useRandomSeed\darg{\meta{number}}}}% +\begin{dCmd}[commandchars=!()]{\aebdimen+2\fboxsep+2\fboxrule} +\useRandomSeed{!meta(number)} +\end{dCmd} + +\newtopic\indent You may have several sections of the same class take a quiz with the +questions rearranged for each. Save the seed value used by +\textsf{exerquiz} to randomize the choices for the class by opening the +\texttt{.sav} and by copying and pasting the line you see into your document; +for example, it could read \cs{randomi=132088850}, then use +\cs{useRandomSeed} with that seed value for that class as follows: +\begin{Verbatim}[xleftmargin=\amtIndent] +\useRandomSeed{132088850} % 11:00 class +% \useRandomSeed{634952429} % 12:30 class +\end{Verbatim} +Of course comment out \cs{inputRandomSeed}. + +\settowidth{\aebdimen}{\cs{obeyLocalRandomize}}% +\begin{dCmd}[commandchars=!()]{\aebdimen+2\fboxsep+2\fboxrule} +\turnOnRandomize +\obeyLocalRandomize +\end{dCmd} + +\newtopic\indent The command \cs{turnOnRandomize} overrides all local settings of \cs{bChoices} +and causes all choice lists to be randomized. While \cs{obeyLocalRandomize} +returns control to the local settings. For example, +\begin{Verbatim}[xleftmargin=\amtIndent] +\turnOnRandomize +... +\bChoices + \Ans...\eAns + \Ans...\eAns + ... +\eChoices +\end{Verbatim} +will cause the choice list to be randomized, even though the +\texttt{random} option was not specified. Whereas, in this code +\begin{Verbatim}[xleftmargin=\amtIndent] +\turnOnRandomize +... +\obeyLocalRandomize +... +\bChoices + \Ans...\eAns + \Ans...\eAns + ... +\eChoices +\end{Verbatim} +the choices will not be randomized, because the \texttt{random} +option was not specified; or they will be randomized if the +\texttt{random} option is used. + +\newtopic\textcolor{red}{Limitations:} There are natural limitations on the use +of \cs{bChoices} and \cs{eChoices} and consequently, there are +limitations on the randomization. The content between \cs{Ans} and +\cs{eAns} cannot have any verbatim text. This is usually not a +problem for mathematical content, but could be a limitation for +computer science where questions about syntax may be posed. I have +in mind a work-around, but haven't pursued the problem as of yet. + +\section{Creating a Quiz Summary Table}\label{s:sumrytbl} + +This feature is designed for a \texttt{quiz} (as opposed to a +\texttt{shortquiz}) and is probably most useful for a long quiz, spanning +several pages. The \cs{displaySumryTbl} command creates a table that summarizes +the user's effort for the quiz; \cs{displaySumryTbl} must follow the final +\verb!\end{questions}! and \emph{must be on a separate page} from the last question of the quiz. +An example of the generated table is shown below in \hyperref[fig:qzSumryTbl]{Figure~\ref*{fig:qzSumryTbl}}. + +\exAeBBlogPDF{p=377} The demo file for this section is +\texttt{\href{\urlAcroTeXBlog/?p=377}{sumry\_tbl.pdf}}, found +at the \href{\urlAcroTeXBlog}{\AcroTeX{} Blog}. + + +\Important The code for these commands are only input when the \textsf{exerquiz} option +\texttt{usesumrytbls} is taken. +\begin{Verbatim}[xleftmargin=\amtIndent,commandchars=!()] +\begin{quiz*}{!ameta(quiz_name)} +Solve each of the following. +\begin{questions} +\item... +... +\item... +\end{questions} + +\newpage %<--start new page +Before you complete your quiz by pressing `End Quiz', review the +list below. A check mark indicates that you responded to that +question; otherwise, you did not respond to the question. + +\begin{center} +\displaySumryTbl{\currQuiz} +\end{center} + +If you are satisfied with your answers, press `End Quiz' to +complete the quiz.\medskip + +\end{quiz*}\quad\ScoreField\currQuiz\CorrButton\currQuiz +\end{Verbatim} + +\begin{figure}[htb] +\begin{center} +\includegraphics{figures/sumrytbl} +\caption{Quiz Summary Table}\label{fig:qzSumryTbl} +\end{center} +\end{figure} + + +The table (as seen in \hyperref[fig:qzSumryTbl]{Figure~\ref*{fig:qzSumryTbl}}) shows a check mark for each question to +which the student gave a response. The student +can review the table, and optionally return to questions that had no response. + +\settowidth{\aebdimen}{\cs{displaySumryTbl[\ameta{KV-pairs}]\darg{\ameta{quiz\_name}}}} +\begin{dCmd}[commandchars=!()]{\aebdimen+2\fboxsep+2\fboxrule} +\displaySumryTbl[!ameta(KV-pairs)]{!ameta(quiz_name)} +\end{dCmd} +\newtopic\textbf{Parameter Description:} The second parameter is the quiz name of the quiz this table represents, +in most cases, \cs{currQuiz} is used. The first parameter consists of key-value pairs, these +are described below. + +\KVP The first parameter takes key-value pairs +\begin{enumerate} + \item\texttt{ntables} is a key that has a value of 1 or 2, the + default is determined by command \cs{smrytbl@ntables}, which is set to 2 in + this package. If \texttt{ntables=1} only one table is created, and + if \texttt{ntables=2} two tables are created, each containing half + the information, as seen in \hyperref[fig:qzSumryTbl]{Figure~\ref*{fig:qzSumryTbl}}. + \item \texttt{showmarkup}: If this switch is true, then markup fields are + created that will hold the number of points the student received for + each problem. The default is that there is no markup. Entering + \texttt{showmarkup} in the option list will generate the markup fields. + The code +\begin{Verbatim}[xleftmargin=\amtIndent] +\displaySumryTbl[ntables=1,showmarkup]{\currQuiz} +\end{Verbatim} + produces a single table with the points markup. + \item \texttt{nocorrections}: If this switch is true, corrections will not + be shown when the user presses the `End Quiz' button. Because of the + way this key is implemented, if \texttt{nocorrections} is true, then + it will be true for any ``duplicate table,'' that is, any table that + references the same quiz. +\end{enumerate} + +\newtopic When the user presses the `Corrections' button, the borders of the checkboxes +are colored, and if \texttt{showmarkup} is used, the points earned for each +problem are shown as well. + +When corrections are made, a red border indicates the answer is +wrong, a green border means the answer is correct, and a +blue border the question was answered incorrectly, but partial credit was +given. The colors are determined by the commands \cs{correctColor}, \cs{wrongColor}, +and \cs{partialColor}. These are ``global color'' that need to set in the preamble; +the quiz and shortquiz system uses the first two, change them will yield changes everywhere. +However, you can change the \cs{partialColor} as this is the only place it is used. +\begin{Verbatim}[xleftmargin=\amtIndent] +\newcommand\partialColor{color.blue} +\end{Verbatim} +This is a JavaScript color, if you redefined it to be a nonstandard color, for example, +this redefinition makes the partial credit color yellow. +\begin{Verbatim}[xleftmargin=\amtIndent] +\renewcommand\partialColor{["RGB", 1, 1, 0]} +\end{Verbatim} + +\Important The table must be on a different page from the questions +because there is an open page action that activates and populates the table +based on the user's responses. + +\newtopic Other related commands are +\begin{Verbatim}[xleftmargin=\amtIndent] +\renewcommand{\sumryTblQ}{Question} +\renewcommand{\sumryTblR}{Responded} +\renewcommand{\sumryTblP}{Page} +\end{Verbatim} +The above three commands form the column titles of the table. +\begin{Verbatim}[xleftmargin=\amtIndent] +\renewcommand{\sumrytablesep}{\space} +\end{Verbatim} +Sets the separation between the tables, in the case that two tables are generated. +\begin{Verbatim}[xleftmargin=\amtIndent] +\newcommand{\sumryTblProbFmt}[1]{\textbf{\textcolor{blue}{#1}}} +\end{Verbatim} +The above command sets the {\LaTeX} formatting of the problems, the +default is bold and blue, but may be redefined. + +\subsection{Placing the Quiz Summary Table Elsewhere} + +You may want the Quiz Summary Table in a +place other than the default location (after the final +\verb!\end{questions}! and before the `End Quiz'). There is no problem +putting it after the quiz and\emph{ before the next quiz}; +however, if you want to put the table up front (that is, in front of the quiz) for +whatever reasons, you need additional commands. + +\newtopic In the area just after \cs{end\darg{questions}} and before `End +Quiz,' place the command +\settowidth{\aebdimen}{\cs{writeProListAux}} +\begin{dCmd}{\aebdimen+2\fboxsep+2\fboxrule} +\writeProListAux +\end{dCmd} +\newtopic\indent This command saves to the auxiliary file the two pieces of information the +\cs{dis\-playSumryTbl} needs to build the table. Then, in the location of +your choice---usually outside of any quiz environment---enclose +\cs{displaySumryTbl} in the \texttt{sumryTblAux} environment. +\settowidth{\aebdimen}{\cs{displaySumryTbl[\ameta{KV-keys}]\darg{\ameta{quiz\_name}}}} +\begin{dCmd}[commandchars=!()]{\aebdimen+2\fboxsep+2\fboxrule} +\begin{sumryTblAux}{!meta(quiz_name)} +\displaySumryTbl[!ameta(KV-keys)]{!ameta(quiz_name)} +\end{sumryTblAux} +\end{dCmd} +\newtopic\indent Here, \ameta{quiz\_name} is the name of the quiz that this table represents. An example +of this environment follows. +\begin{Verbatim}[xleftmargin=\amtIndent] +\begin{sumryTblAux}{\currQuiz}\small %<--make a little smaller +\renewcommand{\sumryTblQ}{\sffamily\bfseries Question} +\renewcommand{\sumryTblR}{\sffamily\bfseries Answered} +\renewcommand{\sumryTblP}{\sffamily\bfseries Page} +\begin{center} + {\normalsize\sffamily\bfseries Quiz Summary Table}\\[3pt] + \displaySumryTbl[showmarkup]{\currQuiz} +\end{center} +\end{sumryTblAux} +\end{Verbatim} + + +%sumryTblAux + +\section{Bookmarking Exercises and Quizzes}\label{bmExQz} + +It is unlikely that anyone would use this feature: Bookmarking exercises +and quizzes. + +%\exPDF{bkmrk_eq} The demo file for this feature is \texttt{bkmrk\_eq.tex}. + +\exAeBBlogPDF{p=906} The demo file for this feature is +\texttt{\href{\urlAcroTeXBlog/?p=906}{bkmrk\_eq.pdf}}. + + +\subsection{For Exercises} + +This ``intelligent'' bookmarking system requires +the minimum of effort to use. For exercises, the command for bookmarking +is \Com{expdfbookmark}, +\settowidth{\aebdimen}{\cs{expdfbookmark\darg{\ameta{bookmark\_title}}}} +\begin{dCmd}[commandchars=!()]{\aebdimen+2\fboxsep+2\fboxrule} +\expdfbookmark{!ameta(bookmark_title)} +\end{dCmd} +\newtopic and should be placed immediately following the beginning of an +exercise environment, like so,\def\OR{\hspace*{-\amtIndent}\normalfont or,} +\begin{Verbatim}[xleftmargin=\amtIndent,commandchars=!()] +\begin{exercise}\expdfbookmark{!ameta(bookmark_title)} +!OR +\begin{exercise*}\expdfbookmark{!ameta(bookmark_title)} +\end{Verbatim} +or, in the case of exercises with parts, and you want to bookmark an +individual part to a question, place \cs{expdfbookmark} immediately +after the \cs{item}, like so +\begin{Verbatim}[xleftmargin=\amtIndent,commandchars=!()] +\item\expdfbookmark{!ameta(bookmark_title)} +\end{Verbatim} + +\newtopic Every bookmark title, \ameta{bookmark\_title}, has a +suffix defined with \Com{exbookmarkfmt} or +\Com{partbookmarkfmt}, depending on whether +the entry is for the top-level exercise, or one of its parts. +The default definitions are +\begin{Verbatim}[xleftmargin=\amtIndent] +\newcommand{\exbookmarkfmt}{\exlabel\space\theeqexno.\space} +\newcommand{\partbookmarkfmt}{(\thepartno)\space} +\end{Verbatim} +The command \cs{exlabel} expands to the language +dependent word for `Exercise', while \cs{theeqexno} expands to +the exercise number, and \cs{thepartno} to the part +letter. These commands can be redefined. + +\subsection{For Quizzes} + +To bookmark a \texttt{shortquiz} or \texttt{quiz}, use \Com{quizpdfbookmark}. +\settowidth{\aebdimen}{\cs{quizpdfbookmark\darg{\ameta{bookmark\_title}}}} +\begin{dCmd}[commandchars=!()]{\aebdimen+2\fboxsep+2\fboxrule} +\quizpdfbookmark{!ameta(bookmark_title)} +\end{dCmd} +\newtopic\indent It should be placed immediately following the beginning of the environments, +\def\OR{\hspace*{-\amtIndent}\normalfont or,} +\begin{Verbatim}[xleftmargin=\amtIndent,commandchars=!()] +\begin{shortquiz}\quizpdfbookmark{!ameta(bookmark_title)} +!OR +\begin{quiz}{!ameta(quiz_name)}\quizpdfbookmark{!ameta(bookmark_title)} +\end{Verbatim} + +\redpoint Unlike bookmarking for exercises, the bookmark command for quizzes does not +support bookmarking individual questions within the quiz. + +\newtopic Every bookmark title, \meta{bookmark\_title}, for a +\texttt{shortquiz} environment has a suffix defined with the +\Com{sqbookmarkfmt} command, the default definition is + +\begin{Verbatim}[xleftmargin=\amtIndent] +\newcommand{\sqbookmarkfmt}{Short Quiz \@shortquizCnt.\space} +\end{Verbatim} + +\newtopic The command \cs{@shortquizCnt} is a macro (not a counter) +that contains the current short quiz count. This command can be redefined. + +\newtopic Every bookmark title, \ameta{bookmark\_title}, for a \texttt{quiz} environment has a +suffix defined with the \Com{qzbookmarkfmt} command, the +default definition is + +\begin{Verbatim}[xleftmargin=\amtIndent] +\newcommand{\qzbookmarkfmt}{Quiz \@quizCnt.\space} +\end{Verbatim} + +\newtopic The command \cs{@quizCnt} is a macro (not a counter) +that contains the current quiz count. This command can be redefined. + +\redpoint \cs{quizpdfbookmark} interacts with the command \Com{titleQuiz}. +(for more information on this, see \hyperref[titleQuiz]{Section~\ref*{titleQuiz}} +and \hyperref[titleQuizSQ]{Section~\ref*{titleQuizSQ}}, pages~\pageref*{titleQuiz} +and~\pageref*{titleQuizSQ}, to learn about \cs{title\-Quiz} for quizzes and short quizzes, respectively.) When a quiz has +a defined title, as defined +by the \cs{titleQuiz}, and the argument of \cs{quizpdfbookmark} is left empty, +the value passed to \cs{titleQuiz} is used as the bookmark text. Thus, the code + +\begin{Verbatim}[xleftmargin=\amtIndent] +\titleQuiz{Differentiation Quiz} +\begin{quiz}{MyDiffQuiz}\quizpdfbookmark{} +... +\end{quiz} +\end{Verbatim} +will bookmark the quiz under the name ``Differentiation Quiz.'' + + +\subsection{Final Note} + +If the bookmarks for exercises, or parts of the exercises, or quizzes do not appear, +you may have to increase the \texttt{tocdepth}. Exerquiz sets this at +\verb!\setcounter{tocdepth}{5}!. + +\section{Extending \AcroT{} with \texttt{dljslib} and \texttt{insdljs}} + +The \textsf{exerquiz} Package, especially the math fill-in question, is quite +programmable. In this section, we discuss two methods of extending the +capabilities of the \AcroB: (1) through the use of the package \texttt{dljslib}, +which is a JavaScript library of extensions; (2) by writing your own custom +extensions using the \texttt{insdljs} package for inserting JavaScripts into the +PDF document. + +\subsection{Using the \texttt{dljslib} Package}\label{sss:dljslib} + +The \texttt{dljslib} Package is actually a ``library'' of JavaScript +functions. At the time of this writing, the library has JavaScripts that can +process answers to math fill-in questions where an \textit{equation} +or a \textit{vector} answer is expected. There is also a JavaScript compare +function that properly evaluates an answer when an indefinite integral is +expected. See the documentation that accompanies the package (by latexing +\texttt{dljslib.dtx}) for details of how to use the library. + +\redpoint For full documentation of \textsf{dljslib} package, see \Nameref{part:dljslib}. + +%\redpoint \textbf{Equation handling.} See the sample file \texttt{jqzequat.tex} for examples +%of posing and evaluating questions that expect an equation as the response. Below is +%a portion of the preamble of that file; basically, to use one or more of the JavaScripts in +%the JavaScript library, you specify that option \cs{usepackage} command for \texttt{dljslib} +%package. In this case, we want to process equations so type\dots +%\begin{Verbatim}[xleftmargin=\amtIndent] +%\documentclass{article} +%\usepackage{amsmath,amscd} +%\usepackage[tight,pdftex,designi,nodirectory]{web} +%\usepackage{exerquiz} +%\usepackage[equations]{dljslib} % <--choose equations +%\end{Verbatim} +% +%\redpoint \textbf{Vector Handling} There are also JavaScript functions for processing +%vector answers. See the sample file \texttt{jqzspec.tex}. Actually this file does not +%use the JavaScript library, but is more of a tutorial on how to use \cs{insdljs} to +%write custom JavaScripts to process \textsf{exerquiz} math fill-in questions. +% +%The preamble of that document could actually be replaced with\dots +%\begin{Verbatim}[xleftmargin=\amtIndent] +%\documentclass{article} +%\usepackage{amsmath,amscd} +%\usepackage[tight,dvipdfm,designi,nodirectory]{web} +%\usepackage{exerquiz} +%\usepackage[vectors,indefIntegral]{dljslib} +%\end{Verbatim} +%\noindent The \texttt{vectors} option specifies JavaScripts for processing +%vector questions. The option \texttt{in\-def\-In\-te\-gral} is also +%specified. This is because that in the file \texttt{jqzspec.tex} a +%comparison function is developed for properly evaluating questions +%in which an indefinite integral is expected. +% +%\redpoint \textbf{Comma Delimited Answers and Sets} The +%\texttt{setSupport} option of the \textsf{dljslib} Package +%provides basic support for math fill-in questions requiring a +%(unordered) list of comma delimited numerical or symbolic answers, +%or for a set. The demo and tutorial file is +%\texttt{set\_test.tex}. See that file for more details. +% +%\redpoint In addition to the two above mentioned sets of JavaScripts there are +%a couple of comparison functions, one for processing indefinite integrals (see +%\texttt{dljs\_ex.tex}), and the other for using relative absolute error rather +%than absolute error. Again, see the documentation of \texttt{dljslib.dtx} and +%the sample file \texttt{jqzspec.tex}. + +\subsection{Using the \texttt{insdljs} Package} + +With the \texttt{insdljs} package you can write your own JavaScript functions +right in the \LaTeX{} source file. These custom JavaScripts are then inserted +into the section of the PDF document where the document level JavaScripts +reside. This package is a stand-alone package, and does not need \textsf{exerquiz}, +though \textsf{exerquiz} now uses this package to insert its JavaScripts into +the document. + +\redpoint Refer to \href{\bUrl/eformman.pdf}{eformman.pdf} +(relative link \href{eformman.pdf}{eformman.pdf}) for the \textsf{insdljs} and the \textsf{eforms} +documentation. Also, see the sample file \texttt{insdljs\_ex.tex} +for examples that do not use \textsf{exerquiz}, and the file +\texttt{jqzspec.tex}, for examples that does use \textsf{exerquiz}. + +\section{Submitting a \protect\texttt{quiz} to a Web Server} + +Quizzes created by the \texttt{quiz} environment are entirely self-contained. +They function within the Web browser (or from within the Adobe Reader) and +do not communicate with any server. This kind of quiz is ideal for a +do-it-yourself tutorial system, read by a well-motivated student who has the +discipline to read the material and to take the quizzes in the spirit in which +they are given. + +However, some educators, myself included, may wish to use the quizzes created +by the \texttt{quiz} environment for classroom credit. It is necessary, +therefore, for the student to be able to submit quiz results to a Web server +which, in turn, should store the results to a database. + +In this section we discuss techniques of turning the quiz into something that +can be submitted to a server. + +\redpoint I have released the \textsf{eq2db} Package, a {\LaTeX} macro package and +server-side script to process \textsf{exerquiz} quizzes. See \Nameref{eq2db}. + +\subsection{Technical Info for ``Do It Yourself''}\label{DIY} + +All one really has to do is to redefine the `End Quiz' link or button to +submit the results of the quiz to the Web server and CGI of your choice. Since +the quiz itself is scored, (optionally) marked, with (optional) answers and +solutions provided, the CGI simply stores the quiz results to a database. + +\subsubsection{Redefining `End Quiz'} + +I've written the `End Quiz' link (button) to have various +programming hooks available to the developer. +The following code is common to both \cs{eq@EndQuizLink} and +\cs{eq@EndQuizButton}, the macros that control the action of +the end quiz link and button, respectively. +\begin{Verbatim}[xleftmargin=\amtIndent] +if (\minQuizResp(\thequestionno)) {\r\t + var f = this.getField("ScoreField.\curr@quiz");\r\t\t + if ( f != null )\r\t\t\t + this.getField("ScoreField.\curr@quiz").value + =(\eq@QuizTotalMsg);\r\t\t + \eq@submitURL + resetQuiz("\curr@quiz")\r\t +} +\end{Verbatim} + +\redpoint The code is a mixture of \LaTeX{} macros and JavaScript. +You can see from this code, that there is a submit hook macro +provided, \cs{eq@submitURL}. Normally, this macro has a definition +of \cs{@empty}. A developer needs only redefine this macro +accordingly; one would use the Acrobat JavaScript method +\texttt{this.submitForm()} to do this. See the \textit{Acrobat JavaScript +Scripting Reference} \cite{tech:AcroJS} for more detail about this +method. + +\redpoint The code flow above is as follows: (1) Execute this code if the +threshold has been met. (See \nameref{threshold}.) The text macro +\cs{curr@quiz} holds the base name of the current quiz. + +(2) If the field \texttt{"ScoreField.\cs{curr@quiz}"} exists, then +write the student's score to that field. (This is the ``Score: 2 +out of 3'' that you see in the demo quizzes.) + +(3) We then submit with the macro \cs{eq@submitURL}. (This would +do nothing if its value is \cs{empty}, the default value.) At this +point we call a \texttt{resetQuiz("\cs{curr@quiz}")} which +sets some values in an array to indicate the state of this quiz. + +\subsubsection{Gathering ID Information with +\texorpdfstring{\protect\cs{textField}}{\textbackslash textField}} + +\redpoint What kind of information would one submit to a CGI? +Well, there is the usual information concerning the identity of +the student (Name, SSN, etc.) and the course, section and so on. + +This basic information can be gathered from the student by +inserting text fields into the document to be filled in. \textsf{Exerquiz} +provides the macro \cs{textField}\footnote{You can also use hyperref's +\cs{TextField} command for this purpose as well.} for this purpose. +For example, +\begin{Verbatim}[xleftmargin=\amtIndent] +\newcommand\FirstName[2]{\textField + [\DV{First Name}\textFont{TiRo}\textSize{10}\textColor{0 0 1}] + {IdInfo.Name.First}{#1}{#2}} +\end{Verbatim} +\noindent This defines a text field with a name of \texttt{"IdInfo.Name.First"}, the two +arguments are the width and height of the field that you want to create. E.g., +\begin{Verbatim}[xleftmargin=\amtIndent] +\FirstName{100pt}{10pt} +\end{Verbatim} +\noindent creates a text field 100pt wide and 10pt high. + +The \cs{textField} macro takes four parameters. +\begin{Verbatim}[xleftmargin=\amtIndent] +\textField[#1]#2#3#4 +\end{Verbatim} +\noindent The first (optional) parameter can be used to custom +design the field; the second is the name of the field; the third +and fourth are the width and height of the field desired. + +\redpoint See the file \texttt{eqformman.tex} on {\cAcroT} \textsf{eForm} +support for complete documentation on +\cs{textField}. + +\subsubsection{Gathering Quiz Specific Information with +\texorpdfstring{\protect\cs{eqSubmit}}{\textbackslash eqSubmit}} + +In addition to ID information on the one taking the quiz, +specific information about what quiz is being taken and where the +results of the quiz are to be stored are needed as well. + +\textsf{Exerquiz} provides a basic macro, called \cs{eqSubmit} +that can be used to gather basic formation of this type. The definition +of it and related commands are given below: +\begin{Verbatim}[xleftmargin=\amtIndent] +\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{Verbatim} + +\noindent The meaning of the parameters are self-explanatory. + +Just prior to the quiz you can type: +\begin{Verbatim}[xleftmargin=\amtIndent] +\eqSubmit{http://www.myschool.edu/cgi-bin/myCGI.cgi}% + {CalcIII}{Quizzes} +\begin{quiz*}{Quiz3} Answer each of the following. +\begin{questions} +... +... +\end{questions} +\end{quiz*}\quad\ScoreField\currQuiz\CorrButton\currQuiz + +\noindent +Answers: \AnswerField\currQuiz +\end{Verbatim} + +\redpoint Any redefinition of \cs{eq@submitURL} would then +include the values of some or all of these text parameters: +\begin{Verbatim}[xleftmargin=\amtIndent] +\eq@CGI, \db@Name, \db@Table, \curr@quiz +\end{Verbatim} +\noindent The last text macro is not gathered by \cs{eqSubmit}, it +is known, however, at the time \cs{eq@submit\-URL} is expanded. + +\subsubsection{Some Variables to Submit} + +When you submit a quiz to a server, the values of \textit{all} +fields are also submitted, unless you define specifically which +fields are to be submitted. + +In addition to the ID info, you would like also to submit the results +of the quiz itself. The relevant variables are as follows: +\begin{questions} + \item The JavaScript variable \texttt{Score} has the number of + correct responses as its value. + \item The \LaTeX{} counter variable \cs{thequestionno} has the count + of the total number of questions in the quiz. + \item The JavaScript array \texttt{Responses} contains the responses of + the student: multiple choice and fill-in responses. The contents of this + array can be converted to a comma-delimited string by using the + \texttt{toString()} method, \texttt{Responses.toString()}. +\end{questions} + +\noindent Now, how does one submit these values? The \cs{eq@submitURL} +command can be used not only to submit the data, but to also +populate certain \textit{hidden} fields with this information. The +hidden data is submitted along with the ID info to be processed. +You can use the \cs{textField} to create hidden text fields for +this purpose. See the next section for a discussion of how to create +hidden text fields. + +\subsection{Features \protect\textit{apropos} to Submitting} + +%\subsubsection{\texorpdfstring{\protect\cs{RespBoxEssay}} +%{\textbackslash RespBoxEssay}: The Essay Question} +% +%Some disciplines make heavy use of the essay question. In an effort to +%expand \textsf{exerquiz} to this question type, the \cs{RespBoxEssay} +%question has been defined. +% +%The syntax is +%\begin{Verbatim}[xleftmargin=\amtIndent] +%\RespBoxEssay[] +%\end{Verbatim} +%The default width of is \cs{linewidth} and the default height is +%\verb+6\baselineskip+. For example, +% +%\begin{oQuestion}{bioNewton} +%\redpoint Sketch the biography of Isaac Newton:\par +%\RespBoxEssay[\rectH{3\baselineskip}]\par\smallskip +%\end{oQuestion} +% +%This type of question is not evaluated by JavaScript, but is meant +%to be submitted to a CGI for storage in a database. Later, the +%instructor can review the essay answer. + +\subsubsection{Assigning Points} + +See \Nameref{sss:asignPts} for information on this subject. + +\subsubsection{\texorpdfstring{\protect\cs{NoPeeking}} +{\textbackslash NoPeeking}}\label{sss:nopeek} + +If you execute the command \cs{NoPeeking} in the preamble of your +document, or prior to a \texttt{quiz}, then any quiz question with +solution will be protected somewhat from prying eyes. + +In this case, an open page action is placed on the first page of +each solution. If the user (student) tries to view a quiz solution +before doing the quiz, the \textcolor{blue}{Adobe Reader} will +automatically change the page to the page containing the quiz and +place an alert box on the screen saying that viewing the solution +before taking the quiz is not permitted. + +To resort to the default behavior, use the \cs{AllowPeeking} +command. + +The previous \texttt{quiz} has been surrounded with a +\cs{NoPeeking}/\-\cs{AllowPeeking} pair. If you go to one +of the \hyperlink{knuth}{solutions} to that quiz, you will see +what happens. If nothing interesting happens, read the next +red point. + +\redpoint Protection is removed when you click on `End Quiz' and +restored when you click on some `Begin Quiz'. + +\section{Functions and Syntax supported by \textsf{Exerquiz}} + +In addition to the JavaScript built in math functions, exerquiz defines a number +of other functions useful in mathematical work. These functions are typically input +in a math question created by \cs{RespBoxMath}, for example, or in the function input +field of an {\AcroFLeX} document.\footnote{The {\AcroFLeX} Graphing Bundle, +\url{http://www.math.uakron.edu/~dpstory/acroflex.html}} + +Exerquiz also has its own syntax for entering algebraic expression in the +\cs{Resp\-Box\-Math} field, these are document here as well. + +\subsection{Functions supported by \textsf{Exerquiz}} + +The following functions are built-in to JavaScript: + +\setlength{\extrarowheight}{1mm} +\setlength{\tabcolsep}{2mm} + +\noindent\begin{longtable}{@{}>{\ttfamily}lp{2.8in}>{\PBS\raggedright}p{1.5in}} +\hline +\multicolumn{1}{@{}l}{Function}&\multicolumn{1}{l}{Description}&\multicolumn{1}{l}{Usage}\\ +\hline +\endfirsthead +\hline +\multicolumn{1}{@{}l}{Function}&\multicolumn{1}{l}{Description}&\multicolumn{1}{l}{Usage}\\ +\hline +\endhead +\hline +\endfoot +abs\textrm{, }|$\cdot$| & absolute value function, preferred form, \texttt{|$\cdot$|} & \texttt{|-3|=3}, \texttt{|x|}\\ +sin & the sine function & \texttt{sin(pi/2)=1}, see the definition of \texttt{pi} below\\ +cos & the cosine function & \texttt{cos(1.5)}, \texttt{cos(2*x)}\\ +tan & the tangent function & \texttt{tan(pi/4)=1}\\ +asin& inverse sine function & \texttt{asin(x)}\\ +acos& inverse cosine function & \texttt{acos(.2)}\\ +atan& inverse tangent function& \texttt{atan(-4)}\\ +exp & the natural exponential function, this function is also implemented as a \verb!e^x!, + where \texttt{e} is the natural number & \texttt{exp(-.5)}, \texttt{exp(-x\string^2)}\\ +log & the common logarithm. In JavaScript log is the natural logarithm, \textsf{exerquiz} + redefines this to be the common logarithm, use \texttt{ln} for natural logarithm & \texttt{log(10)=1}\\ +sqrt & the square root function & \texttt{sqrt(4.5)}\\ +ceil & the \texttt{ceil} function, \texttt{ceil(x)} is the smallest integer greater than or equal to \texttt{x} & +\texttt{ceil(4.5)=5}\\ +floor&the \texttt{floor} function, where \texttt{floor(x)} is the largest integer less than or equal to \texttt{x} & +\texttt{floor(4.5)=4}\\ +max & the maximum between two numbers & \texttt{max(2, 3.4) = 3.4}\\ +min & the minimum between two numbers & \texttt{max(2, 3.4) = 2}\\ +random & a pseudo-random number generator, this function is used internally by \textsf{exerquiz}, and is + available to users, \texttt{random()} returns a number between 0.0 and 1.0 & \texttt{random()}\\ +round & a rounding function, rounds a number to the nearest integer + & \texttt{round(4.5)= 5}, \texttt{round(-3.3)=-3} +\end{longtable} + +\bigskip + +\newtopic The next set of functions are defined by \textsf{exerquiz}. + +\noindent\begin{longtable}{@{}>{\ttfamily}lp{2.8in}>{\PBS\raggedright}p{1.5in}} +\hline +\multicolumn{1}{@{}l}{Function}&\multicolumn{1}{l}{Description}&\multicolumn{1}{l}{Usage}\\ +\hline +\endfirsthead +\hline +\multicolumn{1}{@{}l}{Function}&\multicolumn{1}{l}{Description}&\multicolumn{1}{l}{Usage}\\ +\hline +\endhead +\hline +\endfoot +cot & the \texttt{cotangent} function & \texttt{cot(1)}\\ +sec & the secant function & \texttt{sec(2)}\\ +csc & the \texttt{cosecant} function & \texttt{csc(2)}\\ +arcsin & the inverse sine function, same as \texttt{asin} & \texttt{arcsin(.5)}\\ +arccos & the inverse cosine function, same as \texttt{acos} & \texttt{arccos(-.5)}\\ +arctan & the inverse tangent function, same as \texttt{atan} & \texttt{arctan(1)}\\ +ln & the natural logarithm & \texttt{ln(3.4)}\\ +sinh & the hyperbolic sine function & \texttt{sinh(0)}, \texttt{sinh(x)}\\ +cosh & the hyperbolic cosine function & \texttt{cosh(0)}, \texttt{cosh(x)}\\ +tanh & the hyperbolic tangent function & \texttt{tanh(x)}\\ +coth & the hyperbolic cotangent function & \texttt{coth(x)}\\ +sech & the hyperbolic secant function & \texttt{sech(x)}\\ +csch & the hyperbolic cosecant function & \texttt{csch(x)}\\ +asinh & the inverse hyperbolic sine function & \texttt{asinh(0)}, \texttt{asinh(x)}\\ +acosh & the inverse hyperbolic cosine function & \texttt{acosh(0)}, \texttt{acosh(x)}\\ +atanh & the inverse hyperbolic tangent function & \texttt{atanh(x)}\\ +acoth & the inverse hyperbolic cotangent function & \texttt{acoth(x)}\\ +asech & the inverse hyperbolic secant function & \texttt{asech(x)}\\ +acsch & the inverse hyperbolic cosecant function & \texttt{acsch(x)}\\ +sgn & the sign function, \texttt{sgn(x)} is -1 if \texttt{x} is negative, 1 if \texttt{x} is positive, and 0 of +\texttt{x} is zero + & \texttt{sgn(-3.2) = -1} \\ +cis & the polar representation of a complex number, + $\operatorname{cis}(\theta)=\cos(\theta)+\imath\sin(\theta)$. This function + is only defined if the \texttt{complex} option of \textsf{dljslib} is used. + & \texttt{cis(pi/3)} +\end{longtable} + +\bigskip + +\newtopic There are several other \textsf{exerquiz}-defined +functions that are available through options of the +\textsf{dljslib}, these are \texttt{C} (combinations), \texttt{P} +(permutations), and \texttt{fact} (permutations). See the section +titled \Nameref{extNumerFuncs} for details. + +\paragraph*{Recognized Constants.} \textsf{Exerquiz} recognizes +\texttt{PI} and \texttt{pi} as symbols for the mathematical constant +$\pi\approx \text{3.14159}$. The letter \texttt{e} is recognized as +the natural number, which is approximately 2.7182818285. + +\subsection{Syntax supported by \textsf{Exerquiz}} + +\textsf{Exerquiz} attempts to make entering mathematics as easy and +as natural as using a modern calculator. The following paragraphs +outline the syntax of \textsf{exerquiz}. Authors should reproduce +some form of these rules to their students, and perhaps some +practice documents for them to test themselves with. + +\paragraph*{Grouping.} Algebraic expressions are grouped with +matching parentheses~\texttt{(\,)}, brackets~\texttt{[\,]}, or +braces~\texttt{\{\,\}}. + +\paragraph*{Spaces.} When the user enters a math expression, all +spaces are removed before parsing of the expression begins. +Students can write \texttt{1+(2+3)} or \texttt{1 + ( 2 + 3 )}, these +are the same. + +\paragraph*{Addition and Subtraction.} These operations are +performed using \texttt{+} and \texttt{-}, as expected. For example, +\texttt{(x+1)-(x-2)}, \texttt{x+sin(x-pi)} + +\paragraph*{Multiplication and Division.} These operations are +performed using \texttt{*} and \texttt{/}, as expected. For example, +\texttt{2*x*(3*x+1)} and \texttt{(2*x-1)/(2*x+1)}. + +The use of the multiplication (\texttt{*}), is required, by default, +and its use can be very tedious to the student. If you include the +\textsf{dljslib} package with the \texttt{ImplMulti} option, +\texttt{exerquiz} automatically inserts the multiplication symbol +(\texttt{*}). The examples above, can be written as +\texttt{2x(3x+1)} and \texttt{(2x-1)/(2x+1)}; it is recommended, +therefore, that the \texttt{ImplMulti} option should normally be +used. (Note: The use of \texttt{*} is still correct even when +\texttt{ImplMulti} option is in effect.) + +\paragraph*{Powers and Exponents.} \textsf{Exerquiz} uses +\texttt{\string^} to indicate exponents, for example, +\texttt{x\string^2} means $x^2$. Other examples are \verb!17^(x+1)!, +\verb!(x^2+1)^3!, \verb!(sin(x))^3!, and \verb!(x+1)^(2x+1)!. + +Recall that the letter \texttt{e} is recognized as the natural +number, so \verb!e^{-x^2}! is the same as \verb!exp(-x^2)!. +Normally, the use of \texttt{e} is preferred by students over the +use of \texttt{exp}. For work in elementary mathematics, the +existence of \texttt{exp} need not be even mentioned to the +students. + +The difficulty of entering powers of functions is another issue for +students. As illustrated above, in entering \verb!(sin(x))^3! or +more complex expression, students find a source of difficulty, pain, +and anguish. \textsf{Exerquiz} allows entering powers in the +calculator style, the student can enter \verb!sin(x)^3! for +$(\sin(x))^3$ (often written as $\sin^3(x)$) or \verb!3^sin(x)! to +mean $3^{\sin(x)}$. Expressions like \verb!2^2^3! are interpreted as +\verb!(2^2)^3! (the typeset version is $(2^2)^3$), which evaluates +to 64. The use of parentheses is needed if the desired expression is +$2^{2^3}$; this expression needs to be typed as \verb!2^(2^3)!, +which evaluates to 256. + +If the \texttt{ImplMulti} option of the \texttt{dljslib} package is +in effect, powers of functions can be entered in a more +mathematically traditional, for example \verb!sin^2(x)! is +recognized as the same as \verb!sin(x)^2!, or \verb!(sin(x))^2!; +consequently, \verb!sin^2(x)^2! is the same as \verb!sin(x)^4!! + +\part{The \protect\textsf{eq2db} Package}\chgCurrLblName{The \textsf{eq2db} Package}\label{eq2db} + +\newtopic +As the name suggests, Converts a self-contained exerquiz quiz to one that is +submitted to a server-side script. The {\LaTeX} package itself does very +little other than to define some useful commands that make it easy to convert +a self-contained quiz into one that is submitted to server-side script. + +The \texttt{eq2db} currently has several options, including \texttt{eqRecord}, \opt{eqText}, +\opt{eqEmail}, and \opt{submitAs}. +\begin{Verbatim}[xleftmargin=\amtIndent,commandchars=!()] +\usepackage[eqText,submitAs=!anglemeta(!upshape(FDF|HTML))]{eq2db} +\end{Verbatim} +The option \texttt{eqText} and \texttt{submitAs=FDF} sets up the quiz to use +an ASP (Active Server Page) that I have written. This ASP, named naturally, +\texttt{eqRecord.asp}, takes the data and stores it to a database, such as +Microsoft Access. + +%You can also submit your form data as HTML, as the two websites +%demonstrate.\footnote{These websites were prepared as a script demonstration +%site that is referenced in my yet-to-be submitted book \AEBBook~\cite{book:AEBB}.} +%\begin{quote} +%\url{http://faculty.nwfsc.edu/web/math/storyd/dps/} +%\end{quote} +%The above web page is on a \app{Windows} server hosted by Northwest Florida State +%College (NWFSC). The server-side +%script is written as ASP pages using VBScript. + +There is a website that you can experience submitting form data from a +PDF.\footnote{This website was prepared as a script demonstration site that +is referenced in my yet-to-be submitted book \AEBBook~\cite{book:AEBB}.} +\begin{quote} +\url{http://www.acrotex.net/dps/} +\end{quote} +This web page is on a \app{Linux} server hosted by {\AcroTeX.Net}. The +server-side script is written with PHP. + +\redpoint In recent years, the browser technology has evolved in an unwelcome +direction. Most web browsers do not support the Adobe Reader plug-in, hence, +Reader no longer appears in the browser window, so essential for a good user +experience. Most browsers use their own `native' PDF viewer, which does +respond to links, but knows nothing about JavaScript. The only browser, as of +this writing, that still supports the Adobe Reader plug-in (or ActiveX) is +Microsoft Internet Explorer~11. For online, interactive work with PDF, the +document consumer must use Microsoft Internet Explorer~11. + +\redpoint For more details, see the package documentation, +\texttt{eq2dbman.pdf}.\footnote{The absolute URL is +\url{\bUrl/acrotex/eq2dbman.pdf}} The \textsf{eq2db} package is available +from CTAN (\url{ctan.org/pkg/eq2db}).\endredpoint + + +\part{{\AcroT} \protect\textsf{eForm} Support} + +\newtopic +In this document, we describe the support for form elements in an +{\cAcroT} document. The PDF Specifications indicate there are four +different categories of fields for a total of seven types of +fields. + +\begin{questions} +\setbox0=\hbox{(d)} +\def\I#1{\makebox[\wd0]{\color{blue}(\hfil#1\hfil)}\ } + + \item \textbf{Button Fields} + \begin{description} + \item[\I{a}] \textbf{Push Button} + \item[\I{b}] \textbf{Check Box} + \item[\I{c}] \textbf{Radio Button} + \end{description} + \item \textbf{Choice Fields} + \begin{description} + \item[\I{a}] \textbf{List Box} + \item[\I{b}] \textbf{Combo Box} + \end{description} + \item \textbf{Text Fields} + \item \textbf{Signature Fields} + +\end{questions} +The {\cAcroB} does not support \textit{signature fields}, this +leaves six types of fields. Commands for creating each of the +remaining six types will be discussed. + +The \pkg{hyperref} Package (Rahtz, Oberdiek \textit{et al}) +provides support for the same set of form fields; however, not all +features of these fields can be accessed through the +\pkg{hyperref} commands. I was determined to write my own set +of commands which would be sufficiently comprehensive and +extendable to suit all the needs of the \cAcroB. All the quiz +environments have been modified to use this new set of form +commands, in this way, there is a uniform treatment of all form +fields in \cAcroB. + +\redpoint The documentation for \textsf{eForm} support is too voluminous +to include in this already voluminous document. See +\href{\bUrl/eformman.pdf}{eformman.pdf} (relative link +\href{eformman.pdf}{eformman.pdf}) for complete details. + + +\part{The AeB JavaScript Library}\label{part:dljslib} + +\newtopic +The \textsf{dljslib} package---document level JavaScript +library---is a companion to \textsf{exerquiz} and utilizes +\textsf{insdljs} package. It is a library of JavaScript code that +can be referenced in the preamble of a {\LaTeX} document, the code +is then extracted from the package files, and inserted into the {\LaTeX} +source using the \texttt{insDLJS} environment. + +The code belonging to the library supports the processing +of the quizzes and short quizzes produced by \textsf{exerquiz}; they +extend the capabilities of the core features of the +\textsf{exerquiz} quizzes. Many of the JavaScript functions in the +library were contributed by users of AeB. + +\newtopic My deep appreciation goes out to the contributors to the AeB JavaScript library. +\begin{itemize} + \item The options \texttt{unordered}, \texttt{factors}, + \texttt{point} and \texttt{intervals} were written by Dr. Bruce Wagner + for an online grading system developed by Drs.\ Bruce Wagner and David + Arnold, and Mr.~Jacob Miles-Prystowsky. Dr. Robert Marik contributed to the \texttt{intervals} option, as well. + \item The options \texttt{nodec}, \texttt{noBinFact} and \texttt{combinatorics} were contributed by + Ross Moore and Frances Griffin, and were developed for their + \href{http://rutherglen.ics.mq.edu.au/~macqtex/}{MacQ\TeX} + online testing system.\footnote{\url{http://rutherglen.ics.mq.edu.au/~macqtex/}} +\end{itemize} +The AeB JavaScript library continues to accept contributions from AeB developers. + +\section{Usage and Options} + +As with all {\LaTeX} package, you use \textsf{dljslib} as follows, +\begin{Verbatim}[xleftmargin=\amtIndent,commandchars=!()] +\usepackage[!ameta(options)]{dljslib} +\end{Verbatim} +where \ameta{options} is a comma-delimited list of options. With each of the +\ameta{options}, the associated JavaScript code is brought into the {\LaTeX} +source document. The JavaScript functions, then, are available to your +\textsf{exerquiz} quizzes. + +A list of the \ameta{options} of the \textsf{dljslib} package are listed below, +and each are described in detail in the sections that follow. +\begin{enumerate} +\item \texttt{ImplMulti}: Use this option to allow implied multiplication, e.g., the user can input + \texttt{2xsin(x)} instead of \texttt{2*x*sin(x)}. See \Nameref{ImplMulti}. +\item \texttt{equations}: Use this option to process questions that take an equation as an answer. + See \Nameref{equations}. +\item \texttt{vectors}: Use this option to process questions that take a vector as an answer. + See \Nameref{vectors}. +\item \texttt{setSupport}: Use this option to process questions that take a set as an answer. + See \Nameref{setSupport}. +\item \texttt{unordered}: Use this option to process questions that take an unordered list as an answer. + See \Nameref{unordered}. +\item \texttt{factors}: Use this option to process questions that take a factored form of a polynomial. + See \Nameref{factors}. +\item \texttt{point}: Use this option to process questions that take an ordered pair $(x,y)$ as an answer. + See \Nameref{point}. +\item \texttt{intervals}: Use this option to process questions that take an interval, or a union of intervals + as an answer. See \Nameref{intervals}. +\item \texttt{indefIntegral}: Use this compare function when evaluating the response to an indefinite integral. + See \Nameref{indefIntegral}. +\item \texttt{nodec}: Use this filter function to deny the use of decimal numbers in an answer. + See \Nameref{nodec}. +\item \texttt{noBinFac}: User this filter function to deny the use of \texttt{combinatorial} functions. + See \Nameref{noBinFac}. +\item \texttt{limitArith}: Use any of this collection of filter functions to limit the use of arithmetic operations + in an answer. See \Nameref{limitArith}. +\item \texttt{combinatorics}: Use this option to add combinatorial functions. The user may use these in an answer, + unless denied by the \texttt{noBinFact} filter. + See \Nameref{combinatorics}. +\end{enumerate} + +\newtopic For a document author that is building a system of quizzes and who regularly +uses a subset of these options, sets of options can be grouped +together into a custom option. Use the \texttt{libcusopt.opt} file +to declare your own sets of options. These declarations should be a +combination of existing options. For example, The declarations in the +\texttt{libcusopt.opt} file +\begin{Verbatim}[xleftmargin=\amtIndent] +\DeclareOption{procrespgrp}{\includeOptions{% + vectors,setSupport,equations,intervals,limitArith,% + unordered,point,factors,ImplMulti} +} +\end{Verbatim} +creates a new option for \textsf{dljslib} called +\texttt{procrespgrp} which bundles together all frequently used +options. The file \texttt{libcusopt.opt} can be placed in the +{\LaTeX} search path, but it's perhaps best to put it in your source +file, so that the options are local to that folder. The command +\cs{includeOptions} is defined in the \textsf{insdljs} package. + +%\exPDF{dljslib_apw} A sample \texttt{libcusopt.opt} is distributed with the {\AEB}, +%this sample file consists of the example given above, and is used +%by the sample file \texttt{dljslib\_apw.tex}, which can be found in the folder \texttt{dljslib\_examples}. + +\exAeBBlogPDF{p=959} A sample \texttt{libcusopt.opt} is distributed with the +{\AEB}, this sample file consists of the example given above, and is used by +the sample file \texttt{\href{\urlAcroTeXBlog/?p=959}{dljslib\_apw.pdf}}. + + + + +\newtopic The JavaScript functions are organized into five categories: +\begin{questions} + \item \nameref{piExt} are support functions whose capabilities are built + into the core \textsf{exerquiz} package. When \textsf{exerquiz} detects the presence of these + support functions, it utilizes them seamlessly. + \item \nameref{respfunc} are functions the take over the task of processing the user input. Discussion + of these functions begins on page~\pageref*{respfunc}. + \item \nameref{compareFuncs} are functions that perform the comparison between the author's answer + and the student's answer. Based on this comparison, the student's answer is judged correct or not. + Refer to page~\pageref*{compareFuncs} for the compare functions. + \item \nameref{filterUserResp} are functions that are called immediately after the user + commits the response. A filter function can examine the response before passing it on to + the response function. The filter function can cancel the user input if the input does not + meet certain criterion. The filter functions begin on page~\pageref*{filterUserResp}. + \item \nameref{extNumerFuncs} extend the collection of built-in functions that perform + numerical calculations. These numerical functions are discussed beginning on page~\pageref*{extNumerFuncs}. +\end{questions} + +\def\respBoxPara{% +\texttt{\hyperref[paraRespBox]{\string\RespBoxMath[\#1]\#2(\#3)[\#4]\#5\#6\#7\#8[\#9]*\#10}}} + +\subsection{Parse Input Extensions}\label{piExt} + +This type of JavaScript functions are support functions whose +capabilities are built into the core \textsf{exerquiz} package. +When \textsf{exerquiz} detects the presence of these support +functions, it utilizes them seamlessly. + +\subsubsection{\texttt{ImplMulti}}\label{ImplMulti} + +The default behavior for processing a math fill-in question is to +require the student to insert `\texttt*' for multiplication and to +enclose any function being raised to a power in parentheses, e.g. +\verb+x*(sin(x))^2+. This becomes quite tiresome if the expression to be entered +is complicated. The \texttt{ImplMulti} option enables the student to use +\emph{implied multiplication} and \emph{simplified exponentiation}. + +The \texttt{ImplMulti} option loads two JavaScript functions, \texttt{Ck4Products} +and \texttt{Ck4Expo\-nents}. The latter implements the notation, \verb+sin^2(x)+ +for $\sin^2(x)$, and is equivalent to $(\sin(x))^2$. A more complex exponent must be enclosed enclosed +in parentheses, for example \verb-ln^(x+1)(x)-. The former function, \texttt{Ck4Products}, +inserts the multiplication symbol, `\texttt{*}', wherever multiplication is implied. For example, +\verb+xysin(xy)+ becomes \verb+x*y*sin(x*y)+. + +\newtopic\textcolor{red}{Important:} If loaded, \texttt{exerquiz} +will automatically use these two functions in any math fill-in question, no further action is needed. + +%\exPDF{jquiztst} Many of the demo files that come with AeB use the \texttt{ImplMulti} option, one such +%representative file is \texttt{jquiztst.tex}. + +\exAeBBlogPDF{p=810} Many of the demo files that come with AeB use the \texttt{ImplMulti} option, one such +representative file is \texttt{\href{\urlAcroTeXBlog/?p=810}{jquiztst.pdf}}. + + +\subsection{Response Functions} \label{respfunc} + +For fill-in questions, a response function is one that is called immediately after the user +enters and commits an answer. The default response function that processes the user's response +is \texttt{ProcResp}. The $\text{10}^{\text{th}}$ argument of the \cs{RespBoxMath} command, +\begin{equation*} + \text{\respBoxPara} +\end{equation*} +is used to specify another response function. This section discusses the alternate +response functions available in the library, and gives examples of each. + +\subsubsection{\texttt{equations}} \label{equations} + +Use this option to process questions for which an equation is the +expected answer. This option defines the JavaScript function +\texttt{ProcRespEq}. When using a math fill-in question (the +\cs{RespBoxMath} command), this function is placed in the optional +$\text{10}^{\text{th}}$ argument, the one that follows \texttt{*}. +See \Nameref{ss:respbox} for a description of the parameters of +\cs{RespBoxMath} + +\newtopic The following question goes inside a \texttt{quiz} or +\texttt{shortquiz} environment. +\begin{Verbatim}[xleftmargin=\amtIndent,fontsize=\small] +\RespBoxMath{y = 4 * x - 3}(xy){4}{.0001}{[0,1]x[0,1]}*{ProcRespEq} +\end{Verbatim} + +%\exPDF{jqzequat} The demo file \texttt{jqzequat.tex} includes the +%above example as well as other in the context of a working +%\texttt{shortquiz}, found in the \texttt{dljslib\_examples} folder. + +\exAeBBlogPDF{p=951} The demo file +\texttt{\href{\urlAcroTeXBlog/?p=951}{jqzequat.pdf}} includes the above +example as well as other in the context of a working \texttt{shortquiz}. + +\newtopic Alert box message: May be redefined. +\begin{Verbatim}[xleftmargin=\amtIndent] +\newcommand\equationsAlertMsg{"An equation is expected"} +\end{Verbatim} + +\subsubsection{\texttt{vectors}}\label{vectors} + +Use this option to process questions for which a vector is the +expected answer. This option defines the JavaScript function +\texttt{ProcVec}. When using a math fill-in question (the +\cs{RespBoxMath} command), this function is placed in the optional +$\text{10}^{\text{th}}$ argument, +the one that follows \texttt{*}. See \Nameref{ss:respbox} for a +description of the parameters of \cs{RespBoxMath}. + +\newtopic The following question goes inside a \texttt{quiz} or +\texttt{shortquiz} environment. The premise of these two questions +is that the definitions of $\vec a$, $\vec b$ and $f(t)$ are given: +\begin{Verbatim}[xleftmargin=\amtIndent,fontsize=\small] +\item $\vec a + \vec b = + \RespBoxMath{<4, 4, 4>}{1}{.0001}{[2,4]}*{ProcVec}$ +\item $\vec f'(t) = + \RespBoxMath{}(t){3}{.0001}{[0,1]}*{ProcVec}$ +\end{Verbatim} +The first question takes a three component vector of numerical values, the second +takes a three component vector of function values. + +%\exPDF{jqzvector} These two examples were taken from the demo file \texttt{jqzvector.tex}, +%which includes both \texttt{quiz} and \texttt{shortquiz} environments, found in the \texttt{dljslib\_examples} folder. + +\exAeBBlogPDF{p=949} These two examples were taken from the demo file +\texttt{\href{\urlAcroTeXBlog/?p=949}{jqzvector.pdf}}, +which includes both \texttt{quiz} and \texttt{shortquiz} environments. + + +\newtopic Alert box messages: May be redefined. +\begin{Verbatim}[xleftmargin=\amtIndent] +\newcommand\vectorsErrorMsgi{"I'm looking for a vector. + You need to use proper vector notation, + try using angle brackets <....>."} +\newcommand\vectorsErrorMsgii{"Angle brackets are not balanced. + Check the expression you typed in."} +\newcommand\vectorsErrorMsgiii{"Incorrect number of components. + The answer requires " + aCorrAns.length + " components."} +\end{Verbatim} + +\subsubsection{\texttt{setSupport}} \label{setSupport} + +We introduce three JavaScript (response) functions +for handling a set of answers or a comma delimited list of answers, these +are \texttt{ProcRespSetNum}, \texttt{ProcRespSetSym}, and +\texttt{ProcRespListFormula}. The first function is for numerical +answers, the second for simple symbolic answers. These JavaScript response +functions are passed to \cs{RespBoxMath} as the $\text{10}^{\text{th}}$ argument. + +%\exPDF{set_test} The demo file for these three +%response functions is \texttt{set\_test.tex}; the examples below +%were taken from that file, found in the \texttt{dljslib\_examples} +%folder. + +\exAeBBlogPDF{p=953} The demo file for these three +response functions is \texttt{\href{\urlAcroTeXBlog/?p=953}{set\_test.pdf}}. + + +\newtopic\indent The functions \texttt{ProcRespSetNum}, \texttt{ProcRespSetSym} can +handle (math fill-in) questions whose answers are a \textit{set of +numbers (symbols)} or a comma delimited \emph{list of numbers +(symbols)}. + +\paragraph*{ProcRespSetNum:}\label{para:ProcRespSetNum} The function can handle (math fill-in) +questions whose answers are a \textit{set of numbers} or a +comma delimited \textit{list of numbers}. + +\newtopic This example takes a comma-delimited +list as its expected response. After the student enters the +response, the answer is formatted as a set, with enclosing braces, +like so \verb!{ ... }!. The student does not enter the braces, the +JavaScript does after the comma-delimited list is entered and +committed. +\begin{Verbatim}[xleftmargin=\amtIndent,fontsize=\small] +$(x+1)^2 (x+3) = 0$, $S = \RespBoxMath[\AddAAFormat{\formatAsSet} + \rectW{.75in}\textSize{0}]{-1,-3}{1}{.0001}{[0,1]}*{ProcRespSetNum}$ +\end{Verbatim} +\noindent The formatting of answer is accomplished by passing +\verb!\AddAAFormat{\formatAsSet}! as an optional argument of +\cs{RespBoxMath}. The command \cs{formatAsSet} expands to a +JavaScript function that is defined when the \texttt{setSupport} +option is taken. The little-known key \cs{AddAAFormat} is +defined in \textsf{exerquiz} and is specifically designed for inserting +special formatting into a math fill-in response. The use of the set +formatting is optional. + +\newtopic This next example again uses \texttt{ProcRespSetNum}. The +equation has repeated roots. To require the student to enter the +repeated roots, just list them as part of the answer argument. +%Here,the set notation is not used (since it would be incorrect +%\verb~{-1, 1/2, 2, 2, 2} = {-1, 1/2, 2}~). +\begin{Verbatim}[xleftmargin=\amtIndent,fontsize=\small] +$(x+1)(2x-1)(x-2)^3 = 0$, $x = \RespBoxMath[\rectW{.75in}\textSize{0}] + {-1, 1/2, 2, 2, 2}{1}{.0001}{[0,1]}*{ProcRespSetNum}$ +\end{Verbatim} + +\paragraph*{ProcRespSetSym:} The function can handle (math fill-in) +questions whose answers are a \textit{set of symbols}. + +This function can handle simple symbolic answers. The variable list should +be the ``universal set'' of the problem. +\begin{Verbatim}[xleftmargin=\amtIndent,fontsize=\small] +\def\U{a,b,c,d,e,f,g} % define a universal set +$A \cap B = \RespBoxMath[\AddAAFormat{\formatAsSet} + \rectW{.75in}\textSize{0}]{c,d}(\U){1}{.0001}{[0,1]}*{ProcRespSetSym}$ +\end{Verbatim} + +\paragraph*{ProcRespListFormula:} This function can handle a (math fill-in) +question whose answer is a comma-delimited list of expressions. Similar to +\texttt{ProcVec}, but the angle brackets are not used to specify the vector. + +\newtopic In this example, taken from \texttt{set\_test.tex}, a +vector response is required, but without the enclosing angle +brackets. +\begin{Verbatim}[xleftmargin=\amtIndent] +$\vec f'(t) = \RespBoxMath{e^t, 2*t,cos(t)}(t){3} + {.0001}{0}{1}*{ProcRespListFormula}$ +\end{Verbatim} +You can also define your own formatting function, to format +the input. + +\subsubsection{\texttt{unordered}} \label{unordered} + +This option defines the JavaScript (response) function +\texttt{ProcRespSetFormula} that will grade an \emph{unordered list} of +formulas, such as \texttt{x}, \verb!x^2!, \verb!x^3!. For example, +\begin{Verbatim}[xleftmargin=\amtIndent] +Some question requiring an unordered list of responses. +\RespBoxMath{x,x^2,x^3}{10}{.0001}{[1,2]}*{ProcRespSetFormula} +\end{Verbatim} +A correct answer is a list of the monomials \verb!x!,\verb!x^2!,\verb!x^3! in any order. +As usual, this JavaScript response function is passed to +\cs{RespBoxMath} as the $\text{10}^{\text{th}}$ argument. + +%\exPDF{dljslib_apw} The demo file that uses the \texttt{unordered} option is +%\texttt{dljslib\_apw.tex}, which can be found in the \texttt{dljslib\_examples} folder + +\exAeBBlogPDF{p=959} The demo file that uses the \texttt{unordered} option is +\texttt{\href{\urlAcroTeXBlog/?p=959}{dljslib\_apw.pdf}}. + + +\subsubsection{\texttt{factors}} \label{factors} + +The factors option defines \texttt{ProcRespFactors}, passed to +\cs{RespBoxMath} as the $\text{10}^{\text{th}}$ argument. The +response function \texttt{ProcRespFactors} is used for grading +polynomial factoring questions. For example, if a polynomial factors +as \verb!-5x^2(x-4)(x+2)!, then the answer is only unique up to the +order of factors and a change of sign on an even number of factors. +The student could respond with \verb!-5x^2(x+2)(x-4)! or +\verb!5x^2(-x+4)(x+2)! or \verb!-5(x-4)(x+2)x^2!. The function +should grade all of these variations correctly; however, it will not +grade \verb!-(x-4)(x+2)5x^2! as correct. The leading coefficient, if +there is one, must be placed at the beginning, which conforms to our +usual conventions. + +\begin{Verbatim}[xleftmargin=\amtIndent] +Completely factor the polynomial $x^3-4x^2 + 2x - 8$. +\RespBoxMath{(x^2+2)(x-4)}{10}{0.0001}{[0,1]}*{ProcRespFactors} +\end{Verbatim} +Note that \texttt{ProcRespFactors} is passed to +\cs{RespBoxMath} as the $\text{10}^{\text{th}}$ argument. + +%\exPDF{dljslib_apw} The demo file that uses the \texttt{factors} option is +%\texttt{dljslib\_apw.tex}, which can be found in the \texttt{dljslib\_examples} folder + +\exAeBBlogPDF{p=959} The demo file that uses the \texttt{factors} option is +\texttt{\href{\urlAcroTeXBlog/?p=959}{dljslib\_apw.pdf}}. + + +\subsubsection{\texttt{point}} \label{point} + +The response function \texttt{ProcPoint} is an almost exact copy of your +\texttt{ProcVec}, but uses parentheses instead of angle brackets as +delimiters. Used with questions that have a point $(x,y)$ as the +answer. +\begin{Verbatim}[xleftmargin=\amtIndent] +Calculate the derivative of $\vec f(t) = (e^t,e^(t^2))$. +\RespBoxMath{(e^t,2te^t)}(t){10}{0.0001}{[0,1]}*{ProcPoint} +\end{Verbatim} +\texttt{ProcPoint} is passed to +\cs{RespBoxMath} as the $\text{10}^{\text{th}}$ argument. + + +%\exPDF{dljslib_apw}The demo file that uses the \texttt{point} option is +%\texttt{dljslib\_apw.tex}. + +\exAeBBlogPDF{p=959} The demo file that uses the \texttt{point} option is +\texttt{\href{\urlAcroTeXBlog/?p=959}{dljslib\_apw.pdf}}. + + +\newtopic Alert box messages: May be redefined. +\begin{Verbatim}[xleftmargin=\amtIndent] +\newcommand\pointErrorMsgi{"I'm looking for a point. + You need to use proper point notation."} +\newcommand\pointErrorMsgii{"Parentheses are not balanced."} +\newcommand\pointErrorMsgiii{"Incorrect number of components. + The answer requires " + aCorrAns.length+" components."} +\end{Verbatim} + +\subsubsection{\texttt{intervals}} \label{intervals} + +\texttt{ProcRespIntervals} is for grading questions that have an +interval or union of intervals as the answer. Examples of answers +supported by this function are listed below: +\begin{Verbatim}[xleftmargin=\amtIndent] +(2,3) +[2,3] +(-inf,4) +(-inf,4] +(6,inf) +[6,inf) +(2,3)U[8,9) +(-inf,6)U(9,inf) +(-inf,6]U[7,8)U(9,inf) +\end{Verbatim} +Here \texttt{inf} for infinity and the capital letter \texttt{U} for +the union symbol. Note also that intervals in a union can appear +in any order. + +The \texttt{ProcRespIntervals} function has been modified by Robert Marik +to allow intervals with end points \texttt{ln(2)}, \texttt{exp(4)} or \texttt{sqrt(3)}. +Thus, intervals of the form +\begin{Verbatim}[xleftmargin=\amtIndent] +(ln(2),ln(3)]U(exp(10),inf) +\end{Verbatim} +are recognized by this procedure. + +\begin{Verbatim}[xleftmargin=\amtIndent] +\RespBoxMath{(-inf,4]U[5,inf)}{10} + {.0001}{\viidna}*{ProcRespIntervals} +\end{Verbatim} +\Important Problems with unbalanced parentheses while +authoring and building the PDF file. The code below +\begin{Verbatim}[xleftmargin=\amtIndent] +\intervalbox{(-inf,4)U[5,inf)} +\end{Verbatim} +the right parenthesis of the second interval does not have a +matching left parenthesis. This causes problems with Acrobat +Distiller. As a work around, escape the odd parenthesis (using +\cs{eqbs}), like so \verb!\intervalbox{(-inf,4)U[5,inf\eqbs)}!, + where \cs{eqbs} is defined in the \textsf{insdljs} package. + +%\exPDF{dljslib_apw}The demo file that uses the \texttt{factors} option is +%\texttt{dljslib\_apw.tex}. + +\exAeBBlogPDF{p=959} The demo file that uses the \texttt{factors} option is +\texttt{\href{\urlAcroTeXBlog/?p=959}{dljslib\_apw.pdf}}. + + +\subsubsection{\texttt{complex}}\label{complex} + +This option extends the ability of \textsf{exerquiz} to process questions +that are expecting a complex number as an answer. + +\paragraph*{ProcRespComplex:} The \texttt{complex} option defines +the function \texttt{ProcRespComplex}, which is specified in the usual way, as seen below. +\begin{Verbatim}[xleftmargin=\amtIndent,fontsize=\small] +$(3+3i)+(4+5i) = \RespBoxMath{7+8i}{3}{0.0001}{[0,1]}*{ProcRespComplex}$ +\end{Verbatim} +The \texttt{complex} option also defines the \texttt{cis} function, +the definition of which is +$\operatorname{cis}(x)=\cos(x)+\imath\sin(x)$. When \texttt{complex} +is not loaded, this function is undefined, and will be caught by the +parser of exerquiz as a syntax error. If \texttt{complex} is loaded +and the user enters the \texttt{cis} function in a non-complex +problem, the user's answer is not flagged as a syntax error and will +most probably be scored as \emph{wrong}. The exerquiz implementation of the \texttt{cis} +function, does not, at this time, support powers of the \texttt{cis} function, the parser +attempts to find expressions of the form \texttt{cis\string^}, flag it, and emit +an alert message, see below. This implementation does not detect powers of the form +\texttt{(cis(x))\string^2}, however. + +The next two functions are due to Bruce Wagner, with modifications by D. P. Story. + +\paragraph*{ProcRespListComplex:} This response function evaluates an \emph{ordered} list +of comma-delimited complex numbers. For example, +\begin{Verbatim}[xleftmargin=\amtIndent,fontsize=\small] +If $z=4(\cos x+i\sin x)$, compute $z^2$ and $z^3$, in that order. +\RespBoxMath{16*cis(2x),64*cis(3x)}{4}{0.0001} + {[0,1]}*{ProcRespListComplex} +\end{Verbatim} + + +\paragraph*{ProcRespSetComplex:} This response function evaluates an \emph{unordered} list +of comma-delimited complex numbers. For example, +\begin{Verbatim}[xleftmargin=\amtIndent] + Find all real and complex solutions of the equation $x^2=-9$. + Express your answer(s) in rectangular form $a+bi$. + \RespBoxMath{3i,-3i}{4}{0.0001}{[0,1]}*{ProcRespSetComplex} +\end{Verbatim} + + +%\exPDF{dljslib_complex}The demo file that uses the \texttt{complex} option is +%\texttt{dljslib\_complex.tex}. + +\exAeBBlogPDF{p=1129} The demo file that uses the \texttt{complex} option is +\texttt{\href{\urlAcroTeXBlog/?p=1129}{dljslib\_complex.pdf}}. + + +\newtopic Alert box messages: May be redefined. +\begin{Verbatim}[xleftmargin=\amtIndent] +\newcommand{\complexPowerAlertMsg}{% + "Powers of i (for example, i^2, i^3) are not supported, + replace powers of i with their complex equivalents." +} +\newcommand{\complexCisAlertMsg}{% + "The cis function does not support exponents. Write, + for example, cis^3(x) as cis(3*x), instead."} +\newcommand{\alertNotComplexMsg}{% + "The expression is not in the form of a complex + number, a+bi"} +\def\emptyCompComplexMsg(#1){% + "You entered nothing for the component " + +(#1+1)+" of your answer. Please enter a complex number." +} +\end{Verbatim} +The latter definition takes a delimited argument, necessary since it executes +within a verbatim environment where braces \texttt{\{} and \texttt{\}} are +not grouping delimiters. + +\subsection{Compare Functions} \label{compareFuncs} + +Compare functions are used to compare the author's answer with the +student's answer. Based on the comparison, the student's answer is +judged correct, or not. The \textsf{exerquiz} package has two +built-in compare functions: \texttt{diffCompare} (the default) and +\texttt{reldiffCompare}. The former makes the comparison based on absolute differences +\[ + \texttt{diffCompare} = |\,\text{Author Ans} - \text{Student Ans}\,| +\] +while the latter uses absolute relative differences to make the comparison +\[ + \texttt{reldiffCompare} = \frac{|\,\text{Author Ans} - \text{Student Ans}\,|} + {|\text{Author Ans}|} +\] +Comparison functions are passed through the $\text{9}^{\text{th}}$ argument of \cs{RespBoxMath}, +if no such argument is passed, \texttt{diffCompare} is used. + +\subsubsection{\texttt{indefIntegral}}\label{indefIntegral} + +The answer to an indefinite integral is non-unique; however all +answers differ by a constant. This compare function is used with +indefinite integrals. Note the name of the function is +\texttt{indef\-Com\-pare}, this is the name you use to call the +function. To use this compare function, insert its name in optional +$\text{9}^{\text{th}}$ argument, +\begin{equation*} + \text{\respBoxPara} +\end{equation*} +that's the argument that follows the interval specification. + + +An example of usage of this function is found in the sample file +\texttt{dljslib\_ex.tex}, referenced below; from that file we have: +\begin{Verbatim}[xleftmargin=\amtIndent] +$\displaystyle\int\sin(x)\,dx = + \RespBoxMath{-cos(x)}{4}{.0001}{[0,1]}[indefCompare]$ +\end{Verbatim} + +%\exPDF{dljslib_ex} See the demo file +%\texttt{dljslib\_ex.tex} for an example of indefinite integration +%comparison. Numerous other files use indefinite integration as well. + +\exAeBBlogPDF{p=961} See the demo file +\texttt{\href{\urlAcroTeXBlog/?p=961}{dljslib\_ex.pdf}} for an example of +indefinite integration comparison. + + +\subsubsection{satisfyEq} + +The \texttt{satisfyEq} library of procedures supports the type of question where +the student is asked to enter one or more points that satisfy an equation. + +We pose a problem where the student is asked to enter an order pair or triple +that satisfies an equation. For example + +\newtopic\makebox[0pt][r]{\large\color{red}$\blacktriangleright$\enspace}% +\begin{oQuestion}{satisfyEqQuiz}% +Enter a point that lies on the line $2x+3y=6$, the answer is an +ordered pair of numbers, for example $(1,2)$. +\begin{equation*} + \text{A point is }\RespBoxMath[% + \rectW{1.5in}\textSize{0}]{2x+3y-6}(xy){1}{.0001}{\viidna}*{ProcRespEvalEq}\kern1bp + \CorrAnsButton{various, such as (0,2)} +\end{equation*} +\end{oQuestion} +The verbatim listing follows: +\begin{Verbatim}[numbers=left,xleftmargin=\amtIndent,fontsize=\small] +\RespBoxMath[\rectW{1.5in}\textSize{0}]{2x+3y-6}(xy){1} + {.0001}{\viidna}*{ProcRespEvalEq}\kern1bp + \CorrAnsButton{various, such as (0,2)} +\end{Verbatim} +Line~(2) shows the placement of one of the procedures, \texttt{ProcRespEvalEq}, +that is part of \texttt{satisfyEq}. + +\newtopic There are four procedures in this set: +\begin{enumerate} + \item \texttt{ProcRespEvalEq}: Supports a single equation, the answer + is a single ordered $n$-tuple, the entries are allowed to be zero. + \item \texttt{ProcRespEvalEqNonZero}: Supports a single equation, the + answer is a single ordered n-tuple, the entries are \emph{not + allowed} to be zero. + \item \texttt{ProcRespEvalEqList}: Supports a single equation, the + answer consists of $k$, $n$-tuples, the components of the + $n$-tuples are allowed to be zero. Each $n$-tuple is separated + by a semi-colon (;). + \item \texttt{ProcRespEvalEqListNonZero}: Supports a single equation, + the answer consists of $k$, ordered $n$-tuples, the components of the + $n$-tuples are \emph{not allowed} to be zero. Each $n$-tuple is separated + by a semi-colon (;). +\end{enumerate} + +\paragraph*{Some Technical Details.} Recall the parameter list for +\cs{RespBoxMath}, +\begin{equation*} + \text{\respBoxPara} +\end{equation*} + + +\noindent\texttt{ProcRespEvalEq}, \textsl{et al}, are not based on random +point generation, as are all the other \textsf{exerquiz} functions. Here, +the user enters numerical data, the function then verifies the data +entered satisfies the given equation. The role of one of the parameters +has changed, others are ignored: +\begin{itemize} + \item The role of parameter \texttt{\#2} (the correct answer) has + changed. Suppose the equation presented to the user is $ F = G $. + \begin{itemize} + \item For \texttt{ProcRespEvalEq} and \texttt{ProcRespEvalEqNonZero}, + pass \texttt{F - G} as parameter \texttt{\#2}. + \item For \texttt{ProcRespEvalEqList} and \texttt{ProcRespEvalEqListNonZero}, + pass \texttt{k;F-G} as the parameter \texttt{\#2}. For this type of + problem, the author is asking the user to enter \texttt{k}, $n$-tuples + that satisfy the equation. Note \texttt{k} and \texttt{F-G} are delimited + by a semicolon (\texttt{;}). + \end{itemize} + \item The value of \texttt{epsilon} (parameter \texttt{\#6}) is obeyed. + \item Parameter \texttt{\#5}, the number of iterations, is not used. + Though this parameter is not used, \texttt{\#5} is required by the + macro, so just use \texttt{1} as the number of iterations. + \item Parameter \texttt{\#7}, the domain of the variables, is not + used. Again, since this is a required parameter, use \cs{viidna}; + \cs{viidna} is a special command that can be used for this + parameter, in this context only. + \item The optional parameter \texttt{\#9} is not used and is ignored if present. +\end{itemize} + +\exAeBBlogPDF{p=} Additional examples will (eventually) appear +on the \href{\urlAcroTeXBlog}{\AcroTeX{} Blog}. + + +\subsection{Filter User's Responses} \label{filterUserResp} + +Filters are JavaScript functions that process the user input before being passed to the response function. +Filters are passed to \cs{RespBoxMath} through the $\text{9}^{\text{th}}$ argument, +\begin{Verbatim}[xleftmargin=\amtIndent] +$\displaystyle\int\sin(x)\,dx = + \RespBoxMath{-cos(x)}{4}{.0001}{[0,1]}[indefCompare]$ +\end{Verbatim} +This $\text{9}^{\text{th}}$ argument can take on two formats: (1) the name of the compare function, +as illustrated in `\nameref{indefIntegral}' above; (2) a JavaScript object. Use a JavaScript object +as the $\text{9}^{\text{th}}$ argument to specify a filter. + +The JavaScript object that can be passed in the $\text{9}^{\text{th}}$ argument has two properties +\texttt{comp} and \texttt{priorParse}. The object has the form +\begin{Verbatim}[xleftmargin=\amtIndent,commandchars=!()] +{ comp: !ameta(compare), priorParse: !ameta(JS_func) | !ameta(array_JS_funcs) } +\end{Verbatim} +The first property is used to specify a compare function, the second +property specifies a filter or filters. The value of +\texttt{priorParse} may be a JavaScript function to filter the +user's response, or an array of JavaScript functions to filter the +user input. (The array must be specified using the \Com{Array} +command, illustrated below, see the paragraph +`\nameref{NoProducts}', on page~\pageref*{NoProducts}.) + +\subsubsection{\texttt{nodec}} \label{nodec} + +The \texttt{nodec} option defines the JavaScript function +\texttt{nodec} that attempts to prohibit the use of decimal numbers +in the response. The function simply searches the user response for +any occurrence of the decimal point. (The German language uses +the comma as a decimal point, you can set the decimal point to some +other symbol that \texttt{nodec} searches for through the command +\Com{setdecimalpoint}, the default definition is +\verb!\setdecimalpoint{.}!.) + +\begin{Verbatim}[xleftmargin=\amtIndent,fontsize=\small] +$ 0.75 = \RespBoxMath{3/4}{1}{.0001}{[0,1]}[{priorParse: nodec }] $ +\end{Verbatim} + +\newtopic Alert box message: May be redefined. +\begin{Verbatim}[xleftmargin=\amtIndent] +\newcommand\nodecAlertMsg{% + "A decimal answer is not acceptable here + Please express your answer using fractions, square roots, + e, log, etc."} +\end{Verbatim} + +\subsubsection{\texttt{noBinFac}} \label{noBinFac} + +The \texttt{noBinFac} option defines the JavaScript filter function +\texttt{noBinFac}, that disallows binomial coefficients and +factorials in math fill-in questions. Binomial and factorial +functions are defined through the \texttt{combinatorics} option, +page~\pageref*{combinatorics}. + +\begin{Verbatim}[xleftmargin=\amtIndent] +The number of ways to choose four object from a set of ten is + \RespBoxMath{C(10,4)}{1}{.0001}{[0,1]}[{priorParse: noBinFac}] + \CorrAnsButton{C(10,4)}*{EvalCorrAnsButton} +\end{Verbatim} +The \texttt{noBinFac} filter is used, so the student is not allowed +to enter binomial coefficients; however, the document author can use +binomial coefficients, note the use in the answer (first argument) +and in the \cs{CorrAnsButton}. The special syntax used for +\cs{CorrAnsButton}, \Nameref{inclsoln}. + +%\exPDF{dljs_comb} Illustrations of this filter can be +%found in the \texttt{dljs\_comb.tex}. + +\exAeBBlogPDF{p=963} Illustrations of this filter can be found in +\texttt{\href{\urlAcroTeXBlog/?p=963}{dljs\_comb.pdf}}. + + +\newtopic Alert box messages: May be redefined. +\begin{Verbatim}[xleftmargin=\amtIndent] +\newcommand\noBinFactBinCoeffAlertMsg{% + "You may not use this notation here. + Please evaluate the binomial coefficient. + You may present your answer as a product rather + than calculating a very large number."} +\newcommand\noBinFactPermAlertMsg{% + "You may not use this notation here. + Please evaluate the permutation. + You may present your answer as a product rather + than calculating a very large number."} +\newcommand\noBinFactFactAlertMsg{% + "You may not use this notation here. + Please evaluate the factorial. + You may present your answer as a product rather + than calculating a very large number."} +\end{Verbatim} + +\subsubsection{\texttt{limitArith}} \label{limitArith} + +The \texttt{limitArith} option defines a number of filter functions: +\begin{Verbatim}[xleftmargin=\amtIndent] +DecimalsOnly, NoProducts, NoDivision, NoAddOrSub, +NoArithAllowed,NoExpAllowed,NoTrigAllowed, NoTrigLogAllowed +\end{Verbatim} + +%\exPDF{limarth} Examples of these filtering functions +%can be found in the demo file \texttt{limarth.tex}. + +\exAeBBlogPDF{p=947} Examples of these filtering functions +can be found in the demo file +\texttt{\href{\urlAcroTeXBlog/?p=947}{limarth.pdf}}. + + +\paragraph*{DecimalsOnly} The \texttt{DecimalsOnly} is a function +that takes only numbers, either integer or decimal. Usage +\begin{Verbatim}[xleftmargin=\amtIndent] + $ 2.3 + 4.5 = \RespBoxMath{6.8}{1}{.0001}{[0,1]} + [{priorParse: DecimalsOnly }]$ +\end{Verbatim} + +\paragraph*{NoProducts}\label{NoProducts} The function +\texttt{NoProducts} requires that \texttt{ImplMulti} is taken. An +example of usage is +\begin{Verbatim}[xleftmargin=\amtIndent] +$ 3/4 = \RespBoxMath{.75}{1}{.0001}{[0,1]} + [{priorParse: \Array(NoDivision, NoProducts) }]$ +\end{Verbatim} +In the above example, we first call \texttt{NoDivision} then \texttt{NoProducts}. Several +filtering functions can be executed by putting them into an array, using the \cs{Array} +command.\footnote{The \cs{Array} command was originally named \cs{array}, it has been renamed +to avoid clashing with the \texttt{amsmath} package.} + +\paragraph*{NoAddOrSub} This function, as the name implies, denies the use of both addition and subtraction. +The algorithm I use here is that if a plus or minus follows anything but a left parenthesis, +we assume it is a binary operation of addition or subtraction, respectively. +\begin{Verbatim}[xleftmargin=\amtIndent] +$ 5.1 - 3.2 = + \RespBoxMath{1.9}{1}{.0001}{[0,1]}[{priorParse: NoAddOrSub}]$ +\end{Verbatim} + +\paragraph*{NoArithAllowed} Deny user the use of all arithmetic functions, including exponents. +\begin{Verbatim}[xleftmargin=\amtIndent] +$ 6/5 = \RespBoxMath{1.25}{1}{.0001}{[0,1]} + [{priorParse: NoArithAllowed}]$ +\end{Verbatim} + +\paragraph*{NoExpAllowed} Deny user the use of exponents. +\begin{Verbatim}[xleftmargin=\amtIndent] +$ 25^2 = \RespBoxMath{625}{1}{.0001}{[0,1]} + [{priorParse: NoExpAllowed}] +\end{Verbatim} + +\paragraph*{NoTrigAllowed} Deny user the use all trig functions, as +well as the constants \texttt{PI} and \texttt{pi}, which are aliases +for $\pi$. Example: +\begin{Verbatim}[xleftmargin=\amtIndent] +$ \sin(\pi/4) = \RespBoxMath{sqrt(2)/2}{1}{.0001}{[0,1]} + [{priorParse: NoTrigAllowed }]$ +\end{Verbatim} + +\paragraph*{NoTrigLogAllowed} Deny the use of trig and log functions. + +\begin{Verbatim}[xleftmargin=\amtIndent] +$ \ln(e^2)\sin(\pi/4) = \RespBoxMath{sqrt(2)}{1}{.0001}{[0,1]} + [{priorParse: NoTrigLogAllowed }]\CorrAnsButton{sqrt(2)}$ +\end{Verbatim} + +\paragraph*{sciNotResp} Allow only a response in \emph{normalized} scientific notation: +\texttt{aE([+]|-)d}, where $1\le|\texttt{a}|\le9$, and \texttt{d} is one or more digits +(0-9) prefixed by a \texttt{-}, or an optional \texttt{+}. +\begin{Verbatim}[xleftmargin=\amtIndent] +Convert 123.4 to scientific notation. +\begin{equation*} + 123.4 = \RespBoxMath{1.234E+2}*{1}{0}{[0,1]}[% + {priorParse: sciNotResp }]\CorrAnsButton{1.234E+2} +\end{equation*} +\end{Verbatim} + +\paragraph*{noNegExp} Does not allow negative exponents. For example, +\begin{Verbatim}[xleftmargin=\amtIndent] +\item Simplify $\displaystyle\frac{4}{r^4}\cdot\frac{r^3}{12}= + \RespBoxMath{1/(3r)}(r)*{3}{.0001}{[0,1]}[{% + priorParse:\Array( nodec, noNegExp ) + }]\CorrAnsButton{1/(3r)}$ +\end{Verbatim} + +\paragraph*{Alert box messages:} May be redefined. +\begin{Verbatim}[xleftmargin=\amtIndent] +\newcommand\DecimalsOnlyErrorMsg{"Enter only an integer, + e.g., 17, or a decimal number, e.g. 12.4. + Using arithmetic operations or built in function is + not acceptable for this problem."} +\newcommand\NoProductsErrorMsg{"Multiplication is not allowed + for this problem."} +\newcommand\NoDivisionErrorMsg{"Division is not allowed + for this problem."} +\newcommand\NoAddOrSubErrorMsg{"Neither addition nor subtraction + is not allowed for this problem."} +\newcommand\NoExpAllowedErrorMsg{"The use of exponents is not + allowed for this problem."} +\newcommand\NoTrigAllowedErrorMsg{"The use of trig functions + in this problem is not allowed."} +\newcommand\NoTrigLogAllowedErrorMsg{"The use of trig and log + functions is not allowed in this problem."} +\newcommand{\sciNotSyntaxError}{"Enter the answer in scientific + notation."} +\newcommand{\sciNotNormalForm}{"The scientific notation entered + is not in normalized form."} +\newcommand{\NoNegExpMsg}{"No negative exponents permitted, + keep working!"} +\end{Verbatim} + +\subsection{Extending Numerical Functions} \label{extNumerFuncs} + +These JavaScript functions extend the collection of built-in +functions that perform numerical calculations. + +\subsubsection{\texttt{combinatorics}}\label{combinatorics} + +This option defines three JavaScript functions: a binomial +coefficient function \texttt{ch(n,r)}; a number of permutations +function \texttt{perm(n,r)}, and a factorial function +\texttt{fact(n)}. + +\paragraph*{User Accessible Functions} The user should use the names \texttt{C}, \texttt{P} and \texttt{fact} +to access the functions \texttt{ch}, \texttt{perm} and \texttt{fact}, respectively: +\begin{itemize} + \item $ \texttt{C(n,r)} = \texttt{ch(n,r)} = \dbinom{n}{r} = \dfrac{n\,!}{r\,!(n-r)\,!}$ + \item $ \texttt{P(n,r)} = \texttt{perm(n,r)} = n\cdot(n-1)\cdots(n-r)$ + \item $ \texttt{fact(n)} = n\cdot(n-1)\cdots3\cdot2\cdot1$ +\end{itemize} +\textbf{Note: }If you place \verb!\replaceExclPt{true}! in the preamble, the user is allowed to enter factorials using +the +traditional exclamation notation: for example, \texttt{17!} is the same as fact(17), and \texttt{(17)!}, \texttt{[17]!} +or \verb|{17}!| +are all interpreted as \texttt{fact(17)}. + +%\exPDF{dljs_comb} Illustrations of the \texttt{combinatorics} option can be +%found in the \texttt{dljs\_comb.tex}. + +\exAeBBlogPDF{p=963} Illustrations of the \texttt{combinatorics} option can be +found in \texttt{\href{\urlAcroTeXBlog/?p=963}{dljs\_comb.pdf}}. + + +%------------------------ List of Options ------------------------------------ +\newpage +\section{List of Options}\label{s:ListofOpts} + +%\begin{tabular}{|>{\bfseries\color{red}}l|>{\PBS\raggedright}p{.5\linewidth}|}\hline +% \multicolumn1{|>{\bfseries\columncolor{light-blue}}c|}{Component} & +% \multicolumn1{>{\bfseries\columncolor{light-blue}}c|}{Brief Description}\\ \hline \rowcolor[gray]{.9} + +\def\currentPackage{Web} + +\begin{center} +\setlength{\extrarowheight}{1mm} +\setlength{\tabcolsep}{2mm} +\begin{longtable}{|>{\ttfamily}l|>{\PBS\raggedright}p{.5\linewidth}|} +\hline +\multicolumn2{|c|}{Options of the Web/Exerquiz Packages} \\ +\hline +\endfirsthead +\hline +\multicolumn2{|c|}{Options of the Web/Exerquiz Packages (cont.)} \\ +\hline +\endhead +\hline +\endfoot +\multicolumn2{|c|}{Options of the Web Package} \\ +\hline +\hyperref[sss:driver]{dvipsone} & dvi-to-ps driver by {\Y&Y}, Inc. \\ +\hyperref[sss:driver]{dvips} & dvi-to-ps driver \\ +\hyperref[sss:driver]{pdftex} & tex-to-pdf application \\ +\hyperref[sss:driver]{dvipdfm} & dvi-to-pdf application \\ +\hyperref[sss:driver]{textures} & the Textures System for Mac \\ +\hyperref[sss:designoptions] + {\parbox[t]{.75in+4pt}{designi,\newline + designii,\newline designiii,\newline + designiv,\newline designv}} & these set screen design parameters \\ +\hyperref[ss:templates]{usetemplates} & this option activates mechanism for + creating colored backgrounds and overlays\\ +\hyperref[ss:templates]{leftpanel} & creates a left navigation panel\\ +\hyperref[ss:templates]{rightpanel} & creates a right navigation panel\\ +\hyperref[sss:navibar]{navibar} & inserts a menu bar at the bottom or each + page\\ +\hyperref[sss:latextoc]{latextoc} & displays the standard toc \\ +%\hyperref[sss:nodir]{nodirectory} & eliminates the directory listing on the title page\\ +\hyperref[sss:nodir]{usedirectory} & causes the title page directory to appear on the title page\\ +\hyperref[sss:webforpaper]{forpaper} & this turns off color, and does not put solutions on + separate pages. \\ +\hyperref[forcolorpaper]{forcolorpaper} & Same as \texttt{forpaper}, but + does not turn off color, useful for color printers.\\ +\hyperref[sss:weblatexlayout]% + {latexlayout} & \texttt{web} uses page + layout for \texttt{article} class. + For use with \texttt{forpaper}.\\ +\hyperref[sss:webtight]{tight} & Redefines list environment parameters so + lists don't take up so much space \\ +\hyperref[webpro]{pro} & Causes web to input enhanced control + over various web elements\\ +\hyperref[nobullets]{nobullets} & Forces the use of numbers for subsubsections, also executes the +\texttt{latextoc} option\\ +\hyperref[usesf]{usesf} & switches to sans serif as the default font, good for presentations\\ +\hyperref[web:unicode]{unicode} & Passes the \texttt{unicode} option to \pkg{hyperref}.\\ +\hyperref[web:useui]{useui} & Passes the \texttt{useui} option to \textsf{eforms}.\\ +\hyperref[web:xhyperref]{xhyperref} & Causes web not to include the hyperref package.\\ +\hyperref[web:langopts]{dutch} & Dutch for web, passed to exerquiz. (Thanks to Henny Wilbrink)\\ +\hyperref[web:langopts]{french} & French for web, passed to exerquiz. (Thanks to Jean-Michel Sarlat)\\ +\hyperref[web:langopts]{german} & German for web, passed to exerquiz. (Thanks to Michael Wiedmann)\\ +\hyperref[web:langopts]{italian} & Italian for web, passed to exerquiz. (Thanks to PierLuigi Zezza)\\ +\hyperref[web:langopts]{norsk} & Norwegian for web, passed to exerquiz. (Thanks to Hans Fredrik Nordhaug)\\ +\hyperref[web:langopts]{russian} & Russian for web, passed to exerquiz. (Thanks to Sergei V. Znamenskii)\\ +\hyperref[web:langopts]{spanish} & Spanish for web, passed to exerquiz. (Thanks to Pedro Luis Luque)\\ +\hyperref[web:langopts]{polish} & Polish for web, passed to exerquiz. (Thanks to Jerzy Mycielski)\\ +\hyperref[web:langopts]{finnish} & Finnish for web, passed to exerquiz. (Thanks to P\"aivi Porras)\\ +\hyperref[web:langopts]{catalan} & Catalan for web, passed to exerquiz. (Thanks to Ramon Ballester)\\ +\hyperref[web:langopts]{czech} & Czech for web, passed to exerquiz. (Thanks to Robert Marik)\\ +\hyperref[web:langopts]{brazil} & Brazilian Portuguese for web, passed to exerquiz. (Thanks to Koichi +Sameshima)\\ +\hyperref[web:langopts]{turkish} & Turkish for web, passed to exerquiz. (Thanks to Mahmut Ko\c{c}ak)\\ +\hline +\multicolumn2{|c|}{Options of the Exerquiz Package\gdef\currentPackage{Exerquiz}} \\ \hline +%\hyperref[ss:pdftexerquiz]{pdftex} & tex-to-pdf application \\ +%\hyperref[ss:exbasicusage]{dvipdfm} & dvi-to-pdf application \\ +\hyperref[sss:nosolutions]{nosolutions} & removes the solutions to the exercises \\ +\hyperref[sss:noquizsolutions]% + {noquizsolutions} & removes the solutions to the quizzes \\ +\hyperref[sss:nohideopt]% + {nohiddensolutions} & overrides the `\texttt{h}' (hidden) + option for the exercises.\\ +\hyperref[sss:noHideopt]% + {noHiddensolutions} & overrides the `\texttt{h}' and `\texttt{H}' + (hidden) options for the exercises.\\ +\hyperref[sss:nocorrections]% + {nocorrections} & removes the ability to correct the quizzes\\ +\hyperref[sss:solutionsafter]% + {solutionsafter} & solutions to exercises are typeset just after the question\\ +\hyperref[sss:exquizforpaper]{forpaper} & same function as in \pkg{web}. + Needed when \textsf{exerquiz} is not + used with \pkg{web}\\ +\hyperref[sss:exquizforpaper]% + {forcolorpaper} & same function as in \pkg{web}. + Needed when \textsf{exerquiz} is not + used with \pkg{web}\\ +\hyperref[sss:preview]{preview} & shows the outline of all form fields + in the dvi previewer \\ +\hyperref[sss:nodljs]{nodljs} & turns off the insertion of DLJS \\ +%\hyperref[sss:acrobativ]{acrobativ} & equivalent to \texttt{nodljs}\\ +\hyperref[sss:noquizzes]{exercisesonly} & if document has only exercises, no doc level JS needed\\ +%\hyperref[sss:debug]{debug} & this option is passed on to the \texttt{insdljs} package\\ +\hyperref[sss:proofing]{proofing} & mark the correct answers for + \texttt{shortquiz} \& + \texttt{quiz} for + proof reading. \\ +\hyperref[showgraylettersOpt]% + {showgrayletters} & Show gray letters under check boxes\\ +\hyperref[ss:allowrandomize]% + {allowrandomize} & Allow the randomization of choices in multiple choie questions\\ +\hyperref[eq:unicode]{unicode} & Passes the \texttt{unicode} option to \pkg{hyperref}.\\ +\hyperref[eq:useui]{useui} & Passes the \texttt{useui} option to \textsf{eforms}.\\ +\hyperref[eq:usesumrytbls]{usesumrytbls}& Inputs the code used to create quiz summary tables, + \hyperref[s:sumrytbl]{Section~\ref*{s:sumrytbl}}, page~\pageref*{s:sumrytbl}.\\ +\hyperref[eq:contsolns]{contsolns} & Places a `continued' message in the right footer on a solution page.\\ +\hyperref[sss:exerquizlangopts]{dutch} & JavaScript messages in Dutch (Thanks to Henny Wilbrink)\\ +\hyperref[sss:exerquizlangopts]{french} & JavaScript messages in French (Thanks to Jean-Michel Sarlat)\\ +\hyperref[sss:exerquizlangopts]{german} & JavaScript messages in German (Thanks to Michael Wiedmann)\\ +\hyperref[sss:exerquizlangopts]{italian}& JavaScript messages in Italian (Thanks to PierLuigi Zezza)\\ +\hyperref[sss:exerquizlangopts]{norsk} & JavaScript messages in Noregian (Thanks to Hans Fredrik Nordhaug)\\ +\hyperref[sss:exerquizlangopts]{russian}& JavaScript messages in Russian (Thanks to Sergei V. Znamenskii)\\ +\hyperref[sss:exerquizlangopts]{spanish}& JavaScript messages in Spanish (Thanks to Pedro Luis Luque)\\ +\hyperref[sss:exerquizlangopts]{polish} & JavaScript messages in Polish (Thanks to Jerzy Mycielski)\\ +\hyperref[sss:exerquizlangopts]{finnish}& JavaScript messages in Finnish. (Thanks to P\"aivi Porras)\\ +\hyperref[sss:exerquizlangopts]{catalan}& JavaScript messages in Catalan. (Thanks to Ramon Ballester)\\ +\hyperref[sss:exerquizlangopts]{czech} & JavaScript messages in Czech. (Thanks to Robert Marik)\\ +\hyperref[sss:exerquizlangopts]{brazil} & JavaScript messages in Brazilian Portuguese. (Thanks to Koichi Sameshima)\\ +\hyperref[sss:exerquizlangopts]{turkish}& JavaScript messages in Turkish. (Thanks to Mahmut Ko\c{c}ak)\\ +\hline +\end{longtable} +\end{center} + +\includeexersolutions + +\includequizsolutions + +\newpage +\markright{References} + +\begin{thebibliography}{[1]}\label{references} +\addcontentsline{toc}{section}{\protect\numberline{}References} +\backrefparscanfalse +\def\srtln{\vskip-\baselineskip\vskip-\parsep} +\def\lngln{\vskip-\parsep} + +\item[] We list cited referenced documents, articles, and webpages, as well as + recommended reading. Cited material has the page number where that entry + was referenced. + +\bibitem{tech:AcroJS}\hypertarget{references}{}% + Acrobat JavaScript Scripting Refernce, Technical Note \#5431, Version~6.0., + Adobe Systems, Inc. \backrefprint + \srtln\hfill{\small\url{http://partners.adobe.com/asn/acrobat/docs.jsp}} + +\bibitem{book:Lamport} + Leslie Lamport, \textit{\LaTeX: A Document Preparation} + System (2nd ed.), Addison-Wesley Publishing Company, + 1994, ISBN 0-201-52983-1. \backrefprint + +\bibitem{book:Goossens1} + Michel Goossens, Frank Mittelbach and Alexander + Samarin, \textit{The \LaTeX{} Companion}, second ed., Addison-Wesley + Publishing Company, 2004, ISBN 0-201-36299-6. \backrefprint + +\bibitem{book:Goossens2} + Michel Goossens, Sebastian Rahtz, and Frank + Mittelbach, \textit{The \LaTeX{} Graphics Companion}, + Addison-Wesley Publishing Company, 1997, ISBN + 0-201-85469-4. \backrefprint + +\bibitem{book:Goossens3} Michel Goossens, and Rahtz, Sebastian, + with Gurari, Eitan, Moore, Ross, and Sutor, Robert, + \textit{The \LaTeX\ Web Companion}, + Addison Wesley Longman, Reading, Massachusetts, USA, 1999. + ISBN: 0-201-43311-7. \backrefprint + +\bibitem{book:Kopka} + Helmut Kopka and Patrick W. Daly, \textit{A Guide to + \LaTeX2e} (2nd ed.), Addison-Wesley Publishing Company, + 1995, ISBN 0-201-43777-X. + +\bibitem{book:Knuth} + Donald E. Knuth, \textit{The \TeX book}, Addison-Wesley + Publishing Company, 1987, ISBN 0-201-13448-9. \backrefprint + +\bibitem{book:Merz} + Thomas Merz, \textit{Web Publishing with Acrobat/PDF}, + Springer-Verlag Berlin Heidelberg New York, 1998, + ISBN 3-540-63762-1. \backrefprint + +\bibitem{article:Story:Pdfmarks} + D.P. Story, \textit{Pdfmarks: Links and Forms}, AcroTeX Web + Site, 1998. \backrefprint + \lngln\hfill{\small\url{www.math.uakron.edu/~dpstory/acrotex.html}} + +\bibitem{article:Story:LaTeX} + D.P. Story, \textit{Using \LaTeX\ to Create Quality PDF Documents for the + WWW}, Acro\!\TeX\ Web Site, 1998. \backrefprint + \srtln\hfill{\small\url{www.math.uakron.edu/~dpstory/acrotex.html}} + +\bibitem{book:AEBB} + D. P. Story, \textsl{\AEBBook}, in preparation. \backrefprint + + +\end{thebibliography} + + +% \printindex +\end{document} + +\newpage + +\makeatletter +\renewcommand{\section}{% + \renewcommand{\@seccntformat}[1]{}% + \@startsection{section}{1}{\z@}% + {-3ex\@plus -1ex \@minus-.2ex}% + {1ex\@plus .2ex}% 6pt + {\noindent\normalfont\normalsize\bfseries\color{aeb}}}% +\renewcommand\subsection{% + \renewcommand{\@seccntformat}[1]{\textbullet\enspace}% + \@startsection{subsection}{2}{\z@}% + {-2.5ex\@plus -1ex \@minus -.2ex}% + {1ex \@plus .2ex}% + {\noindent\normalfont\normalsize\bfseries\color{aeb}}} +\renewcommand\subsubsection{% + \renewcommand{\@seccntformat}[1]{\color{aeb}\large$\bullet$\enspace} + \@startsection{subsubsection}{3}{\z@}% + {-2ex\@plus -1ex \@minus -.2ex}% + {.5ex \@plus .2ex}% + {\noindent\normalfont\normalsize\bfseries}} +\renewcommand*\thesection{} +\renewcommand*\thesubsection{\textbullet} +%\renewcommand*{\thesubsubsection}{\textbullet} +\renewcommand*\l@subsection{\@dottedtocline{2}{2.8em}{1.2em}} +%\l@subsection{\@dottedtocline{3}{3.8em}{1.2em}} +\makeatother + +\addtocontents{toc}{\string\renewcommand*\string\l@subsection{\string\@dottedtocline{2}{2.8em}{1.2em}}} + +\section{What's New} + +The following is a brief enumeration of some of the major new +features of the \pkg{web} and \textsf{exerquiz} packages. + +\subsection{Web} + +\begin{questions} + + \item (Version 4.1) Added the option \texttt{useui}, which is passed + \textsf{eforms}. If \textsf{eforms} is subsequently loaded, + \textsf{eforms} loads the xkeyval package, and key-value pairs are + defined for use in the optional argument of form and link commands. + See the \href{eformman.pdf}{eforms manual} for details. + + \item (Version 4.1) Added a unicode option. This option is passed to hyperref, if eforms + is subsequently loaded, eforms (and exerquiz) will accept {\LaTeX} markup in the optional + argument of the form fields. See the \href{eformman.pdf}{eforms manual} for details. + + \item (Version 4.1) Added the \texttt{turkish} language option. I extend my appreciation + to Mahmut Ko\c{c}ak for this translation. + + \item (Version 4.0g) Added the command \cs{useFullWidthForPaper}, see the discussion + in \Nameref{paperoptions}. + \item (Version 4.0f) Added \cs{setScreensizeFromGraphic}, see + \hyperref[setScreensizeFromGraphic]{Section~\ref*{setScreensizeFromGraphic}}, + page~\pageref*{setScreensizeFromGraphic}. + \item (Version 4.0d) \cs{makeinlinetitle}, see \Nameref{inlinetitle}. + \item (Version 4.0c) Added \cs{aboveTopTitleSkip}, the amount of skip above the first + line on the title page, so the whole title can be move downwards, if + desired. See the section \Nameref{top}. + \item (Version 4.0) The pro option with many user-convenient features, + see \Nameref{webpro}. + \item (Version 4.0) New \Web{} options of \texttt{usesf}, + \hyperref[usesf]{page~\pageref*{usesf}} and \texttt{center\-title\-page}, + \hyperref[centertitle]{page~\pageref*{centertitle}}. + +\item[] \rule[2pt]{1in}{.4pt} Older New Stuff \rule[2pt]{1in}{.4pt} + + \item (Version 3.3) Made many internal changes for my new package, the + \textsf{\textcolor{blue}{Acro\!\TeX{} Presentation Bundle}} (\cAPB), yet + to be released, but see \url{http://www.acrotex.net} for details and demos. + \item (Version 3.3) Added some commands for running headers + and footers, these are \cs{lheader}, \cs{cheader}, \cs{rheader}, + \cs{lfooter}, \cs{cfooter}, \cs{rfooter}, \cs{clearHeaders} and \cs{re\-store\-Head\-ers}. + \item (Version 3.2) Added support for the Dr. Uwe Kern's \textsf{xcolor} + package. Unrecognized options are passed to the color package, + in particular, the \textsf{(x)color} option \texttt{dvipsnames} is passed + from \Web{} to the color package. + \item[] If available, \textsf{xcolor} is used, otherwise + \pkg{web} uses the standard \textsf{color} package. + \item[] There is a \texttt{noxcolor} which should be used as a + global option, that is passed as an option of the class. Thus, +\begin{Verbatim}[xleftmargin=\amtIndent] +\documentclass[noxcolor]{article} +\end{Verbatim} + will cause \pkg{web} (and other packages such as + \textsf{PSTricks}) to use the \textsf{color} package, even + though \textsf{xcolor} may be present. + \item (Version 3.2) Added a \texttt{nobullets} option. When taken, the bullets + that traditionally appear for the \cs{subsubection} now appear + with subsubsection numbers. + + \item (Version 3.2) Added a \texttt{draft} option: When you take this option, + graphic overlays are not allowed. This is useful when you rely + heavily on graphic overlays, but during the development phase, + don't need to read and re-read your overlays. The defined + background colors will be used instead. Remove this option to + build the final version of your document. + + \item (Version 3.2) Defined macros for conveniently + setting the color of some of the title page elements: + \cs{titleColor}, \cs{authorColor} and \cs{universityColor}. + Each takes a single argument, a named color. The defaults are +\begin{Verbatim}[xleftmargin=\amtIndent] +\universityColor{blue} +\titleColor{black} +\authorColor{black} +\end{Verbatim} + + \item (Version 3.2) Changed optional argument for the template commands + \cs{template} and \cs{panel\-template}: +\begin{Verbatim}[xleftmargin=\amtIndent] +\template[]{} +\paneltemplate[]{} +\end{Verbatim} + The optional argument \texttt{[]} can be used + to pass options to the underlying \cs{includegraphics} command. Do + not use the \texttt{width} and \texttt{height} keys; probably, it is + safest to use only the Boolean keys. The Boolean key + \texttt{hiresbb} is quite useful when stretching a small graphic to + fit over a larger area. The one required argument is the path to the + graphic file. + + \item (Version 3.2) Added a number of new commands to improve template management. See + the \texttt{web.dtx} for documentation. + \item (Version 3.2) Added language option \texttt{czech}, the translation due + to Robert Marik. + \item (Version 3.2) Added language option \texttt{catalan}, the translation due + to Ramon Ballester. + \item (Version 3.2) Added language option \texttt{brazil}, the translation due to + Koichi Sameshima. + \item Added language \texttt{finnish} Options. Translation due + to Paivi Porras. + \item Added a \texttt{\hyperref[forcolorpaper]{forcolorpaper}} option. This is the same as \texttt{forpaper} + but the color operators are not turned off. + \item Added three new options for creating color backgrounds + and overlays, \texttt{usetemplates}. \texttt{rightpanel} and + \texttt{leftpanel}, see the section \Nameref{ss:templates}. + The various template options requires the \textsf{eso-pic} + package by Rolf Niepraschk and the \textsf{everyshi} package + by Martin Schr\"oder. The \textsf{web package} supports graphics overlays + for the \texttt{dvipsone}, \texttt{dvips}, \texttt{pdftex} and + \texttt{dvipdfm} options. + \item Added a command to create navigation icons, + \nameref{ss:newnaviicon}, page~\pageref{ss:newnaviicon}. + \item Added a \texttt{textures} option, due to Ross Moore. + \item Made some minor changes to make \pkg{web} work better + with the \texttt{book} document class. + \item The introduction of the \textsf{polish} option. This + makes a total of nine localizations of \textsf{web/exerquiz}: + french, german, norsk, dutch, spanish, italian, russian, + dansk and polish. + \item Set an alias between \cs{marginsize} and \cs{margins}. + The latter is used by pdfscreen. This will make it easier for + people to switch between using web and pdfscreen. The use of + \cs{marginsize} is now deprecated. +\end{questions} + +\normalcolor + +\subsection{Exerquiz} + + +\begin{questions} + + \item (Version 6.3) Added the option \texttt{useui}, which is passed + \textsf{eforms}. If \textsf{eforms} is subsequently loaded, + \textsf{eforms} loads the xkeyval package, and key-value pairs are + defined for use in the optional argument of form and link commands. + See the \href{eformman.pdf}{eforms manual} for details. + + \item (Version 6.3) Added a unicode option. This option is passed to hyperref, if eforms + is subsequently loaded, eforms (and exerquiz) will accept {\LaTeX} markup in the optional + argument of the form fields. See the \href{eformman.pdf}{eforms manual} for details. + + \item (Version 6.3) Added the \texttt{turkish} language option. I extend my appreciation + to Mahmut Ko\c{c}ak for this translation. + + \item (Version 6.2d) Added \cs{titleQuiz} and \cs{fancyQuizHeaders}, + see \hyperref[titleQuiz]{Section~\ref*{titleQuiz}}, page~\pageref*{titleQuiz} + and \hyperref[titleQuizSQ]{Section~\ref*{titleQuizSQ}}, page~\pageref*{titleQuizSQ}. + \item (Version 6.2c) Added a feature that I have used for years to \textsf{exerquiz}: + see the section titled \Nameref{showcreditmarkup}. + \item (Version 6.2a) Added a feature for bookmarking exercises and quizzes, + see \hyperref[bmExQz]{Section~\ref*{bmExQz}} on page~\pageref*{bmExQz}. + \item (Version 6.2) Added the manswers environment for multiple answer + questions, that is, multiple choice questions that have several correct + answers. Multiple selection is permitted. See the \Nameref{manswersQuiz}. + \item (Version 6.1) Added the ability to randomize the multiple + choice alternatives, see the two sections \Nameref{ss:allowrandomize} and + \Nameref{s:random} for details. + \item (Version 6.05f) For inputting math fill-in responses. \texttt{log} now means common log, + and as before \texttt{ln} means natural log. Also, + re-engineered things so that math fill-in now accepts, and + correctly interprets, scientific notation (using E-notation) + $\texttt{}\text{E}\texttt{}$. The + capital letter E represents ``times ten raised to the power'', + the lower case e is reserved for use as the natural number. + \item (Version 6.05d) Added option \texttt{showgrayletters}, + see \Nameref{showgraylettersOpt}. + \item (Version 6.05e) Added \cs{setMClabelsep} and + \cs{resetMClabelsep} to adjust the horizontal distance between + the label and text for multiple choice questions. See the + discussion in \Nameref{BasicUsage}. + + \item (Version 6.05g) Added \cs{renameSolnAfterTo} for conveniently + changing the solution after label, and + \cs{resetSolnAfterToDefault} for resetting back to the default. + These two commands are available for use in \textsf{exerquiz} or + in \textsf{eqexam}. There is a brief discussion of these + commands in \Nameref{sss:solutionsafter}. + + \item (Version 6.05c) Added the commands \Com{DeclareQuiz}, \Com{floatQuiz}, + \Com{startQuizHere}, \Com{endQuizHere}, and \Com{dockQuiz}. to + start a quiz in an arbitrary place prior to the beginning of the + quiz. See \Nameref{floatQuiz}. + +\item[] \rule[2pt]{1in}{.4pt} Older New Stuff \rule[2pt]{1in}{.4pt} + +\item (Version 6.03) Added the \hyperref[bChoices]{\cs{bChoices}}/\cs{eChoices} command + pair, this makes it easy to lay out multiple choice alternatives. + +\item (Version 6.0) Improved the \texttt{mathGrp} environment so + that it treats grouped question truly as a unit. Added two + optional parameters to the environment. The document author + can specify a JavaScript function to grade the grouped + questions. Despite its name, \texttt{mathGrp} environment + works for text fill-in as well as math fill-ins (but not for + multiple choice). The \texttt{mathGrp} environment also now + works for the \texttt{shortquiz} environment (in addition to + the \texttt{quiz} environment). See \Nameref{grouped}. + + \item Separated the \href{eformman.pdf}{eforms} support from + the \textsf{exerquiz} package. \textsf{eforms} is now a + stand-alone package that can be used by people who may want to + use PDF forms outside the context of a document that contains + quizzes. See the demo file \texttt{eforms\_tst.tex}. + + \item \textcolor{red}{Important:} There is one required + parameter for the \texttt{quiz} environment, a base name used + to build the names of the form fields used in the quiz, e.g., + \verb+\begin{quiz}{qzQuiz1}+. Now this base name of the quiz + should only contain ascii characters or numbers. This name is + now used to construct a JavaScript object, so it must be a + valid JavaScript object name. For example \texttt{qzQuiz1} is + correct, but \texttt{qz:Quiz-1} is not. + + \item Created \cs{@PromptButton} a new correct answer button for quizzes. Quiz + questions might have a series of parts in which the answer + to one part depends on the answer to the previous part. + With \cs{@PromptButton}, the answer can be optionally + provided while the student is taking the quiz. See the section on the + Prompt Button for details. + + \item Created a grouping environment for math fill-in questions. See the section + entitled Grouping Math Fill-in Questions. + + \item Added a \texttt{noquizsolutions} option -- mostly for online quizzing -- + see page~\pageref{sss:noquizsolutions}. + \item Changed the behavior of \cs{CorrButton}: If \hyperref[sss:nocorrections]{\texttt{nocorrections}} + is used, the \cs{CorrButton} does not appear. This is reasonable, + \cs{CorrButton} is used to display corrections to the quiz. + \item Modified the \texttt{questions} environment so that it behaves more like + standard {\LaTeX} list environments. You can now nest the \texttt{questions} + environment three deep. See \texttt{pc\_test.tex} for examples. + \item Added an optional argument to the \cs{Ans} command for multiple-choice questions + for assigning \textit{partial credit}. See the demo file \texttt{pc\_test.tex}. + \item Modified the behavior of the link-type multiple choice questions When you select + an alternative, a check appears superimposed over the letter. I've removed the + alert dialog informing the user that he has change his selection. The file + \texttt{pc\_test.tex} illustrates this. + \item The \hyperref[paraRespBoxNine]{ninth parameter} of \cs{RespBoxMath} has been modified to take an JS object. + This object can have two properties: +\begin{Verbatim}[xleftmargin=\amtIndent] +{ [ priorParse: | ], + [ comp: ] } +\end{Verbatim} + The \texttt{priorParse} property is used to filter the user's answer prior to be fully parsed, + while the \texttt{comp} property is used to specify a custom compare function. + See the demo file \texttt{integer\_tst.tex} for examples. + \item Again for the math fill-in (\cs{RespBoxMath}), the way in which you specify variables (the + \hyperlink{paraRespBoxThree}{third parameter}) + has changed: Specify the variables using a comma-delimited list, for example, \texttt{(r:x,i:n,y)}. + Typing the variables has been introduced: \texttt{r:x} means that \texttt{x} is a real variable (the default) + and \texttt{i:n} means that \texttt{n} is an integer variable. See the demo file \texttt{integer\_tst.tex}. + + \item Added complete support with \textsf{eForms}. Integrated + this support into the quiz environments. See the \texttt{\href{eformman.pdf}{eForms Manual}} + documentation file for complete details. + \item Documented the use of form check boxes with the \texttt{shortquiz} + environment and introduced the commands + \begin{Verbatim}[xleftmargin=\amtIndent] + \sqTurnOffAlerts,\sqTurnOnAlerts,\sqNoCorrections,\sqNoCorrections + \end{Verbatim} + to control response feedback. + \item Added language \texttt{finnish} Options. Translation due + to Paivi Porras. + \item Eliminated the need for the \cs{ifforAcroV} switch in the + \texttt{*.ins} files. I've written new code that detects whether Acro4 or + Acro5 is being used; in the latter case, a \texttt{try/catch} strategy is + used to catch exceptions. + \item Added a \texttt{textures} option, due to Ross Moore. + \item Wrote same JavaScripts and placed them in the \texttt{dljslib} to + process questions in which an equation is the expected answer. See the + sample file \texttt{jqzequat.tex}. + \item Wrote the \texttt{dljslib} Package, this is a library of JavaScript + functions that extends the capabilities of \textsf{exerquiz}. + \item Extended math fill-in questions to include arbitrary multivariate + questions. See the sample file \texttt{multivar.tex}. + \item Added several macros: \cs{defaultquiztype} and + \cs{quiztype}. The first command takes no arguments, the + second on takes one: either l or f; e.g. \verb+quiztype{f}+ + (\verb+quiztype{l}+) causes the quiz environment to ignore the + optional `quiztype' parameter (\texttt* or no \texttt*) and to + use a form-type (resp.\ link-type). Placing + \cs{defaultquiztype} reverts the quiz environment back to its + default behavior (obeying the first optional parameter). + \item Added the convenience commands for the \texttt{quiz} environment: \cs{useBeginQuizButton}, + \cs{use\-EndQuizButton}, \cs{useBeginQuizLink} and \cs{useEndQuizLink}. + See \mlNameref{sss:FormButton} for details.\footnote{This link requires Adobe Reader 7.0 or later.} + \item Added the \texttt{noHiddensolutions} for \textsf{exerquiz}, and + added an `\texttt{H}' option for exercises to hide solutions, see + \nameref{sss:hide} and \nameref{sss:noHideopt}, for details. + \item Added a method of assigning points to a quiz question. Useful + for submitting questions to a CGI for recording in a database. + \item Added a \texttt{noPeeking()} JS function and supporting macros. + When the \cs{NoPeeking} command is executed, the student cannot + see the solutions to the quizzes (not shortquizzes) by browsing + through the file. See \Nameref{sss:nopeek}. + \item Added new JS functions \texttt{lowThreshold()} and + \texttt{highThreshold()}. I modified the end of quiz macros to + incorporate the calling of one of these two (or calling a + document author defined routine). See \Nameref{threshold}. + \item Added a `\texttt{debug}' option, which gets passed on + to \texttt{insdljs} package. This can be used to write some + debugging commands within your JS. (\Nameref{sss:debug}) + \item For math fill-ins, the author does not use the + JavaScript syntax; the author can use simplified notation, e.g, + \verb+2*x*e^(x^2)+ instead of \texttt{2*x*exp(pow(x,2))}. + Author's answer now passes through the ParseInput JS routine. + \item Now the document author can define a custom + JS function to process an answer. Also, when writing + Math fill-in questions, you can also define your + own variable (no longer restricted to just `$x$'). + \item Added in a \texttt{solutions} environment to + \texttt{quiz} environment. Added additional optional parameter + into the \cs{RespBox}, \cs{RespBoxTxt} macros to indicate the + presence of a solution. The solution is viewed by + shift-clicking on the ``Ans'' Button (\cs{CorrAnsButton}). A + button or checkbox that has a solution has a boundary color of + \cs{solutionColor}. + \item \texttt{Exerquiz} now uses the package \texttt{insDLSJ} to + insert document level JavaScripts; this gives the document author + a chance to write custom JavaScripts. I've also modified many macros + that enable the document author to ``hook'' into. + \item New command \cs{RespBoxEssay} that can be used to pose + Essay-type questions. The question is not evaluated by JavaScript + within the document; rather, this question should be submitted + to a CGI for later review by the instructor. + \item \cs{RespBoxMath} has been defined to be the same as + \cs{RespBox} to give a little more consistency in naming. + \item The use of \cs{RespBoxNT} has been deprecated. Added in + feature to customize the comparison of two answers. + \item Added a text fill-in question type that can be used in the + \texttt{short\-quiz} and \texttt{quiz} environments. + (\Nameref{sss:oTxtQ}) + \item A \texttt{preview} option has been added. When this + option is used, the bounding rectangles of all form fields + are framed so their positions can be seen in a dvi previewer. + See \mlNameref{sss:preview}.\footnote{This link requires Adobe Reader 7.0 or later.} + \end{questions} + + \subsection{insdljs} + + The \texttt{insdljs} Package is a general purpose \LaTeX{} package + for inserting Acrobat JavaScript into the document level section + of a PDF document. The package features the \texttt{insDLJS} + environment. This environment typically goes in the preamble of a + \LaTeX{} source file, or in the style files of a \LaTeX{} package. + See the documentation contained within the \texttt{insdljs.dtx} + file for additional details. There is a sample file, + \texttt{insdljs\_ex.tex} that can be used as a startup test file. + +\begin{questions} + \item (Version 2.0f) Added a command \cs{previewMiKTeX} which redefines \cs{jsR} and + \cs{jsT} that enables, I hope, the \textsf{yap} previewer to preview + an \textsf{AeB} document. + \item Added the \texttt{defineJS} environment. Use this environment to + write JavaScript for buttons and other form fields. + \item Added the \texttt{execJS} environment. Use this environment to write + ``discardable'' JavaScript that will execute when the newly created document is opened + in the Acrobat Viewer. (The Acrobat Viewer, not the Reader, is required.) + See the demo file \texttt{execjstst.tex}. +\end{questions} + +\subsection{dljslib} + +The \texttt{dljslib} Package acts as a library of JavaScript +functions. Due to the increased programmability of +\texttt{exerquiz} and its new-found flexibility, it is possible to +write a number of different routines to handle various kinds of +math fill-in questions. These JavaScript functions can be stored +in the library and retrieved when needed. This package requires +the \texttt{insdljs} package. + \begin{questions} + + \item There are some major user-contributed JavaScript routines. + The following functions, which are \texttt{ProcResp}-types, were + written for an online grading system being developed by Drs.\ + Bruce Wagner and David Arnold, and Mr. Jacob Miles-Prystowsky. + The descriptions given below were provided by the authors. + I want to extend my deep thanks for their contribution! See the + documentation of \textsf{dljslib.dtx} for extended details. + \begin{questions} + \item The JS function \texttt{ProcRespSetFormula} grades an + unordered list of formulas, such as \texttt{x}, \verb!x^2!, \verb!x^3!. + \item \texttt{ProcRespFactors} is for grading polynomial factoring + questions. If a polynomial factors as + \verb!-5x^2(x-4)(x+2)!, the answer is only unique + up to the order of factors and a change of sign on an + even number of factors. For example, it could also be + written as \verb!-5x^2(x+2)(x-4)! or + \verb!5x^2(-x+4)(x+2)! or \verb!-5(x-4)(x+2)x^2!, etc. + This script should grade all of these correctly. + \item The JS function \texttt{ProcPoint} is almost an exact copy of + the JS function \texttt{ProcVec}, but uses parentheses instead of angle brackets as + delimiters. This is for questions that have a point $(x,y)$ as the + answer. + \item \texttt{ProcRespIntervals} is for grading questions that have an + interval or union of intervals as the answer. + \end{questions} + \item[] The sample file for this contribution is \texttt{dljslib\_apw.tex}. + + \item Added a feature whereby you can create a file + \texttt{libcusopt.opt} to declare your own options for this + package. These declarations should be a combination of existing options. + For example, +\begin{Verbatim}[xleftmargin=\amtIndent] +\DeclareOption{procrespgrp}{\includeOptions{% + vectors,setSupport,equations,intervals,% + unordered,point,factors,ImplMulti} +} +\end{Verbatim} + creates a new option for \textsf{dljslib} called \texttt{procrespgrp} which bundles + together all frequently used JS functions frequently used. The file + \texttt{libcusopt.opt} can be placed in the {\LaTeX} search path, but it's perhaps + best to put it in your source file, so that the options are local to that folder. + The command \cs{includeOptions} is defined in \texttt{dljslit.dtx}. + + \item[] A sample \texttt{libcusopt.opt} is distributed with the + {\AEB}, this sample file consists of the example given above, + and is used by the sample file \texttt{dljslib\_apw.tex}. + +\item[] \rule[2pt]{1in}{.4pt} Older New Stuff \rule[2pt]{1in}{.4pt} + + \item Added an option \texttt{limitArith} to the + \textsf{dljslib}, which limits the use of arithmetic operations + and built-in functions. The demo file is + \texttt{limarth.tex}, found in the \texttt{dljslib\_examples} + folder. \item Added \texttt{setSupport} option to + \textsf{dljslib}. This gives support to math fill-in questions + for processing (1) a set of numerical answers or a comma + delimited list of answers; (2) a symbolic set of answers. The + demo file is \texttt{set\_test.tex}. + + \item Added \texttt{combinatorics}, \texttt{nodec} and + \texttt{noBinFac} to the JavaScript library. These additions + are due to Ross Moore and Frances Griffin and were developed + for their + \href{http://rutherglen.ics.mq.edu.au/~macqtex/}{MacQ{\TeX}} + online testing system. Some of the changes listed in the + \textsf{exerquiz} section above were to accommodate these new + functions (for example, having integer variables). Many, many + thanks for generously sharing their JavaScript with the + \TeX/PDF community. The test file for these features is + \texttt{integer\_tst.tex}. +\end{questions} +% See the documentation contained within the \texttt{dljslib.dtx} document, and +% see \Nameref{sss:dljslib}. + +\section{What's Old} + +\paragraph*{History.} The \pkg{web} and \textsf{exerquiz} packages were written in +preparation for a two-day workshop on \LaTeX/PDF that I gave at +the \textcolor{red}{College of the Redwoods}, April~30-May~1, +1999, at the invitation of David Arnold. The workshop forced me +to take many of the basic macros that I had developed in plain +\TeX\ and convert them to \LaTeX. + +Significant additions to the \textsf{exerquiz} were made immediately +following the $\text{20}^{\text{th}}$ Annual Conference of the \TeX\ +User's Group (\textsf{tug}), in August, 1999, Vancouver, British +Columbia, which I attended. + +The \textsf{insdljs} package was written for the $\text{22}^{\text{nd}}$ +Annual Conference of the \TeX\ User's Group (\textsf{tug}), in +August 2001, at the University of Delaware, Newark, Delaware. + +The \texttt{execJS} environment was created as a result of some +work I did for the Seybold SF Convention, 2002 (see article at +\href{http://www.planetpdf.com/mainpage.asp?webpageid=2130}{planetPDF}); +the techniques were first presented to the PDF public at this +convention. My complete presentation from that conference is +again available from +\href{http://www.planetpdf.com/mainpage.asp?webpageid=2310}{planetPDF}. + +\paragraph*{Acknowledgements.} Noel Vaillant, \url{www.probability.net}, deserves my thanks for +his enthusiasm for the \pkg{web} style file and his initial +work on it inspired me to make a serious effort at writing a +\LaTeX\ package. + +Thanks also goes out to Jean-Michel Sarlat for writing a French +version of the \pkg{web} and \textsf{exerquiz} packages. See +his \href{http://melusine.eu.org/syracuse/}{Syracuse} Web site. He +urged me to include a language option. Thanks also goes to +Michael Wiedmann who suggested a language option many months +earlier, but I'm afraid it landed on deaf ears at the time. +These two provided the translations for the \texttt{french} and +\texttt{german} options. (January 1, 2000) + +My thanks to Heiko Oberdiek, who took a close look at +\textsf{insdljs}. He made several suggestions, and urged me to +make some significant improvements to this package. + +\medbreak\noindent +Now, I really must get back to retirement.\enspace\dps + +\addtocontents{toc}{\protect\vspace{2ex}} +\includeexersolutions +\includequizsolutions + + +\newpage +\markright{References} + +\begin{thebibliography}{[1]}\label{references} +\addcontentsline{toc}{section}{\protect\numberline{}References} + +\bibitem{tech:AcroJS}\hypertarget{references}{}% + Acrobat JavaScript Scripting Refernce, Technical Note \#5431, Version~6.0., + Adobe Systems, Inc., 200\\ \url{http://partners.adobe.com/asn/acrobat/docs.jsp} + +\bibitem{book:Lamport} + Leslie Lamport, \textit{\LaTeX: A Document Preparation} + System (2nd ed.), Addison-Wesley Publishing Company, + 1994, ISBN 0-201-52983-1. + +\bibitem{book:Goossens1} + Michel Goossens, Frank Mittelbach and Alexander + Samarin, \textit{The \LaTeX{} Companion}, Addison-Wesley + Publishing Company, 1994, ISBN 0-201-54199-8. + +\bibitem{book:Goossens2} + Michel Goossens, Sebastian Rahtz, and Frank + Mittelbach, \textit{The \LaTeX{} Graphics Companion}, + Addison-Wesley Publishing Company, 1997, ISBN + 0-201-85469-4. + +\bibitem{book:Goossens3} Michel Goossens, and Rahtz, Sebastian, + with Gurari, Eitan, Moore, Ross, and Sutor, Robert, + \textit{The \LaTeX\ Web Companion}, + Addison Wesley Longman, Reading, Massachusetts, USA, 1999. + ISBN: 0-201-43311-7. + +\bibitem{book:Kopka} + Helmut Kopka and Patrick W. Daly, \textit{A Guide to + \LaTeX2e} (2nd ed.), Addison-Wesley Publishing Company, + 1995, ISBN 0-201-43777-X. + +\bibitem{book:Knuth} + Donald E. Knuth, \textit{The \TeX book}, Addison-Wesley + Publishing Company, 1987, ISBN 0-201-13448-9. + +\bibitem{book:Merz} + Thomas Merz, \textit{Web Publishing with Acrobat/PDF}, + Springer-Verlag Berlin Heidelberg New York, 1998, + ISBN 3-540-63762-1. + +\bibitem{article:Story:Pdfmarks} + D.P. Story, \textit{Pdfmarks: Links and Forms}, AcroTeX Web + Site, 1998,\\\url{www.math.uakron.edu/~dpstory/acrotex.html} + +\bibitem{article:Story:LaTeX} + D.P. Story, \textit{Using \LaTeX\ to Create Quality PDF Documents for the + WWW}, Acro\!\TeX\ Web Site, 1998,\\ + \url{www.math.uakron.edu/~dpstory/acrotex.html} + + +\end{thebibliography} + + +% \printindex +\end{document} + +I copied the file amsfonts.map from texmf/dvips/ams +to texmf/pdftex/base. I then edited the file +pdftex.cfg and included the line +map +amsfonts.map. +map standard.map % to get dings + +output_format 1 +compress_level 9 +decimal_digits 2 +page_width 210mm +page_height 297mm +horigin 1in +vorigin 1in +map standard.map +map +cm.map +map +amsfonts.map +% map +logo.map +% map +lucida.map +% map +misc.map +% map +cs.map +% map +cmttf.map +% map +test.map +% map +ttftest.map +% map +mono.map + + +\subsubsection{An Example}\label{sss:quizexample} + + +%\renewcommand\bqlabel{Begin Quiz} +%\renewcommand\eqlabel{End Quiz} + +The following example is used at the Acro\!\TeX\ Web Site in a +demonstration program on how to use \emph{Adobe's FDF Toolkit} to +process form data from a pdf file. (Form data exported from a pdf +file is in the \emph{Forms Data Format}, or FDF.) The url for +this demonstration program is \url{\bUrl/demo/quiz1_q.pdf}. + + +\symbolchoice{diamond} + +\begin{quiz*}{QuizTotal} Answer each of the following. Passing is 100\%. + +\begin{questions} + +\item Calculate the limit, if it exists, otherwise, state that it does not +exist (d.n.e.). +\[ + \lim_{x\to3}\frac{\sqrt{3x}(x^2-4)^2}{x^2-2x-1}. +\] +\begin{answers}4 +\Ans0 $75$ &\Ans1 $\dfrac{75}2$ &\Ans0 $25$ &\Ans0 d.n.e. +\end{answers} + +\item Calculate the limit, if it exists, otherwise, state that it does not +exist (d.n.e.). +\[ + \lim_{t\to2}\frac{t^2-4}{t-2}. +\] +\begin{answers}4 +\Ans0 $2$ &\Ans0 $+\infty$ &\Ans1 4 &\Ans0 d.n.e. +\end{answers} + +\item Calculate the limit, +$\displaystyle\lim_{t\to2^-}\frac{t^2}{t-2}$, if it exists, otherwise, +state that it does not exist (d.n.e.). +\begin{answers}4 +\Ans1 $-\infty$ &\Ans0 $+\infty$ &\Ans0 $4$ &\Ans0 d.n.e. +\end{answers} + +\item Using one-sided limit techniques, determine whether the limit +$\lim_{x\to2}f(x)$ exists and state its value, where +\[ + f(x) = \begin{cases} + |x^2-5| & \text{for }x\le2 \\ + \dfrac{x-2}{x-2} & \text{for }x>2 + \end{cases} +\] +\begin{answers}4 +\Ans0 $-1$& \Ans0 0 &\Ans1 1 &\Ans0 d.n.e. +\end{answers} + +\item Calculate the limit, +$\displaystyle\lim_{x\to-2}\frac{\sqrt{x+8}-\sqrt6}{x+2}$, +if it exists, otherwise, state that it does not +exist (d.n.e.). +\begin{answers}4 +\Ans0 $\dfrac1{\sqrt6}$ &\Ans1 $\dfrac{\sqrt6}{12}$ & + \Ans0 $\dfrac12$ &\Ans0 d.n.e. +\end{answers} + +\item There is some function $f$ and some number $a$ in the domain of +$f$ such that +\[ + f'(a)=\lim_{x\to-2}\frac{\sqrt{x+8}-\sqrt6}{x+2} +\] +Name the function $f$ and the number $a$. +\begin{answers}2 +\Ans1 \strut$f(x)=\sqrt{x+8}$; $a=-2$ &\Ans0 $f(x)=\sqrt{x}$; $a=-2$\\[3pt] +\Ans0 \strut$f(x)=\sqrt{x+8}$; $a=0$ &\Ans0 $f(x)=\sqrt{x+8}$; $a=2$ +\end{answers} +\end{questions} +\end{quiz*}\quad\raisebox{-3pt} +{\TextField[width=3in,name=QuizTotal,bordercolor=0 0 1,default=\eqScore]{}} + +\medskip\noindent +The partial code for this quiz looks like this. +\begin{Verbatim}[xleftmargin=\amtIndent] +\symbolchoice{diamond} % change to diamond `check' +\begin{quiz*}{QuizTotal} Answer each of the following.... +\begin{questions} +......... +\end{questions} +\end{quiz*}\quad\raisebox{-3pt}{\TextField[name=QuizTotal, + default=\eqScore,bordercolor=0 0 1,width=3in]{}} +\end{Verbatim} + + +\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 +\raisebox{-2pt}{\renewcommand\LayoutTextField[2]{% label, field +\medskip\noindent#2}% +\TextField[name=qzTeXc,width=1.25in,align={0 /Ff 1}, + default=\eqScore]{}\raisebox{3.5pt}{% + \CorrButton[\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}% + \BS{/W 1 /S /I}% % border width 1, inset button + ]{qzTeXc}}} + + +%\noindent\begin{minipage}{\linewidth} +\begin{quiz}*{qzTeX} 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} + + +\subsection{Greater Customization with + \texorpdfstring{\protect\cs{TextField}} + {\textbackslash TextField}}\label{ss:modoutputfield} + +The \cs{ScoreField} macro is defined as +\begin{Verbatim}[xleftmargin=\amtIndent] +\newcommand{\ScoreField}[2][width=1.5in]{% + \TextField[name=#2,default=\eqScore,align={0 /Ff 1},#1]{}} +\end{Verbatim} + +\noindent You can see the command takes one required argument and one +optional argument (the required one is label \texttt{\#2} and the +optional one is \texttt{\#1}). The required argument becomes the +\texttt{name} of the field, and the optional parameter is just +added into the parameter list of \cs{TextField}. You can also see +the \texttt{value} of the field is set to \cs{eqScore}, which +expands to `Score:' in English. + +More sophisticated score fields can be obtained by manipulating +\cs{TextField} directly. + +We can modify the appearance of the text field in a couple of +ways: (1) by changing some of the options in \cs{TextField}; (2) +changing the macro definition of \cs{LayoutTextField}. + +\subsubsection{Admissible key-value pairs of +\texorpdfstring{\protect\cs{TextField}} + {\textbackslash TextField}}\label{sss:modtextfield} + +In this section we will outline methods of modifying the +appearance of \cs{TextField} text box, which is a macro defined in +the \pkg{hyperref} package. + +The following table lists several useful options for +\cs{TextField}. + +%Numerous examples on how to use these options +%follow the table. + + +\begin{longtable}{>{\ttfamily}lll>{\PBS\raggedright}p{1.5in}} +\multicolumn{4}{l}{\large\color{red}$\blacktriangleright$ +\color{blue} \cs{TextField} Options: Dimension Related} \\ [3pt] +height & dimen & & height of box \\ +width & dimen & & width of field box \\ [12pt] +% +\multicolumn{4}{l}{\large\color{red}$\blacktriangleright$ +\color{blue} \cs{TextField} Options: Text Related} \\ [3pt] align +&name &0 & $0=\text{left-aligned}$,\newline + $1=\text{centered}$\newline + $2=\text{right-aligned}$ \\ +charsize & dimen & 10pt & Font size of text \\ [12pt] +% +\multicolumn{4}{l}{\large\color{red}$\blacktriangleright$ +\color{blue} \cs{TextField} Options: Color Related} \\ [3pt] +backgroundcolor & RGB &1 1 1& Color of background color.\\ +bordercolor & RGB & 1 0 0 & Color of the border.\\ [12pt] +color & RGB & 0 0 0 & Color of text within field\\ +borderstyle & name &S& S (solid), B (beveled), + I (insert), U (underlined) \\ [12pt] +% +\multicolumn{4}{l}{\large\color{red}$\blacktriangleright$ +\color{blue} \cs{TextField} Options: Style Related} \\ [3pt] +borderwidth & number & 1 & Width of the border of the + box (in points)\\[12pt] +% +\multicolumn{4}{l}{\large\color{red}$\blacktriangleright$ +\color{blue} \cs{TextField} Options: Field Related} \\ [3pt] +default & & & default value of the field \\ +name & name & & name of the field\\ +readonly & Boolean& false & set read-only switch +\end{longtable} +%\end{flushleft} + +A complete list of options comes with the \pkg{hyperref} +documentation; or see Michel Goossens \textit{et +al}~\cite{book:Goossens3}, entitled \textit{The \LaTeX\ Web +Companion} + +We next present several examples that illustrate the use of these +options. + +\subsubsection{Some Examples of +\texorpdfstring{\protect\cs{Textfield}} + {\textbackslash Textfield}}\label{sss:exampltextfield} + +\def\LayoutTextField#1#2{\redpoint\raisebox{-3pt}{#2}} + +\TextField[width=2in,name=QuizTotal,bordercolor=0 0 1, + default=\eqScore]{} + +\begin{Verbatim}[xleftmargin=\amtIndent] +\TextField[width=2in,name=QuizTotal, + bordercolor=0 0 1,default=\eqScore]{} +\end{Verbatim} + +\noindent The \texttt{readonly} is an important attribute to have---the +students cannot modify their score. Unfortunately, +\texttt{readonly} \emph{does not work} with \pkg{hyperref}. To +overcome this ``bug'' in \pkg{hyperref}, you have to be a +little sneaky. + +\TextField[width=2in,name=Example,bordercolor=0 0 1, + backgroundcolor=0.98 0.92 0.73,color=1 0 0,align={0 /Ff 1}, + default=Text Field with Various Options]{} + +\begin{Verbatim}[xleftmargin=\amtIndent] +\TextField[width=2in,name=Example,bordercolor=0 0 1, + backgroundcolor=0.98 0.92 0.73,color=1 0 0, + align={0 /Ff 1}, % realonly is /Ff 1 in pdf code + default=Text Field with Various Options]{} +\end{Verbatim} + +\noindent The read only key-value (\texttt{/Ff 1}) can ``ride'' into the +code on the ``back'' of the \texttt{align} parameter. +(\texttt{align=0} means left-aligned in the text field.) + +\TextField[width=2in,name=Example,bordercolor=1 1 1,color=0 0 1, + backgroundcolor=.753 .753 .753,borderstyle=B,align={1 /Ff 1}, + default=Your Score goes here]{} + +\begin{Verbatim}[xleftmargin=\amtIndent] +\TextField[width=1.25in,name=Example,bordercolor=1 1 1, + backgroundcolor=.753 .753 .753,color=0 0 1, + borderstyle=B,align={1 /Ff 1}, % /Ff 1 = readonly + default=Your Score goes here]{} +\end{Verbatim} + +\subsubsection{Modifying +\texorpdfstring{\protect\cs{LayoutTextField}} {\textbackslash +LayoutTextField}}\label{sss:modlayout} + +\renewcommand\LayoutTextField[2]{#1 #2} + +The macro \cs{LayoutTextField} allows you to design how your text +box is formated by \TeX. The default definition for +\pkg{hyperref} is +\begin{Verbatim}[xleftmargin=\amtIndent] + \newcommand\LayoutTextField[2]{#1 #2} +\end{Verbatim} +\noindent The first argument is the \textsf{label}, the second is the +textfield. For example, above definition yields:\\ +\TextField[width=2.4in,name=Name]{\bfseries Enter your name: } +\begin{Verbatim}[xleftmargin=\amtIndent] + \TextField[width=2.5in,name=Name]{Enter your name: } +\end{Verbatim} + +\medskip +The \textsf{exerquiz} package redefines this to +\begin{Verbatim}[xleftmargin=\amtIndent] +\renewcommand\LayoutTextField[2]{% label, field + \medskip\noindent#2} +\end{Verbatim} + +Finally, the field examples given earlier had the following +definition for \cs{LayoutTextField}: +\begin{Verbatim}[xleftmargin=\amtIndent] +\newcommand\redpoint{\par\medskip\noindent + \makebox[\parindent][l]{\large\textcolor{red} + {$\blacktriangleright$}}} +\renewcommand\LayoutTextField[2]{\redpoint + \raisebox{-3pt}{#2}} +\end{Verbatim} + +\noindent I lowered the text field to line up better with the +\texttt{amssymb} symbol \cs{blacktriangleright} +($\blacktriangleright$), which is painted red. In this way we +obtain + +\def\LayoutTextField#1#2{\redpoint\raisebox{-3pt}{#2}} +\TextField[width=2in,name=QuizTotal,bordercolor=0 0 1, + default=\eqScore]{} +\begin{comment} +\begin{Verbatim}[xleftmargin=\amtIndent] +\TextField[width=2in,name=QuizTotal,bordercolor=0 0 1, + default=\eqScore]{} +\end{Verbatim} +\end{comment} + +\subsubsection{Custom Comparisons}\label{cusComp} + +This section is devoted to customizing the method of comparison +for the math type objective question using \cs{RespBoxMath} command. + +When the user enters an answer into the response box, a +document level JavaScript function, \texttt{ProcResp}, is called. +As discussed earlier, the value of the expression entered by the +user is compared the corresponding value of the answer given by +the document author. The key word in the last sentence is ``compared''. There +is a compare function that compares the author's answer with the user's answer. + +In general, the \texttt{ProcResp} passes five parameters to a compare function. +The compare function can be be customized by the document author; there is, however, +a standard, or default, compare function. It is defined as follows: + +\begin{Verbatim}[xleftmargin=\amtIndent] +function diffCompare(a,b,c,F,G) { + var x; + with(Math) { + x = c; + F = eval(F); + G = eval(G); + return abs ( F - G ); + } +} +\end{Verbatim} +\noindent The meaning of these five parameters of this comparison function are + +\begin{description} + \item[\ttfamily a:] The left-hand endpoint of the interval. + \item[\ttfamily b:] The right-hand endpoint of the interval. + \item[\ttfamily c:] The point at which both the user and author answers are to + be evaluated. + \item[\ttfamily F:] The author's answer, a function in $x$. + \item[\ttfamily G:] The user's answer, a function in $x$. +\end{description} + +The function \texttt{diffCompare} evaluates each of the two +functions \texttt F and \texttt G at \texttt{x = c}, and returns +the absolute difference in the two. For this simple comparison, the parameters +\texttt a and \texttt b are not used. + +The \texttt{diffCompare} will be sufficient for most, but not +all mathematical questions. For example, consider the following question: + +\medskip +\begin{oQuestion}{indefInt1} +$\displaystyle\int \sin(x)\,dx = $\space +\RespBoxMath{-cos(x)}{4}{.0001}01\kern1bp\CorrAnsButton{-cos(x)} +\end{oQuestion} + +\medskip\noindent +There are infinitely many answers, all of them of the form $-\cos(x)+C$. Note that +the only input that is marked as correct is $-\cos(x)$, the JavaScript does not judge +$-\cos(x)+1$, to be correct, for example. The problem is, of course, the method of +comparison, \texttt{diffCompare}, is not appropriate to this particular problem. + +The above question needs a specialized method of comparison. Consider +the compare function: + +\begin{Verbatim}[xleftmargin=\amtIndent] +\begin{insDLJS}[indefCompare]{compare}{Comparisons} +function indefCompare(a,b,c,F,G) { + var C, eqx; + with(Math) { + eqx = a; + C = eval(F)-eval(G); + eqx = c; + F = eval(F); + G = eval(G); + return abs( F - G - C ); + } +} +\end{insDLJS} +\end{Verbatim} +\noindent This environment was placed in the preamble of this document, and uses the +\texttt{insdljs} package, which comes with the \texttt{exerquiz} distribution. +This will add the function \texttt{indefCompare} function to the document level +JavaScript section of the PDF file when it is created. + +\redpoint It is \emph{important} to note that when you are writing your +own compare functions, the independent variable must be named +`\texttt{eqx}'. The functions \texttt F and \texttt G have been +searched and their original independent variable has been replaced with +`\texttt{eqx}'. To get a correct evaluation, therefore, any compare functions +must use the `\texttt{eqx}' to evaluate the functions. + +Let's try that same question, but with this compare function instead of the +default compare function + +\medskip +\begin{oQuestion}{indefInt2} +$\displaystyle\int \sin(x)\,dx = $\space +\RespBoxMath{-cos(x)}{4}{.0001}01[indefCompare]\kern1bp\CorrAnsButton{-cos(x)} +\end{oQuestion} + +\medskip\noindent +Now, if you enter $-\cos(x) + 10$, for example, that answer will be judged as +correct by \texttt{ProcResp}. + +The code for the above response box is + +\begin{Verbatim}[xleftmargin=\amtIndent] +\begin{oQuestion}{indefInt2} +$\displaystyle\int \sin(x)\,dx = $\space +\RespBoxMath{-cos(x)}{4}{.0001}01[indefCompare]\kern1bp +\CorrAnsButton{-cos(x)} +\end{oQuestion} +\end{Verbatim} + +\noindent The optional ninth parameter is present in the +\cs{\hyperlink{paraRespBox}{RespBoxMath}}. Use this parameter to +pass the name of the compare function that is to process the +question. Here, we specify \texttt{indefCompare}, which was +defined in the preamble of this document using the +\texttt{insDLJS} environment. -- cgit v1.2.3