summaryrefslogtreecommitdiff
path: root/texmf-dist/doc/latex/thorshammer/examples
diff options
context:
space:
mode:
Diffstat (limited to 'texmf-dist/doc/latex/thorshammer/examples')
-rw-r--r--texmf-dist/doc/latex/thorshammer/examples/nosolns/thexrt.tex4
-rw-r--r--texmf-dist/doc/latex/thorshammer/examples/ordinary-option/get-hash-string.tex35
-rw-r--r--texmf-dist/doc/latex/thorshammer/examples/ordinary-option/quiz-pwd-to-correct-AA.tex190
-rw-r--r--texmf-dist/doc/latex/thorshammer/examples/ordinary-option/thqz-p2c.pdfbin0 -> 143076 bytes
-rw-r--r--texmf-dist/doc/latex/thorshammer/examples/ordinary-option/thqz-p2c.tex (renamed from texmf-dist/doc/latex/thorshammer/examples/ordinary-option/quiz-pwd-to-correct-AR.tex)123
5 files changed, 67 insertions, 285 deletions
diff --git a/texmf-dist/doc/latex/thorshammer/examples/nosolns/thexrt.tex b/texmf-dist/doc/latex/thorshammer/examples/nosolns/thexrt.tex
index 7852cdc1..f94d5187 100644
--- a/texmf-dist/doc/latex/thorshammer/examples/nosolns/thexrt.tex
+++ b/texmf-dist/doc/latex/thorshammer/examples/nosolns/thexrt.tex
@@ -1,7 +1,7 @@
\documentclass{article}
\usepackage{amstext}
\usepackage{web}
-\usepackage[usesumrytbls,allowrandomize]{exerquiz}
+\usepackage[usesumrytbls,allowrandomize]{exerquiz}
\usepackage{ran_toks}
\usepackage[usebatch]{thorshammer}
@@ -10,7 +10,7 @@
% It is important to freeze the seed so that (1) you can reproduce the exact
% same quiz at a later time; (2) allow content written to the AUX file to
% come up to date. This is important when using summary tables.
-\useRandomSeed{1344524586}
+\useRandomSeed{1344524586}
\setInitMag{fitwidth}
\hypersetup{pdfpagemode=UseNone} % don't need to see bookmarks
diff --git a/texmf-dist/doc/latex/thorshammer/examples/ordinary-option/get-hash-string.tex b/texmf-dist/doc/latex/thorshammer/examples/ordinary-option/get-hash-string.tex
deleted file mode 100644
index b20c438a..00000000
--- a/texmf-dist/doc/latex/thorshammer/examples/ordinary-option/get-hash-string.tex
+++ /dev/null
@@ -1,35 +0,0 @@
-\documentclass{article}
-\usepackage[designi]{web}
-\usepackage{eforms}
-
-%\previewOn\pmpvOn
-
-\parindent0pt \parskip6pt
-
-\begin{document}
-
-\begin{defineJS}{\btnAct}
-var resp=app.response({
- cQuestion: "Enter a PIN number",
- cTitle: "Get Hash String"
-});
-var f=this.getField("txt");
-if (resp!=null) f.value=Collab.hashString(resp);
-\end{defineJS}
-
-Create a four digit (PIN) number and copy that number into the body of the
-definition of the \verb|\PIN| command, which is defined in the source file
-\texttt{quiz-pwd-to-correct-AR.tex}. This is to record and save the number.
-
-Push the button and enter the four digit number you just created into the
-response box. When you press the \textsf{OK} button, the hash string of the
-number you entered appears in the text field. Copy and paste this value into
-the \texttt{quiz-pwd-to-correct-AR.tex} as the value of the
-\texttt{\_PinCode} JavaScript variable. Now you're ready to compile the file
-\texttt{quiz-pwd-to-correct-AR.tex}.
-
-\pushButton[\CA{Push}\AAmouseup{\btnAct}]{btn}{}{11bp}\olBdry
-\textField[\textSize{8}]{txt}{2in}{11bp}\olBdry
-\pushButton[\CA{Reset}\AAmouseup{this.resetForm();}]{reset}{}{11bp}
-
-\end{document}
diff --git a/texmf-dist/doc/latex/thorshammer/examples/ordinary-option/quiz-pwd-to-correct-AA.tex b/texmf-dist/doc/latex/thorshammer/examples/ordinary-option/quiz-pwd-to-correct-AA.tex
deleted file mode 100644
index e84d9781..00000000
--- a/texmf-dist/doc/latex/thorshammer/examples/ordinary-option/quiz-pwd-to-correct-AA.tex
+++ /dev/null
@@ -1,190 +0,0 @@
-\documentclass{article}
-\usepackage{amstext}
-\usepackage[designi]{web}
-\usepackage{exerquiz}[2019/10/14]
-
-%\previewOn\pmpvOn
-
-% save the original defn of \eq@@EndQuizButtonActions as \eq@@EndQuizButtonActionsSave
-\efsave\eq@@EndQuizButtonActions\as\eq@@EndQuizButtonActionsDefSave
-
-\usepackage[ordinary]{thorshammer}
-
-\thQzHeaderL{PWD Quizzes}
-\thQzHeaderCQ{Quiz 1}
-
-% save the revised defn of \eq@@EndQuizButtonActions as \eq@@EndQuizButtonActionsThorSave
-\efsave\eq@@EndQuizButtonActions\as\eq@@EndQuizButtonActionsThorSave
-
-\renewcommand\eqQuizPointsMsg{%
-"\eqptScore\space"+ptScore+" \eqOutOf\space"+nPointTotal}
-
-\let\app\textsf
-\let\pkg\textsf
-\let\uif\textsf
-\let\env\texttt
-\let\opt\texttt
-\def\cs#1{\texttt{\char`\\#1}}
-
-
-\execJSOn
-\useBeginQuizButton[\CA{Begin}]
-\useEndQuizButton[\CA{End}]
-
-% If the students have Acrobat, they can see the pin number
-% if they know how; however, if we use a hash string, the actual
-% PIN is not retained within document.
-\def\PIN{5243} % PIN number, change as desired
-
-% save \CorrBtnActionsJS as \CorrBtnActionsJSSave
-\efsave\CorrBtnActionsJS\as\CorrBtnActionsJSSave
-\begin{defineJS*}[\makeesc\@]{\CorrBtnActionsPwdJS}
-var resp=app.response({
- cQuestion: "Enter the PIN number",
- cTitle: "View Answers",
- bPassword: true
-});
-var _resp=Collab.hashString(resp);
-if (_resp==_PinCode) {
- correctQuiz("@eqBaseName",@thequestionno);
- if (typeof correctSumryTbl == "function")
- correctSumryTbl("@eqBaseName",@thequestionno);
-}
-\end{defineJS*}
-
-\DeclareQuiz{qz1}
-
-\begin{execJS}{execjs}
-this.addScript("Pin Code","var _PinCode = \"" + Collab.hashString("\PIN")+"\"");
-\end{execJS}
-
-\begin{document}
-
-\section{Introduction}
-
-\noindent\textbf{Goal:} Make the \uif{Correct} button password
-protected.\medskip
-
-\noindent\textbf{Discussion:} This file illustrates the methods
-of protecting the \uif{Correct} button with a password. This
-file requires \app{Acrobat} to create; while the companion file
-(\texttt{quiz-pwd-to-correct-AR.tex}) does not.
-
-If only MC and MS questions are posed, the \pkg{thorshammer}
-package is not needed; otherwise, it is needed to support the
-other types of questions.
-
-Within \pkg{exerquiz} the command that holds the JavaScript
-action of the \uif{Correct} button is \cs{CorrBtnActionsJS}. We
-save this macro, and change over to \cs{CorrBtnActionsPwdJS},
-defined in the preamble. We use the commands \cs{efsave} and
-\cs{efrestore}, defined in \pkg{eforms}, to change the default
-action to the password action, and back again. We do the same
-thing for the \uif{End Quiz} action. (\pkg{thorshammer}
-redefines \cs{eq@@EndQuizButtonActions}, the JavaScript actio of
-the \uif{End Quiz} button.)
-
-
-\newpage
-
-\section{Quiz with PIN to correct}
-
-% require students to answer all questions
-\renewcommand\minQuizResp{highThreshold} % 1
-
-For the quiz below, the \uif{Correct} button has an encrypted
-password. The password appears in parentheses for the convenience of the casual reader.
-
-% use password version of \CorrButton action
-\efrestore\CorrBtnActionsJS\from\CorrBtnActionsPwdJS
-\begin{quiz*}{\currQuiz}
-Solve each
-\begin{questions}
- \item The sum of 1 and 1 is\dots
-\begin{answers}{5}
-\bChoices
- \Ans0 0\eAns
- \Ans0 1\eAns
- \Ans1 2\eAns
- \Ans0 3\eAns
- \Ans0 4\eAns
-\eChoices
-\end{answers}
-\item $9+8=\RespBoxMath{17}{1}{.0001}{[0,1]}\cgBdry\CorrAnsButton{17}$
-\end{questions}
-\end{quiz*}\quad\PointsField{\currQuiz}\olBdry\CorrButton{\currQuiz} (PIN: \PIN)\vcgBdry
-
-\AnswerField{\currQuiz}
-
-\newpage
-
-\section{Quiz without PIN to correct}
-
-Now we try to create an ordinary \pkg{exerquiz} quiz without password protection.
-
-% restore \eq@@EndQuizButtonActions from its default defn
-\efrestore\eq@@EndQuizButtonActions\from\eq@@EndQuizButtonActionsDefSave
-% restore \CorrBtnActionsJS from \CorrBtnActionsJSSave
-\efrestore\CorrBtnActionsJS\from\CorrBtnActionsJSSave
-
-\renewcommand\minQuizResp{lowThreshold}
-
-\begin{quiz*}{qz2}
-Solve each
-\begin{questions}
- \item The sum of 1 and 1 is\dots
-\begin{answers}{5}
-\bChoices
- \Ans0 0\eAns
- \Ans0 1\eAns
- \Ans1 2\eAns
- \Ans0 3\eAns
- \Ans0 4\eAns
-\eChoices
-\end{answers}
-\item $9+8=\RespBoxMath{17}{1}{.0001}{[0,1]}\cgBdry\CorrAnsButton{17}$
-\end{questions}
-\end{quiz*}\quad\PointsField{\currQuiz}\olBdry\CorrButton{\currQuiz}\vcgBdry
-
-\AnswerField{\currQuiz}
-
-
-\newpage
-
-\section{Another quiz with PIN to correct}
-
-It is possible to have a different PIN number for this quiz (multiple PINs in one document), but
-I see no need for this.
-
-\DeclareQuiz{qz3}
-
-
-% restore \eq@@EndQuizButtonActions from \eq@@EndQuizButtonActionsThorSave
-\efrestore\eq@@EndQuizButtonActions\from\eq@@EndQuizButtonActionsThorSave
-% restore password protection for Correct button
-\efrestore\CorrBtnActionsJS\from\CorrBtnActionsPwdJS
-
-% require students to answer all questions
-\renewcommand\minQuizResp{highThreshold}
-
-\begin{quiz*}{qz3}
-Solve each
-\begin{questions}
- \item The sum of 1 and 1 is\dots
-\begin{answers}{5}
-\bChoices
- \Ans0 0\eAns
- \Ans0 1\eAns
- \Ans1 2\eAns
- \Ans0 3\eAns
- \Ans0 4\eAns
-\eChoices
-\end{answers}
-\item $9+8=\RespBoxMath{17}{1}{.0001}{[0,1]}\cgBdry\CorrAnsButton{17}$
-\end{questions}
-\end{quiz*}\quad\PointsField{\currQuiz}\olBdry\CorrButton{\currQuiz} (PIN: \PIN)\vcgBdry
-
-\AnswerField{\currQuiz}
-
-
-\end{document}
diff --git a/texmf-dist/doc/latex/thorshammer/examples/ordinary-option/thqz-p2c.pdf b/texmf-dist/doc/latex/thorshammer/examples/ordinary-option/thqz-p2c.pdf
new file mode 100644
index 00000000..3c37ab22
--- /dev/null
+++ b/texmf-dist/doc/latex/thorshammer/examples/ordinary-option/thqz-p2c.pdf
Binary files differ
diff --git a/texmf-dist/doc/latex/thorshammer/examples/ordinary-option/quiz-pwd-to-correct-AR.tex b/texmf-dist/doc/latex/thorshammer/examples/ordinary-option/thqz-p2c.tex
index 9123ce34..f9484694 100644
--- a/texmf-dist/doc/latex/thorshammer/examples/ordinary-option/quiz-pwd-to-correct-AR.tex
+++ b/texmf-dist/doc/latex/thorshammer/examples/ordinary-option/thqz-p2c.tex
@@ -1,74 +1,70 @@
-% Requires Acrobat
\documentclass{article}
\usepackage{amstext}
\usepackage[designi]{web}
-\usepackage{exerquiz}[2019/10/11]
+\usepackage{exerquiz}[2021/06/24]
+\usepackage[!showscore]{eq-pin2corr}[2021/06/24]
-\efsave\eq@@EndQuizButtonActions\as\eq@@EndQuizButtonActionsDefSave
+%\previewOn\pmpvOn
\usepackage[ordinary]{thorshammer}
-\thQzHeaderL{PWD Quiz}
+\thQzHeaderL{Secured Quiz}
\thQzHeaderCQ{Quiz 1}
-\efsave\eq@@EndQuizButtonActions\as\eq@@EndQuizButtonActionsThorSave
-
-%\previewOn\pmpvOn
-
+% Thor's hammer modifies this definition, we restore it to its
+% 'ordinary' definition.
\renewcommand\eqQuizPointsMsg{%
"\eqptScore\space"+ptScore+" \eqOutOf\space"+nPointTotal}
\let\app\textsf
\let\pkg\textsf
+\let\uif\textsf
\let\env\texttt
\let\opt\texttt
-\let\uif\textsf
+\def\cs#1{\texttt{\char`\\#1}}
+
\execJSOn
\useBeginQuizButton[\CA{Begin}]
\useEndQuizButton[\CA{End}]
-% If the students have Acrobat, they can see the pin number
-% if they know how.
-
-\efsave\CorrBtnActionsJS\as\CorrBtnActionsJSSave
-\begin{defineJS*}[\makeesc\@]{\CorrBtnActionsPwdJS}
-var resp=app.response({
- cQuestion: "Enter the PIN number",
- cTitle: "View Answers",
- bPassword: true
-});
-var _resp=Collab.hashString(resp);
-if (_resp==_PinCode) {
- correctQuiz("@eqBaseName",@thequestionno);
- if (typeof correctSumryTbl == "function")
- correctSumryTbl("@eqBaseName",@thequestionno);
-}
-\end{defineJS*}
-
-\DeclareQuiz{qz}
-
-\def\PIN{5243} % PIN number, change as desired
-\begin{insDLJS}{pin}{Pin Code}
-var _PinCode = "02JRVZdRgYgCA-Rtje8VkD";
-\end{insDLJS}
-
-\parindent0pt
-\parskip6pt
+% the default PIN number for eq-pin2corr is 5243
+%
+% When building your own quiz document, decide on a PIN number
+% then use the utility document get-hash-string.pdf to acquire
+% the corresponding hash string. Place your own PIN and hash string
+% in the two arguments of \declPINId.
+\declPINId{5243}{02JRVZdRgYgCA-Rtje8VkD} % PIN number, hash string
+% So instructor can bypass entering the PIN.
+\classPINVar{_PinCode1}
+
+\DeclareQuiz{qz1}
\begin{document}
-\noindent\textbf{Goal:} Make the \uif{Correct} button password protected.\medskip
+\section{Introduction}
+
+\noindent\textbf{Goal:} Make the \uif{Correct} button password protected.
+This revised file now uses the
+\pkg{\href{https://ctan.org/pkg/eq-pin2corr}{eq-pin2corr}} package to make
+things simpler. Additional commands are introduced here to manage the smooth
+transition from password PIN protection, to an ordinary quiz, and back to a
+PIN protected quiz.\medskip
+
+\noindent\textbf{Discussion:} This file illustrates the methods for
+protecting the \uif{Correct} button with a password. To create a PIN
+protected \uif{Correct} button, expand \cs{usePINCorrBtn} (\pkg{eq-pin2corr})
+prior to the quiz. Following the quiz, use the commands \cs{restoreNormalEndQuiz}
+(\pkg{exerquiz}) and \cs{restoreCorrBtn} (\pkg{eq-pin2corr}). The latter
+restores the default action of the \uif{End Quiz} control, this is needed
+because \pkg{thorshammer} changes this action to a custom action;
+\cs{restoreCorrBtn} removes the PIN security of the \uif{Correct} control.
-\noindent\textbf{Discussion:}
-This demo file uses a \emph{hash string} to encode the password for the instructor to correct
-the quiz, it avoids the use of \app{Adobe Acrobat} by getting the hash string from the
-PDF \texttt{get-hash-string}. Copy the hash string generated from \texttt{get-hash-string}
-as the value of the JavaScript variable \texttt{\_PinCode} in the \textsf{insDLJS} environment
-seen in this source file for this document. Then, compile this document and distribute.
+There is another command \cs{useEndQuizThor} (\pkg{thorshammer}) is used to
+modify the \uif{End Quiz} control to the action as defined by the
+\pkg{thorshammer} package. Read additional comments found in the body and
+source of this file.
-%Delay the correction of this next quiz by expanding the new command
-%\verb|\pwdCorrBtnJS|.
\newpage
@@ -81,7 +77,8 @@ For the quiz below, the \uif{Correct} button has an encrypted
password. The password appears in parentheses for the convenience of the casual reader.
% use password version of \CorrButton action
-\efrestore\CorrBtnActionsJS\from\CorrBtnActionsPwdJS
+\usePINCorrBtn
+
\begin{quiz*}{\currQuiz}
Solve each
\begin{questions}
@@ -97,20 +94,24 @@ Solve each
\end{answers}
\item $9+8=\RespBoxMath{17}{1}{.0001}{[0,1]}\cgBdry\CorrAnsButton{17}$
\end{questions}
-\end{quiz*}\quad\PointsField{\currQuiz}\olBdry\CorrButton{\currQuiz} (PIN: \PIN)\vcgBdry
+\end{quiz*}\quad\PointsField{\currQuiz}\olBdry\CorrButton{\currQuiz} (PIN: \numPINId)\vcgBdry
\AnswerField{\currQuiz}
\newpage
+\thQzHeaderL{Ordinary Quiz}
+\thQzHeaderCQ{Quiz 2}
+
+
\section{Quiz without PIN to correct}
Now we try to create an ordinary \pkg{exerquiz} quiz without password protection.
-% restore \eq@@EndQuizButtonActions from its default defn
-\efrestore\eq@@EndQuizButtonActions\from\eq@@EndQuizButtonActionsDefSave
-% restore \CorrBtnActionsJS from \CorrBtnActionsJSSave
-\efrestore\CorrBtnActionsJS\from\CorrBtnActionsJSSave
+
+% Now do an ordinary quiz
+\restoreNormalEndQuiz
+\restoreCorrBtn
\renewcommand\minQuizResp{lowThreshold}
@@ -136,18 +137,23 @@ Solve each
\newpage
+\thQzHeaderL{Secured Quiz}
+\thQzHeaderCQ{Quiz 3}
+
+
\section{Another quiz with PIN to correct}
It is possible to have a different PIN number for this quiz (multiple PINs in one document), but
I see no need for this.
-\DeclareQuiz{qz3}
+The previous quiz was a normal \pkg{exerquiz} quiz. We now want another PIN protected quiz, so
+prior to this next quiz we expand \cs{usePINBtn} and \cs{useEndQuizThor}. The latter is a new
+command that restores the default action of the \pkg{thorshammer} package to the \uif{End Quiz} event.
+\DeclareQuiz{qz3}
-% restore \eq@@EndQuizButtonActions from \eq@@EndQuizButtonActionsThorSave
-\efrestore\eq@@EndQuizButtonActions\from\eq@@EndQuizButtonActionsThorSave
-% restore password protection for Correct button
-\efrestore\CorrBtnActionsJS\from\CorrBtnActionsPwdJS
+\usePINCorrBtn
+\useEndQuizThor
% require students to answer all questions
\renewcommand\minQuizResp{highThreshold}
@@ -167,8 +173,9 @@ Solve each
\end{answers}
\item $9+8=\RespBoxMath{17}{1}{.0001}{[0,1]}\cgBdry\CorrAnsButton{17}$
\end{questions}
-\end{quiz*}\quad\PointsField{\currQuiz}\olBdry\CorrButton{\currQuiz} (PIN: \PIN)\vcgBdry
+\end{quiz*}\quad\PointsField{\currQuiz}\olBdry\CorrButton{\currQuiz} (PIN: \numPINId)\vcgBdry
\AnswerField{\currQuiz}
-\end{document} \ No newline at end of file
+
+\end{document}