summaryrefslogtreecommitdiff
path: root/texmf-dist/doc/latex/acrotex/examples/jtxttst.tex
blob: 4d78e08625516d67ba714d47a573cd886258c33f (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
\documentclass{article}
\usepackage{amsmath}
\usepackage
    [tight,designi]{web}
\usepackage{exerquiz}
\usepackage[indefIntegral]{dljslib}

\title{Extending the Exerquiz Package Text Fill-in Questions}
\author{D. P. Story}
\subject{Sample file}
\keywords{LaTeX, PDF, derivative, calculus, JavaScript}

\university{NORTHWEST FLORIDA STATE COLLEGE\\
Department of Mathematics}
\email{dpstory@uakron.edu}
\version{2.0}
\copyrightyears{1999-\the\year}

\nocopyright
\norevisionLabel

\def\D{\dfrac {\hbox{\text{d}}}{\text{d}x}}
\def\dPose#1{$\D#1=$ }

\newcommand\redpoint{\par\ifdim\lastskip>0pt\relax\vskip-\lastskip\fi
\vskip\medskipamount\noindent
  \makebox[\parindent][l]{\large\color{red}$\blacktriangleright$}}
\newcommand{\cs}[1]{\texttt{\char`\\#1}}

\useMCCircles

\begin{document}

\maketitle

\section{Text Fill-in Questions}

\textsf{Exerquiz} can now create text fill-in questions, questions
in which the response is text (as opposed to a mathematical
expression). 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. For example:

\redpoint\begin{oQuestion}{ex1}%
Who was the first President\footnote{of the United States}?\
\RespBoxTxt{0}{0}{4}{George Washington}{Washington}
    {G. Washington}{Geo. Washington}
\end{oQuestion}

\medskip\noindent
The command \cs{RespBoxTxt} is the one that creates a text fill-in question. Its
syntax is
\begin{verbatim}
\RespBoxTxt[#1]#2#3[#4]#5<plus listing of alternatives>
\end{verbatim}
\noindent\textbf{\hypertarget{paraRespBoxTxt}{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 that indicates
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.
\end{enumerate}
See the JavaScript function \texttt{eqFilter} in \texttt{exerquiz.dtx} for
program code details.  Additional filtering options may be added.

\item[\ttfamily\#3:] This parameter is a number that indicates the compare
method to be used. Permissible values of this parameter are
\begin{enumerate}
    \item[\ttfamily0:] (The default) The author's and user's answers are
    compared for an exact match. (These answers are filtered before they are
    compared.)
    \item[\ttfamily1:] 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{enumerate}
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 forth 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{enumerate}

\makeatletter
% remove label `Quiz' and gobble up the space that follows it.
\renewcommand\sqlabel[1]{\@gobble}
\makeatother
\begin{shortquiz}[comboexamp]%
The following series of examples illustrate different combinations
parameters~\texttt{\#2} and~\texttt{\#3}.  All questions are in
response to the question ``Who was the first president of the
United States?''
\begin{questions}
\item Remove all white space and non-word characters, convert to lower case,
then look for a match.
\RespBoxTxt{0}{0}{4}{George Washington}{Washington}
    {G. Washington}{Geo. Washington}
Of course, ``George Washington'' and ``G. Washington'' are correct, but
so too are ``georgewashington''and ``gwashington''.

\item Remove all white space, convert to lower case, then look for an
exact match. Here we don't remove non-word characters, such as punctuation.
\RespBoxTxt{1}{0}{4}{George Washington}{Washington}
    {G. Washington}{Geo. Washington}
For example, answers ``G. Washington'', ``georgewashington'' and
``g. washington'' are correct, but ``gwashington'' is not.

\item Remove all white space, then look for an exact match. (Here,
we do not remove punctuation and do not convert to lower case.)
\RespBoxTxt{2}{0}{4}{George Washington}{Washington}
    {G. Washington}{Geo. Washington} The
response ``G. Washington'' is correct, but ``g. washington'' is not.

\item Now lets put parameter~\texttt{\#3} equal to \texttt1. Here, we convert
to lower case, remove white space, and look for a substring match.
\RespBoxTxt{1}{1}{4}{George Washington}{Washington}
    {G. Washington}{Geo. Washington} Note that ``President Washington'',
``General Geo. Washington'', and ``Washington, George'' are correct.
Also ``Fred Washington'' is correct, since it matches the second
alternative, Washington. (If we eliminate Washington as an
alternative, then ``Fred Washington'' would be judged incorrect,
let's test that theory:
\begin{oQuestion}{wash2}\RespBoxTxt{2}{1}{3}{George Washington}
{G. Washington}{Geo. Washington}\end{oQuestion}
\end{questions}
\end{shortquiz}

\section{Short Quiz Environment}

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

\begin{questions}

\answersEndHook{\hfill\makebox[0pt][r]{\sqTallyBox}}

\item Who was the first president of the United States?\par\kern3pt\noindent
\RespBoxTxt{0}{0}[geow]{4}{George Washington}{Washington}{G. Washington}{Geo. Washington}\hfill
\CorrAnsButton{George Washington}\cgBdry\sqTallyBox
\begin{solution}
Yes, George Washington was the first President of the United
States of America.
\end{solution}

\item Name \emph{one} of the two people recognized as a founder of
Calculus.\par\kern3pt\noindent
\RespBoxTxt{2}{0}{5}{Isaac Newton}{Newton}{I. Newton}{Gottfried Leibniz}{Leibniz}\hfill
\CorrAnsButton{Isaac Newton or Gottfried Leibniz}\olBdry\sqTallyBox

\item If $f$ is differentiable, then $f$ is continuous.
\begin{answers}{4}
\Ans1 True &
\Ans0 False
\end{answers}

\item
\dPose {4 x^{-1/2}}\RespBoxMath{-2*pow(x,-3/2)}{4}{.0001}{[1,2]}\hfill
\CorrAnsButton{-2*x^(-3/2)}\olBdry\sqTallyBox

\item
$\displaystyle\int \frac 1x\,dx = $\space
\RespBoxMath{ln(abs(x))}{4}{.0001}{[1,2]}[indefCompare]\hfill
\CorrAnsButton{ln(|x|)}\olBdry\sqTallyBox

\end{questions}
\end{shortquiz}
\begin{flushright}
\sqClearButton\olBdry\sqTallyTotal
\end{flushright}

\newpage
\section{Quiz Environment}

Here is a mixture of all types of questions, all with solutions.

\useBeginQuizButton[\CA{Begin}]
\useEndQuizButton[\CA{Finish}]

\begin{quiz}*{calcquiz} Answer each of the following. Passing
is 100\%.

\begin{questions}

\item If $\lim_{x\to a} f(x) = f(a)$, then we say that $f$ is\dots
\begin{answers}[cont]3
\Ans0 differentiable &\Ans1 continuous &\Ans0 integrable
\end{answers}
\begin{solution}
A function $f$ is said to be continuous at $x=a$ if $x\in\operatorname{Dom}(f)$,
$\lim_{x\to a} f(x) $ exists and $\lim_{x\to a} f(x) = f(a)$.
\end{solution}

\item Name \emph{one} of the two people recognized as a founder of
Calculus.\par\kern3pt
\RespBoxTxt{0}{0}[calc]{4}{Isaac Newton}{Newton}{Gottfried Leibniz}{Leibniz}%
\CorrAnsButton{Isaac Newton or Gottfried Leibniz}
\begin{solution}
Isaac Newton and Gottfried Leibniz are the co-creators of Calculus.
\end{solution}

\item $\cos(\pi) = \RespBoxMath{-1}[cospi]{1}{.0001}{[2,4]}\CorrAnsButton{-1}$
\begin{solution}
Oh, come on now. You know that $\cos(\pi)=-1$.
\end{solution}

\item $\displaystyle\int \sin(x)\,dx =
\RespBoxMath{-cos(x)}[intSin]{4}{.0001}{[0,1]}[indefCompare]\CorrAnsButton{-cos(x)}$
\begin{solution}
\relax\begin{equation*}
        \int \sin(x) \,dx = -\cos(x) + C
\end{equation*}
\adjDisplayBelow
\end{solution}

\end{questions}
\end{quiz}\quad\ScoreField\currQuiz\olBdry\CorrButton\currQuiz

\noindent
Answers: \AnswerField\currQuiz

\end{document}