diff options
author | Norbert Preining <norbert@preining.info> | 2021-02-01 13:14:30 +0900 |
---|---|---|
committer | Norbert Preining <norbert@preining.info> | 2021-02-01 13:14:30 +0900 |
commit | a979a969ee8a924408ebeb767035b9e4f48f7efa (patch) | |
tree | 04ad221758f0fb7f3c3cb8bb13db45763032f7f3 /texmf-dist/source/latex/acrotex/exerquiz.dtx | |
parent | 272af43327ca6868322c4781c0b2dd979391a08a (diff) |
acrotex (2021-02-01)
Diffstat (limited to 'texmf-dist/source/latex/acrotex/exerquiz.dtx')
-rw-r--r-- | texmf-dist/source/latex/acrotex/exerquiz.dtx | 4025 |
1 files changed, 2085 insertions, 1940 deletions
diff --git a/texmf-dist/source/latex/acrotex/exerquiz.dtx b/texmf-dist/source/latex/acrotex/exerquiz.dtx index d75879e0..f478c87f 100644 --- a/texmf-dist/source/latex/acrotex/exerquiz.dtx +++ b/texmf-dist/source/latex/acrotex/exerquiz.dtx @@ -22,7 +22,7 @@ %<randomize>\ProvidesFile{aebrandom.def} %<sumrytbls>\ProvidesFile{aebsumrytbls.def} %<template>\ProvidesFile{template.def} -%<package|driver|aebjs|eqexam|randomize|sumrytbls|template> [2020/03/14 v8.5.10 % +%<package|driver|aebjs|eqexam|randomize|sumrytbls|template> [2021/01/20 v8.6.2 % %<package> Exerquiz: Exercises and Quizzes for LaTeX/PDF package (dps)] %<driver> Exerquiz documentation driver file (dps)] %<aebjs> Exerquiz document level JavaScript (dps)] @@ -51,6 +51,7 @@ \let\env\texttt \let\opt\texttt \let\app\textsf +\let\uif\textsf \def\nmpsep#1{\hskip-\marginparsep\texttt{#1}} \def\visispace{\symbol{32}} \def\ameta#1{\ensuremath{\langle\textit{\texttt{#1}}\rangle}} @@ -98,15 +99,21 @@ % \end{macrocode} %\changes{v8.2.8}{2018/12/13}{The SOL file is now written entirely when there is no solution option specified} % (v8.0 dated 2017/08/08) This version introduces multi-letter variables and what I'll term `alternate appearances'. -% This is a major addition, changes are marked by \texttt{dps17} for future reference in case something goes wrong. % \changes{v8.0}{2017/08/08}{Introduce multi-letter variables and alternate appearances. Changes % made are marked by `\texttt{dps17}' throughout the DTX.} % \changes{v7.7k}{2016/04/18}{Minor bug fixes, improved driver recognition} % \changes{v7.7j}{2016/04/05}{Change in eforms to 2016/04/05 v2.8f} % +% \section{Introduction} +% +% The \pkg{exerquiz} package provides support for the creation of exercises and quizzes +% with or without solutions. These are PDF form and link based. The packages provides ``intelligent'' evaluation +% of the students' responses. This package also provides code for the \pkg{eqexam} package so that these +% two packages are consistent in their approach. +% % \section{Package options and setup}\label{options} % -% Introduce a number of useful options for \textsl{exerquiz}. +% Introduce a number of useful options for \pkg{exerquiz}. % \subsection{Options for paper, solutions, JavaScript and preview} % \begin{macrocode} % Begin package segment @@ -121,16 +128,17 @@ \RequirePackage{ifluatex} \@ifundefined{exqtable}{\def\exqtable{table}}{} \IfFileExists{xcolor.sty}{% - \def\eq@ColorPackage{xcolor}% - \PassOptionsToPackage{\exqtable,hyperref}{xcolor}} - {\def\eq@ColorPackage{color}} + \def\eq@ColorPackage{xcolor}% + \PassOptionsToPackage{\exqtable,hyperref}{xcolor}} + {\def\eq@ColorPackage{color}} % \end{macrocode} -% \IndexOpt{noxcolor} An option to force +% \leavevmode\IndexOpt{noxcolor}^^A +% An option to force % the use of the \textsf{color} package. % \begin{macrocode} \DeclareOption{noxcolor}{\def\eq@ColorPackage{color}} % \end{macrocode} -% \IndexOpt{forpaper}\IndexOpt{forcolorpaper} +% \leavevmode\IndexOpt{forpaper}\IndexOpt{forcolorpaper}^^A % Pass the |monochrome| option to the color package %\changes{v6.06a}{2007/04/09} %{ @@ -146,7 +154,7 @@ \AtBeginDocument{\ifnum\eq@drivernum=4 \else\AllowPeeking\fi} } % \end{macrocode} -% \IndexOpt{preview} +% \leavevmode\IndexOpt{preview}^^A % With this option, the bounding boxes of all form fields appear in the % dvi preview. Use this option of properly positioning your fields, then % remove this option on the final build of the document. This option is no @@ -154,13 +162,13 @@ % \begin{macrocode} \DeclareOption{preview}{\PassOptionsToPackage{preview}{eforms}} % \end{macrocode} -% \IndexOpt{nosolutions} +% \leavevmode\IndexOpt{nosolutions}^^A % With the option, the solutions to the exercises are not % included in the typeset document. % \begin{macrocode} \DeclareOption{nosolutions}{\eq@nosolutionstrue\eq@nolinktrue} % \end{macrocode} -% \IndexOpt{noquizolutions} +% \leavevmode\IndexOpt{noquizolutions}^^A % No solutions for quizzes (shortquiz and quiz environments). % \begin{macrocode} \DeclareOption{noquizsolutions}{\eq@noquizsolutionstrue\eq@nolinktrue} @@ -177,7 +185,7 @@ \DeclareOption{online}{\let\eq@online\eq@YES} \let\eq@online\eq@NO % \end{macrocode} -% \IndexOpt{nohiddensolutions}\IndexOpt{noHiddensolutions} +% \leavevmode\IndexOpt{nohiddensolutions}\IndexOpt{noHiddensolutions}^^A % Overrides any hidden solutions specified with the \texttt{exercise} % environment. % \begin{macrocode} @@ -185,12 +193,12 @@ \DeclareOption{noHiddensolutions}% {\eq@globalshowsolutionstrue\AtBeginDocument{\def\Hidesymbol{h}}} % \end{macrocode} -% \IndexOpt{solutionsafter} +% \leavevmode\IndexOpt{solutionsafter}^^A % Solutions will appear after the statement of the exercise. % \begin{macrocode} \DeclareOption{solutionsafter}{\eq@solutionsaftertrue\eq@nolinktrue} % \end{macrocode} -% \IndexOpt{solutionsonly} +% \leavevmode\IndexOpt{solutionsonly}^^A % Here is a highly specialized option, put in at the request of a former friend. %\changes{v6.2f}{2007/12/21}{Added a solutionsonly option} % \begin{macrocode} @@ -202,7 +210,7 @@ \newif\ifsolutionsonly\solutionsonlyfalse \@ifundefined{ifanswerkey}{\newif\ifanswerkey\answerkeyfalse}{} % \end{macrocode} -% \IndexOpt{contsolns} +% \leavevmode\IndexOpt{contsolns}^^A % This option requires both \textsf{web} and \textsf{exerquiz}. The package % tests for the presence of the \textsf{web} and whether webheadings pagestyle % is used. @@ -214,25 +222,25 @@ \def\contsolnsErrorMsg{\PackageWarning{exerquiz}{contsolns option, cannot find file contsolns.def}} % \end{macrocode} -% \IndexOpt{nocorrections} +% \leavevmode\IndexOpt{nocorrections}^^A % The code for correcting the |quiz| environment is % not written; this results in a smaller file. % \begin{macrocode} \DeclareOption{nocorrections}{\nocorrectionstrue} % \end{macrocode} -% \IndexOpt{proofing} +% \leavevmode\IndexOpt{proofing}^^A % An option for marking the correct answers for shortquiz and quiz % \begin{macrocode} \DeclareOption{proofing}{\eq@proofingtrue} % \end{macrocode} -% \IndexOpt{showgrayletters} +% \leavevmode\IndexOpt{showgrayletters}^^A % When this option is in effect, capital letters in gray appear under % the multiple choice question boxes of quizzes. % \begin{macrocode} \newif\ifaebshowgrayletters\aebshowgraylettersfalse \DeclareOption{showgrayletters}{\aebshowgrayletterstrue} % \end{macrocode} -% \IndexOpt{vspacewithsolns} +% \leavevmode\IndexOpt{vspacewithsolns}^^A % This is for the \texttt{vspacewithsolns} option designed for % \textsf{eqexam}, but can be used in \textsf{exerquiz}. The switch % \cs{ifvspacewithsolns} is defined in \textsf{eqexam}, and we only @@ -253,7 +261,7 @@ \providecommand\displayworkareaOn{\displayworkareatrue} \providecommand\displayworkareaOff{\displayworkareafalse} % \end{macrocode} -% \IndexOpt{nodljs} +% \leavevmode\IndexOpt{nodljs}^^A % An option for excluding all DLJS from the document. Useful with the % \texttt{forpaper} option, or a document destined to be printed. Pass % on to insdljs package. @@ -261,24 +269,24 @@ \DeclareOption{nodljs}{\PassOptionsToPackage{nodljs}{insdljs}% \AtEndOfPackage{\let\importdljs\eq@YES}} % \end{macrocode} -% \IndexOpt{execAfter} +% \leavevmode\IndexOpt{execAfter}^^A % Execute any JS defined within the \texttt{execJS} environment. Works only for % authors using Acrobat 5.0 or Acrobat Approval. % \begin{macrocode} \DeclareOption{execJS}{\PassOptionsToPackage{execJS}{insdljs}} % \end{macrocode} -% \IndexOpt{exercisesonly} +% \leavevmode\IndexOpt{exercisesonly}^^A % If the document author wants only to create a series of exercises, no quizzes, there is no % need for the Document-level JavaScript. So, we have a couple of convenience options. % \begin{macrocode} \DeclareOption{exercisesonly}{\PassOptionsToPackage{nodljs}{insdljs}} % \end{macrocode} -% \IndexOpt{debug} +% \leavevmode\IndexOpt{debug}^^A % An option for debugging JavaScript. Pass on to insdljs package. % \begin{macrocode} \DeclareOption{debug}{\PassOptionsToPackage{debug}{insdljs}} % \end{macrocode} -% \IndexOpt{allowrandomize} +% \leavevmode\IndexOpt{allowrandomize}^^A % Beginning with version 6.1 of \textsf{exerquiz}, it is possible to randomize % the choices in a multiple choice question. These choices must be set off % by the command \cs{bChoices}/\cs{eChoices} pair. The command \cs{bChoices} now has @@ -289,7 +297,8 @@ {\PackageInfo{exerquiz}{inputting aebrandom.def}} {cannot find aebrandom.def}} % \end{macrocode} -% \IndexOpt{usesumrytbls} +% \leavevmode\IndexOpt{usesumrytbls}^^A +% The declare the use of summary tables % \begin{macrocode} \newif \ifusesumrytbls \usesumrytblsfalse \DeclareOption{usesumrytbls}{\usesumrytblstrue @@ -365,7 +374,7 @@ \PassOptionsToPackage{xetex}{eforms}% } % \end{macrocode} -% \IndexOpt{textures} +% \leavevmode\IndexOpt{textures}^^A % This option, and testing are due to Ross Moore 3/6/02 % \begin{macrocode} \DeclareOption{textures}{\def\eq@drivernum{3}% @@ -374,7 +383,7 @@ \PassOptionsToPackage{textures}{eforms}% } % \end{macrocode} -% \IndexOpt{dviwindo} +% \leavevmode\IndexOpt{dviwindo}^^A % Set \cmd{\eq@noformstrue}, this inserts an \cmd{\endinput} just after % the end of the |exercise| environment. No quizzes for % \texttt{dviwindo}. @@ -388,7 +397,7 @@ % \def\eq@drivernum{5} % \def\eq@driver{dvipsone/dvips} % \def\eq@driver{no driver specified} -% \IndexOpt{unicode} +% \leavevmode\IndexOpt{unicode}^^A % Passes the unicode option to \textsf{hyperref}. % \changes{v6.3}{2008/03/19} % { @@ -397,7 +406,7 @@ % \begin{macrocode} \DeclareOption{unicode}{\PassOptionsToPackage{unicode}{hyperref}} % \end{macrocode} -% \IndexOpt{useui} +% \leavevmode\IndexOpt{useui}^^A % Passes the useui option to eforms. With this option, % the key-value pairs \textsl{\'{a} la xkeyval} can be used. % \changes{v6.3}{2008/03/19} @@ -419,7 +428,7 @@ % \begin{macrocode} \let\LangRedefinitions\relax % \end{macrocode} -% \IndexOpt{french} +% \leavevmode\IndexOpt{french}^^A % Translations due to Jean-Michel SARLAT. % \begin{macrocode} \DeclareOption{french}{% @@ -428,7 +437,7 @@ {\PackageInfo{exerquiz}{French Option: Cannot find the file eqfr.def, using the default, English.}}}} % \end{macrocode} -% \IndexOpt{german} +% \leavevmode\IndexOpt{german}^^A % Translation due to Michael Wiedmann. % \begin{macrocode} \DeclareOption{german}{% @@ -437,7 +446,7 @@ {\PackageInfo{exerquiz}{German Option: Kann die Datei eqde.def nicht finden, benutze Default, Englisch.}}}} % \end{macrocode} -% \IndexOpt{norsk} +% \leavevmode\IndexOpt{norsk}^^A % Translation due to Hans Fredrik Nordhaug. % \begin{macrocode} \DeclareOption{norsk}{% @@ -446,7 +455,7 @@ {\PackageInfo{exerquiz}{Norsk Option: Cannot find the file eqno.def, using the default, English.}}}} % \end{macrocode} -% \IndexOpt{dutch} +% \leavevmode\IndexOpt{dutch}^^A % Translation due to Henny Wilbrink % \begin{macrocode} \DeclareOption{dutch}{% @@ -455,7 +464,7 @@ {\PackageInfo{exerquiz}{Dutch Option: Kan bestand eqnl.def niet vinden, gebruik default, Engels.}}}} % \end{macrocode} -% \IndexOpt{spanish} +% \leavevmode\IndexOpt{spanish}^^A % Translation due to Pedro Luis Luque % \begin{macrocode} \DeclareOption{spanish}{% @@ -464,7 +473,7 @@ {\PackageInfo{exerquiz}{Spanish Option: Opci\'on Espa\~nola: no puede encontrar el fichero eqes.def, usar\'a por defecto, English.}}}} % \end{macrocode} -% \IndexOpt{italian} +% \leavevmode\IndexOpt{italian}^^A % Translation due to PierLuigi Zezza % \begin{macrocode} \DeclareOption{italian}{% @@ -473,7 +482,7 @@ {\PackageInfo{exerquiz}{pzione Italiano: Non trovo il file eqit.def, utilizzo quello di default, English.}}}} % \end{macrocode} -% \IndexOpt{russian} +% \leavevmode\IndexOpt{russian}^^A % Translation due to Sergei V. Znamenskii % \begin{macrocode} \DeclareOption{russian}{% @@ -486,7 +495,7 @@ {\PackageInfo{exerquiz}{Russian Option: Cannot find the file eqru.def, using the default, English.}}}} % \end{macrocode} -% \IndexOpt{dansk} +% \leavevmode\IndexOpt{dansk}^^A % Translation due to Erik Leimand % \begin{macrocode} \DeclareOption{dansk}{% @@ -495,7 +504,7 @@ {\PackageInfo{exerquiz}{Dansk Option: Cannot find the file eqda.def, using the default, English.}}}} % \end{macrocode} -% \IndexOpt{polish} +% \leavevmode\IndexOpt{polish}^^A % Translation due to Jerzy Mycielski % \begin{macrocode} \DeclareOption{polish}{% @@ -504,7 +513,7 @@ {\PackageInfo{exerquiz}{Polish Option: Cannot find the file eqpo.def, using the default, English.}}}} % \end{macrocode} -% \IndexOpt{finnish} +% \leavevmode\IndexOpt{finnish}^^A % Translation due to Paivi Porras % \begin{macrocode} \DeclareOption{finnish}{% @@ -513,7 +522,7 @@ {\PackageInfo{exerquiz}{Finnish Option: Cannot find the file eqfin.def, using the default, English.}}}} % \end{macrocode} -% \IndexOpt{catalan} +% \leavevmode\IndexOpt{catalan}^^A % Translation due to Ramon Ballester % \begin{macrocode} \DeclareOption{catalan}{% @@ -522,7 +531,7 @@ {\PackageInfo{exerquiz}{Catalan Option: Cannot find the file eqcat.def, using the default, English.}}}} % \end{macrocode} -% \IndexOpt{czech} +% \leavevmode\IndexOpt{czech}^^A % Translation due to Robert Marik % \begin{macrocode} \DeclareOption{czech}{% @@ -531,7 +540,7 @@ {\PackageInfo{exerquiz}{Czech Option: Cannot find the file eqcz.def, using the default, English.}}}} % \end{macrocode} -% \IndexOpt{brazil} +% \leavevmode\IndexOpt{brazil}^^A % Translation due to Koichi Sameshima % \begin{macrocode} \DeclareOption{brazil}{% @@ -541,7 +550,7 @@ n\~ao foi poss\'ivel encontrar o arquivo eqbr.def, usaremos o padr\~ao, English.}}}} % \end{macrocode} -% \IndexOpt{turkish} +% \leavevmode\IndexOpt{turkish}^^A % Translation due to Mahmut Ko\c{c}ak % \begin{macrocode} \DeclareOption{turkish}{% @@ -690,6 +699,7 @@ % \begin{macrocode} \newif\ifeq@randomizeChoices \eq@randomizeChoicesfalse \newif\ifeq@randomizeallChoices \eq@randomizeallChoicesfalse +\newif\if@DoNotRandomize \@DoNotRandomizefalse % \end{macrocode} % \begin{macro}{\turnOnRandomize} % \begin{macro}{\obeyLocalRandomize} @@ -705,6 +715,20 @@ % \end{macrocode} % \end{macro} % \end{macro} +% \begin{macro}{\doNotRandomizeChoices} +% \begin{macro}{\allowRandomizedChoices} +% These two commands allow for finer control over whether to randomize choices +% or not. Expanding \cs{doNoRandomizeChoices} overrides the \opt{allowrandomize} +% option; whereas \cs{allowRandomizedChoices} restores the original behavior +% set by the \opt{allowrandomize} option. +% \changes{v8.6.2}{2021/01/20}{Added \string\cs{doNoRandomizeChoices} and +% \string\cs{allowRandomizedChoices}} +% \begin{macrocode} +\def\doNotRandomizeChoices{\@DoNotRandomizetrue} +\def\allowRandomizedChoices{\@DoNotRandomizefalse} +% \end{macrocode} +% \end{macro} +% \end{macro} % These\DescribeMacro{\saveRandomSeed}\DescribeMacro{\inputRandomSeed} two % commands are used when the \texttt{allowrandomize} option is in effect, Until % then, they do nothing. See the definition in \autoref{randomize}. @@ -3717,8 +3741,8 @@ % \section{Common code for quizzes.} % Here, we include a few commands common to both % quiz environments. -% -% Colors used by \textsf{exerquiz}: \texttt{webgreen} normally defined in \textsf{web} +%\medskip\par\noindent +% Colors used by \textsf{exerquiz}: \texttt{webgreen} normally defined in \textsf{web}. % \begin{macrocode} \definecolor{webgreen}{rgb}{0,.6,0} % \end{macrocode} @@ -3786,23 +3810,25 @@ \define@key{props@ques}{labelwidth}[]{\def\propQ@labelwidth{#1}} \let\propQ@labelwidth\@empty % \end{macrocode} -% \IndexKey{topsep}\texttt{topsep}, \IndexKey{partopsep}\texttt{partopsep}, +% \leavevmode\IndexKey{topsep}^^A +% \texttt{topsep}, \IndexKey{partopsep}\texttt{partopsep}, % \IndexKey{parsep}\texttt{parsep}, and \IndexKey{itemsep}\texttt{itemsep}. % \begin{macrocode} \define@key{props@ques}{topsep}[\the\topsep]{\edef\propQ@topsep{#1}} \define@key{props@ques}{partopsep}[\the\partopsep]% - {\edef\propQ@partopsep{#1}} + {\edef\propQ@partopsep{#1}} \define@key{props@ques}{parsep}[\the\parsep]{\edef\propQ@parsep{#1}} \define@key{props@ques}{itemsep}[\the\itemsep]{\edef\propQ@itemsep{#1}} % \end{macrocode} -% \IndexKey{labelsepTo}\texttt{labelsepTo} and \IndexKey{labelsep}\texttt{labelsep} +% \leavevmode\IndexKey{labelsepTo}\texttt{labelsepTo} and \IndexKey{labelsep}\texttt{labelsep} % \begin{macrocode} \define@key{props@ques}{labelsepTo}[\normalsize\normalfont\ ]% - {\def\propQ@labelsepTo{#1}} + {\def\propQ@labelsepTo{#1}} \define@key{props@ques}{labelsep}[\@empty]{\def\propQ@labelsep{#1}} \let\propQ@labelsep\@empty % \end{macrocode} -% \IndexKey{color}\texttt{color} +% \leavevmode\IndexKey{color}^^A +% A color key set the color of the numbers in a question environment. % \begin{macrocode} \define@key{props@ques}{color}[blue]{\quesNumColor{#1}} % \end{macrocode} @@ -3814,42 +3840,41 @@ % Now we begin the \texttt{questions} environment. There is an optional parameter % wherein we pass the key-value pairs defined above. % \begin{macrocode} -\newenvironment{questions}[1][] -{% - \ifnum\@eqquestiondepth>\tw@\@toodeep\else - \advance\@eqquestiondepth\@ne\fi - \def\@quesctr{eqquestionno\romannumeral\the\@eqquestiondepth}% - \toks@=\expandafter\expandafter\expandafter{#1}\expandafter - \xdef\csname quesOpts\@quesctr\endcsname{\the\toks@}% - \edef\tempexp{\noexpand\setkeys{props@ques}{\the\toks@}}\tempexp - \list{\qMark@Hook\prior@questionsHook - \insE@rlyAtQues\gdef\eqPTs{1}% - \global\let\eqQT\eq@na% +\newenvironment{questions}[1][]{% + \ifnum\@eqquestiondepth>\tw@\@toodeep\else + \advance\@eqquestiondepth\@ne\fi + \def\@quesctr{eqquestionno\romannumeral\the\@eqquestiondepth}% + \toks@=\expandafter\expandafter\expandafter{#1}\expandafter + \xdef\csname quesOpts\@quesctr\endcsname{\the\toks@}% + \edef\tempexp{\noexpand\setkeys{props@ques}{\the\toks@}}\tempexp + \list{\qMark@Hook\prior@questionsHook + \insE@rlyAtQues\gdef\eqPTs{1}% + \global\let\eqQT\eq@na% % \end{macrocode} % (06/06/10) We create a macro \cs{@currentQues} that holds the current % problem number 2(a)(i), for example. % \begin{macrocode} - {\@tempcnta=0 \let\@thispr@b\@empty - \@whilenum\@tempcnta<\@eqquestiondepth\do{\advance\@tempcnta\@ne - \ifx\@thispr@b\@empty\edef\@thispr@b{% - \csname theeqquestionno\romannumeral\the\@tempcnta\endcsname}\else - \edef\@thispr@b{\@thispr@b% - \csname theeqquestionno\romannumeral\the\@tempcnta\endcsname}\fi - }\xdef\@currentQues{\@thispr@b}}% - \makebox[\labelwidth][r]{\normalfont\@nameuse{label\@quesctr}}% - \xdef\eq@pageThisQ{\the\c@page}% - \post@questionsHook}{\usecounter{\@quesctr}% + {\@tempcnta=0 \let\@thispr@b\@empty + \@whilenum\@tempcnta<\@eqquestiondepth\do{\advance\@tempcnta\@ne + \ifx\@thispr@b\@empty\edef\@thispr@b{% + \csname theeqquestionno\romannumeral\the\@tempcnta\endcsname}\else + \edef\@thispr@b{\@thispr@b% + \csname theeqquestionno\romannumeral\the\@tempcnta\endcsname}\fi + }\xdef\@currentQues{\@thispr@b}}% + \makebox[\labelwidth][r]{\normalfont\@nameuse{label\@quesctr}}% + \xdef\eq@pageThisQ{\the\c@page}% + \post@questionsHook}{\usecounter{\@quesctr}% % \end{macrocode} % We set the list parameter for the \texttt{questions} environment. % \begin{macrocode} \ifx\propQ@labelsep\@empty - \settowidth{\labelsep}{\propQ@labelsepTo}\else - \setlength{\labelsep}{\propQ@labelsep}\fi + \settowidth{\labelsep}{\propQ@labelsepTo}\else + \setlength{\labelsep}{\propQ@labelsep}\fi \ifx\propQ@labelwidth\@empty - \settowidth{\labelwidth}% - {\propQ@labelwidthTo\hspace{\labelsep}}\else - \settowidth{\labelwidth}{\hspace{\propQ@labelwidth}% - \hspace{\labelsep}}\fi + \settowidth{\labelwidth}% + {\propQ@labelwidthTo\hspace{\labelsep}}\else + \settowidth{\labelwidth}{\hspace{\propQ@labelwidth}% + \hspace{\labelsep}}\fi \setlength{\topsep}{\propQ@topsep}% \setlength{\partopsep}{\propQ@partopsep}% \ifdim\parskip>\z@\addtolength{\topsep}{-\parskip}\fi @@ -3951,10 +3976,10 @@ % \begin{macrocode} \newenvironment{shortquiz*} {% - \xdef\eq@pageThisQ{\the\c@page}% - {\eqtmpcnta\@shortquizCnt\relax\advance\eqtmpcnta\@ne - \xdef\@shortquizCnt{\the\eqtmpcnta}}% - \sqForms\@shortquiz + \xdef\eq@pageThisQ{\the\c@page}% + {\eqtmpcnta\@shortquizCnt\relax\advance\eqtmpcnta\@ne + \xdef\@shortquizCnt{\the\eqtmpcnta}}% + \sqForms\@shortquiz }{\aeb@endshortquiz} % \end{macrocode} % Determines if the next argument is optional, if yes, we pass to @@ -3962,7 +3987,7 @@ % continue to \cs{@@shortquiz}. % \begin{macrocode} \def\@shortquiz{\@ifnextchar[% - {\@@shortquiz}{\@@shortquiz[\@sqGenBaseName]}} + {\@@shortquiz}{\@@shortquiz[\@sqGenBaseName]}} % \end{macrocode} % \end{environment} % \cs{@@shortquiz} continues the parsing of \texttt{shortquiz} and \texttt{shortquiz*}. @@ -3970,8 +3995,8 @@ % as a delimited parameter \texttt{\#1}. % \begin{macrocode} \def\sq@setCLN#1{\ifx\aebTitleQuiz\@empty - \protected@edef\@currentlabelname{#1}\else - \protected@edef\@currentlabelname{\@currentlabelname}\fi + \protected@edef\@currentlabelname{#1}\else + \protected@edef\@currentlabelname{\@currentlabelname}\fi } % \end{macrocode} % (2013/09/29) Added \cs{isQZ} and \cs{isSQZ} @@ -3979,37 +4004,53 @@ \let\isQZ=q \let\isSQZ=s %</package|eqexam> %<*package> -\def\sq@IDTxtField{\makebox[0pt][l]{\textField[\autoCenter{n}\BC{}\BG{} - \S{S}\textSize{0}\Ff{\FfReadOnly} - \AA{\AAFormat{% - if (typeof \oField=="undefined")\r\t - var \oField=new Object;\r - \oField.Grp={}; - \ifx\defaultColorJSLoc\@empty\else\r - \oField.DefaultColorJSLoc=\defaultColorJSLoc;\fi - \ifx\rghtColorJSLoc\@empty\else\r - \oField.RightColorJSLoc=\rghtColorJSLoc;\fi - \ifx\wrngColorJSLoc\@empty\else\r - \oField.WrongColorJSLoc=\wrngColorJSLoc;\fi - \ifx\rghtAnsSymbJSLoc\@empty\else\r - \oField.RightAnsSymbJSLoc=\rghtAnsSymbJSLoc;\fi - \ifx\wrngAnsSymbJSLoc\@empty\else\r - \oField.WrongAnsSymbJSLoc=\wrngAnsSymbJSLoc;\fi -}}]{sqID\oField}{2bp}{2bp}}% -} -\def\qz@IDTxtField{\makebox[0pt][l]{\textField[\autoCenter{n}\BC{}\BG{} +% \end{macrocode} +% The hidden ID field for a short-quiz +% \begin{macrocode} +\def\sq@IDTxtField{\makebox[0pt][l]{% + \textField[\autoCenter{n}\BC{}\BG{} \S{S}\textSize{0}\Ff{\FfReadOnly} - \AA{\AAFormat{if(typeof aQuizzesInDoc=="undefined")\r\t - var aQuizzesInDoc=new Array();\r - if (aQuizzesInDoc.indexOf("\oField")) - aQuizzesInDoc.push("\oField");\r + \AA{\AAFormat{% + if\eqSP(typeof\eqSP\oField=="undefined")\eqSP + var\eqSP\oField=new\eqSP Object;\r + \oField.Grp={};% + \ifx\defaultColorJSLoc\@empty\else\r + \oField.DefaultColorJSLoc=\defaultColorJSLoc;\fi + \ifx\rghtColorJSLoc\@empty\else\r + \oField.RightColorJSLoc=\rghtColorJSLoc;\fi + \ifx\wrngColorJSLoc\@empty\else\r + \oField.WrongColorJSLoc=\wrngColorJSLoc;\fi + \ifx\rghtAnsSymbJSLoc\@empty\else\r + \oField.RightAnsSymbJSLoc=\rghtAnsSymbJSLoc;\fi + \ifx\wrngAnsSymbJSLoc\@empty\else\r + \oField.WrongAnsSymbJSLoc=\wrngAnsSymbJSLoc;\fi + }}]{sqID\oField}{2bp}{2bp}}% +} +% \end{macrocode} +% The \uif{Format} code for the hidden quiz ID text field. +%\changes{v8.6}{2020/11/29}{\string\cs{qz@IDTxtField}: Format code now in \string\env{defineJS}} +% \begin{macrocode} +\begin{defineJS}[\makeesc\!\makecmt\%]{\qzIDFmt} +if(typeof aQuizzesInDoc=="undefined") + var aQuizzesInDoc=new Array(); +if (aQuizzesInDoc.indexOf("!oField")) + aQuizzesInDoc.push("!oField"); % \end{macrocode} % (2019/06/22) Added in declaration of quiz object. %\changes{v8.2.12}{2019/06/22}{Added declaration of quiz object} % \begin{macrocode} - if (typeof \oField=="undefined")\r\t - var \oField=new Object;\r - }}]{qzID\oField}{2bp}{2bp}}} +if (typeof !oField=="undefined") + var !oField=new Object; +\end{defineJS} +% \end{macrocode} +% The hidden text field for quizzes. The role of this field is to initialize things +% for the associated quiz. This field has \uif{Format} code (\cs{qzIDFmt}), and the \app{Reader} will +% execute this code when the page is opened. The code creates a new array \texttt{aQuizzesInDoc}, if needed, +% and adds this quiz to the list of quizzes in the doc. Refer to \cs{qzIDFmt} above. +% \begin{macrocode} +\def\qz@IDTxtField{\makebox[0pt][l]{\textField[\autoCenter{n}\BC{}\BG{} + \S{S}\textSize{0}\Ff{\FfReadOnly} + \AA{\AAFormat{\qzIDFmt}}]{qzID\oField}{2bp}{2bp}}} %</package> %<*package|eqexam> \let\eqQuizType\relax @@ -4030,7 +4071,7 @@ \let\@Ans\Ans@sq@f \ifx\oField\@empty \typeout{^^JExerquiz: Base field name required when using - shortquiz with '*' option}% + shortquiz with '*' option}% \PackageInfo{exerquiz}{Assuming link style^^J}% \let\@Ans\Ans@sq@l \fi @@ -4060,21 +4101,21 @@ % a \cs{@gobbletwo}, this eats up the next two tokens that immediately % follow \cs{sqlabel} in the beginning of the \texttt{shortquiz} environment. % \begin{macrocode} - \def\sqlabel{\aebtitleQuiz\@gobbletwo}% + \def\sqlabel{\aebtitleQuiz\@gobbletwo}% \fi % \end{macrocode} % When the online (or email) options are used in eqexam, the \cs{hypertarget} % command is adding vertical space. Normally \cs{sqlabel} is empty, so we don't % need \cs{hypertarget} in this case here. % \begin{macrocode} - \sq@aboveskip\sq@priorhook - \@ifundefined{PointsOnLeft}% - {\sq@setCLN{\eq@defaultShortQuizLabelName}% - \ifx\sqlabel\@empty\else\noindent\fi - \hypertarget{sqH\@currentHref}{}\sq@IDTxtField - \ifx\sqlabel\@empty\else\expandafter - \sqlabel\expandafter\sqhspace\fi - {\set@typeset@protect\aebtitleQuiz}}{}\ignorespaces + \sq@aboveskip\sq@priorhook + \@ifundefined{PointsOnLeft}% + {\sq@setCLN{\eq@defaultShortQuizLabelName}% + \ifx\sqlabel\@empty\else\noindent\fi + \hypertarget{sqH\@currentHref}{}\sq@IDTxtField + \ifx\sqlabel\@empty\else\expandafter + \sqlabel\expandafter\sqhspace\fi + {\set@typeset@protect\aebtitleQuiz}}{}\ignorespaces %</package> %<eqexam> \sq@aboveskip\sq@priorhook\ignorespaces %<*package|eqexam> @@ -4336,19 +4377,19 @@ % \begin{macrocode} \let\prior@quizSolnHeaderHook\@empty \newcommand\quizSolnHeader[3][]{% - \prior@quizSolnHeaderHook - \ifeqforpaper\else\webnewpage\fi\noindent + \prior@quizSolnHeaderHook + \ifeqforpaper\else\webnewpage\fi\noindent %</package|eqexam> %<*package> - \def\eq@argi{#1}% - \ifx\eq@argi\@empty\else\noPeek#1\fi - \hypertarget{#2}{#3}\relax + \def\eq@argi{#1}% + \ifx\eq@argi\@empty\else\noPeek#1\fi + \hypertarget{#2}{#3}\relax %</package> %<*eqexam> - #2% + #2% %</eqexam> %<*package|eqexam> - \solnspace + \solnspace } %</package|eqexam> %<*package> @@ -4378,7 +4419,7 @@ % when he is not authorized to). % \begin{macrocode} \def\noPeekAction#1#2{% - /AA <</O<</S/JavaScript/JS(noPeek("#1",#2))>> >> + /AA <</O<</S/JavaScript/JS(noPeek("#1",#2))>> >> } %</package> %<*package|eqexam> @@ -4399,14 +4440,14 @@ % \cmd{\relax}. % \begin{macrocode} \def\includequizsolutions{\@ifstar - {\let\resetQZtsolns\relax\includequizsolutionsi} - {\def\resetQZtsolns{\global\let\include@quizsolutions\relax}% - \includequizsolutionsi}} + {\let\resetQZtsolns\relax\includequizsolutionsi} + {\def\resetQZtsolns{\global\let\include@quizsolutions\relax}% + \includequizsolutionsi}} \newcommand{\includequizsolutionsi}[1][]{% - \filterFor{#1}\includequizsolutionsii} + \filterFor{#1}\includequizsolutionsii} \def\includequizsolutionsii{\include@quizsolutions - \resetQZtsolns - \let\eqFilterArg\@empty} + \resetQZtsolns + \let\eqFilterArg\@empty} %</package|eqexam> %<*package> % \end{macrocode} @@ -4460,11 +4501,11 @@ % \begin{macrocode} \newcommand{\quizSolnInput} {% - \global\let\webnewpage\relax - \bgroup\OKToWriteExamDatatrue - \writeT@QzSolns{\string\endinput}\egroup - \immediate\closeout\quiz@solns - \ifeq@noquizsolutions\else + \global\let\webnewpage\relax + \bgroup\OKToWriteExamDatatrue + \writeT@QzSolns{\string\endinput}\egroup + \immediate\closeout\quiz@solns + \ifeq@noquizsolutions\else % \end{macrocode} % If there are quiz solutions, we start a new page, and clear the right mark. % We execute \cmd{\eq@normallheader} which sets the running left header, @@ -4473,30 +4514,30 @@ % with \cmd{\sqslsecrunhead}, makes it easier to define running headers % when solutions are filtered. % \begin{macrocode} - \iftherearequizsolutions\newpage\markright{}% - \eq@normallheader\markright{\sqslsecrunhead}% - \ifx\webnewpage\relax - \def\webnewpage{\global\let\webnewpage\newpage}\fi + \iftherearequizsolutions\newpage\markright{}% + \eq@normallheader\markright{\sqslsecrunhead}% + \ifx\webnewpage\relax + \def\webnewpage{\global\let\webnewpage\newpage}\fi % \end{macrocode} % Here we have various prior commands, and the setting of the % section title. % \begin{macrocode} - \priorsqslsectitle\quizSolnsHeadnToc\priorsqslinput + \priorsqslsectitle\quizSolnsHeadnToc\priorsqslinput % \end{macrocode} % Now input the solution file \cmd{\jobname.qsl}. % \begin{macrocode} - \InputIfFileExists{\jobname.qsl}{}% - {!!! Solutions to quizzes not found} + \InputIfFileExists{\jobname.qsl}{}% + {!!! Solutions to quizzes not found} % \end{macrocode} % A hook for hanging things % \begin{macrocode} - \eqqzsolutionshook + \eqqzsolutionshook % \end{macrocode} % Reset the running header cleanly % \begin{macrocode} - \newpage\eq@defaultlheader - \fi + \newpage\eq@defaultlheader \fi + \fi } % \end{macrocode} % The internal command that insert solutions. This command @@ -4540,35 +4581,35 @@ % \cs{defaultquiztype}. % \begin{macrocode} \newcommand{\quiztype}[1]{% - \def\@quiztype{#1}\def\aeb@FLOverride{#1}} + \def\@quiztype{#1}\def\aeb@FLOverride{#1}} \let\@quiztype\@empty \newcommand{\defaultquiztype}{\let\@quiztype\@empty - \let\aeb@FLOverride\relax} + \let\aeb@FLOverride\relax} \let\aeb@FLOverride\relax % \end{macrocode} % \end{macro} % \end{macro} % \begin{macrocode} \def\@setFormLinkType{% - \if\qstar*% - \ifx\aeb@FLOverride\relax% - \def\@@quiztype{f}% - \else - \if\aeb@FLOverride l\def\@@quiztype{l}\else - \def\@@quiztype{f}\fi - \fi + \if\qstar*% + \ifx\aeb@FLOverride\relax% + \def\@@quiztype{f}% \else - \ifx\aeb@FLOverride\relax - \def\@@quiztype{l}% - \else - \if\aeb@FLOverride f\def\@@quiztype{f}\else - \def\@@quiztype{l}\fi - \fi + \if\aeb@FLOverride l\def\@@quiztype{l}\else + \def\@@quiztype{f}\fi \fi + \else + \ifx\aeb@FLOverride\relax + \def\@@quiztype{l}% + \else + \if\aeb@FLOverride f\def\@@quiztype{f}\else + \def\@@quiztype{l}\fi + \fi + \fi } \def\setdefault@Ans{\@setFormLinkType - \expandafter\global\expandafter - \let\expandafter\@Ans\expandafter=\csname Ans@\@@quiztype\endcsname + \expandafter\global\expandafter + \let\expandafter\@Ans\expandafter=\csname Ans@\@@quiztype\endcsname } % \end{macrocode} % \begin{macro}{\useForms} @@ -4626,36 +4667,36 @@ % question label, i.e., \texttt{2(a)(ii)}. These two lines are repeated for % the \texttt{oQuestion} and \texttt{shortquiz} environments. % \begin{macrocode} - \xdef\eq@pageThisQ{\the\c@page}% - \let\@currentQues\@empty - \global\let\eqQzQuesList\@empty - \global\let\pointValuesArray\@empty + \xdef\eq@pageThisQ{\the\c@page}% + \let\@currentQues\@empty + \global\let\eqQzQuesList\@empty + \global\let\pointValuesArray\@empty % \end{macrocode} % Initialize \texttt{ptypeArray} to track problem types better % \changes{v7.7m}{2016/07/04}{Initialize \string\texttt{ptypeArray} to track problem types better} % \begin{macrocode} - \global\let\ptypeArray\@empty + \global\let\ptypeArray\@empty % \end{macrocode} % Initialize \texttt{corrAnsArray} to track the correct answers % \changes{v7.7n}{2016/07/06}{Initialize \string\texttt{ptypeArray} to track problem types better} % \begin{macrocode} - \global\let\corrAnsArray\@empty + \global\let\corrAnsArray\@empty % \end{macrocode} % Update the internal quiz counter. % \begin{macrocode} - {\eqtmpcnta\@quizCnt\advance\eqtmpcnta\@ne - \xdef\@quizCnt{\the\eqtmpcnta}}% + {\eqtmpcnta\@quizCnt\advance\eqtmpcnta\@ne + \xdef\@quizCnt{\the\eqtmpcnta}}% % \end{macrocode} % We try to support {\LaTeX}'s cross-referencing system by defining % \cs{@currentlabel}, \cs{@currentHlabel}, and \cs{@currentlabelname}. % \begin{macrocode} - \edef\@currentlabel{\@quizCnt}% - \edef\@currentHref{quiz.\@quizCnt}% - \sq@setCLN{\eq@defaultQuizLabelName}% - \setcounter{eqpointvalue}{0}\setcounter{questionno}{0}% - \eq@initializeServerSubmit - \global\let\eqQuizType\isQZ %\tabcolsep=0pt - \gdef\eqPTs{1}\global\let\eqQT\eq@na + \edef\@currentlabel{\@quizCnt}% + \edef\@currentHref{quiz.\@quizCnt}% + \sq@setCLN{\eq@defaultQuizLabelName}% + \setcounter{eqpointvalue}{0}\setcounter{questionno}{0}% + \eq@initializeServerSubmit + \global\let\eqQuizType\isQZ %\tabcolsep=0pt + \gdef\eqPTs{1}\global\let\eqQT\eq@na % \end{macrocode} % \changes{v6.3u}{2010/11/04}{% % Added \cs{xdef}\cs{oField}\texttt{\{\#2\}}, this is @@ -4663,31 +4704,32 @@ % Add \cs{listOfQuizNames} to track quizzes % \changes{v7.8k}{2017/07/25}{Added \string\cs{listOfQuizNames} to track quizzes} % \begin{macrocode} - \g@addto@macro\ListOfQuizNames{,#2}% - \gdef\quiz@total{#2}\xdef\curr@quiz{#2}\xdef\oField{#2}% - \xdef\currQuiz{#2}\xdef\currQuizStartPage{\thepage}% - \xdef\aPointType{0}% + \g@addto@macro\ListOfQuizNames{,#2}% + \gdef\quiz@total{#2}\xdef\curr@quiz{#2}\xdef\oField{#2}% + \xdef\currQuiz{#2}\xdef\currQuizStartPage{\thepage}% + \xdef\aPointType{0}% % \end{macrocode} % (2013/12/20) Pass \cs{bqlabelISO} through \cs{pdfstringdef}. % \begin{macrocode} - \def\fieldJSStr@CMD{\fieldJSStr*[noquotes]\bqlabelISO}% - \expandafter\fieldJSStr@CMD\expandafter{\bqlabelISO}% - \ifx\@quiztype\@empty\gdef\@@quiztype{#1}\else - \xdef\@@quiztype{\@quiztype}\fi - \let\@qzsolndest\@empty - \let\answers\answers@q\let\endanswers\endanswers@q - \let\manswers\manswers@q\let\endmanswers\endanswers@q - \let\solution\solution@sq\let\endsolution\endsolution@sq - \expandafter% - \xdef\csname titleOf\currQuiz\endcsname{\aebTitleQuiz}% + \def\fieldJSStr@CMD{\flJSStr*[noquotes]\bqlabelISO}% + \expandafter\fieldJSStr@CMD\expandafter{\bqlabelISO}% + \ifx\@quiztype\@empty\gdef\@@quiztype{#1}\else + \xdef\@@quiztype{\@quiztype}\fi + \let\@qzsolndest\@empty + \let\answers\answers@q\let\endanswers\endanswers@q + \let\manswers\manswers@q\let\endmanswers\endanswers@q + \let\solution\solution@sq\let\endsolution\endsolution@sq + \expandafter + \xdef\csname titleOf\currQuiz\endcsname{\aebTitleQuiz}% % \end{macrocode} % Modified the destination name of \cs{hypertarget} to avoid deplicate % destinations. Did the same thing for the \texttt{shortquiz}. % \changes{v7.8a}{2016/12/07}{Modified destination name of \string\cs{hypertarget}} % \begin{macrocode} - \q@aboveskip\q@priorhook\noindent\hypertarget{qzH\@currentHref}{}% - \eq@beginQuiz\qhspace{\set@typeset@protect\aebtitleQuiz}% - \ignorespaces} + \q@aboveskip\q@priorhook\noindent\hypertarget{qzH\@currentHref}{}% + \eq@beginQuiz\qhspace{\set@typeset@protect\aebtitleQuiz}% + \ignorespaces +} % \end{macrocode} % Here is the end for the \texttt{quiz} and \texttt{quiz*} environments. The % \cs{eq@prior@endQuiz} can be used for whatever purposes a @@ -4740,78 +4782,114 @@ % Use a button instead of a link for begin quiz % \begin{macrocode} \newcommand\useBeginQuizButton[1][] - {\renewcommand\eq@beginQuiz{\eq@BeginQuizButton[#1]}} + {\renewcommand\eq@beginQuiz{\eq@BeginQuizButton[#1]}} % \end{macrocode} % \end{macro} % \begin{macro}{\useEndQuizButton} % Use a button instead of a link for end quiz % \begin{macrocode} \newcommand\useEndQuizButton[1][] - {\renewcommand\eq@endQuiz{\eq@EndQuizButton[#1]}} + {\renewcommand\eq@endQuiz{\eq@EndQuizButton[#1]}} % \end{macrocode} % \end{macro} % \begin{macro}{\useBeginQuizLink} % Use a link begin quiz (the default) % \begin{macrocode} \newcommand\useBeginQuizLink - {\renewcommand\eq@beginQuiz{\eq@BeginQuizLink}} + {\renewcommand\eq@beginQuiz{\eq@BeginQuizLink}} % \end{macrocode} % \end{macro} % \begin{macro}{\useEndQuizLink} % Use a link end quiz (the default) % \begin{macrocode} \newcommand\useEndQuizLink - {\renewcommand\eq@endQuiz{\eq@EndQuizLink}} + {\renewcommand\eq@endQuiz{\eq@EndQuizLink}} % \end{macrocode} % \end{macro} -% \begin{macrocode} -%\def\listOfQuizzes{} -%\def\listOfSubmitQuizzes{} -%\def\initializeAllSubmitQuizzes{} -% \end{macrocode} % \begin{macro}{\@initQuiz} -% \begin{macro}{\priorInitQuiz} -% \begin{macro}{\postInitQuiz} % \cs{@initQuiz} is executed when you click on `Begin Quiz'. Included here are some % macro hooks for insert code prior to, and after the quiz initialization. This % command appears in the commands \cs{eq@@BeginQuizLinkActions} and \cs{eq@@BeginQuizButtonActions} below. %\changes{v7.0}{2014/11/05}{Added some JS: lstOfQuizzes is an object % listing all quizzes in the document, the value is the quiz object. We add properties % isSubmitted and initializeWith to the quiz object.} +%\changes{v8.6.1}{2020/12/30}{Changed the comparison method for \string\cs{priorInitQuiz} and +% \string\cs{postInitQuiz} to reflect their \string\cs{newcommand} definition.} % \begin{macrocode} \newcommand\@initQuiz{% - var \curr@quiz=new Object();\jsR - lstOfQuizzes["\curr@quiz"]=\curr@quiz;\jsR - \curr@quiz.oAlertCheck={bAfterValue:false};\jsR - \curr@quiz.Grp={}; - \ifx\defaultColorJSLoc\@empty\else\jsR - \oField.DefaultColorJSLoc=\defaultColorJSLoc;\fi - \ifx\rghtColorJSLoc\@empty\else\jsR - \oField.RightColorJSLoc=\rghtColorJSLoc;\fi - \ifx\wrngColorJSLoc\@empty\else\jsR - \oField.WrongColorJSLoc=\wrngColorJSLoc;\fi - \ifx\partialColorJSLoc\@empty\else\jsR - \oField.PartialColorJSLoc=\partialColorJSLoc;\fi - \ifx\rghtAnsSymbJSLoc\@empty\else\jsR - \oField.RightAnsSymbJSLoc=\rghtAnsSymbJSLoc;\fi - \ifx\wrngAnsSymbJSLoc\@empty\else\jsR - \oField.WrongAnsSymbJSLoc=\wrngAnsSymbJSLoc;\fi - \ifx\corrAnsSymbJSLoc\@empty\else\jsR - \oField.CorrAnsSymbJSLoc=\corrAnsSymbJSLoc;\fi - \ifx\eqGradeScaleLoc\@empty\else\jsR - \oField.GradeScaleLoc=new Array(\eqGradeScaleLoc);\fi - \ifx\eqCorrLocalChoiceFully\@empty\else\jsR % dpsf07 - \oField.fullyCorrectLoc=\eqCorrLocalChoiceFully;\fi - \ifx\priorInitQuiz\@empty\else\jsR\priorInitQuiz\fi %\jsR - InitializeQuiz("\curr@quiz",\ifnocorrections0\else1\fi); - \ifx\eq@CGI\@empty\jsR\curr@quiz.isSubmitted=false;\else - \jsR\curr@quiz.isSubmitted=true;\fi - \jsR\curr@quiz.initializeWith=% -'InitializeQuiz("\curr@quiz",\ifnocorrections0\else1\fi);' - \ifx\postInitQuiz\@empty\else\jsR\postInitQuiz\fi -} -% \end{macrocode} -% \cs{priorInitQuiz} and \cs{postInitQuiz} are hooks that allow a document author to + var\eqSP\curr@quiz=new Object();\jsR + lstOfQuizzes["\curr@quiz"]=\curr@quiz;\jsR + \curr@quiz.oAlertCheck={bAfterValue:false};\jsR + \curr@quiz.Grp={};% + \ifx\defaultColorJSLoc\@empty\else\jsR + \oField.DefaultColorJSLoc=\defaultColorJSLoc;\fi + \ifx\rghtColorJSLoc\@empty\else\jsR + \oField.RightColorJSLoc=\rghtColorJSLoc;\fi + \ifx\wrngColorJSLoc\@empty\else\jsR + \oField.WrongColorJSLoc=\wrngColorJSLoc;\fi + \ifx\partialColorJSLoc\@empty\else\jsR + \oField.PartialColorJSLoc=\partialColorJSLoc;\fi + \ifx\rghtAnsSymbJSLoc\@empty\else\jsR + \oField.RightAnsSymbJSLoc=\rghtAnsSymbJSLoc;\fi + \ifx\wrngAnsSymbJSLoc\@empty\else\jsR + \oField.WrongAnsSymbJSLoc=\wrngAnsSymbJSLoc;\fi + \ifx\corrAnsSymbJSLoc\@empty\else\jsR + \oField.CorrAnsSymbJSLoc=\corrAnsSymbJSLoc;\fi + \ifx\eqGradeScaleLoc\@empty\else\jsR + \oField.GradeScaleLoc=new Array(\eqGradeScaleLoc);\fi + \ifx\eqCorrLocalChoiceFully\@empty\else\jsR + \oField.fullyCorrectLoc=\eqCorrLocalChoiceFully;\fi + \if$\priorInitQuiz$\else\jsR\priorInitQuiz\fi\jsR + InitializeQuiz("\curr@quiz",\ifnocorrections0\else1\fi);% + \ifx\eq@CGI\@empty\jsR\curr@quiz.isSubmitted=false;\else + \jsR\curr@quiz.isSubmitted=true;\fi + \jsR\curr@quiz.initializeWith=% + 'InitializeQuiz("\curr@quiz",\ifnocorrections0\else1\fi);';% + \if$\postInitQuiz$\else\jsR\postInitQuiz\fi% +} +% \end{macrocode} +% The following is the \env{defineJS} version of \cs{@initQuiz}. This is experiemental +% for now, not yet implemented. +%\begin{verbatim} +%\begin{defineJS}[\makeesc\!\makecmt\%]{\@initQuiz} +%var !curr@quiz=new Object(); +%lstOfQuizzes["!curr@quiz"]=!curr@quiz; +%!curr@quiz.oAlertCheck={bAfterValue:false}; +%!curr@quiz.Grp={};% +%!ifx!defaultColorJSLoc!@empty!else +%!oField.DefaultColorJSLoc=!defaultColorJSLoc;!fi% +%!ifx!rghtColorJSLoc!@empty!else +%!oField.RightColorJSLoc=!rghtColorJSLoc;!fi% +%!ifx!wrngColorJSLoc!@empty!else +%!oField.WrongColorJSLoc=!wrngColorJSLoc;!fi% +%!ifx!partialColorJSLoc!@empty!else +%!oField.PartialColorJSLoc=!partialColorJSLoc;!fi% +%!ifx!rghtAnsSymbJSLoc!@empty!else +%!oField.RightAnsSymbJSLoc=!rghtAnsSymbJSLoc;!fi% +%!ifx!wrngAnsSymbJSLoc!@empty!else +%!oField.WrongAnsSymbJSLoc=!wrngAnsSymbJSLoc;!fi% +%!ifx!corrAnsSymbJSLoc!@empty!else +%!oField.CorrAnsSymbJSLoc=!corrAnsSymbJSLoc;!fi% +%!ifx!eqGradeScaleLoc!@empty!else +%!oField.GradeScaleLoc=new Array(!eqGradeScaleLoc);!fi% +%!ifx!eqCorrLocalChoiceFully!@empty!else +%!oField.fullyCorrectLoc=!eqCorrLocalChoiceFully;!fi% +%!if$!priorInitQuiz$!else +%!priorInitQuiz!fi% +%InitializeQuiz("!curr@quiz",!ifnocorrections0!else1!fi);% +%!ifx!eq@CGI!@empty +%!curr@quiz.isSubmitted=false;!else +%!curr@quiz.isSubmitted=true;!fi +%!curr@quiz.initializeWith=% +%'InitializeQuiz("!curr@quiz",!ifnocorrections0!else1!fi);';% +%!if$!postInitQuiz$!else +%!postInitQuiz!fi +%\end{defineJS} +%\end{verbatim} +% \end{macro} +% \begin{macro}{\priorInitQuiz} +% \begin{macro}{\postInitQuiz} +% These two commands are hooks that allow a document author to % execute JavaScript just prior to initializing the quiz and just after. These appear in % \cs{eq@@BeginQuizLinkActions} and \cs{eq@@BeginQuizButtonActions} below. % \begin{macrocode} @@ -4820,24 +4898,32 @@ % \end{macrocode} % \end{macro} % \end{macro} -% \end{macro} -% Here are a couple of macros used with `End Quiz', and are used for +% Here are a couple\DescribeMacro{\eq@submitURL}\DescribeMacro{\eq@insertHiddenFields}{} +% of macros that appear in `\uif{End Quiz}', and are used for % submitting quiz results to a web server. % \begin{macrocode} \let\eq@submitURL\@empty \let\eq@insertHiddenFields\@empty % \end{macrocode} +% \begin{macro}{\priorSubmitQuiz} +% \begin{macro}{\postSubmitQuiz} +% These two commands are defined in this package, but are use in \pkg{eq2db}. +% \begin{macrocode} +\newcommand\priorSubmitQuiz{} +\newcommand\postSubmitQuiz{} +% \end{macrocode} +% \end{macro} +% \end{macro} % % \subsubsection{With Links} % % \begin{macro}{\eq@BeginQuizLink} -% Begin quiz with links +% `\uif{Begin Quiz}' with links % \begin{macrocode} \def\eq@@BeginQuizLinkActions{\A{\JS{\@initQuiz}}} \def\eq@BeginQuizLinkDefaults{\Border{0 0 0}} \let\bqlabelFmt\@empty -\def\eq@BeginQuizLink{% - \qz@IDTxtField +\def\eq@BeginQuizLink{\qz@IDTxtField \set@@Link{}{}{}{\color{\@linkcolor}\bqlabelFmt\bqlabel}{}% {\eq@setWidgetProps\setLink@driver}% {\eq@BeginQuizLinkDefaults\eq@@BeginQuizLinkActions\every@Link}% @@ -4846,47 +4932,22 @@ % \end{macro} % \begin{macro}{\eq@EndQuizLink} % Code the the link version of `End Quiz'. +% \changes{v8.6}{2020/11/29}{Action for End Quiz Lnk now a \string\env{defineJS} env} % \begin{macrocode} -\newcommand\priorSubmitQuiz{} -\newcommand\postSubmitQuiz{} -\def\eq@@EndQuizLinkActions{\A{\JS{% - if (!isQuizInitialized("\curr@quiz"))\jsR\jsT - eqAppAlert(InitMsg("\bqlabelISO"),3);\jsR - else {\jsR\jsT - if (\minQuizResp(\thequestionno)) {\jsR\jsT\jsT - \curr@quiz.PtValues=new % - Array(\pointValuesArray);\jsR\jsT\jsT - ProbType = [\ptypeArray];\jsR\jsT\jsT -\if@inclkey - \curr@quiz.CorrAns=(new % - Array(\corrAnsArray));\jsR\jsT\jsT -\fi - DisplayQuizResults("\curr@quiz",\theeqpointvalue,% - \thequestionno);\jsR\jsT\jsT - var h=this.getField("ScoreData.\curr@quiz");\jsR\jsT\jsT - h.value=Score+";"+NQuestions+";"% - +ptScore+";"+NPointTotal;\jsR\jsT\jsT - \eq@submitURL - \postSubmitQuiz - \jsT\jsT resetQuiz("\curr@quiz");\jsR\jsT - }\jsR - }}}% -} +\def\eq@@EndQuizLinkActions{\A{\JS{\eQzBtnActns}}} \def\eq@EndQuizLinkDefaults{\Border{0 0 0}} \let\eqlabelFmt\@empty -\def\eq@EndQuizLink -{% - \ifx\eq@CGI\@empty - \let\eq@submitURL\@empty - \let\eq@insertHiddenFields\@empty - \fi - \set@@Link{}{}{}{\color{\@linkcolor}\eqlabelFmt\eqlabel}{}% - {\eq@setWidgetProps\setLink@driver}% - {\eq@EndQuizLinkDefaults\eq@@EndQuizLinkActions\every@Link}% - \makebox[0pt][r]{\textField[\BC{}\autoCenter{n}]% - {htxtfld.\curr@quiz}{2bp}{2bp}}% - \makebox[0pt][r]{\eq@hiddenScoreData\eq@insertHiddenFields}% - \global\let\eq@CGI\@empty\ignorespaces +\def\eq@EndQuizLink{% + \ifx\eq@CGI\@empty + \let\eq@submitURL\@empty + \let\eq@insertHiddenFields\@empty\fi + \set@@Link{}{}{}{\color{\@linkcolor}\eqlabelFmt\eqlabel}{}% + {\eq@setWidgetProps\setLink@driver}% + {\eq@EndQuizLinkDefaults\eq@@EndQuizLinkActions\every@Link}% + \makebox[0pt][r]{\textField[\BC{}\autoCenter{n}]% + {htxtfld.\curr@quiz}{2bp}{2bp}}% + \makebox[0pt][r]{\eq@hiddenScoreData\eq@insertHiddenFields}% + \global\let\eq@CGI\@empty\ignorespaces } % \end{macrocode} % \end{macro} @@ -4896,10 +4957,11 @@ % \begin{macro}{\eq@BeginQuizButton} % This is the button when the user wants button rather than link for the % \texttt{quiz} environment. +% \changes{v8.6}{2020/11/29}{Action for End Quiz Btn now a \string\env{defineJS} env} % \begin{macrocode} \def\BeginQuizButtonDefaults{% - \CA{\bqlabel}\H{P}\F{\FPrint} - \BC{1 0 0}\BG{.7529 .7529 .7529}\W{1}\S{B}} + \CA{\bqlabel}\H{P}\F{\FPrint} + \BC{1 0 0}\BG{.7529 .7529 .7529}\W{1}\S{B}} \def\eq@@BeginQuizButtonActions{\A{\JS{\@initQuiz}}} \newcommand\eq@BeginQuizButton[1][]{% \mbox{\qz@IDTxtField\push@@Button{#1}{beginQuiz.\curr@quiz}{}% @@ -4910,41 +4972,41 @@ % \end{macrocode} % \end{macro} % \begin{macro}{\eq@EndQuizButton} -% The `End Quiz' code for Links -% \begin{macrocode} -\def\EndQuizButtonDefaults{% - \CA{\eqlabel}\F{\FPrint}\BC{1 0 0} - \BG{.7529 .7529 .7529}\W{1}\S{B}\H{P}} -\def\eq@@EndQuizButtonActions{\A{\JS{% - if (!isQuizInitialized("\curr@quiz"))\jsR\jsT - eqAppAlert(InitMsg("\bqlabelISO"),3);\jsR - else {\jsR\jsT - if (\minQuizResp(\thequestionno)&&_ModalNotOn){\jsR\jsT\jsT - \curr@quiz.PtValues=(new % - Array(\pointValuesArray));\jsR\jsT\jsT - ProbType=[\ptypeArray];\jsR\jsT\jsT -\if@inclkey - \curr@quiz.CorrAns=(new % - Array(\corrAnsArray));\jsR\jsT\jsT -\fi - DisplayQuizResults("\curr@quiz",\theeqpointvalue,% - \thequestionno);\jsR\jsT\jsT - var h=this.getField("ScoreData.\curr@quiz");\jsR\jsT\jsT - h.value=Score+";"+NQuestions+";"% - +ptScore+";"+NPointTotal;\jsR\jsT\jsT - \eq@submitURL - \postSubmitQuiz - \jsT\jsT resetQuiz("\curr@quiz");\jsR\jsT - }\jsR - }}}% +% The `End Quiz' code +% \begin{macrocode} +\begin{defineJS}[\makeesc\*\makecmt\%]{\eQzBtnActns} +if (!isQuizInitialized("*curr@quiz")) + eqAppAlert(InitMsg("*bqlabelISO"),3); +else { + if (*minQuizResp(*thequestionno)&&_ModalNotOn){ + *curr@quiz.PtValues=new Array(*pointValuesArray); + ProbType=[*ptypeArray];% +*if@inclkey + *curr@quiz.CorrAns=new Array(*corrAnsArray);*fi + DisplayQuizResults("*curr@quiz",*theeqpointvalue,% +*thequestionno); + var h=this.getField("ScoreData.*curr@quiz"); + h.value=Score+";"+NQuestions+";"% ++ptScore+";"+NPointTotal;% +*ifx*eq@submitURL*empty*else + *eq@submitURL*fi% +*if$*postSubmitQuiz$*else + *postSubmitQuiz*fi + resetQuiz("*curr@quiz"); + } } +\end{defineJS} +\def\EndQuizButtonDefaults{% + \CA{\eqlabel}\F{\FPrint}\BC{1 0 0} + \BG{.7529 .7529 .7529}\W{1}\S{B}\H{P}} +\def\eq@@EndQuizButtonActions{% + \A{\JS{\eQzBtnActns}}} \newcommand{\eq@hiddenScoreData}{\makebox[0pt][r]{% \textField[\BC{}\F{\FHidden}]{ScoreData.\curr@quiz}{2bp}{2bp}}} \newcommand\eq@EndQuizButton[1][]{% \ifx\eq@CGI\@empty \let\eq@submitURL\@empty - \let\eq@insertHiddenFields\@empty - \fi + \let\eq@insertHiddenFields\@empty\fi \mbox{\push@@Button{#1}{endQuiz.\curr@quiz}{}% {\DefaultHeightOfWidget}{\eq@protect\A}% {\eq@setButtonProps\eq@Button@driver}% @@ -4959,8 +5021,8 @@ % \begin{macro}{\eqCGI} % \begin{macro}{\eqSubmit} % These four commands give general support for submitting quiz data -% to a web server for storage in a database. Use in my \textsf{eq2db} Package -% which I have not completed yet. (2014/09/14) Sanitized first argument of \cs{eqSubmit}. +% to a web server for storage in a database. Use in the \pkg{eq2db} package. +% (2014/09/14) Sanitized first argument of \cs{eqSubmit}. % \begin{macrocode} \newcommand\databaseName[1]{\gdef\db@Name{#1}}\def\db@Name{} \newcommand\tableName[1]{\gdef\db@Table{#1}}\def\db@Table{} @@ -5974,24 +6036,22 @@ if (isEndQuizPushed("@eqBaseName")){ % here, then goes to |\Ans@sq@l@driver| the rest of the code that depends on the % driver. % \begin{macrocode} -\def\sqWrongRespJS{OnBlurRespBox( false, "\oField" );} -\def\sqRightRespJS{OnBlurRespBox( true, "\oField" );} +\def\sqWrongRespJS{OnBlurRespBox(false,"\oField");} +\def\sqRightRespJS{OnBlurRespBox(true,"\oField");} \def\Ans@sq@l@Actions {% - \A{\if\Ans@choice1 - \JS{\sqRightRespJS} - \ifx\@qzsolndest\@empty\else - \ifeq@solutionsafter\else - /Next <</S/GoTo/D(\@qzsolndest)>> - \fi + \A{\if\Ans@choice\eq@One\JS{\sqRightRespJS} + \ifx\@qzsolndest\@empty\else + \ifeq@solutionsafter\else + /Next <</S/GoTo/D(\@qzsolndest)>> \fi + \fi \else \JS{\sqWrongRespJS\jsR \ifx\oField\@empty\else - updateTally("\oField.\thequestionno"); - \fi}% + updateTally("\oField.\thequestionno");\fi}% \fi - }% + }% } % \end{macrocode} % \end{macro} @@ -6047,6 +6107,7 @@ if (isEndQuizPushed("@eqBaseName")){ % \end{macrocode} % \end{macro} % \subsubsection{Form Style} +% \subsubsection{Answers for the \texttt{answers} and \texttt{manswers} Environment} % \begin{macro}{\Ans@sq@f} % For the link multiple choice type question. The driver independent stuff starts % here, then goes to |\Ans@sq@f@driver| the rest of the code that depends on the @@ -6073,28 +6134,46 @@ if (isEndQuizPushed("@eqBaseName")){ \def\sqNoCorrections{\let\@sqAlertsOnly\eq@One} \def\sqCorrections{\let\@sqAlertsOnly\eq@Zero} \sqNoCorrections -\def\Ans@sq@f@ActionsTrue{% - \if\@sqTurnOffAlerts1OnBlurRespBox(true,"\oField");\jsR\fi - \ifx\@qzsolndest\@empty\else\ifeq@solutionsafter\else - jmpToNamedDest("\oField","\@qzsolndest",% - \if\@sqTurnOffAlerts00\else1\fi);\fi - \fi\eqAddAAMouseUpMC} -\def\Ans@sq@f@ActionsFalse{% - \if\@sqTurnOffAlerts1OnBlurRespBox(false,"\oField" );\jsR\fi - \ifx\oField\@empty\else - updateTally("\oField.\thequestionno"); - \fi\jsR\eqAddAAMouseUpMC} +% \end{macrocode} +% JavaScript code for the mouse up action for the \emph{correct} choice of the radio button field +% (\texttt{mc.\ameta{fld-name}.\ameta{q-num}}) for the form version of a multiple choice question of a \texttt{shortquiz}. +% \begin{macrocode} +\begin{defineJS}[\makeesc\*\makecmt\%]{\Ans@sq@f@ActionsTrue} +*ifx*@sqTurnOffAlerts*eq@One% +OnBlurRespBox(true,"*oField"); +*fi% +var qzSolnDest="*@qzsolndest"; +var solnAfter=*ifeq@solutionsafter% +true*else% +false*fi; +if ((qzSolnDest!="") && !solnAfter) % +jmpToNamedDest("*oField","*@qzsolndest",% +*ifx*@sqTurnOffAlerts*eq@Zero0*else1*fi);% +*ifx*eqAddAAMouseUpMC*empty*else +*eqAddAAMouseUpMC*fi +\end{defineJS} +% \end{macrocode} +% JavaScript code for the mouse up action for the \emph{incorrect} choice of the radio button field +% (\texttt{mc.\ameta{fld-name}.q-num}) for the form version of a multiple choice question of a \texttt{shortquiz}. +% \begin{macrocode} +\begin{defineJS}[\makeesc\*\makecmt\%]{\Ans@sq@f@ActionsFalse} +*ifx*@sqTurnOffAlerts*eq@One% +OnBlurRespBox(false,"*oField"); +*fi% +var qzSolnDest="*@qzsolndest"; +if( qzSolnDest!="") updateTally("*oField.*thequestionno");% +*ifx*eqAddAAMouseUpMC*empty*else +*eqAddAAMouseUpMC*fi +\end{defineJS} % \end{macrocode} % The actions for the form version of a multiple choice question of a \texttt{shortquiz}. % \begin{macrocode} -\def\Ans@sq@f@Actions{\A{\if\Ans@choice\eq@One - \JS{\Ans@sq@f@ActionsTrue}\else - \JS{\Ans@sq@f@ActionsFalse}\fi}% - \AAmousedown{updateTally.downState=!!event.target.isBoxChecked% - (\arabic{quizno}-1);}} +\def\Ans@sq@f@Actions{\AAmouseup{\if\Ans@choice\eq@One + \Ans@sq@f@ActionsTrue\else\Ans@sq@f@ActionsFalse\fi} + \AAmousedown{updateTally.downState=!!event.target.isBoxChecked% + (\arabic{quizno}-1);}} \def\Ans@proofing#1{\ifeq@proofing\if\Ans@choice1\relax - \llap{\@proofingsymbol\,\hskip#1\relax}% - \fi\fi} + \llap{\@proofingsymbol\,\hskip#1\relax}\fi\fi} % \end{macrocode} %\DescribeMacro{\sqRghtSymbChoice}\DescribeMacro{\sqRghtSymbColor} for the \texttt{shortquiz} % environment, these first two commands assign the right symbol (default check) and @@ -6102,19 +6181,19 @@ if (isEndQuizPushed("@eqBaseName")){ % does the same thing for the wrong answer. % \begin{macrocode} \def\sqRghtSymbChoice#1{\chooseJSsymbol*{#1}% - \ifx\eq@retnStyle\@empty - \edef\sq@corrsymch{\sqRghtSymbChoiceDef}\else - \edef\sq@corrsymch{#1}\fi} + \ifx\eq@retnStyle\@empty + \edef\sq@corrsymch{\sqRghtSymbChoiceDef}\else + \edef\sq@corrsymch{#1}\fi} \def\sqRghtSymbColor#1{\edef\eq@arg{#1}\ifx\eq@arg\@empty - \edef\sq@corrsymcol{\sqRghtSymbColorDef}\else - \edef\sq@corrsymcol{#1}\fi} + \edef\sq@corrsymcol{\sqRghtSymbColorDef}\else + \edef\sq@corrsymcol{#1}\fi} \def\sqWrngSymbChoice#1{\chooseJSsymbol*{#1}% - \ifx\eq@retnStyle\@empty - \edef\sq@wrgsymch{\sqWrngSymbChoiceDef}\else - \edef\sq@wrgsymch{#1}\fi} + \ifx\eq@retnStyle\@empty + \edef\sq@wrgsymch{\sqWrngSymbChoiceDef}\else + \edef\sq@wrgsymch{#1}\fi} \def\sqWrngSymbColor#1{\edef\eq@arg{#1}\ifx\eq@arg\@empty - \edef\sq@wrgsymcol{\sqWrngSymbColorDef}\else - \edef\sq@wrgsymcol{#1}\fi} + \edef\sq@wrgsymcol{\sqWrngSymbColorDef}\else + \edef\sq@wrgsymcol{#1}\fi} \def\sqRghtSymbChoiceDef{check} \def\sqRghtSymbColorDef{0 .6 0 rg} \def\sqWrngSymbChoiceDef{cross} @@ -6124,8 +6203,8 @@ if (isEndQuizPushed("@eqBaseName")){ \edef\sq@wrgsymch{\sqWrngSymbChoiceDef} \edef\sq@wrgsymcol{\sqWrngSymbColorDef} \def\sqResetSymbToDef{% - \sqRghtSymbChoice{}\sqRghtSymbColor{}% - \sqWrngSymbChoice{}\sqWrngSymbColor{}% + \sqRghtSymbChoice{}\sqRghtSymbColor{}% + \sqWrngSymbChoice{}\sqWrngSymbColor{}% } % \end{macrocode} %\DescribeMacro{\qChoiceSymb}\DescribeMacro{\qChoiceColor} for the \texttt{quiz} @@ -6133,12 +6212,12 @@ if (isEndQuizPushed("@eqBaseName")){ % color (default webgreen). % \begin{macrocode} \def\qChoiceSymb#1{\chooseJSsymbol*{#1}% - \ifx\eq@retnStyle\@empty - \edef\qz@chksymb{\qChoiceSymbDef}\else - \edef\qz@chksymb{#1}\fi} + \ifx\eq@retnStyle\@empty + \edef\qz@chksymb{\qChoiceSymbDef}\else + \edef\qz@chksymb{#1}\fi} \def\qChoiceColor#1{\edef\eq@arg{#1}\ifx\eq@arg\@empty - \edef\qz@chksymbcol{\qChoiceColorDef}\else - \edef\qz@chksymbcol{#1}\fi} + \edef\qz@chksymbcol{\qChoiceColorDef}\else + \edef\qz@chksymbcol{#1}\fi} \def\qChoiceSymbDef{check} \def\qChoiceColorDef{0 0 0 rg} \edef\qz@chksymb{\qChoiceSymbDef} @@ -6146,43 +6225,44 @@ if (isEndQuizPushed("@eqBaseName")){ %</package> %<*package|eqexam> \let\rbf@Opts\@empty -\def\Ans@sq@f{% - \if\eq@listType\eq@One\stepcounter{quizno}\else - \@ifundefined{ifwithinsoldoc}{\refstepcounter{quizno}} - {\ifwithinsoldoc\stepcounter{quizno}\else - \refstepcounter{quizno}\fi}\fi\PBS\raggedright +\def\Ans@sq@f{\if\eq@listType\eq@One + \stepcounter{quizno}\else + \@ifundefined{ifwithinsoldoc}{\refstepcounter{quizno}} + {\ifwithinsoldoc\stepcounter{quizno}\else + \refstepcounter{quizno}\fi}\fi + \PBS\raggedright %</package|eqexam> % \end{macrocode} %\changes{v6.7d}{2013/05/27}{added \cs{rbf@Opts} to hardwire choices.} % \begin{macrocode} %<*package> - \if\Ans@choice\eq@One - \def\rbf@Opts{\symbolchoice{\sq@corrsymch}% - \textColor{\sq@corrsymcol}}\else - \def\rbf@Opts{\symbolchoice{\sq@wrgsymch}% - \textColor{\sq@wrgsymcol}}\fi + \if\Ans@choice\eq@One + \def\rbf@Opts{\symbolchoice{\sq@corrsymch}% + \textColor{\sq@corrsymcol}}\else + \def\rbf@Opts{\symbolchoice{\sq@wrgsymch}% + \textColor{\sq@wrgsymcol}}\fi %</package> %<*package|eqexam> - \settowidth{\eq@tmplength}{\eq@lw@f}% - \eq@tmpdima=\wd\eq@tmpbox% - \hangindent=\eq@tmplength\hangafter=1\relax - \insertGrayLetters % 6.3d + \settowidth{\eq@tmplength}{\eq@lw@f}% + \eq@tmpdima=\wd\eq@tmpbox% + \hangindent=\eq@tmplength\hangafter=1\relax + \insertGrayLetters %</package|eqexam> %<*eqexam> - \Ans@sq@f@driver + \Ans@sq@f@driver %</eqexam> %<*package> - \mbox{\expandafter\radio@@Button\expandafter{\rbf@Opts}% - {mc.\oField.\thequestionno}% - {\RadioFieldSize}{\RadioFieldSize}% - {\Ans@choice\alph{quizno}}{\eq@protect\A}% - {\eq@setWidgetProps\eq@Radio@driver}% - {\@@Ans@sq@f@Defaults\Ans@sq@f@Actions\every@RadioButton - \every@sqRadioButton}}% - \Ans@proofing{\RadioFieldSize}% + \mbox{\expandafter\radio@@Button\expandafter{\rbf@Opts}% + {mc.\oField.\thequestionno}% + {\RadioFieldSize}{\RadioFieldSize}% + {\Ans@choice\alph{quizno}}{\eq@protect\A}% + {\eq@setWidgetProps\eq@Radio@driver}% + {\@@Ans@sq@f@Defaults\Ans@sq@f@Actions\every@RadioButton + \every@sqRadioButton}}% + \Ans@proofing{\RadioFieldSize}% %</package> %<*package|eqexam> -\eq@hspanner\ignorespaces} + \eq@hspanner\ignorespaces} %</package|eqexam> %<*package> % \end{macrocode} @@ -6194,87 +6274,108 @@ if (isEndQuizPushed("@eqBaseName")){ % %</package> %<*eqexam> -% dps 4/16/05 \let\Ans@ck@sq@f\Ans@sq@f %</eqexam> %<*package> -\def\@@Ans@ck@sq@f@Defaults -{% - \BC{0 0 0}\Ff{\FfNoToggleToOff} - \F{\FPrint}\textSize{12}\textColor{0 g}\W{1} +\def\@@Ans@ck@sq@f@Defaults{% + \BC{0 0 0}\Ff{\FfNoToggleToOff} + \F{\FPrint}\textSize{12}\textColor{0 g}\W{1} } \begingroup \catcode`\&=12 \gdef\eq@AND{&&} \endgroup -\def\Ans@ck@sq@f@ActionsTrue{% - var fName=event.target.name;\jsR - var g=this.getField("mc.\oField.\thequestionno");\jsR - var a=g.getArray();\jsR - for (var i=0; i<a.length; i++)\jsR\jsT - if ( a[i].isBoxChecked(0) \eq@AND\space - a[i].value.charAt(0)==0)\jsR\jsT\jsT - a[i].checkThisBox(0,false);\jsR - \if\@sqTurnOffAlerts1OnBlurRespBox(% - true,"\oField");\jsR\fi - \ifx\@qzsolndest\@empty\else - \ifeq@solutionsafter\else - % if all correct answers are check, jump to solution - for (var i=0; i<a.length; i++){\jsR\jsT - if ( a[i].exportValues[0].charAt(0)==1 \eq@AND\space - !a[i].isBoxChecked(0))\jsR\jsT\jsT - break;\jsR - }\jsR - if (i>=a.length) jmpToNamedDest("\oField","\@qzsolndest",% - \if\@sqTurnOffAlerts00\else1\fi); - \fi - \fi\eqAddAAMouseUpMS} -\def\Ans@ck@sq@f@ActionsFalse{% - var fName=event.target.name;\jsR - var g=this.getField("mc.\oField.\thequestionno");\jsR - var a=g.getArray();\jsR - for (var i=0; i<a.length; i++)\jsR - {\jsR\jsT - if (a[i].value.charAt(0)==0) {\jsR\jsT\jsT - if ( fName != a[i].name )\jsR\jsT\jsT\jsT - a[i].checkThisBox(0,false);\jsR\jsT - }\jsR - }\jsR - \if\@sqTurnOffAlerts1OnBlurRespBox( false, "\oField" );\fi - \ifx\oField\@empty\else - updateTally("\oField.\thequestionno"); - \fi\eqAddAAMouseUpMS} +% \end{macrocode} +% Mouse up action for a \emph{correct answer box} (a checkbox) to MS question of short-quiz +% (field name: \texttt{mc.\ameta{fld-name}.\ameta{ques-num}}.\ameta{choice-num}) +% \begin{macrocode} +\begin{defineJS}[\makeesc\*\makecmt\%]{\Ans@ck@sq@f@ActionsTrue} +var fName=event.target.name; +var g=this.getField("mc.*oField.*thequestionno"); +var a=g.getArray(); +for (var i=0; i<a.length; i++) + if ( (a[i].isBoxChecked(0)) && % +(a[i].value.charAt(0)==0) ) + a[i].checkThisBox(0,false);% +*ifx*@sqTurnOffAlerts*eq@One% +OnBlurRespBox(true,"*oField"); +*fi% +var qzSolnDest="*@qzsolndest"; +var solnAfter=*ifeq@solutionsafter% +true*else% +false*fi; +if ( (qzSolnDest != "") && !solnAfter ) { + for (var i=0; i<a.length; i++){ + if ((a[i].exportValues[0].charAt(0)==1) && % +(!a[i].isBoxChecked(0))) break; + } +} +if (i>=a.length) jmpToNamedDest("*oField","*@qzsolndest",% +*ifx*@sqTurnOffAlerts*eq@Zero0*else1*fi);% +*ifx*eqAddAAMouseUpMS*empty*else +*eqAddAAMouseUpMS*fi +\end{defineJS} +% \end{macrocode} +% Mouse up action for a \emph{incorrect answer box} (a checkbox) to MS question of short-quiz +% (field name: \texttt{mc.\ameta{fld-name}.\ameta{ques-num}}.\ameta{choice-num}) +% \begin{macrocode} +\begin{defineJS}[\makeesc\*\makecmt\%]{\Ans@ck@sq@f@ActionsFalse} +var fName=event.target.name; +var g=this.getField("mc.*oField.*thequestionno"); +var a=g.getArray(); +for (var i=0; i<a.length; i++) { + if (a[i].value.charAt(0)==0) { + if ( fName != a[i].name ) + a[i].checkThisBox(0,false); + } +}% +*ifx*@sqTurnOffAlerts*eq@One% +OnBlurRespBox(false,"*oField"); +*fi% +*ifx*oField*@empty*else +updateTally("*oField.*thequestionno");*fi% +*ifx*eqAddAAMouseUpMS*empty*else +*eqAddAAMouseUpMS*fi +\end{defineJS} +% \end{macrocode} +% Set all actions for check box for a MS question of a short-quiz +% (field name: \texttt{mc.\ameta{fld-name}.\ameta{ques-num}}.\ameta{choice-num}) +% \begin{macrocode} \def\Ans@ck@sq@f@Actions{% - \A{\if\Ans@choice\eq@One - \JS{\Ans@ck@sq@f@ActionsTrue}\else - \JS{\Ans@ck@sq@f@ActionsFalse}\fi}% + \AAmouseup{\if\Ans@choice\eq@One + \Ans@ck@sq@f@ActionsTrue\else + \Ans@ck@sq@f@ActionsFalse\fi} \AAmousedown{updateTally.downState=!!event.target.isBoxChecked(0);}} -\def\Ans@ck@sq@f{% - \if\eq@listType\eq@One\stepcounter{quizno}\else - \@ifundefined{ifwithinsoldoc}{\refstepcounter{quizno}} - {\ifwithinsoldoc\stepcounter{quizno}\else - \refstepcounter{quizno}\fi}\fi\PBS\raggedright - \if\Ans@choice1% - \def\rbf@Opts{\symbolchoice{\sq@corrsymch}% - \textColor{\sq@corrsymcol}}\else - \def\rbf@Opts{\symbolchoice{\sq@wrgsymch}% - \textColor{\sq@wrgsymcol}}\fi - \settowidth{\eq@tmplength}{\eq@lw@f}% - \eq@tmpdima=\wd\eq@tmpbox% - \hangindent=\eq@tmplength\hangafter=1\relax - \insertGrayLetters % 6.3d - \mbox{\expandafter\check@@Box\expandafter{\rbf@Opts}% - {mc.\oField.\thequestionno.\arabic{quizno}}% - {\RadioFieldSize}{\RadioFieldSize} - {\Ans@choice\alph{quizno}}{\eq@protect\A}% - {\eq@setWidgetProps\eq@Check@driver}% - {\@@Ans@ck@sq@f@Defaults\Ans@ck@sq@f@Actions\every@CheckBox - \every@sqCheckBox}}% - \Ans@proofing{\RadioFieldSize}% -\eq@hspanner\ignorespaces} % \end{macrocode} -% \end{macro} -% \subsection{For \texttt{quiz}} +% The check boxes to a MS question in an \env{manswers} environment of a short-quiz; the name of this field +% |mc.\oField.\thequestionno.\arabic{quizno}|. +% \begin{macrocode} +\def\Ans@ck@sq@f{\if\eq@listType\eq@One + \stepcounter{quizno}\else + \@ifundefined{ifwithinsoldoc}{\refstepcounter{quizno}} + {\ifwithinsoldoc\stepcounter{quizno}\else + \refstepcounter{quizno}\fi}\fi\PBS\raggedright + \if\Ans@choice\eq@One + \def\rbf@Opts{\symbolchoice{\sq@corrsymch}% + \textColor{\sq@corrsymcol}}\else + \def\rbf@Opts{\symbolchoice{\sq@wrgsymch}% + \textColor{\sq@wrgsymcol}}\fi + \settowidth{\eq@tmplength}{\eq@lw@f}\eq@tmpdima\wd\eq@tmpbox + \hangindent\eq@tmplength\hangafter\@ne % dps + \insertGrayLetters % 6.3d + \mbox{\expandafter\check@@Box\expandafter{\rbf@Opts}% + {mc.\oField.\thequestionno.\arabic{quizno}}% + {\RadioFieldSize}{\RadioFieldSize} + {\Ans@choice\alph{quizno}}{\eq@protect\A}% + {\eq@setWidgetProps\eq@Check@driver}% + {\@@Ans@ck@sq@f@Defaults\Ans@ck@sq@f@Actions\every@CheckBox + \every@sqCheckBox}}% + \Ans@proofing{\RadioFieldSize}% + \eq@hspanner\ignorespaces +} +% \end{macrocode} +% \end{macro} +% \subsection{For the \texttt{quiz} environment} % \subsubsection{The \texttt{answers} and \texttt{manswers} Environment} % \begin{macro}{answers} % This is the answers environment for the \texttt{quiz} @@ -6304,51 +6405,51 @@ if (isEndQuizPushed("@eqBaseName")){ \newif\ifeqshowOutOf \eqshowOutOffalse \def\showOutOfinSmryTbl{false} \def\eq@recordThesePTs{% - \ifx\pointValuesArray\@empty - \edef\ptsValue{\showOutOfinSmryTbl,\eqPTs}\else - \edef\ptsValue{,\eqPTs}\fi - \expandafter\g@addto@macro\expandafter\pointValuesArray - \expandafter{\ptsValue}} + \ifx\pointValuesArray\@empty + \edef\ptsValue{\showOutOfinSmryTbl,\eqPTs}\else + \edef\ptsValue{,\eqPTs}\fi + \expandafter\g@addto@macro\expandafter\pointValuesArray + \expandafter{\ptsValue}} % \end{macrocode} % \changes{v7.7m}{2016/07/04}{Added \string\texttt{ptypeArray} to track problem types better} % \begin{macrocode} \let\ptypeArray\@empty \def\eq@recordProbType{% - \ifx\ptypeArray\@empty - \edef\tmp@exp{\noexpand\g@addto@macro - \noexpand\ptypeArray{null,"\eqQT"}}\else - \edef\tmp@exp{\noexpand\g@addto@macro - \noexpand\ptypeArray{,"\eqQT"}}\fi - \tmp@exp + \ifx\ptypeArray\@empty + \edef\tmp@exp{\noexpand\g@addto@macro + \noexpand\ptypeArray{null,"\eqQT"}}\else + \edef\tmp@exp{\noexpand\g@addto@macro + \noexpand\ptypeArray{,"\eqQT"}}\fi + \tmp@exp } \let\corrAnsArray\@empty \def\eq@recordCorrAns#1{% - \ifx\corrAnsArray\@empty - \edef\tmp@exp{\noexpand\g@addto@macro - \noexpand\corrAnsArray{null,#1}}\else - \edef\tmp@exp{\noexpand\g@addto@macro - \noexpand\corrAnsArray{,#1}}\fi - \tmp@exp + \ifx\corrAnsArray\@empty + \edef\tmp@exp{\noexpand\g@addto@macro + \noexpand\corrAnsArray{null,#1}}\else + \edef\tmp@exp{\noexpand\g@addto@macro + \noexpand\corrAnsArray{,#1}}\fi + \tmp@exp } \def\aeb@answerType@r{r} \def\aeb@answerType@c{c} \newcommand\answers@q{% - \eq@AddProbToQzQuesList - \def\aeb@answerType{r}\setdefault@Ans\eq@recordThesePTs - \eq@recordProbType - \addtocounter{eqpointvalue}{\eqPTs}\stepcounter{questionno}% - \def\aeb@thisType{"mc"}\@ifnextchar[{\answers@@q}% - {\@ifstar{\answers@@q[\curr@quiz.\thequestionno]}{\answers@@q[]}}% + \eq@AddProbToQzQuesList + \def\aeb@answerType{r}\setdefault@Ans\eq@recordThesePTs + \eq@recordProbType + \addtocounter{eqpointvalue}{\eqPTs}\stepcounter{questionno}% + \def\aeb@thisType{"mc"}\@ifnextchar[{\answers@@q}% + {\@ifstar{\answers@@q[\curr@quiz.\thequestionno]}{\answers@@q[]}}% } \def\answers@@q[#1]#2{\global\let\eq@ansChoiceArray\@empty - \xdef\aeb@numCols{#2}\edef\eqtmp{\aPointType}% - \xdef\aPointType{\eqtmp,[\eqPTs,\aeb@thisType]}% - \ifx\q@hwdest\@empty - \xdef\@qzsolndest{#1}\else - \gdef\@qzsolndest{\q@hwdest}\fi - \ifnum\aeb@numCols=1 - \gdef\eq@listType{1}\expandafter\answers@q@list\else - \gdef\eq@listType{0}\expandafter\answers@q@tabular\fi{\aeb@numCols}% + \xdef\aeb@numCols{#2}\edef\eqtmp{\aPointType}% + \xdef\aPointType{\eqtmp,[\eqPTs,\aeb@thisType]}% + \ifx\q@hwdest\@empty + \xdef\@qzsolndest{#1}\else + \gdef\@qzsolndest{\q@hwdest}\fi + \ifnum\aeb@numCols=1 + \gdef\eq@listType{1}\expandafter\answers@q@list\else + \gdef\eq@listType{0}\expandafter\answers@q@tabular\fi{\aeb@numCols}% } % \end{macrocode} % \end{macro} @@ -6372,59 +6473,58 @@ if (isEndQuizPushed("@eqBaseName")){ % #2 = number of columns in the tabular environment %\end{verbatim} % \begin{macrocode} -\newcommand\manswers@q -{% - \eq@AddProbToQzQuesList - \def\aeb@answerType{c}\@setFormLinkType - \global\expandafter\let\expandafter\@Ans - \expandafter=\csname Ans@ck@\@@quiztype\endcsname - \eq@recordThesePTs\eq@recordProbType - \addtocounter{eqpointvalue}{\eqPTs}\stepcounter{questionno}% - \def\aeb@thisType{"ms"}\@ifnextchar[{\answers@@q}% - {\@ifstar{\answers@@q[\curr@quiz.\thequestionno]}{\answers@@q[]}}% +\newcommand\manswers@q{% + \eq@AddProbToQzQuesList + \def\aeb@answerType{c}\@setFormLinkType + \global\expandafter\let\expandafter\@Ans + \expandafter=\csname Ans@ck@\@@quiztype\endcsname + \eq@recordThesePTs\eq@recordProbType + \addtocounter{eqpointvalue}{\eqPTs}\stepcounter{questionno}% + \def\aeb@thisType{"ms"}\@ifnextchar[{\answers@@q}% + {\@ifstar{\answers@@q[\curr@quiz.\thequestionno]}{\answers@@q[]}}% } % \end{macrocode} % \end{macro} % \begin{macrocode} \newenvironment{answers@q@list}[1]{% - \ifx\aeb@answerType\eq@r - \let\endanswers\endanswers@q@list\else - \let\endmanswers\endanswers@q@list\fi - \list{\strut\@Ans}{% - \if\qstar*\relax - \if\aeb@FLOverride\eq@l - \settowidth{\labelwidth}{\eq@lw@l}\else - \settowidth{\labelwidth}{\eq@lw@f}\fi - \else - \if\aeb@FLOverride\eq@f - \settowidth{\labelwidth}{\eq@lw@f}\else - \settowidth{\labelwidth}{\eq@lw@l}\fi - \fi - \setlength{\topsep}{-\parskip+\aboveanswersSkip}% - \setlength{\parsep}{0pt}\setlength{\itemindent}{0pt}% - \setlength{\listparindent}{\parindent}% - \setlength{\leftmargin}{\labelwidth}% - \setlength{\labelsep}{0pt}% - \def\Ans{\Ans@list}% - }% + \ifx\aeb@answerType\eq@r + \let\endanswers\endanswers@q@list\else + \let\endmanswers\endanswers@q@list\fi + \list{\strut\@Ans}{% + \if\qstar*\relax + \if\aeb@FLOverride\eq@l + \settowidth{\labelwidth}{\eq@lw@l}\else + \settowidth{\labelwidth}{\eq@lw@f}\fi + \else + \if\aeb@FLOverride\eq@f + \settowidth{\labelwidth}{\eq@lw@f}\else + \settowidth{\labelwidth}{\eq@lw@l}\fi + \fi + \setlength{\topsep}{-\parskip+\aboveanswersSkip}% + \setlength{\parsep}{0pt}\setlength{\itemindent}{0pt}% + \setlength{\listparindent}{\parindent}% + \setlength{\leftmargin}{\labelwidth}% + \setlength{\labelsep}{0pt}% + \def\Ans{\Ans@list}% + }% }{\endlist\setcounter{quizno}{0}% - \eq@answersEndHook - \setdefault@Ans - \ifx\aeb@answerType\aeb@answerType@r + \eq@answersEndHook + \setdefault@Ans + \ifx\aeb@answerType\aeb@answerType@r % \end{macrocode} % If this is a MC question, we record the author's correct answer % \begin{macrocode} - \eq@recordCorrAns{\eq@ansChoiceArray}\ifwithinMCFI + \eq@recordCorrAns{\eq@ansChoiceArray}\ifwithinMCFI % \end{macrocode} % If within a \cs{bMCFI}/\cs{eMCFI} command pair, we also record % the author's correct answer. % \begin{macrocode} - \eq@recordCorrAns{\s@veCorrAnsMCFI}\fi\else + \eq@recordCorrAns{\s@veCorrAnsMCFI}\fi\else % \end{macrocode} % If this is a MS question, we record the author's correct answer as an array % \begin{macrocode} - \eq@recordCorrAns{[\eq@ansChoiceArray]}\fi - \global\let\eqlimselTo\@empty + \eq@recordCorrAns{[\eq@ansChoiceArray]}\fi + \global\let\eqlimselTo\@empty } % \end{macrocode} % \begin{macrocode} @@ -6433,52 +6533,50 @@ if (isEndQuizPushed("@eqBaseName")){ \qztabsep{1.5pt} \def\qzTabPos#1{\def\qz@TabPos{[#1]}}\qzTabPos{} \def\answers@q@tabular#1{% - \ifinner\else\par\removelastparskip\vspace{\aboveanswersSkip}\fi - \eq@tmpdima=\linewidth - \@tempcnta#1\relax + \ifinner\else\par\removelastparskip\vspace{\aboveanswersSkip}\fi + \eq@tmpdima=\linewidth + \@tempcnta#1\relax % n-1 - \advance\@tempcnta-1\relax + \advance\@tempcnta\m@ne % 2(n-1) - \multiply\@tempcnta by2 - \@tempdima\qz@tabsep\relax + \multiply\@tempcnta\tw@ + \@tempdima\qz@tabsep\relax % 2*(n-1)*\qz@tabsep - \multiply\@tempdima\@tempcnta + \multiply\@tempdima\@tempcnta % \linewidth-(n-1)*\qz@tabsep - \advance\eq@tmpdima-\@tempdima + \advance\eq@tmpdima-\@tempdima % (\linewidth-(n-1)*\qz@tabsep)/n - \divide\eq@tmpdima by#1 -% \begin{macrocode} - \tabcolsep\qz@tabsep\relax - \def\Ans{\Ans@tabular}% - \ifx\aeb@answerType\eq@r - \let\endanswers\endanswers@q@tabular\else - \let\endmanswers\endanswers@q@tabular\fi - \noindent\expandafter - \tabular\qz@TabPos{@{}*{#1}{p{\eq@tmpdima}}@{}}% + \divide\eq@tmpdima by#1 + \tabcolsep\qz@tabsep\relax + \def\Ans{\Ans@tabular}% + \ifx\aeb@answerType\eq@r + \let\endanswers\endanswers@q@tabular\else + \let\endmanswers\endanswers@q@tabular\fi + \noindent\expandafter + \tabular\qz@TabPos{@{}*{#1}{p{\eq@tmpdima}}@{}}% } % \end{macrocode} % \begin{macro}{\endanswers} % Again, we put \verb+\let\endanswers=\endanswers@q+. % \begin{macrocode} -\def\endanswers@q@tabular -{% - \endtabular\setcounter{quizno}{0}% - \eq@answersEndHook - \setdefault@Ans - \ifx\aeb@answerType\aeb@answerType@r +\def\endanswers@q@tabular{% + \endtabular\setcounter{quizno}{0}% + \eq@answersEndHook + \setdefault@Ans + \ifx\aeb@answerType\aeb@answerType@r % \end{macrocode} % If this is a MC question, we record the author's correct answer % \begin{macrocode} - \eq@recordCorrAns{\eq@ansChoiceArray}\ifwithinMCFI + \eq@recordCorrAns{\eq@ansChoiceArray}\ifwithinMCFI % \end{macrocode} % If within the MCFI command pair, we record the author's fill-in as well. % \begin{macrocode} - \eq@recordCorrAns{\s@veCorrAnsMCFI}\fi\else + \eq@recordCorrAns{\s@veCorrAnsMCFI}\fi\else % \end{macrocode} % If this is a MS question, we record the author's correct answer as an array % \begin{macrocode} - \eq@recordCorrAns{[\eq@ansChoiceArray]}\fi - \global\let\eqlimselTo\@empty + \eq@recordCorrAns{[\eq@ansChoiceArray]}\fi + \global\let\eqlimselTo\@empty } % \end{macrocode} % \end{macro} @@ -6489,75 +6587,73 @@ if (isEndQuizPushed("@eqBaseName")){ % \begin{macrocode} \let\qRadionActionsHook\@empty \def\Ans@@l@Actions{\A{\JS{% - this.getField("mc.\curr@quiz.\thequestionno").value - = "\Ans@choice\alph{quizno}";\jsR + this.getField("mc.\curr@quiz.\thequestionno").value\eqSP + =\eqSP"\Ans@choice\alph{quizno}";\jsR RecordPointValue([0,\eqPTs,\eq@pPTs],\thequestionno);\jsR RecordProblemType("\eqQT",\thequestionno);\jsR ProcessQuestion(\Ans@choice,"\alph{quizno}",\thequestionno,% -\arabic{quizno},"\curr@quiz",0,\ifnocorrections0\else1\fi,% -"\bqlabelISO"\if\eqQuizType\isQZ\ifx\eq@online\eq@YES -\ifeq@noquizsolutions\else,1\fi\fi\fi);\qRadionActionsHook}}% + \arabic{quizno},"\curr@quiz",0,\ifnocorrections0\else1\fi,% + "\bqlabelISO"\if\eqQuizType\isQZ\ifx\eq@online\eq@YES + \ifeq@noquizsolutions\else,1\fi\fi\fi);\qRadionActionsHook}}% } -\def\Ans@r@l@Defaults -{% - \BC{}\S{S}\W{1}\Ff{\FfNoToggleToOff}\F{\FPrint} - \textSize{12}\textColor{0 g}\Ff{\FfReadOnly} +\def\Ans@r@l@Defaults{% + \BC{}\S{S}\W{1}\Ff{\FfNoToggleToOff}\F{\FPrint} + \textSize{12}\textColor{0 g}\Ff{\FfReadOnly} } \def\Ans@l{\leavevmode\if\eq@listType1\stepcounter{quizno}% - \else\refstepcounter{quizno}\fi\PBS\raggedright - \settowidth{\eq@tmplength}{\eq@lw@l}\sbox{\eq@tmpbox}{\eq@l@l}% - \hangindent=\eq@tmplength\hangafter=1\relax - \eq@tmpdima=\wd\eq@tmpbox - \def\link@@Content{(\hfil\linkContentFormat\hfil)}% -% begin dps changes 12/19/03 -% \end{macrocode} -% (2013/10/24) Imperative that radio button has no boundary line. -% \begin{macrocode} - \def\late@options{\BC{}}% -\if\Ans@choice1\relax\eq@recordAnsChoice\fi - \makebox[0pt][l]{\radio@@Button{}{mc.\curr@quiz.\thequestionno}% - {\eq@tmpdima}{\RadioFieldSize}{\Ans@choice\alph{quizno}}% - {\eq@protect\A}{\eq@setWidgetProps\eq@l@check@driver}% - {\Ans@r@l@Defaults\every@RadioButton - \every@qRadioButton\late@options}}% -% end dps changes 12/19/03 - \set@@Link{}{}{}% + \else\refstepcounter{quizno}\fi\PBS\raggedright + \settowidth{\eq@tmplength}{\eq@lw@l}\sbox{\eq@tmpbox}{\eq@l@l}% + \hangindent=\eq@tmplength\hangafter=1\relax + \eq@tmpdima=\wd\eq@tmpbox + \def\link@@Content{(\hfil\linkContentFormat\hfil)}% +% \end{macrocode} +% (2013/10/24) Imperative that radio button have no boundary line. +% \begin{macrocode} + \def\late@options{\BC{}}% + \if\Ans@choice\eq@One\relax\eq@recordAnsChoice\fi + \makebox[0pt][l]{\radio@@Button{}{mc.\curr@quiz.\thequestionno}% + {\eq@tmpdima}{\RadioFieldSize}{\Ans@choice\alph{quizno}}% + {\eq@protect\A}{\eq@setWidgetProps\eq@l@check@driver}% + {\Ans@r@l@Defaults\every@RadioButton + \every@qRadioButton\late@options}}% + \set@@Link{}{}{}% {\makebox[\eq@tmpdima]{\color{\@linkcolor}\link@@Content}}% {\eq@protect\A}{\eq@setWidgetProps\setLink@driver}% {\set@LinkTextDefaults\Ans@@l@Actions\every@Link}% - \ifnocorrections\else - \if\Ans@choice1\relax - \edef\Ans@c@l@Choice{\noexpand\DV{Yes}% - \ifx\@qzsolndest\@empty - \noexpand\Ff{\FfReadOnly}% - \else % there is a solution - \ifeq@noquizsolutions - \noexpand\Ff{\FfReadOnly}% - \else - \noexpand\A{\noexpand\quiz@SolutionActionHook}% - \fi - \fi - }% - \else - \def\Ans@c@l@Choice{\Ff{\FfReadOnly}\BC{}}% - \fi - \def\late@options{\BC{}}% - \if\Ans@choice1\relax - \ifx\@qzsolndest\@empty\else - \ifeq@noquizsolutions\else - \edef\late@options{\noexpand\BC{\solution@Color}}% - \fi - \fi + \ifnocorrections\else + \if\Ans@choice\eq@One + \edef\Ans@c@l@Choice{\noexpand\DV{Yes}% + \ifx\@qzsolndest\@empty + \noexpand\Ff{\FfReadOnly}% + \else % there is a solution + \ifeq@noquizsolutions\noexpand + \Ff{\FfReadOnly}% + \else\noexpand + \A{\noexpand\quiz@SolutionActionHook}% + \fi + \fi + }% + \else + \def\Ans@c@l@Choice{\Ff{\FfReadOnly}\BC{}}% + \fi + \def\late@options{\BC{}}% + \if\Ans@choice\eq@One + \ifx\@qzsolndest\@empty\else + \ifeq@noquizsolutions\else + \edef\late@options{\noexpand\BC{\solution@Color}}% + \fi \fi - \makebox[0pt][r]{\check@@Box{}% - {mcq.\curr@quiz.\thequestionno.\arabic{quizno}}% - {\eq@tmpdima}{0pt}{Yes}{}% \@tempdimb - {\eq@setWidgetProps\eq@l@check@driver}% - {\Ans@c@f@Defaults\Ans@c@l@Choice\every@RadioButton - \every@qRadioButton\late@options}}% \fi - \Ans@proofing{\eq@tmpdima}% -\eq@hspanner\ignorespaces} + \makebox[0pt][r]{\check@@Box{}% + {mcq.\curr@quiz.\thequestionno.\arabic{quizno}}% + {\eq@tmpdima}{0pt}{Yes}{}% \@tempdimb + {\eq@setWidgetProps\eq@l@check@driver}% + {\Ans@c@f@Defaults\Ans@c@l@Choice\every@RadioButton + \every@qRadioButton\late@options}}% + \fi + \Ans@proofing{\eq@tmpdima}\eq@hspanner + \ignorespaces +} % \end{macrocode} % \end{macro} % Now for the code to support the \texttt{manswers} environment for link style. @@ -6566,74 +6662,75 @@ if (isEndQuizPushed("@eqBaseName")){ % a checkbox, on top of that a link (that the user interacts with) and on top another check box. % \begin{macrocode} \def\Ans@ck@@l@Actions{\A{\JS{% - var ckfName="mck.\curr@quiz.\thequestionno.\arabic{quizno}";\jsR - var ckf = this.getField(ckfName);\jsR - ckf.checkThisBox(0,!ckf.isBoxChecked(0));\jsR - var _bOK=true;\jsR -\ifx\eqlimselTo\@empty\else _bOK = LimitSelection(\eqlimselTo,% -"mck.\curr@quiz.\thequestionno","\arabic{quizno}");\jsR\fi -if (_bOK) {\jsR\jsT - var aPMSretn=ProcessMultiSelection(\Ans@choice,"\alph{quizno}",% -\thequestionno,\arabic{quizno},"\curr@quiz",\eqPTs,\eq@pPTs);\jsR\jsT - RecordProblemType("\eqQT",\thequestionno);\jsR\jsT - ProcessQuestion(aPMSretn[0],aPMSretn[1],\thequestionno,% -\arabic{quizno},"\curr@quiz",0,\ifnocorrections0\else1\fi,% -"\bqlabelISO"\if\eqQuizType\isQZ\ifx\eq@online\eq@YES -\ifeq@noquizsolutions\else,1\fi\fi\fi);\jsR -} - }} -} -\def\Ans@ck@l@Defaults -{% - \BC{}\S{S}\W{1}\H{N}\Ff{\FfNoToggleToOff} - \textSize{12}\textColor{0 g}\Ff{\FfReadOnly} + var\eqSP ckfName="mck.\curr@quiz.\thequestionno.\arabic{quizno}";\jsR + var\eqSP ckf = this.getField(ckfName);\jsR + ckf.checkThisBox(0,!ckf.isBoxChecked(0));\jsR + var\eqSP _bOK=true;\jsR +\ifx\eqlimselTo\@empty\else + _bOK=LimitSelection(\eqlimselTo,% + "mck.\curr@quiz.\thequestionno","\arabic{quizno}");\jsR +\fi + if(_bOK)\eqSP{\jsR\jsT + var\eqSP aPMSretn=ProcessMultiSelection(\Ans@choice,"\alph{quizno}",% + \thequestionno,\arabic{quizno},"\curr@quiz",% + \eqPTs,\eq@pPTs);\jsR\jsT + RecordProblemType("\eqQT",\thequestionno);\jsR\jsT + ProcessQuestion(aPMSretn[0],aPMSretn[1],\thequestionno,% + \arabic{quizno},"\curr@quiz",0,\ifnocorrections0\else1\fi,% + "\bqlabelISO"\if\eqQuizType\isQZ\ifx\eq@online\eq@YES + \ifeq@noquizsolutions\else,1\fi\fi\fi);\jsR + }}}% } -\def\Ans@ck@l{% - \leavevmode\if\eq@listType1\stepcounter{quizno}% - \else\refstepcounter{quizno}\fi - \if\Ans@choice1\eq@recordAnsChoice\fi\PBS\raggedright - \settowidth{\eq@tmplength}{\eq@lw@l}\sbox{\eq@tmpbox}{\eq@l@l}% - \hangindent=\eq@tmplength\hangafter=1\relax - \eq@tmpdima=\wd\eq@tmpbox - \def\link@@Content{(\hfil\linkContentFormat\hfil)}% -% begin dps changes 12/19/03 - \makebox[0pt][l]{% - \check@@Box{}{mck.\curr@quiz.\thequestionno.\arabic{quizno}}% - {\eq@tmpdima}{\RadioFieldSize}{\Ans@choice\alph{quizno}}% - {\eq@protect\A}{\eq@setWidgetProps\eq@l@check@driver}% - {\Ans@ck@l@Defaults\every@RadioButton - \every@qckCheckbox}}% -% end dps changes 12/19/03 - \set@@Link{}{}{}% +\def\Ans@ck@l@Defaults{% + \BC{}\S{S}\W{1}\H{N}\Ff{\FfNoToggleToOff} + \textSize{12}\textColor{0 g}\Ff{\FfReadOnly} +} +\def\Ans@ck@l{\leavevmode + \if\eq@listType1\stepcounter{quizno}% + \else\refstepcounter{quizno}\fi + \if\Ans@choice\eq@One\eq@recordAnsChoice\fi + \PBS\raggedright + \settowidth{\eq@tmplength}{\eq@lw@l}\sbox{\eq@tmpbox}{\eq@l@l}% + \hangindent\eq@tmplength\hangafter\@ne + \eq@tmpdima\wd\eq@tmpbox + \def\link@@Content{(\hfil\linkContentFormat\hfil)}% + \makebox[0pt][l]{% + \check@@Box{}{mck.\curr@quiz.\thequestionno.\arabic{quizno}}% + {\eq@tmpdima}{\RadioFieldSize}{\Ans@choice\alph{quizno}}% + {\eq@protect\A}{\eq@setWidgetProps\eq@l@check@driver}% + {\Ans@ck@l@Defaults\every@RadioButton + \every@qckCheckbox}}% + \set@@Link{}{}{}% {\makebox[\eq@tmpdima]{\color{\@linkcolor}\link@@Content}}% {\eq@protect\A}{\eq@setWidgetProps\setLink@driver}% {\set@LinkTextDefaults\Ans@ck@@l@Actions\every@Link}% - \ifnocorrections\else - \if\Ans@choice1\relax - \edef\Ans@c@l@Choice{\noexpand\DV{Yes}% - \ifx\@qzsolndest\@empty\noexpand\BC{}% - \noexpand\Ff{\FfReadOnly}% - \else % there is a solution - \ifeq@noquizsolutions - \noexpand\BC{}\noexpand\Ff{\FfReadOnly}% - \else - \noexpand\BC{\solution@Color}% - \noexpand\A{\noexpand\quiz@SolutionActionHook}% - \fi - \fi - }% - \else - \def\Ans@c@l@Choice{\Ff{\FfReadOnly}\BC{}}% + \ifnocorrections\else + \if\Ans@choice\eq@One + \edef\Ans@c@l@Choice{\noexpand\DV{Yes}% + \ifx\@qzsolndest\@empty\noexpand\BC{}% + \noexpand\Ff{\FfReadOnly}% + \else % there is a solution + \ifeq@noquizsolutions + \noexpand\BC{}\noexpand\Ff{\FfReadOnly}% + \else + \noexpand\BC{\solution@Color}% + \noexpand\A{\noexpand\quiz@SolutionActionHook}% + \fi \fi - \makebox[0pt][r]{\check@@Box{}% - {mcq.\curr@quiz.\thequestionno.\arabic{quizno}}% - {\eq@tmpdima}{0pt}{Yes}{}% - {\eq@setWidgetProps\eq@l@check@driver}% - {\Ans@c@f@Defaults\Ans@c@l@Choice\every@RadioButton - \every@qRadioButton}}% + }% + \else + \def\Ans@c@l@Choice{\Ff{\FfReadOnly}\BC{}}% \fi - \Ans@proofing{\eq@tmpdima}% -\eq@hspanner\ignorespaces} + \makebox[0pt][r]{\check@@Box{}% + {mcq.\curr@quiz.\thequestionno.\arabic{quizno}}% + {\eq@tmpdima}{0pt}{Yes}{}% + {\eq@setWidgetProps\eq@l@check@driver}% + {\Ans@c@f@Defaults\Ans@c@l@Choice\every@RadioButton + \every@qRadioButton}}% + \fi + \Ans@proofing{\eq@tmpdima}\eq@hspanner + \ignorespaces +} % \end{macrocode} % \end{macro} % \subsubsection{Form Style} @@ -6642,32 +6739,35 @@ if (_bOK) {\jsR\jsT % here, then goes to |\Ans@f@driver| the rest of the code that depends on the % driver. % \begin{macrocode} -\def\Ans@f{\leavevmode\if\eq@listType1\stepcounter{quizno}% - \else\refstepcounter{quizno}\fi - \PBS\raggedright\Ans@@f} -\def\Ans@r@f@Defaults -{% - \BC{0 0 0}\S{S}\W{1}\Ff{\FfNoToggleToOff} - \F{\FPrint}\textSize{12}\textColor{0 g} +\def\Ans@f{\leavevmode + \if\eq@listType1\stepcounter{quizno}\else + \refstepcounter{quizno}\fi + \PBS\raggedright\Ans@@f} +\def\Ans@r@f@Defaults{% + \BC{0 0 0}\S{S}\W{1}\Ff{\FfNoToggleToOff} + \F{\FPrint}\textSize{12}\textColor{0 g} } +% \end{macrocode} % Action of the radio button field +% \begin{macrocode} \def\Ans@r@f@Actions{\A{\JS{% - RecordPointValue([0,\eqPTs,\eq@pPTs],\thequestionno);\jsR - RecordProblemType("\eqQT",\thequestionno);\jsR - ProcessQuestion(\Ans@choice,"\alph{quizno}",\thequestionno,% - \arabic{quizno},"\curr@quiz",0,\ifnocorrections0\else1\fi,% - "\bqlabelISO"\if\eqQuizType\isQZ\ifx\eq@online\eq@YES - \ifeq@noquizsolutions\else,1\fi\fi\fi);\qRadionActionsHook}} + RecordPointValue([0,\eqPTs,\eq@pPTs],\thequestionno);\jsR + RecordProblemType("\eqQT",\thequestionno);\jsR + ProcessQuestion(\Ans@choice,"\alph{quizno}",\thequestionno,% + \arabic{quizno},"\curr@quiz",0,\ifnocorrections0\else1\fi,% + "\bqlabelISO"\if\eqQuizType\isQZ\ifx\eq@online\eq@YES + \ifeq@noquizsolutions\else,1\fi\fi\fi);\qRadionActionsHook}} } +% \end{macrocode} % Action of the check box underlying the radio button field +% \begin{macrocode} \def\quiz@SolutionActionHook{% - /S/GoTo/D(\@qzsolndest)/Next<<\JS{this.resetForm(% - ["mcq.\curr@quiz.\thequestionno.\arabic{quizno}"]);}>> + /S/GoTo/D(\@qzsolndest)/Next<<\JS{this.resetForm(% + ["mcq.\curr@quiz.\thequestionno.\arabic{quizno}"]);}>> } -\def\Ans@c@f@Defaults -{% - \BC{0 0 0}\S{S}\W{1}\F{\FHidden}\textSize{12} - \textColor{0 g}\symbolchoice{circle} +\def\Ans@c@f@Defaults{% + \BC{0 0 0}\S{S}\W{1}\F{\FHidden}\textSize{12} + \textColor{0 g}\symbolchoice{circle} } % \end{macrocode} % \changes{v6.05d}{2007/04/14} @@ -6687,64 +6787,60 @@ if (_bOK) {\jsR\jsT % \begin{macrocode} \providecommand\graylettersColor{gray} \def\insertGrayLetters{\ifaebshowgrayletters - \rlap{\makebox[\RadioFieldSize]% - {\textcolor{\graylettersColor}{\Alph{quizno}}}}\else\relax\fi} + \rlap{\makebox[\RadioFieldSize]% + {\textcolor{\graylettersColor}{\Alph{quizno}}}}\else\relax\fi} %</package|eqexam> %<*package> -\def\Ans@@f -{% - \settowidth{\eq@tmplength}{\eq@lw@f}% - \hangindent=\eq@tmplength\hangafter=1 - \bottomOfAnsfStack\insertGrayLetters -% dps add - \edef\rbf@Opts{\ifaeb@usecircles\else - \noexpand\symbolchoice{\qz@chksymb}\fi - \noexpand\textColor{\qz@chksymbcol}}% - \if\Ans@choice1\eq@recordAnsChoice\fi - \mbox{\expandafter\radio@@Button\expandafter{\rbf@Opts}% - {mc.\curr@quiz.\thequestionno}% - {\RadioFieldSize}{\RadioFieldSize}{\Ans@choice\alph{quizno}}% - {\eq@protect\A}{\eq@setWidgetProps\eq@Radio@driver}% - {\Ans@r@f@Defaults\Ans@r@f@Actions\every@RadioButton - \every@qRadioButton\insert@circlesymbol}}% - \let\late@options\@empty - \ifnocorrections\else - \if\Ans@choice1\relax - \edef\Ans@c@f@Choice{\noexpand\DV{Yes}% - \ifx\@qzsolndest\@empty\noexpand\Ff{\FfReadOnly}% - \else - \ifeq@noquizsolutions - \noexpand\Ff{\FfReadOnly}% - \else - \noexpand\A{\noexpand\quiz@SolutionActionHook}% - \fi - \fi - }% - \else - \def\Ans@c@f@Choice{\Ff{\FfReadOnly}}% +\def\Ans@@f{% + \settowidth{\eq@tmplength}{\eq@lw@f}% + \hangindent=\eq@tmplength\hangafter=1 + \bottomOfAnsfStack\insertGrayLetters + \edef\rbf@Opts{\ifaeb@usecircles\else + \noexpand\symbolchoice{\qz@chksymb}\fi + \noexpand\textColor{\qz@chksymbcol}}% + \if\Ans@choice\eq@One\eq@recordAnsChoice\fi + \mbox{\expandafter\radio@@Button\expandafter{\rbf@Opts}% + {mc.\curr@quiz.\thequestionno}% + {\RadioFieldSize}{\RadioFieldSize}{\Ans@choice\alph{quizno}}% + {\eq@protect\A}{\eq@setWidgetProps\eq@Radio@driver}% + {\Ans@r@f@Defaults\Ans@r@f@Actions\every@RadioButton + \every@qRadioButton\insert@circlesymbol}}% + \let\late@options\@empty + \ifnocorrections\else + \if\Ans@choice\eq@One + \edef\Ans@c@f@Choice{\noexpand\DV{Yes}% + \ifx\@qzsolndest\@empty\noexpand\Ff{\FfReadOnly}\else + \ifeq@noquizsolutions + \noexpand\Ff{\FfReadOnly}\else + \noexpand\A{\noexpand\quiz@SolutionActionHook}\fi \fi + }% + \else + \def\Ans@c@f@Choice{\Ff{\FfReadOnly}}% + \fi % \end{macrocode} % \changes{v6.7h}{2013/08/19}{When the \cs{useMCCircles} is used, the boundary % color is transparent. We try a fix for this to show the colored solution % boundary. The fix uses the \cs{late@options} commands.} % \begin{macrocode} - \ifaeb@usecircles\def\late@options{\BC{}}\fi - \if\Ans@choice1\relax - \ifx\@qzsolndest\@empty\else - \ifeq@noquizsolutions\else - \edef\late@options{\noexpand\BC{\solution@Color}}% - \fi - \fi + \ifaeb@usecircles\def\late@options{\BC{}}\fi + \if\Ans@choice\eq@One + \ifx\@qzsolndest\@empty\else + \ifeq@noquizsolutions\else + \edef\late@options{\noexpand\BC{\solution@Color}}% \fi - \makebox[0pt][r]{\check@@Box{}% - {mcq.\curr@quiz.\thequestionno.\arabic{quizno}}% - {\RadioFieldSize}{\RadioFieldSize}{Yes}{}% - {\eq@setWidgetProps\eq@Check@driver}% - {\Ans@c@f@Defaults\Ans@c@f@Choice\every@CheckBox - \every@qCheckBox\late@options}}% + \fi \fi - \Ans@proofing{\RadioFieldSize}% -\eq@hspanner\ignorespaces} + \makebox[0pt][r]{\check@@Box{}% + {mcq.\curr@quiz.\thequestionno.\arabic{quizno}}% + {\RadioFieldSize}{\RadioFieldSize}{Yes}{}% + {\eq@setWidgetProps\eq@Check@driver}% + {\Ans@c@f@Defaults\Ans@c@f@Choice\every@CheckBox + \every@qCheckBox\late@options}}% + \fi + \Ans@proofing{\RadioFieldSize}\eq@hspanner + \ignorespaces +} % \end{macrocode} % \DescribeMacro{\limitSelectionTo} limits the selection to the number specified % by its argument for multiple selection questions. @@ -6755,108 +6851,108 @@ if (_bOK) {\jsR\jsT % \begin{macro}{\Ans@ck@f} % The support for multiple selection answers within the \texttt{manswers} environment. % \begin{macrocode} -\def\Ans@ck@f{\leavevmode\if\eq@listType1\stepcounter{quizno}% - \else\refstepcounter{quizno}\fi - \if\Ans@choice1\eq@recordAnsChoice\fi - \PBS\raggedright\Ans@@ck@f} -\def\Ans@ck@f@Defaults -{% - \BC{0 0 0}\S{S}\W{1}\Ff{\FfNoToggleToOff} - \textSize{12}\textColor{0 g} +\def\Ans@ck@f{\leavevmode + \if\eq@listType1\stepcounter{quizno}% + \else\refstepcounter{quizno}\fi + \if\Ans@choice\eq@One\eq@recordAnsChoice\fi + \PBS\raggedright\Ans@@ck@f} +\def\Ans@ck@f@Defaults{% + \BC{0 0 0}\S{S}\W{1}\Ff{\FfNoToggleToOff} + \textSize{12}\textColor{0 g} } +% \end{macrocode} % Action of the radio button field -\def\Ans@ck@f@Actions -{% - \A{\JS{% +% \begin{macrocode} +\def\Ans@ck@f@Actions{% + \A{\JS{% % \end{macrocode} % Here is limit the number of selections. If \cs{eqlimselTo} is nonempty, % we call \texttt{LimitSelection()} to count the number of checks in this % current field. If too many, we uncheck the current effort and inform the % user. % \begin{macrocode} - var _bOK=true;\jsR -\ifx\eqlimselTo\@empty\else _bOK = LimitSelection(\eqlimselTo,% -"mck.\curr@quiz.\thequestionno","\arabic{quizno}");\jsR\fi + var\eqSP_bOK=true;\jsR +\ifx\eqlimselTo\@empty\else + _bOK\eqSP=\eqSP LimitSelection(\eqlimselTo,% + "mck.\curr@quiz.\thequestionno","\arabic{quizno}");\jsR\fi % \end{macrocode} % As a result of the previous changes, we make this a condition: % if the JavaScript function \texttt{LimitSelection()} returns false, we do not execute. The default % value is \texttt{\_bOK=true}. % \begin{macrocode} -if (_bOK) {\jsR\jsT - var aPMSretn=ProcessMultiSelection(\Ans@choice,"\alph{quizno}",% -\thequestionno,\arabic{quizno},"\curr@quiz",\eqPTs,\eq@pPTs);\jsR\jsT - RecordProblemType("\eqQT",\thequestionno);\jsR\jsT - ProcessQuestion(aPMSretn[0],aPMSretn[1],\thequestionno,% -\arabic{quizno},"\curr@quiz",0,\ifnocorrections0\else1\fi,% -"\bqlabelISO"\if\eqQuizType\isQZ\ifx\eq@online\eq@YES -\ifeq@noquizsolutions\else,1\fi\fi\fi);\jsR -}}}% + if(_bOK)\eqSP{\jsR\jsT + var aPMSretn=ProcessMultiSelection(\Ans@choice,"\alph{quizno}",% + \thequestionno,\arabic{quizno},"\curr@quiz",% + \eqPTs,\eq@pPTs);\jsR\jsT + RecordProblemType("\eqQT",\thequestionno);\jsR\jsT + ProcessQuestion(aPMSretn[0],aPMSretn[1],\thequestionno,% + \arabic{quizno},"\curr@quiz",0,\ifnocorrections0\else1\fi,% + "\bqlabelISO"\if\eqQuizType\isQZ\ifx\eq@online\eq@YES + \ifeq@noquizsolutions\else,1\fi\fi\fi);\jsR + }}}% } +% \end{macrocode} % Action of the check box underlying the radio button field -\def\quiz@SolutionActionHook{% - /S/GoTo/D(\@qzsolndest)/Next<<\JS{this.resetForm(% -["mcq.\curr@quiz.\thequestionno.\arabic{quizno}"]);}>> +% \begin{macrocode} +\def\quiz@SolutionActionHook{/S/GoTo/D(\@qzsolndest)% + /Next<<\JS{this.resetForm([% + "mcq.\curr@quiz.\thequestionno.\arabic{quizno}"]);}>> } % \end{macrocode} % \cs{Ans@@ck@f} is the definition of the \cs{Ans} command within the % \texttt{manswers} environment. % \begin{macrocode} -\def\Ans@@ck@f -{% - \settowidth{\eq@tmplength}{\eq@lw@f}% - \hangindent=\eq@tmplength\hangafter=1 - \bottomOfAnsfStack\insertGrayLetters +\def\Ans@@ck@f{% + \settowidth{\eq@tmplength}{\eq@lw@f}% + \hangindent\eq@tmplength\hangafter\@ne + \bottomOfAnsfStack\insertGrayLetters % \end{macrocode} % The bottom most checkbox % \begin{macrocode} - \bottomOfAnsfStack\insertGrayLetters -% dps add -\def\cbf@Opts{\symbolchoice{\qz@chksymb}% + \bottomOfAnsfStack\insertGrayLetters + \def\cbf@Opts{\symbolchoice{\qz@chksymb}% \textColor{\qz@chksymbcol}}% - \mbox{\expandafter\check@@Box\expandafter{\cbf@Opts}% - {mck.\curr@quiz.\thequestionno.\arabic{quizno}}% - {\RadioFieldSize}{\RadioFieldSize}{\Ans@choice\alph{quizno}}% - {\eq@protect\A}{\eq@setWidgetProps\eq@Check@driver}% - {\Ans@ck@f@Defaults\Ans@ck@f@Actions\every@RadioButton - \every@qckCheckbox}}% - \ifnocorrections\else - \if\Ans@choice1\relax - \edef\Ans@c@f@Choice{\noexpand\DV{Yes}% - \ifx\@qzsolndest\@empty\noexpand\Ff{\FfReadOnly}% - \else - \ifeq@noquizsolutions - \noexpand\Ff{\FfReadOnly}% - \else - \noexpand\A{\noexpand\quiz@SolutionActionHook}% - \fi - \fi - }% - \else - \def\Ans@c@f@Choice{\Ff{\FfReadOnly}}% - \fi - \let\late@options\@empty - \if\Ans@choice1\relax - \ifx\@qzsolndest\@empty\else - \ifeq@noquizsolutions\else - \edef\late@options{\noexpand\BC{\solution@Color}}% - \fi - \fi + \mbox{\expandafter\check@@Box\expandafter{\cbf@Opts}% + {mck.\curr@quiz.\thequestionno.\arabic{quizno}}% + {\RadioFieldSize}{\RadioFieldSize}{\Ans@choice\alph{quizno}}% + {\eq@protect\A}{\eq@setWidgetProps\eq@Check@driver}% + {\Ans@ck@f@Defaults\Ans@ck@f@Actions\every@RadioButton + \every@qckCheckbox}}% + \ifnocorrections\else + \if\Ans@choice\eq@One + \edef\Ans@c@f@Choice{\noexpand\DV{Yes}% + \ifx\@qzsolndest\@empty\noexpand\Ff{\FfReadOnly}\else + \ifeq@noquizsolutions + \noexpand\Ff{\FfReadOnly}\else + \noexpand\A{\noexpand\quiz@SolutionActionHook}\fi \fi + }% + \else + \def\Ans@c@f@Choice{\Ff{\FfReadOnly}}% + \fi + \let\late@options\@empty + \if\Ans@choice\eq@One + \ifx\@qzsolndest\@empty\else + \ifeq@noquizsolutions\else + \edef\late@options{\noexpand\BC{\solution@Color}}\fi + \fi + \fi % \end{macrocode} % The top most checkbox % \begin{macrocode} - \makebox[0pt][r]{\check@@Box{}% - {mcq.\curr@quiz.\thequestionno.\arabic{quizno}}% - {\RadioFieldSize}{\RadioFieldSize}{Yes}{}% - {\eq@setWidgetProps\eq@Check@driver}% - {\Ans@c@f@Defaults\Ans@c@f@Choice\every@CheckBox + \makebox[0pt][r]{\check@@Box{}% + {mcq.\curr@quiz.\thequestionno.\arabic{quizno}}% + {\RadioFieldSize}{\RadioFieldSize}{Yes}{}% + {\eq@setWidgetProps\eq@Check@driver}% + {\Ans@c@f@Defaults\Ans@c@f@Choice\every@CheckBox % \end{macrocode} % (2012/12/22) Replace \cs{every@qRadioButton} with \cs{every@qCheckBox}. % \begin{macrocode} - \every@qCheckBox\late@options}}% - \fi - \Ans@proofing{\RadioFieldSize}% -\eq@hspanner\ignorespaces} + \every@qCheckBox\late@options}}% + \fi + \Ans@proofing{\RadioFieldSize}\eq@hspanner + \ignorespaces +} % \end{macrocode} % \end{macro} % \begin{macrocode} @@ -6914,9 +7010,9 @@ if (_bOK) {\jsR\jsT % \begin{macrocode} \define@key{bchoice}{nCols}{\def\bChoiceNumCols{#1}} \@for\eqi:=1,2,3,4,5,6,7,8,9,10 \do{\edef\temp@expand@def{% - \noexpand\define@key{bchoice}{\eqi}[\eqi]{% - \noexpand\def\noexpand\bChoiceNumCols{\eqi}}% - }\temp@expand@def + \noexpand\define@key{bchoice}{\eqi}[\eqi]{% + \noexpand\def\noexpand\bChoiceNumCols{\eqi}}% + }\temp@expand@def } % \end{macrocode} % The number of columns specified in the answers environment is saved as the value @@ -6927,8 +7023,8 @@ if (_bOK) {\jsR\jsT % This is the definition of the random key\IndexKey{random}, a boolean. % \begin{macrocode} \define@key{bchoice}{random}[true]{% - \csname if#1\endcsname\eq@randomizeChoicestrue - \else\eq@randomizeChoicesfalse\fi + \csname if#1\endcsname\eq@randomizeChoicestrue + \else\eq@randomizeChoicesfalse\fi } % \end{macrocode} % \changes{v6.3x}{2011/04/05}{% @@ -6949,20 +7045,19 @@ if (_bOK) {\jsR\jsT % \end{macrocode} % If \cs{numCols} is $1$, we use a list environment, otherwise, a tabular is used. % \begin{macrocode} -\def\@ansChoices[#1]% -{% +\def\@ansChoices[#1]{% % \end{macrocode} % We initialize some variables that the new label option uses. % \begin{macrocode} - \global\let\@tempholdSaveAns\@empty %4/5 - \global\let\@tempholdSaveChoice\@empty %4/5 - \global\let\bChoiceLabel\@empty %4/5 - \setkeys{bchoice}{#1}% - \global\eq@tabColCnt=0 - \ifnum\aeb@numCols=1 % list mode - \def\eq@next{\@layoutListAns}\else % tabular mode - \def\eq@next{\@layoutTabularAns{\bChoiceNumCols}}\fi - \eq@next + \global\let\@tempholdSaveAns\@empty %4/5 + \global\let\@tempholdSaveChoice\@empty %4/5 + \global\let\bChoiceLabel\@empty %4/5 + \setkeys{bchoice}{#1}% + \global\eq@tabColCnt=\z@ + \ifnum\aeb@numCols=\@ne % list mode + \def\eq@next{\@layoutListAns}\else % tabular mode + \def\eq@next{\@layoutTabularAns{\bChoiceNumCols}}\fi + \eq@next } \let\eChoices\relax % \end{macrocode} @@ -6973,7 +7068,7 @@ if (_bOK) {\jsR\jsT % should be \cs{eChoices}.) % \begin{macrocode} \def\@layoutListAns{\@ifnextchar\Ans{\@getListAns}% - {\@lookforendansChoices{\@layoutListAns}}% + {\@lookforendansChoices{\@layoutListAns}}% } % \end{macrocode} % \changes{v6.3x}{2011/04/05}{% @@ -6989,11 +7084,11 @@ if (_bOK) {\jsR\jsT % to \cs{@@@SaveAns}; otherwise, it gobbles all leftovers. % \begin{macrocode} \newcommand{\eq@saveAns}[2][]{% - \let\eq@next\@@@SaveAnsGobbleAns - \ifx\bChoiceLabel\@empty\else - \def\eq@savedAnsOpt{#1}\def\eq@savedAnsZO{#2}% - \if\eq@savedAnsZO1 \let\eq@next\@@@SaveAns\fi - \fi\eq@next + \let\eq@next\@@@SaveAnsGobbleAns + \ifx\bChoiceLabel\@empty\else + \def\eq@savedAnsOpt{#1}\def\eq@savedAnsZO{#2}% + \if\eq@savedAnsZO1\let\eq@next\@@@SaveAns\fi + \fi\eq@next } % \end{macrocode} % \cs{@@@SaveAns} collects the answer to the problem, and placed @@ -7001,21 +7096,21 @@ if (_bOK) {\jsR\jsT % the alternative letter as well in \cs{@tempholdSaveChoice}. % \begin{macrocode} \long\def\@@@SaveAns#1\eAns{% 4/5 - \g@addto@macro\@tempholdSaveAns{\\{\ignorespaces#1}}% + \g@addto@macro\@tempholdSaveAns{\\{\ignorespaces#1}}% % \end{macrocode} % This code is expanded before the \cs{Ans} command is, so we'll simulate % incrementing the \texttt{quizno} counter, \dots % \begin{macrocode} - \addtocounter{quizno}{1}% - \edef\temp@expand{\noexpand\g@addto@macro\noexpand + \addtocounter{quizno}{1}% + \edef\temp@expand{\noexpand\g@addto@macro\noexpand \@tempholdSaveChoice{% - \noexpand\\{\ifx\sqstar\@empty\aebChoiceAltFmt\else - \ifaebshowgrayletters\Alph{quizno}\else - \linkContentFormat\fi\fi}}}\temp@expand + \noexpand\\{\ifx\sqstar\@empty\aebChoiceAltFmt\else + \ifaebshowgrayletters\Alph{quizno}\else + \linkContentFormat\fi\fi}}}\temp@expand % \end{macrocode} % and decrement when we are finished adding to the token list. % \begin{macrocode} - \addtocounter{quizno}{-1}% + \addtocounter{quizno}{-1}% } % \end{macrocode} % \cs{eq@displayAns} is \cs{let} to \verb!\\!. Definition and name may change. @@ -7035,29 +7130,30 @@ if (_bOK) {\jsR\jsT \def\oxfordCommaOn{\oxfordcommatrue} \def\oxfordCommaOff{\oxfordcommafalse} \def\eq@insertComma{% - \ifx\eq@comma\@empty - \ifnum\@nameuse{NumAns\eq@namearg}>2\relax - \def\eq@comma{,}\fi - \else\ifx\eq@insertAnd\@empty\eq@comma\space - \else\ifnum\@tempcnta=\@nameuse{NumAns\eq@namearg}% - \ifoxfordcomma\eq@comma\fi\else\eq@comma\fi\space - \fi + \ifx\eq@comma\@empty + \ifnum\@nameuse{NumAns\eq@namearg}>\tw@ + \def\eq@comma{,}\fi + \else\ifx\eq@insertAnd\@empty\eq@comma\space + \else\ifnum\@tempcnta=\@nameuse{NumAns\eq@namearg}% + \ifoxfordcomma\eq@comma\fi\else\eq@comma\fi\space \fi + \fi } \newcommand\eqAnd{and}\def\eq@insertAnd{% - \ifnum\@nameuse{NumAns\eq@namearg}<2\relax\else - \ifnum\@nameuse{NumAns\eq@namearg}>2\relax - \else\leavevmode\space\fi\eqAnd\space\fi} -\long\def\eq@displayAns#1{\advance\@tempcnta1\relax - \eq@insertComma - \ifnum\@tempcnta=\@nameuse{NumAns\eq@namearg}\eq@insertAnd\fi#1} + \ifnum\@nameuse{NumAns\eq@namearg}<\tw@\else + \ifnum\@nameuse{NumAns\eq@namearg}>\tw@\relax + \else\leavevmode\space\fi\eqAnd\space\fi +} +\long\def\eq@displayAns#1{\advance\@tempcnta\@ne + \eq@insertComma + \ifnum\@tempcnta=\@nameuse{NumAns\eq@namearg}\eq@insertAnd\fi#1} \def\eq@displayAlts#1{\advance\@tempcnta1 - \eq@insertComma - \ifnum\@tempcnta=\@nameuse{NumAns\eq@namearg}\eq@insertAnd\fi - \savedAltFmt{#1}} + \eq@insertComma + \ifnum\@tempcnta=\@nameuse{NumAns\eq@namearg}\eq@insertAnd\fi + \savedAltFmt{#1}} \def\eq@displayAltsAns#1{\advance\@tempcnta1\relax - \eq@insertComma - \ifnum\@tempcnta=\@nameuse{NumAns\eq@namearg}\eq@insertAnd\fi#1} + \eq@insertComma + \ifnum\@tempcnta=\@nameuse{NumAns\eq@namearg}\eq@insertAnd\fi#1} % \end{macrocode} % \begin{macro}{\useSavedAns} % \begin{macro}{\useSavedAlts} @@ -7073,35 +7169,35 @@ if (_bOK) {\jsR\jsT % \begin{macrocode} \newcommand{\savedAltFmt}[1]{(#1)} \newcommand{\useSavedAns}{\bgroup\@ifstar{\useSavedAns@i} - {\let\eq@insertAnd\@empty\useSavedAns@i}} + {\let\eq@insertAnd\@empty\useSavedAns@i}} \newcommand{\useSavedAns@i}[2][]{\@tempcnta=0\relax - \def\eq@namearg{#2}\let\label\@gobble - \def\eq@argi{#1}\ifx\eq@argi\@empty - \let\eq@comma\@empty - \let\\\eq@displayAns\@nameuse{SavedAns#2}\else - \@nameuse{SavedAns#2-Idx#1}\fi - \egroup + \def\eq@namearg{#2}\let\label\@gobble + \def\eq@argi{#1}\ifx\eq@argi\@empty + \let\eq@comma\@empty + \let\\\eq@displayAns\@nameuse{SavedAns#2}\else + \@nameuse{SavedAns#2-Idx#1}\fi + \egroup } \newcommand{\useSavedAlts}{\bgroup\@ifstar{\useSavedAlts@i} - {\let\eq@insertAnd\@empty\useSavedAlts@i}} + {\let\eq@insertAnd\@empty\useSavedAlts@i}} \newcommand{\useSavedAlts@i}[2][]{\@tempcnta=0\relax - \def\eq@namearg{#2}\@nameuse{caseFor#2}% - \def\eq@argi{#1}\ifx\eq@argi\@empty - \let\eq@comma\@empty - \let\\\eq@displayAlts\@nameuse{SavedAlts#2}\else - \savedAltFmt{\@nameuse{SavedAlts#2-Idx#1}}\fi - \egroup + \def\eq@namearg{#2}\@nameuse{caseFor#2}% + \def\eq@argi{#1}\ifx\eq@argi\@empty + \let\eq@comma\@empty + \let\\\eq@displayAlts\@nameuse{SavedAlts#2}\else + \savedAltFmt{\@nameuse{SavedAlts#2-Idx#1}}\fi + \egroup } \newcommand{\useSavedAltsAns}{\bgroup\@ifstar{\useSavedAltsAns@i} - {\let\eq@insertAnd\@empty\useSavedAltsAns@i}} + {\let\eq@insertAnd\@empty\useSavedAltsAns@i}} \newcommand{\useSavedAltsAns@i}[2][]{\@tempcnta=0\relax - \def\eq@namearg{#2}\@nameuse{caseFor#2}\let\label\@gobble - \def\eq@argi{#1}\ifx\eq@argi\@empty - \let\eq@comma\@empty - \let\\\eq@displayAltsAns\@nameuse{SavedAltsAns#2}\else - \savedAltFmt{\@nameuse{SavedAlts#2-Idx#1}} - \@nameuse{SavedAns#2-Idx#1}\fi - \egroup + \def\eq@namearg{#2}\@nameuse{caseFor#2}\let\label\@gobble + \def\eq@argi{#1}\ifx\eq@argi\@empty + \let\eq@comma\@empty + \let\\\eq@displayAltsAns\@nameuse{SavedAltsAns#2}\else + \savedAltFmt{\@nameuse{SavedAlts#2-Idx#1}} + \@nameuse{SavedAns#2-Idx#1}\fi + \egroup } \newcommand{\useSavedNumAns}[1]{\@nameuse{NumAns#1}} % \end{macrocode} @@ -7110,21 +7206,21 @@ if (_bOK) {\jsR\jsT % \end{macro} % \end{macro} % \begin{macrocode} -\long\def\@@@SaveAnsGobbleAns#1\eAns{} % 4/5 +\long\def\@@@SaveAnsGobbleAns#1\eAns{} % \end{macrocode} % This command gets, and sets the list of alternatives % \begin{macrocode} -\long\def\@getListAns\Ans#1\eAns{%\@@par %start new paragraph +\long\def\@getListAns\Ans#1\eAns{%\@@par % \end{macrocode} % We record the list as we process each item. % \begin{macrocode} - \eq@saveAns#1\eAns % 4/5 - \Ans#1\vspace{\@rowskip}% - \@layoutListAns + \eq@saveAns#1\eAns + \Ans#1\vspace{\@rowskip}% + \@layoutListAns } \long\def\@lookforendansChoices#1{% - \@ifnextchar\eChoices{\rowsep{\rowsep@default}% - \expandafter\@findendans\@gobble}{\expandafter#1\@gobble}% + \@ifnextchar\eChoices{\rowsep{\rowsep@default}% + \expandafter\@findendans\@gobble}{\expandafter#1\@gobble}% } % \end{macrocode} % The argument is the number of columns to typeset, this number @@ -7132,10 +7228,10 @@ if (_bOK) {\jsR\jsT % environment. % \begin{macrocode} \def\@layoutTabularAns#1{% - \let\eq@tabSep\@empty - \xdef\numShortCols{#1}% - \ifnum#1>\aeb@numCols \xdef\numShortCols{\aeb@numCols}\fi - \@@layoutTabularAns + \let\eq@tabSep\@empty + \xdef\numShortCols{#1}% + \ifnum#1>\aeb@numCols \xdef\numShortCols{\aeb@numCols}\fi + \@@layoutTabularAns } % \end{macrocode} % If the next token is \cs{Ans} we grab its all stuff between @@ -7145,98 +7241,99 @@ if (_bOK) {\jsR\jsT % should be \cs{eChoices}.) % \begin{macrocode} \def\@@layoutTabularAns{% - \@ifnextchar\Ans{\@getTabAns}% - {\@lookforendansChoices{\@@layoutTabularAns}}% + \@ifnextchar\Ans{\@getTabAns}% + {\@lookforendansChoices{\@@layoutTabularAns}}% } \def\rowsep#1{\gdef\@rowsep{[#1]}\gdef\@rowskip{#1}}% \rowsep{\rowsep@default} \def\rowsepDefault#1{\def\rowsep@default{#1}} \def\rowsep@default{0pt} \long\def\@getTabAns\Ans#1\eAns{% - \eq@saveAns#1\eAns - \global\advance\eq@tabColCnt1 - \let\@save@tabSep=\eq@tabSep - \ifnum\eq@tabColCnt=\numShortCols - \global\eq@tabColCnt=0 - \xdef\eq@tabSep{\noexpand\\\noalign{\kern\@rowskip\relax}}% - \else - \gdef\eq@tabSep{&}% - \fi - \@ifnextchar\eChoices{\@save@tabSep\Ans#1\rowsep{\rowsep@default} - \expandafter\@findendans\@gobble}% - {\@save@tabSep\Ans#1\@@layoutTabularAns}% + \eq@saveAns#1\eAns + \global\advance\eq@tabColCnt1 + \let\@save@tabSep=\eq@tabSep + \ifnum\eq@tabColCnt=\numShortCols + \global\eq@tabColCnt=0 + \xdef\eq@tabSep{\noexpand\\\noalign{\kern\@rowskip\relax}}% + \else + \gdef\eq@tabSep{&}% + \fi + \@ifnextchar\eChoices{\@save@tabSep\Ans#1\rowsep{\rowsep@default} + \expandafter\@findendans\@gobble}% + {\@save@tabSep\Ans#1\@@layoutTabularAns}% } % \end{macrocode} % This command, I think, is executed after we've found the \cs{eChoices}. % \begin{macrocode} -\def\@findendans{\@ifnextchar\end{% 4/5 +\def\@findendans{\@ifnextchar\end{% % \end{macrocode} % If there is a \cs{bChoiceLabel} we process the alternatives. % \begin{macrocode} - \ifx\bChoiceLabel\@empty\else - \processLabeledAns\fi - }{\expandafter\@findendans\@gobble}}% + \ifx\bChoiceLabel\@empty\else + \processLabeledAns\fi + }{\expandafter\@findendans\@gobble}}% % \end{macrocode} % The command that processes the alternatives. % \changes{v6.7g}{2013/08/09}{Changed \texttt{\#1} to \cs{the}\cs{@temptokena} Fixing % a nasty bug. Reported by Christopher C.} % \begin{macrocode} \def\defineEachAns#1{\advance\eqtmpcnta\@ne - \@temptokena={#1}\csarg\xdef - {SavedAns\bChoiceLabel-Idx\the\eqtmpcnta}{\the\@temptokena}% - \ifsolutionsonly\else - {\let\\\relax\eq@IWDefs{\string - \csarg\string\gdef{SavedAns\bChoiceLabel-Idx\the\eqtmpcnta}% - {\the\@temptokena}}}\fi + \@temptokena={#1}\csarg\xdef + {SavedAns\bChoiceLabel-Idx\the\eqtmpcnta}{\the\@temptokena}% + \ifsolutionsonly\else + {\let\\\relax\eq@IWDefs{\string + \csarg\string\gdef{SavedAns\bChoiceLabel-Idx\the\eqtmpcnta}% + {\the\@temptokena}}}% + \fi } \def\defineEachChoice#1{\advance\eqtmpcnta\@ne - \@temptokena={#1}\csarg\xdef - {SavedAlts\bChoiceLabel-Idx\the\eqtmpcnta}% - {\the\@temptokena}\ifsolutionsonly\else - {\let\\\relax\eq@IWDefs{\string - \csarg\string - \gdef{SavedAlts\bChoiceLabel-Idx\the\eqtmpcnta}% - {\the\@temptokena}}}\fi + \@temptokena={#1}\csarg\xdef + {SavedAlts\bChoiceLabel-Idx\the\eqtmpcnta}% + {\the\@temptokena}\ifsolutionsonly\else + {\let\\\relax\eq@IWDefs{\string + \csarg\string + \gdef{SavedAlts\bChoiceLabel-Idx\the\eqtmpcnta}% + {\the\@temptokena}}}\fi } \def\processLabeledAns{% - \bgroup - \let\label\@gobble + \bgroup + \let\label\@gobble % \end{macrocode} % \changes{v7.7c}{2015/10/08}{Added memory for the case} % \begin{macrocode} -\if\aeb@FLOverride\eq@l - \global\@namedef{caseFor\bChoiceLabel}{\graylettersOff}\else - \ifaebshowgrayletters + \if\aeb@FLOverride\eq@l + \global\@namedef{caseFor\bChoiceLabel}{\graylettersOff}\else + \ifaebshowgrayletters \global\@namedef{caseFor\bChoiceLabel}{\graylettersOn}\else \global\@namedef{caseFor\bChoiceLabel}{\graylettersOff}\fi -\fi - \toks@=\expandafter{\@tempholdSaveAns}\csarg - \xdef{SavedAns\bChoiceLabel}{\the\toks@}% - \ifsolutionsonly\else{\let\\\relax\eq@IWDefs{\string - \csarg\string\gdef{SavedAns\bChoiceLabel}{\the\toks@}}}\fi - \eqtmpcnta\z@\let\\\defineEachAns\the\toks@ - \xdef\@currNCntAns{\the\eqtmpcnta}\csarg - \xdef{NumAns\bChoiceLabel}{\@currNCntAns}% - \ifsolutionsonly\else{\eq@IWDefs{\string - \csarg\string\gdef{NumAns\bChoiceLabel}{\the\eqtmpcnta}}}\fi - \toks@=\expandafter{\@tempholdSaveChoice}\csarg - \xdef{SavedAlts\bChoiceLabel}{\the\toks@}% - \ifsolutionsonly\else{\let\\\relax\eq@IWDefs{\string - \csarg\string\gdef{SavedAlts\bChoiceLabel}{\the\toks@}}}\fi - \eqtmpcnta\z@\relax\let\\\defineEachChoice\the\toks@ - \eqtmpcnta\@ne\toks@={}%{\ignorespaces\@gobble}% - \loop - \edef\temp@exp{\the\toks@\noexpand\\{% - \noexpand\useSavedAlts[\the\eqtmpcnta]{\bChoiceLabel} - \noexpand\useSavedAns[\the\eqtmpcnta]{\bChoiceLabel}}}% - \toks@=\expandafter{\temp@exp}% - \ifnum\eqtmpcnta<\@currNCntAns\relax - \advance\eqtmpcnta\@ne - \repeat - \csarg\xdef{SavedAltsAns\bChoiceLabel}{\the\toks@}% - \ifsolutionsonly\else{\let\\\relax\eq@IWDefs{\string - \csarg\string\gdef{SavedAltsAns\bChoiceLabel}{\the\toks@}}}\fi - \egroup + \fi + \toks@=\expandafter{\@tempholdSaveAns}\csarg + \xdef{SavedAns\bChoiceLabel}{\the\toks@}% + \ifsolutionsonly\else{\let\\\relax\eq@IWDefs{\string + \csarg\string\gdef{SavedAns\bChoiceLabel}{\the\toks@}}}\fi + \eqtmpcnta\z@\let\\\defineEachAns\the\toks@ + \xdef\@currNCntAns{\the\eqtmpcnta}\csarg + \xdef{NumAns\bChoiceLabel}{\@currNCntAns}% + \ifsolutionsonly\else{\eq@IWDefs{\string + \csarg\string\gdef{NumAns\bChoiceLabel}{\the\eqtmpcnta}}}\fi + \toks@=\expandafter{\@tempholdSaveChoice}\csarg + \xdef{SavedAlts\bChoiceLabel}{\the\toks@}% + \ifsolutionsonly\else{\let\\\relax\eq@IWDefs{\string + \csarg\string\gdef{SavedAlts\bChoiceLabel}{\the\toks@}}}\fi + \eqtmpcnta\z@\relax\let\\\defineEachChoice\the\toks@ + \eqtmpcnta\@ne\toks@={}%{\ignorespaces\@gobble}% + \loop + \edef\temp@exp{\the\toks@\noexpand\\{% + \noexpand\useSavedAlts[\the\eqtmpcnta]{\bChoiceLabel} + \noexpand\useSavedAns[\the\eqtmpcnta]{\bChoiceLabel}}}% + \toks@=\expandafter{\temp@exp}% + \ifnum\eqtmpcnta<\@currNCntAns\relax + \advance\eqtmpcnta\@ne + \repeat + \csarg\xdef{SavedAltsAns\bChoiceLabel}{\the\toks@}% + \ifsolutionsonly\else{\let\\\relax\eq@IWDefs{\string + \csarg\string\gdef{SavedAltsAns\bChoiceLabel}{\the\toks@}}}\fi + \egroup } % \end{macrocode} % \end{macro} @@ -7264,7 +7361,7 @@ if (_bOK) {\jsR\jsT % We redefine \cs{nextrandom} from \texttt{random.tex} to save the initializing seed. % \begin{macrocode} \def\nextrandom{\begingroup - \ifnum\randomi<\@ne % then initialize with time + \ifnum\randomi<\@ne % then initialize with time \global\randomi\time \global\multiply\randomi388 \global\advance\randomi\year \global\multiply\randomi31 \global\advance\randomi\day @@ -7276,16 +7373,16 @@ if (_bOK) {\jsR\jsT % \changes{v6.7f}{2013/08/03}{Save the initial seed value to \cs{eqInitSeedValue}.} % \begin{macrocode} \xdef\InitSeedValue{\the\randomi}% - \fi - \count@ii\randomi - \divide\count@ii 127773 % modulus = multiplier * 127773 + 2836 - \count@\count@ii - \multiply\count@ii 127773 - \global\advance\randomi-\count@ii % random mod 127773 - \global\multiply\randomi 16807 - \multiply\count@ 2836 - \global\advance\randomi-\count@ - \ifnum\randomi<\z@ \global\advance\randomi 2147483647\relax\fi + \fi + \count@ii\randomi + \divide\count@ii 127773 % modulus = multiplier * 127773 + 2836 + \count@\count@ii + \multiply\count@ii 127773 + \global\advance\randomi-\count@ii % random mod 127773 + \global\multiply\randomi 16807 + \multiply\count@ 2836 + \global\advance\randomi-\count@ + \ifnum\randomi<\z@\global\advance\randomi 2147483647\relax\fi \endgroup } % \end{macrocode} @@ -7311,29 +7408,31 @@ if (_bOK) {\jsR\jsT % Added support for randomizing the multiple choices, requires the use of \cs{bChoices} % and \cs{eChoices}. % } -% \begin{macrocode} -\def\@ansChoices[#1]% -{% - \global\let\@tempholdSaveAns\@empty % 5/24 - \global\let\@tempholdSaveChoice\@empty % 5/24 - \global\let\bChoiceLabel\@empty % 5/24 - \ifeq@randomizeallChoices - \setkeys{bchoice}{#1,random=true}\else - \setkeys{bchoice}{#1}\fi - \global\eq@tabColCnt=0 - \ifeq@randomizeChoices\expandafter\@@bChoices - \else\expandafter\@@ansChoices\fi +% \changes{v8.6.2}{2021/01/20}{Incorporated \string\cs{if@DoNotRandomize} +% into the \string\cs{@ansChoices} macro for MC and MS questions} +% \begin{macrocode} +\def\@ansChoices[#1]{% + \global\let\@tempholdSaveAns\@empty + \global\let\@tempholdSaveChoice\@empty + \global\let\bChoiceLabel\@empty + \ifeq@randomizeallChoices + \setkeys{bchoice}{#1,random=true}\else + \setkeys{bchoice}{#1}\fi + \global\eq@tabColCnt=\z@ + \if@DoNotRandomize\eq@randomizeChoicesfalse\fi + \ifeq@randomizeChoices\expandafter\@@bChoices + \else\expandafter\@@ansChoices\fi } % \end{macrocode} % This is actually the old \cs{@ansChoices} only slightly modified. % \begin{macrocode} \def\@@ansChoices{% - \ifnum\aeb@numCols=1 % list mode - \def\eq@next{\@layoutListAns}% - \else % tabular mode - \edef\eq@next{\noexpand\@layoutTabularAns{\bChoiceNumCols}}% - \fi - \eq@next + \ifnum\aeb@numCols=\@ne % list mode + \def\eq@next{\@layoutListAns}% + \else % tabular mode + \edef\eq@next{\noexpand\@layoutTabularAns{\bChoiceNumCols}}% + \fi + \eq@next } % \end{macrocode} % The following are some registers to hold integers and tokens. @@ -7348,21 +7447,21 @@ if (_bOK) {\jsR\jsT % otherwise, we're finished. % \begin{macrocode} \def\@@bChoices{\gdef\@temphold{}\gdef\@tempholdrandom{}% - \gdef\@tempholdfreeze{}\aeb@searchfortoken{\@getAns}% + \gdef\@tempholdfreeze{}\aeb@searchfortoken{\@getAns}% } \def\aeb@searchfortoken#1{% - \@ifnextchar\Ans{\advance\aeb@numChoices1\relax#1} - {\@ifnextchar\eFreeze{\expandafter\@getFreezeAns\@gobble} - {\@ifnextchar\par{\def\@@temp{\aeb@searchfortoken{#1}}% - \expandafter\@@temp\@gobble}{\@eChoices}}}% + \@ifnextchar\Ans{\advance\aeb@numChoices1\relax#1} + {\@ifnextchar\eFreeze{\expandafter\@getFreezeAns\@gobble} + {\@ifnextchar\par{\def\@@temp{\aeb@searchfortoken{#1}}% + \expandafter\@@temp\@gobble}{\@eChoices}}}% } % \end{macrocode} % The non-frozen questions will be held in the macro \cs{@temphold}. % We keep track of the number of choices using the counter \cs{aeb@numChoices}. % \begin{macrocode} \long\def\@getAns\Ans#1\eAns{% - \g@addto@macro\@temphold{{\Ans#1\eAns}}% - \aeb@searchfortoken{\@getAns}% + \g@addto@macro\@temphold{{\Ans#1\eAns}}% + \aeb@searchfortoken{\@getAns}% } % \end{macrocode} % We've encountered \cs{eFreeze}, if the next token is \cs{Ans}, go get the @@ -7374,14 +7473,14 @@ if (_bOK) {\jsR\jsT % in the macro \cs{@tempholdfreeze}. % \begin{macrocode} \long\def\@@getFreezeAns\Ans#1\eAns{% - \g@addto@macro\@tempholdfreeze{\Ans#1\eAns}% - \aeb@searchfortoken{\@@getFreezeAns}% + \g@addto@macro\@tempholdfreeze{\Ans#1\eAns}% + \aeb@searchfortoken{\@@getFreezeAns}% } % \end{macrocode} % When we are finished finding all the choices, we come here to randomize the choices. % \begin{macrocode} \long\def\@eChoices#1\eChoices{% - \aeb@randomizeChoices{\the\aeb@numChoices}% + \aeb@randomizeChoices{\the\aeb@numChoices}% } % \end{macrocode} % The routine that randomizes the choices. Basically, we use \texttt{random.tex} to get @@ -7391,46 +7490,46 @@ if (_bOK) {\jsR\jsT % here \cs{aeb@hold} is used as a scratch token register. % \begin{macrocode} \def\aeb@randomizeChoices#1{% - \setrannum{\aeb@ranChoice}{1}{#1} - \eqtmpcnta\z@\aeb@hold=\expandafter{\@temphold}\def\@temphold{}% - \expandafter\@tfor\expandafter - \@temp\expandafter:\expandafter=\the\aeb@hold \do {% - \advance\eqtmpcnta\@ne - \ifnum\eqtmpcnta=\aeb@ranChoice\relax - \aeb@hold=\expandafter\expandafter\expandafter - {\expandafter\@tempholdrandom\@temp}% - \edef\@tempholdrandom{\the\aeb@hold}% - \else - \aeb@hold=\expandafter\expandafter\expandafter - {\expandafter\@temphold\expandafter{\@temp}}% - \edef\@temphold{\the\aeb@hold}% - \fi - }% + \setrannum{\aeb@ranChoice}{1}{#1} + \eqtmpcnta\z@\aeb@hold=\expandafter{\@temphold}\def\@temphold{}% + \expandafter\@tfor\expandafter + \@temp\expandafter:\expandafter=\the\aeb@hold \do {% + \advance\eqtmpcnta\@ne + \ifnum\eqtmpcnta=\aeb@ranChoice\relax + \aeb@hold=\expandafter\expandafter\expandafter + {\expandafter\@tempholdrandom\@temp}% + \edef\@tempholdrandom{\the\aeb@hold}% + \else + \aeb@hold=\expandafter\expandafter\expandafter + {\expandafter\@temphold\expandafter{\@temp}}% + \edef\@temphold{\the\aeb@hold}% + \fi + }% % \end{macrocode} % We repeat this process a total of \cs{aeb@numChoices}, the original count of the number % of choices. Once finished, we go to \cs{aeb@finishedRandomizing} to lay out the % randomized choices for typesetting. % \begin{macrocode} - \aeb@numChoices=#1 - \advance\aeb@numChoices-1 - \ifnum\aeb@numChoices=0\relax - \def\aeb@next{\aeb@finishedRandomizing}\else - \def\aeb@next{\aeb@randomizeChoices{\the\aeb@numChoices}}\fi - \aeb@next + \aeb@numChoices=#1 + \advance\aeb@numChoices\m@ne + \ifnum\aeb@numChoices=\z@ + \def\aeb@next{\aeb@finishedRandomizing}\else + \def\aeb@next{\aeb@randomizeChoices{\the\aeb@numChoices}}\fi + \aeb@next } % \end{macrocode} % This command assembles the questions held in random order in the command \cs{@tempholdrandom} and % the frozen ones held in \cs{@tempholdfreeze}, and lays out the choices for typesetting. % \begin{macrocode} \def\aeb@finishedRandomizing{% - \aeb@hold=\expandafter\expandafter\expandafter - {\expandafter\@tempholdrandom\@tempholdfreeze}% - \gdef\@temphold{}\gdef\@tempholdrandom{}\gdef\@tempholdfreeze{}% - \edef\finished@Randomizing{% - \noexpand\@@ansChoices - \the\aeb@hold - \noexpand\eChoices}% - \finished@Randomizing + \aeb@hold=\expandafter\expandafter\expandafter + {\expandafter\@tempholdrandom\@tempholdfreeze}% + \gdef\@temphold{}\gdef\@tempholdrandom{}\gdef\@tempholdfreeze{}% + \edef\finished@Randomizing{% + \noexpand\@@ansChoices + \the\aeb@hold + \noexpand\eChoices}% + \finished@Randomizing } % \end{macrocode} % \begin{macro}{\saveRandomSeed} @@ -7455,21 +7554,20 @@ if (_bOK) {\jsR\jsT % by \textsf{ran\_toks}. Now, there share a common aux file and common initial and final % seeds. % \begin{macrocode} -%\def\saveRandomSeed{\AtEndDocument{\eq@writeRandomData}} \def\saveRandomSeed{\PackageInfo{exerquiz} - {The command \string\saveRandomSeed\space - is deprecated.\MessageBreak Seed automatically saved}} + {The command \string\saveRandomSeed\space + is deprecated.\MessageBreak Seed automatically saved}} % \end{macrocode} % I \cs{let} the commands in this file to the companion commands in \textsf{ran\_toks} file. % The user can use either set of commands \cs{inputRandomSeed} or \cs{useLastSeed} as one % pair and \cs{useRandomSeed} and \cs{useThisSeed} as the other pair. % \begin{macrocode} \@ifpackageloaded{ran_toks}{% - \let\inputRandomSeed\useLastAsSeed - \let\useRandomSeed\useThisSeed + \let\inputRandomSeed\useLastAsSeed + \let\useRandomSeed\useThisSeed }{% - \def\inputRandomSeed{\eq@readRandomData}% - \def\useRandomSeed#1{\saveseedfalse\randomi=#1}% + \def\inputRandomSeed{\eq@readRandomData}% + \def\useRandomSeed#1{\saveseedfalse\randomi=#1}% } \def\InitSeedValue{\the\randomi} % dps \@ifundefined{ifsaveseed}{\newif\ifsaveseed\saveseedtrue}{} % dps @@ -7478,40 +7576,39 @@ if (_bOK) {\jsR\jsT % \end{macro} % \end{macro} % \begin{macrocode} -\def\eq@writeRandomData -{% - \ifsaveseed - \@ifundefined{saveseedinfo}{\newwrite\saveseedinfo}{} - \immediate\openout \saveseedinfo \jobname_rt.sav - \let\verbatim@out\saveseedinfo - \def\eqrt@msgi{initializing seed value}% - \def\eqrt@msgii{last random number used}% - \uccode`c=`\%\uppercase{% - \immediate\write\verbatim@out - {\InitSeedValue\space c \eqrt@msgi}% - \immediate\write\verbatim@out - {\the\randomi\space c \eqrt@msgii}% - }\immediate\closeout\saveseedinfo - \fi +\def\eq@writeRandomData{% + \ifsaveseed + \@ifundefined{saveseedinfo}{\newwrite\saveseedinfo}{} + \immediate\openout \saveseedinfo \jobname_rt.sav + \let\verbatim@out\saveseedinfo + \def\eqrt@msgi{initializing seed value}% + \def\eqrt@msgii{last random number used}% + \uccode`c=`\%\uppercase{% + \immediate\write\verbatim@out + {\InitSeedValue\space c \eqrt@msgi}% + \immediate\write\verbatim@out + {\the\randomi\space c \eqrt@msgii}% + }\immediate\closeout\saveseedinfo + \fi } \AtEndDocument{\eq@writeRandomData} % \end{macrocode} % Save the data to the file \cs{jobname\_ran.sav}. % \begin{macrocode} \def\eq@readRandomData{\IfFileExists{\jobname_rt.sav}{% - \PackageInfo{exerquiz}{Inputting \jobname_rt.sav}% - \@ifundefined{readsavfile}{\newread\readsavfile}{}% - \openin\readsavfile=\jobname_rt.sav - \read\readsavfile to \InitSeedValue - \read\readsavfile to \eqlastRandomNum - \closein\readsavfile - \randomi=\eqlastRandomNum - \xdef\InitSeedValue{\the\randomi}% - \immediate\closeout\readsavfile + \PackageInfo{exerquiz}{Inputting \jobname_rt.sav}% + \@ifundefined{readsavfile}{\newread\readsavfile}{}% + \openin\readsavfile=\jobname_rt.sav + \read\readsavfile to \InitSeedValue + \read\readsavfile to \eqlastRandomNum + \closein\readsavfile + \randomi=\eqlastRandomNum + \xdef\InitSeedValue{\the\randomi}% + \immediate\closeout\readsavfile }{% - \PackageInfo{exerquiz}{\jobname_rt.sav cannot - be found, \MessageBreak - using the random initializer}% + \PackageInfo{exerquiz}{\jobname_rt.sav cannot + be found, \MessageBreak + using the random initializer}% }} % \end{macrocode} % \begin{macrocode} @@ -7551,27 +7648,27 @@ if (_bOK) {\jsR\jsT %} % \begin{macrocode} \def\REF{\@ifstar{\let\isREFstar\eq@One\aeb@REFstar} - {\let\isREFstar\eq@Zero\aeb@REF}} + {\let\isREFstar\eq@Zero\aeb@REF}} \def\aeb@REFstar#1{\@ifundefined{r@#1}{\hbox{\reset@font\bfseries ??}} - {\ifaebshowgrayletters\aeb@buildUpperCaseRef{#1}% - \else\ref*{#1}\fi}% + {\ifaebshowgrayletters\aeb@buildUpperCaseRef{#1}% + \else\ref*{#1}\fi}% } \def\aeb@REF#1{\@ifundefined{r@#1}{\hbox{\reset@font\bfseries ??}} - {\ifaebshowgrayletters\aeb@buildUpperCaseRef{#1}% - \else\ref{#1}\fi}% + {\ifaebshowgrayletters\aeb@buildUpperCaseRef{#1}% + \else\ref{#1}\fi}% } %</package|eqexam> %<*eqexam> \def\aeb@buildUpperCaseRef#1{% - \xdef\tmp@expand{\aeb@exiii\@firstoftwo\csname r@#1\endcsname}% - \xdef\tmp@expand{\uppercase{\tmp@expand}}\tmp@expand + \xdef\tmp@expand{\aeb@exiii\@firstoftwo\csname r@#1\endcsname}% + \xdef\tmp@expand{\uppercase{\tmp@expand}}\tmp@expand } %</eqexam> %<*package> \def\aeb@buildUpperCaseRef#1{% - \xdef\tmp@expand{\aeb@exiii\@firstoffive\csname r@#1\endcsname}% - \xdef\tmp@expand{\uppercase{\tmp@expand}}% - \if\isREFstar\eq@One\tmp@expand\else\hyperref[#1]{\tmp@expand}\fi + \xdef\tmp@expand{\aeb@exiii\@firstoffive\csname r@#1\endcsname}% + \xdef\tmp@expand{\uppercase{\tmp@expand}}% + \if\isREFstar\eq@One\tmp@expand\else\hyperref[#1]{\tmp@expand}\fi } % \end{macrocode} % \end{macro} @@ -7600,10 +7697,10 @@ if (_bOK) {\jsR\jsT % \begin{macrocode} \let\insert@circlesymbol\@empty \def\useMCCircles{\useForms - \ifaeb@usecircles\else - \global\aeb@usecirclestrue - \gdef\insert@circlesymbol{\symbolchoice{circle}}% - \fi + \ifaeb@usecircles\else + \global\aeb@usecirclestrue + \gdef\insert@circlesymbol{\symbolchoice{circle}}% + \fi } % \end{macrocode} % \end{macro} @@ -7613,9 +7710,9 @@ if (_bOK) {\jsR\jsT % to their values prior to the last invocation of \cs{useMCCircles}. % \begin{macrocode} \def\useMCRects{\useForms - \ifaeb@usecircles\global\aeb@usecirclesfalse - \global\let\insert@circlesymbol\@empty - \fi + \ifaeb@usecircles\global\aeb@usecirclesfalse + \global\let\insert@circlesymbol\@empty + \fi } \let\useMCCRects\useMCRects % \end{macrocode} @@ -7667,26 +7764,25 @@ if (_bOK) {\jsR\jsT % question label, i.e., \texttt{2(a)(ii)}. These two lines are repeated for % the \texttt{shortquiz} and \texttt{quiz} environments. % \begin{macrocode} - \let\@currentQues\@empty - \xdef\eq@pageThisQ{\the\c@page}% - \global\let\eqQzQuesList\@empty - \xdef\oField{#1}\xdef\curr@quiz{#1}\xdef\currQuiz{#1}% - \g@addto@macro\ListOfSQuizNames{,#1}\let\@qzsolndest\@empty -% \stepcounter{questionno}% - \let\eqQuizType\isSQZ\gdef\eqPTs{1}\global\let\eqQT\eq@na - \let\answers\answers@sq - \let\endanswers\endanswers@sq - \let\manswers\manswers@sq - \let\endmanswers\endmanswers@sq - \let\solution\solution@sq - \let\endsolution\endsolution@sq - \noindent\oqpriorhook\sq@IDTxtField\ifx\aebTitleQuiz\@empty - \else\aebtitleQuiz\fi\ignorespaces + \let\@currentQues\@empty + \xdef\eq@pageThisQ{\the\c@page}\global + \let\eqQzQuesList\@empty + \xdef\oField{#1}\xdef\curr@quiz{#1}\xdef\currQuiz{#1}% + \g@addto@macro\ListOfSQuizNames{,#1}\let\@qzsolndest\@empty + \let\eqQuizType\isSQZ\gdef\eqPTs{1}\global\let\eqQT\eq@na + \let\answers\answers@sq + \let\endanswers\endanswers@sq + \let\manswers\manswers@sq + \let\endmanswers\endmanswers@sq + \let\solution\solution@sq + \let\endsolution\endsolution@sq + \noindent\oqpriorhook\sq@IDTxtField\ifx\aebTitleQuiz\@empty + \else\aebtitleQuiz\fi\ignorespaces }{% - \global\let\aebtitleQuiz\@empty - \global\let\aebTitleQuiz\@empty - \global\let\eq@tq@star\relax - \aftergroup\ignorespaces + \global\let\aebtitleQuiz\@empty + \global\let\aebTitleQuiz\@empty + \global\let\eq@tq@star\relax + \aftergroup\ignorespaces } \def\oSolution#1{\edef\@qzsolndest{#1}} % \end{macrocode} @@ -7833,11 +7929,11 @@ if (_bOK) {\jsR\jsT % \begin{macrocode} \def\eq@rpl#1#2{_rplVarsBy('#1','#2')@} % dps17 % \end{macrocode} -% A variation on the objective style math problem, is to initially populate the response box with an +% \textbf{Correcting an incorrect entry.} A variation on the objective style math problem is to initially populate the response box with an % incorrect answer and ask the student to correct it. (Good for future teachers.) The problem type set % straightforward when multi-variables are not used, just specify the \cs{V} and \cs{DV} keys in the -% optional argument of \cs{RespBoxMath}. When multi-variables are used, we have to precede the question -% with \DescribeMacro{\setInitAltAppr}\cs{setInitAltAppr}. There are two variations, the first is for +% optional argument of \cs{RespBoxMath}. When multi-variables are used, we enclose the question +% with \DescribeMacro{\bInitAltAppr}\cs{bInitAltAppr}/\allowbreak\DescribeMacro{\eInitAltAppr}\cs{eInitAltAppr}. There are two variations, the first is for % a non-\app{dvips/Distiller} workflow (document JavaScript are embedded at the creation of the PDF; % the second variation is with Distiller, where the document JavaScript is embedded with \app{Acrobat} % after the creation of the PDF. In the latter case, the JavaScript functions used below (\texttt{processMathVars}, @@ -7845,13 +7941,17 @@ if (_bOK) {\jsR\jsT % opened in \app{Acrobat}. As a result, an exception is thrown. When the exception is thrown, % \texttt{app.setTimeOut} gives a delay and the field is reset after 25 milliseconds, this causes % the \emph{initial} alternate appearance to appear, if that is desired. -% \changes{v8.1a}{2017/09/03}{Add \string\cs{setInitAltAppr} for setting the initial alternate appearance} +% \changes{v8.1a}{2017/09/03}{Added \string\cs{bInitAltAppr}/\string\allowbreak\string\cs{eInitAltAppr} +% command pair for setting the initial alternate appearance} +% \begin{macrocode} +\ifnum\eq@drivernum=\z@ + \def\RorRT{\r\t}\else\def\RorRT{\r}\fi +% \end{macrocode} +% The following commands are in support of the \cs{bInitAltAppr}/\allowbreak\cs{eInitAltAppr} command pair. % \begin{macrocode} -\ifnum\eq@drivernum=0\def\RorRT{\r\t}\else\def\RorRT{\r}\fi \def\toAltApprCnt{0}\def\toAltApprVar{_toAltAppr\toAltApprCnt} \def\toAltApprCntInc{{\@tempcnta=\toAltApprCnt\relax - \advance\@tempcnta1\relax - \xdef\toAltApprCnt{\the\@tempcnta}}} + \advance\@tempcnta\@ne\xdef\toAltApprCnt{\the\@tempcnta}}} \def\setCoreInitAltAppr{% var\eqSP_substVars=\indepVars;\RorRT var\eqSP_mathVars=processMathVars(_substVars);\RorRT @@ -7859,10 +7959,18 @@ if (_bOK) {\jsR\jsT event.value=RespBoxAppr(event);\RorRT getSubstValue.aSubsts=[];% } +% \end{macrocode} +% \leavevmode\DescribeMacro{\bInitAltAppr}\DescribeMacro{\eInitAltAppr} This command pair +% are used to set the initial value of a \cs{RespBoxMath} field. +% See the {Acro\negthinspace\TeX} article \url{http://www.acrotex.net/blog/?p=1335} +% for a discussion of the use of \cs{bInitAltAppr}/\allowbreak +% \cs{bInitAltAppr}. +% An alternate method is to use \cs{formatInitAltApprs} directly +% \begin{macrocode} \def\bInitAltAppr{\ifShowAppr \def\ShowApprSAVE{true}\toAltApprCntInc\ShowApprfalse - \def\eqAddAAFormat{\ifnum\eq@drivernum=0try\eqLBr\RorRT\fi - \setCoreInitAltAppr\ifnum\eq@drivernum=0 \r\eqRBr catch(e){\RorRT + \def\eqAddAAFormat{\ifnum\eq@drivernum=\z@ try\eqLBr\RorRT\fi + \setCoreInitAltAppr\ifnum\eq@drivernum=\z@\r\eqRBr catch(e){\RorRT var\eqSP\toAltApprVar=% app.setTimeOut('this.resetForm("'+event.target.name+'");% app.clearTimeOut(\toAltApprVar);',250);\r}\fi}\else @@ -7875,61 +7983,85 @@ if (_bOK) {\jsR\jsT % \changes{v6.4c}{2011/07/01}{\cs{RespBoxMath} now records its lists of % independent variables under the global variable \texttt{\_mathVars}.} % \begin{macrocode} -\def\AAKqRespBoxMath{% +\begin{defineJS}[\makeesc\*\makecmt\%]{\AAKqRespBoxMath} % \end{macrocode} % \cs{AAKqRespBoxMath} is the default keystroke action script for \cs{RespBoxMath} % \begin{macrocode} - if(event.willCommit){\r\t - RecordPointValue(\eqPTs,\thequestionno\ifx\grpquestions1,% -\thegrpquestionno,\grpPointValue,\grpTotalWeight,% -"\grpEvalFunction"\fi);\r\t - RecordProblemType("\eqQT",\thequestionno);\r\t +if(event.willCommit){ + RecordPointValue(*eqPTs,*thequestionno*ifx*grpquestions*eq@One,% +*thegrpquestionno,*grpPointValue,*grpTotalWeight,% +"*grpEvalFunction"*fi); + RecordProblemType("*eqQT",*thequestionno); % \end{macrocode} % If there are substitute variables, \cs{ifSubstVars} is true, and the script below % are the lines developed in support of multi-letter variables. % \begin{macrocode} -\ifSubstVars % dps17 - var\eqSP_substVars=\indepVars;\r\t - var\eqSP_mathVars=processMathVars(_substVars);\r\t - var\eqSP_substValue=getSubstValue(_substVars,event.value);\r\t - var\eqSP_substAns=getSubstValue(_substVars,"\eqCorrectAns");\r\t - var\eqSP retn=\processJSfunc(\rbArgs,% - \compareJSfunc,_substValue);\r\t -\else - var\eqSP_mathVars=\indepVars;\r\t - var\eqSP retn=\processJSfunc(\rbArgs,\compareJSfunc);\r\t -\fi - ProcUserResp(retn,event.value,\thequestionno,% -0\ifx\grpquestions1,\thegrpquestionno\fi);\r - }\r - if (!isQuizInitialized("\currQuiz")) {\r\t - \eqObjAlert eqAppAlert(InitMsg("\bqlabelISO"),3);\r\t - event.rc = false;\r - } +*ifSubstVars% + var _substVars=*indepVars; + var _mathVars=processMathVars(_substVars); + var _substValue=getSubstValue(_substVars,event.value); + var _substAns=getSubstValue(_substVars,"*eqCorrectAns"); + var retn=*processJSfunc(*rbArgs,% + *compareJSfunc,_substValue);*else% + var _mathVars=*indepVars; + var retn=*processJSfunc(*rbArgs,*compareJSfunc);*fi + ProcUserResp(retn,event.value,*thequestionno,0% +*ifx*grpquestions*eq@One,*thegrpquestionno*fi); +} +if (!isQuizInitialized("*currQuiz")) { + *eqObjAlert*eqAppAlert(InitMsg("*bqlabelISO"),3); + event.rc = false;% +*ifx*eqAddAAKeystroke*@empty*else +*eqAddAAKeystroke*fi } -\def\RespBoxMathDefaults -{% - \BC{0 0 0}\S{S}\textColor{0 g}\F{\FPrint}\W{1} +\end{defineJS} +\def\RespBoxMathDefaults{% + \BC{0 0 0}\S{S}\textColor{0 g}\F{\FPrint}\W{1} } -\def\moreRespBoxMathDefaults -{% - \edef\@moreRespBoxMathDefaults{% - \if\eqQuizType\isQZ\ifx\eq@online\eq@YES - \ifeq@noquizsolutions - \else\noexpand\Ff{\FfReadOnly}\fi\fi\fi - }% +\def\moreRespBoxMathDefaults{% + \edef\@moreRespBoxMathDefaults{% + \if\eqQuizType\isQZ\ifx\eq@online\eq@YES + \ifeq@noquizsolutions + \else\noexpand\Ff{\FfReadOnly}\fi\fi\fi + }% } \let\eqAddAAFormat\@empty % \end{macrocode} % \DescribeMacro{\eqSP}\cs{eqSP} is a space character to keep \textsf{dvips} from breaking lines at space. % \begin{macrocode} -\def\eqSP{\string\040} % dps17 +\def\eqSP{\string\040} \def\eqLBr{\string\173} \def\eqRBr{\string\175} +% \end{macrocode} +% Keystroke action for \cs{RespBoxMath}. +% \begin{macrocode} +\begin{defineJS}[\makeesc\!\makecmt\%]{\rbmAAKey} +if(event.willCommit) { +!ifSubstVars% +% \end{macrocode} +% If there are multi-letter variables (\cs{SubstVarstrue}), we insert the code developed. +% \begin{macrocode} + var _substVars=!indepVars; + var _mathVars=processMathVars(_substVars); + var _substValue=getSubstValue(_substVars,event.value); + var _substAns=getSubstValue(_substVars,"!eqCorrectAns"); + var retn=!processJSfunc(!rbArgs,% +!compareJSfunc,_substValue);!else% + var _mathVars=!indepVars; + var retn=!processJSfunc(!rbArgs,!compareJSfunc);!fi% +!ifx!@sqTurnOffAlerts!eq@One + OnBlurRespBox(retn,"!curr@quiz");!fi% +!ifx!eqAddAAKeystroke!@empty!else +!eqAddAAKeystroke!fi +} +\end{defineJS} +% \end{macrocode} +% The actions of \cs{RespBoxMath} +% \begin{macrocode} \def\@@RespBoxMathActions{% \AA{\if\eqQuizType\isQZ - \AAKeystroke{\AAKqRespBoxMath\eqAddAAKeystroke} - \AAFormat{\ifShowAppr\ifSubstVars\ifarrowDelim % dps17 + \AAKeystroke{\AAKqRespBoxMath} + \AAFormat{\ifShowAppr\ifSubstVars\ifarrowDelim % \end{macrocode} % The \texttt{RespBoxApp()} JavaScript function replaces the multi-letter variable (\texttt{alpha}, for example) % with its appearance (|\\u03B1|, eg). @@ -7937,31 +8069,8 @@ if (_bOK) {\jsR\jsT try{event.value=RespBoxAppr(event);}catch(e){}\r \fi\fi\fi\eqAddAAFormat} \else - \AAKeystroke{if(event.willCommit) {\r\t -\ifSubstVars% -% \end{macrocode} -% If there are multi-letter variables (\cs{SubstVarstrue}), we insert the code developed. -% \begin{macrocode} - var\eqSP_substVars=\indepVars;\r\t - var\eqSP_mathVars=processMathVars(_substVars);\r\t - var\eqSP_substValue=getSubstValue(_substVars,event.value);\r\t - var\eqSP_substAns=getSubstValue(_substVars,"\eqCorrectAns");\r\t - var\eqSP retn=\processJSfunc(\rbArgs,% - \compareJSfunc,_substValue);\r\t -\else - var\eqSP_mathVars=\indepVars;\r\t - var\eqSP retn=\processJSfunc(\rbArgs,\compareJSfunc); -\fi -\if\@sqTurnOffAlerts1% - OnBlurRespBox(retn,"\curr@quiz"); -\fi -% \end{macrocode} -% Moved \cs{eqAAKeystrokArg} from the conditional to the position below. -% \changes{v7.8i}{2017/07/21}{Moved \string\cs{eqAAKeystrokArg}} -% \begin{macrocode} - \eqAddAAKeystroke\r - }} - \AAFormat{\ifShowAppr\ifSubstVars\ifarrowDelim % dps17 + \AAKeystroke{\rbmAAKey} + \AAFormat{\ifShowAppr\ifSubstVars\ifarrowDelim try{event.value=RespBoxAppr(event);}catch(e){}\r\fi\fi\fi \eqAddAAFormat}% \AAOnFocus{\JS{var retn = null;}}% @@ -8052,13 +8161,13 @@ if (_bOK) {\jsR\jsT \def\defaultRDPrecision#1{\def\eq@defaultRDPrecision{#1}} \defaultRDPrecision{1E-14} % \end{macrocode} -% dps/change 02/23/07 Here we try to implement a suggest of Bruce Wagner. If the tolerance +% dps/change 02/23/07 Here we try to implement a suggestion of Bruce Wagner. If the tolerance % is set to zero, then use \texttt{reldiffCompare} as the default compare, and set the tolerance % to some small value. Here, the small value is the value of the command % \cs{eq@defaultRDPrecision} which can be set by \cs{defaultRDPrecision}. The default definition % is \verb!\defaultRDPrecision{1E-14}!. % \begin{macrocode} -\newif\ifarrowDelim\arrowDelimfalse % dps17 +\newif\ifarrowDelim\arrowDelimfalse % \end{macrocode} % The problem is to detect when \cs{indepVars} contains the arrow notation (\verb~->~), this signals % that the appearance of the user's response is to be replaced by another appearance. The command @@ -8198,32 +8307,40 @@ if (_bOK) {\jsR\jsT % \cs{RespBoxMath} continues here % \begin{macrocode} \def\@eq@RespB@x#1(#2)[#3]#4#5#6{\xdef\@qzsolndest{#3}% dps17 - \gdef\indepVars{"#2"}\isFrstrpl#2\@nil\if\frstIsrpl\eq@YES - \def\@IVi{#2}\else\expandafter\def\expandafter - \@IVi\expandafter{#2}\fi\edef\@IVii{#2}\ifx\@IVi\@IVii + \gdef\indepVars{"#2"}\isFrstrpl#2\@nil + \if\frstIsrpl\eq@YES + \def\@IVi{#2}\else\expandafter\def\expandafter + \@IVi\expandafter{#2}\fi + \edef\@IVii{#2}% + \ifx\@IVi\@IVii % \end{macrocode} % If \cs{indepVars} (\texttt{\#2}) does not contain \cs{rpl}, the two versions % of \cs{@IVi} and \cs{@IVii} should compare favorably. If they differ, the difference % is due to the presence of \cs{rpl}. % \begin{macrocode} - \global\SubstVarsfalse\else\global\SubstVarstrue - \isAltApprSpec{#2}\fi + \global\SubstVarsfalse + \else + \global\SubstVarstrue + \isAltApprSpec{#2}% + \fi % \end{macrocode} % \textbf{Counting number of variables.} We count the number of independent variables. % \begin{macrocode} - \cntVars{#2}\def\eq@precision{#5}% - \ifx\eq@precision\eq@ZERO - \def\eq@defaultCompare{reldiffCompare}% + \cntVars{#2}\def\eq@precision{#5}% + \ifx\eq@precision\eq@ZERO + \def\eq@defaultCompare{reldiffCompare}% % \end{macrocode} % (2017/01/11) Replace \texttt{\#1} by \cs{eqCorrectAns} to delay expansion % \changes{v7.8d}{2017/01/11}{Replace \string\texttt{\#1} by \string\cs{eqCorrectAns} to delay expansion} % \begin{macrocode} - \def\rbArgstmp{\rbFlag,% dps17 - \ifSubstVars_substAns\else"#1"\fi,#4,% - \eq@defaultRDPrecision}\else - \def\eq@defaultCompare{diffCompare}% - \def\rbArgstmp{\rbFlag,% dps17 - \ifSubstVars_substAns\else"#1"\fi,#4,#5}\fi + \def\rbArgstmp{\rbFlag,% + \ifSubstVars_substAns\else"#1"\fi,#4,% + \eq@defaultRDPrecision}% + \else + \def\eq@defaultCompare{diffCompare}% + \def\rbArgstmp{\rbFlag,% + \ifSubstVars_substAns\else"#1"\fi,#4,#5}% + \fi % \end{macrocode} % We have arrived at the first of possibly two parameters that define the interval(s) % from which to sample random points. There are two forms, the old style (deprecated) @@ -8232,7 +8349,7 @@ if (_bOK) {\jsR\jsT % (10/10/11) To support \cs{viidna}, we expand \texttt{\#6} first before passing it % to the command \cs{@checkforInterval}. % \begin{macrocode} - \edef\eq@ixparam{#6}\expandafter\eq@chkivIntrvls\eq@ixparam\\% + \edef\eq@ixparam{#6}\expandafter\eq@chkivIntrvls\eq@ixparam\\% } % \end{macrocode} % \DescribeMacro{\viidna} is used with the \texttt{satisfyEq} for the seventh parameter, @@ -8240,7 +8357,6 @@ if (_bOK) {\jsR\jsT % stop compilation. % \begin{macrocode} \def\viidna{[0,1]} -%\def\viidna{[]} % \end{macrocode} % If the next token is a `\texttt[', then that signals the beginning of an interval % such as \texttt{[a,b]}, must be the new style. The second parameter is not @@ -8319,10 +8435,8 @@ if (_bOK) {\jsR\jsT % \changes{v8.2}{2018/03/18}{Corrected \string\cs{eq@recordCorrAns}} % \changes{v8.2.1}{2018/03/19}{If not a math group, record this data} % \begin{macrocode} -\ifx\grpquestions\eq@Zero - \eq@recordCorrAns{"\eqCorrectAns"}% 2018/03/18 -% \eq@recordCorrAns{("\eqCorrectAns")}% 01/11 -\fi + \ifx\grpquestions\eq@Zero + \eq@recordCorrAns{"\eqCorrectAns"}\fi \ifeq@proofing\makebox[0pt][l]{\space\math@correctAnswer}\fi \eq@TextField % send to the driver-dependent macro % \end{macrocode} @@ -8394,71 +8508,74 @@ if (_bOK) {\jsR\jsT % Pick up any parameters that would modify the appearance of this text field. % \begin{macrocode} \def\RespBoxTxtOnBlur{OnBlurRespBox(% - \if\@sqTurnOffAlerts1retn\else null\fi,"\curr@quiz");} + \ifx\@sqTurnOffAlerts\eq@One + retn\else null\fi,"\curr@quiz");} +\def\eqObjAlertIfFalse{if (false) } \def\eqObjAlert{% \ifx\eqQuizType\isQZ\ifx\eq@online\eq@YES\ifeq@noquizsolutions - \else if (false) \fi\fi\fi} -\begin{defineJS}[% - \catcode`\@=0\relax\catcode`\%=14\relax]{\AAKqRespBoxTxt} + \else\eqObjAlertIfFalse\fi\fi\fi} +\def\eqAppAlert{eqAppAlert} +% \end{macrocode} +% Keystroke action for \cs{RespBoxTxt} +% \begin{macrocode} +\begin{defineJS}[\makeesc\*\makecmt\%]{\AAKqRespBoxTxt} if(event.willCommit){ - RecordPointValue(@eqPTs,@thequestionno@ifx@grpquestions1,% -@thegrpquestionno,@grpPointValue,@grpTotalWeight,% -"@grpEvalFunction"@fi); - RecordProblemType("@eqQT",@thequestionno); - var retn = ProcRespTxt(@rbTxtAlt); - ProcUserResp(retn,event.value,@thequestionno,% -0@ifx@grpquestions1,@thegrpquestionno@fi); -} -if (!isQuizInitialized("@currQuiz")) { - @eqObjAlert@space eqAppAlert(InitMsg("@bqlabelISO"),3); + RecordPointValue(*eqPTs,*thequestionno*ifx*grpquestions*eq@One,% +*thegrpquestionno,*grpPointValue,*grpTotalWeight,% +"*grpEvalFunction"*fi); + RecordProblemType("*eqQT",*thequestionno); + var retn = ProcRespTxt(*rbTxtAlt); + ProcUserResp(retn,event.value,*thequestionno,0% +*ifx*grpquestions*eq@One,*thegrpquestionno*fi); +} +if (!isQuizInitialized("!currQuiz")) { + *eqObjAlert*eqAppAlert(InitMsg("*bqlabelISO"),3); event.rc = false; } \end{defineJS} -\def\RespBoxTxtDefaults -{% +\def\RespBoxTxtDefaults{% \BC{0 0 0}\W{1}\S{S}\textColor{0 g}\F{\FPrint}% } -\def\moreRespBoxTxtDefaults -{% +\def\moreRespBoxTxtDefaults{% \edef\@moreRespBoxTxtDefaults{% \if\eqQuizType\isQZ\ifx\eq@online\eq@YES \ifeq@noquizsolutions\else \noexpand\Ff{\FfReadOnly}\fi\fi\fi }% } -\def\@@RespBoxTxtActions -{% +\begin{defineJS}[\makeesc\!\makecmt\%]{\rbtAAKey} +if(event.willCommit) { + var retn = ProcRespTxt(!rbTxtAlt);% +!ifx!@sqTurnOffAlerts!eq@One + !RespBoxTxtOnBlur!fi% +!ifx!eqAddAAKeystroke!@empty!else +!eqAddAAKeystroke!fi +} +\end{defineJS} +\def\@@RespBoxTxtActions{% \AA{\if\eqQuizType\isQZ % \end{macrocode} -% Added \cs{eqAAKeystrokArg} to \cs{@@RespBoxTxtActions} -% \changes{v7.8i}{2017/07/21}{Added \string\cs{eqAAKeystrokArg} to \string\cs{@@RespBoxTxtActions}} +% Added \cs{eqAddAAKeystroke} to \cs{@@RespBoxTxtActions} +% \changes{v7.8i}{2017/07/21}{Added \string\cs{eqAddAAKeystroke} to \string\cs{@@RespBoxTxtActions}} % \begin{macrocode} \AAKeystroke{\AAKqRespBoxTxt\eqAddAAKeystroke} \AAFormat{\eqAddAAFormat} \else - \AAKeystroke{% - if(event.willCommit) {\r\t - retn = ProcRespTxt(\rbTxtAlt);\r - \if\@sqTurnOffAlerts1 - \t\RespBoxTxtOnBlur\r\fi - \eqAddAAKeystroke\r - }% - } + \AAKeystroke{\rbtAAKey} \AAFormat{\eqAddAAFormat} - \AAOnFocus{\JS{var retn = null;}} + \AAOnFocus{\JS{var\eqSP retn=null;}} % \end{macrocode} % (2005/12/02) A fix for Acro7.0, a change in the blur event, must % move this event to keystroke so behavior is the same as in previous % versions. % \begin{macrocode} - \if\@sqTurnOffAlerts0% + \ifx\@sqTurnOffAlerts\eq@Zero \AAOnBlur{\JS{\RespBoxTxtOnBlur}}\fi \fi } } \def\annot@subtype@rbt{rbt} -\newcommand\@RespBoxTxt[1][] -{% +\newcommand\@RespBoxTxt[1][]{% \edef\annot@subtype{\annot@subtype@rbt}% \eq@AddProbToQzQuesList \ifx\grpquestions\eq@Zero\addtocounter{eqpointvalue}{\eqPTs}\fi @@ -8511,7 +8628,7 @@ if (!isQuizInitialized("@currQuiz")) { \def\eq@argi{-1}\fi\fi\fi \def\eq@argii{#2}\ifx\eq@argii\eq@ONE\else\def\eq@argii{0}\fi \begingroup - \ifnum\eq@argii=1\relax + \ifnum\eq@argii=\@ne % \end{macrocode} % local definitions: \DescribeMacro{\rexpStr}\cs{rexpStr}, % \DescribeMacro{\\<RegEXP>}|\\|, and \DescribeMacro{\word}\cs{word}. @@ -8528,37 +8645,37 @@ if (!isQuizInitialized("@currQuiz")) { #4\space instead}{Enter a positive integer.}\fi } \def\@argRead#1{\xdef\jsTempArgs{\txtAltList}% - \ifx\txtAltList\@empty\xdef\txtAltList{"#1"}\else - \xdef\txtAltList{\jsTempArgs,"#1"}\fi\@@argRead} + \ifx\txtAltList\@empty\xdef\txtAltList{"#1"}\else + \xdef\txtAltList{\jsTempArgs,"#1"}\fi\@@argRead} \def\@@argRead{\advance\eqtmpcnta\m@ne - \ifnum\eqtmpcnta=\z@ - \def\eq@next{\endgroup - \xdef\rbTxtAlt{\rbTxtAlt,\txtAltList}% - \if\grpquestions\eq@Zero - \ifwithinMCFI - \xdef\s@veCorrAnsMCFI{[\txtAltList]}\else - \eq@recordCorrAns{[\txtAltList]}\fi - \else + \ifnum\eqtmpcnta=\z@ + \def\eq@next{\endgroup + \xdef\rbTxtAlt{\rbTxtAlt,\txtAltList}% + \if\grpquestions\eq@Zero + \ifwithinMCFI + \xdef\s@veCorrAnsMCFI{[\txtAltList]}\else + \eq@recordCorrAns{[\txtAltList]}\fi + \else % \end{macrocode} % \changes{v7.8a}{2016/11/18}{Fixed a typo, \string\texttt{...AnsArrayi} should be % \string\texttt{...AnsGrpAnsArray}} % Fixed typo, changed \cs{eq@recordGrpAnsArrayi} to \cs{eq@recordGrpAnsArray}. % \begin{macrocode} - \eq@recordGrpAnsArray{[\txtAltList]}% - \fi - \eq@@RespBoxTxt - }% - \else - \def\eq@next{\@argRead}% - \fi\eq@next + \eq@recordGrpAnsArray{[\txtAltList]}% + \fi + \eq@@RespBoxTxt + }% + \else + \def\eq@next{\@argRead}% + \fi\eq@next } \def\eq@@RespBoxTxt{% - \ifeq@proofing\makebox[0pt][l]{\space\txt@correctAnswer}\fi - \eq@TextField + \ifeq@proofing\makebox[0pt][l]{\space\txt@correctAnswer}\fi + \eq@TextField % \end{macrocode} % Closing of the \cs{hbox} begun above. % \begin{macrocode} - \egroup + \egroup } % \end{macrocode} % If the \texttt{proofing} option is specified, then we type out the author's list of @@ -8566,8 +8683,8 @@ if (!isQuizInitialized("@currQuiz")) { % \begin{macrocode} \def\gobbleTxt#1>#2,#3,#4,{} \gdef\txt@correctAnswer{\ttfamily\color{\@proofingsymbolColor}% - \spaceskip=2pt\xspaceskip=2pt - \expandafter\gobbleTxt\meaning\rbTxtAlt + \spaceskip=2pt\xspaceskip=2pt + \expandafter\gobbleTxt\meaning\rbTxtAlt } % \end{macrocode} % \end{macro} @@ -8607,134 +8724,160 @@ if (!isQuizInitialized("@currQuiz")) { % that $4$ alternatives follow.) % \end{description} % \begin{macrocode} -\begin{defineJS}[% - \catcode`\@=0\relax\catcode`\%=14\relax]{\AAKqRespBoxTxtPC} +\begin{defineJS}[\makeesc\*\makecmt\%]{\AAKqRespBoxTxtPC} if(event.willCommit){ - RecordPointValue(@eqPTs,@thequestionno@ifx@grpquestions1,% -@thegrpquestionno,@grpPointValue,@grpTotalWeight,% -"@grpEvalFunction"@fi); - RecordProblemType("@eqQT",@thequestionno); - var retn = ProcRespTxtPC(@rbTxtAlt); -@ifx@grpquestions1% -ProbValue[@thequestionno][3+@thegrpquestionno]% -=ProcRespTxtPC.txtPCpCr;@else% -ProbValue[@thequestionno]=ProcRespTxtPC.txtPCpCr;@fi - ProcUserResp(retn,event.value,@thequestionno,0% -@ifx@grpquestions1,@thegrpquestionno@fi); -} -if (!isQuizInitialized("@currQuiz")) { - @eqObjAlert@space eqAppAlert(InitMsg("@bqlabelISO"),3); - event.rc = false; + RecordPointValue(*eqPTs,*thequestionno*ifx*grpquestions*eq@One,% +*thegrpquestionno,*grpPointValue,*grpTotalWeight,% +"*grpEvalFunction"*fi); + RecordProblemType("*eqQT",*thequestionno); + var retn = ProcRespTxtPC(*rbTxtAlt); +*ifx*grpquestions*eq@One% + ProbValue[*thequestionno][3+*thegrpquestionno]% +=ProcRespTxtPC.txtPCpCr;*else% + ProbValue[*thequestionno]=ProcRespTxtPC.txtPCpCr;*fi + ProcUserResp(retn,event.value,*thequestionno,0% +*ifx*grpquestions*eq@One,*thegrpquestionno*fi); +} +if (!isQuizInitialized("*currQuiz")) { + *eqObjAlert*eqAppAlert(InitMsg("*bqlabelISO"),3); + event.rc = false; } \end{defineJS} -\def\@@RespBoxTxtPCActions -{% - \AA{\if\eqQuizType\isQZ - \AAKeystroke{\AAKqRespBoxTxtPC} - \else - \AAKeystroke{% - if(event.willCommit) {\r\t - retn = ProcRespTxtPC(\rbTxtAlt);\r -\if\@sqTurnOffAlerts1% - \t\RespBoxTxtOnBlur\r -\fi - }% - } - \AAOnFocus{\JS{var retn = null;}} -\if\@sqTurnOffAlerts0% - \AAOnBlur{\JS{\RespBoxTxtOnBlur}}% -\fi - \fi - } +\begin{defineJS}[\makeesc\!\makecmt\%]{\rbtPCAAKey} +if(event.willCommit) { + retn = ProcRespTxtPC(!rbTxtAlt);% +!ifx!@sqTurnOffAlerts!eq@One + !RespBoxTxtOnBlur!fi% +} +\end{defineJS} +\def\@@RespBoxTxtPCActions{% + \AA{% + \if\eqQuizType\isQZ + \AAKeystroke{\AAKqRespBoxTxtPC} + \else + \AAKeystroke{\rbtPCAAKey} + \AAOnFocus{\JS{var\eqSP retn=null;}} + \ifx\@sqTurnOffAlerts\eq@Zero + \AAOnBlur{\JS{\RespBoxTxtOnBlur}}\fi + \fi + } } % \end{macrocode} % Here is the beginning of \cs{RespBoxTxtPC}. % \begin{macrocode} \newcommand{\RespBoxTxtPC}{\def\rbFlag{0}\@RespBoxTxtPC} \def\annot@subtype@rbtpc{rbtpc} -\newcommand\@RespBoxTxtPC[1][] -{% - \edef\annot@subtype{\annot@subtype@rbtpc}% - \eq@AddProbToQzQuesList - \smallskip\ifx\grpquestions\eq@Zero - \addtocounter{eqpointvalue}{\eqPTs}\fi - \if\eqQuizType\isQZ\def\rbFlag{1}\global\IsRespBoxtrue - \ifx\grpquestions\eq@One - \stepcounter{grpquestionno}% - \def\Fld@name{% - grpobj.\curr@quiz.\thequestionno.\thegrpquestionno}% - \else - \eq@recordThesePTs\eq@recordProbType - \edef\eqtmp{\aPointType}% - \xdef\aPointType{\eqtmp,[\eqPTs,"text"]}% - \stepcounter{questionno}% - \def\Fld@name{obj.\curr@quiz.\thequestionno}% - \fi +\newcommand\@RespBoxTxtPC[1][]{% + \edef\annot@subtype{\annot@subtype@rbtpc}% + \eq@AddProbToQzQuesList + \smallskip\ifx\grpquestions\eq@Zero + \addtocounter{eqpointvalue}{\eqPTs}\fi + \if\eqQuizType\isQZ\def\rbFlag{1}\global\IsRespBoxtrue + \ifx\grpquestions\eq@One + \stepcounter{grpquestionno}% + \def\Fld@name{% + grpobj.\curr@quiz.\thequestionno.\thegrpquestionno}% \else - \stepcounter{questionno}% - \def\Fld@name{obj.\oField.\thequestionno}% + \eq@recordThesePTs\eq@recordProbType + \edef\eqtmp{\aPointType}% + \xdef\aPointType{\eqtmp,[\eqPTs,"text"]}% + \stepcounter{questionno}% + \def\Fld@name{obj.\curr@quiz.\thequestionno}% \fi - \moreRespBoxTxtDefaults - \leavevmode\hbox\bgroup\text@@Field{#1}{\Fld@name}% - {\RBW}{\DefaultHeightOfWidget}% - {\eq@protect\AA}{\eq@setWidgetProps\@@RespBoxTxtPC}% - {\RespBoxTxtDefaults\@moreRespBoxTxtDefaults - \@@RespBoxTxtPCActions\every@eqTextField\every@RespBoxTxt}% + \else + \stepcounter{questionno}% + \def\Fld@name{obj.\oField.\thequestionno}% + \fi + \moreRespBoxTxtDefaults + \leavevmode\hbox\bgroup\text@@Field{#1}{\Fld@name}% + {\RBW}{\DefaultHeightOfWidget}% + {\eq@protect\AA}{\eq@setWidgetProps\@@RespBoxTxtPC}% + {\RespBoxTxtDefaults\@moreRespBoxTxtDefaults + \@@RespBoxTxtPCActions\every@eqTextField\every@RespBoxTxt}% } \def\@@RespBoxTxtPC#1{\@ifnextchar[{\@@@RespBoxTxtPC{#1}} - {\@ifstar{\@@@RespBoxTxtPC{#1}[\curr@quiz.\thequestionno]}% - {\@@@RespBoxTxtPC{#1}[]}}} + {\@ifstar{\@@@RespBoxTxtPC{#1}[\curr@quiz.\thequestionno]}% + {\@@@RespBoxTxtPC{#1}[]}}} \def\@@@RespBoxTxtPC#1[#2]#3{\xdef\@qzsolndest{#2}% \begingroup % \end{macrocode} % We make special definitions for retrieving the parameters. % \begin{macrocode} - \def\rexpStr##1{\eqbs\eqbs\eqbs\eqbs##1}% - \def\\##1{\eqbs\eqbs\eqbs\eqbs##1}% - \def\word##1{\\b##1\\b}\def\any{@any@} - \gdef\rbTxtAlt{\rbFlag,#1,1}% force sub-string match - \global\let\txtAltList\@empty - \eqtmpcnta=#3\relax\ifnum\eqtmpcnta>\z@\expandafter\@argReadPC\else - \PackageError{exerquiz}{% - The third required parameter of - \string\RespBoxTxtPC\MessageBreak - is required to be a positive integer. - You entered\MessageBreak #3\space instead} - {Enter a positive integer.}\fi + \def\rexpStr##1{\eqbs\eqbs\eqbs\eqbs##1}% + \def\\##1{\eqbs\eqbs\eqbs\eqbs##1}% + \def\word##1{\\b##1\\b}\def\any{@any@} + \gdef\rbTxtAlt{\rbFlag,#1,1}% force sub-string match + \global\let\txtAltList\@empty + \eqtmpcnta=#3\relax\ifnum\eqtmpcnta>\z@\expandafter\@argReadPC\else + \PackageError{exerquiz}{% + The third required parameter of + \string\RespBoxTxtPC\MessageBreak + is required to be a positive integer. + You entered\MessageBreak #3\space instead} + {Enter a positive integer.}\fi } % \end{macrocode} % \texttt{\#1=<num>}, partial credit for this answer, \texttt{\#2=word}. % \begin{macrocode} \newcommand\@argReadPC[2][0]{\xdef\jsTempArgs{\txtAltList}% - \ifx\txtAltList\@empty\xdef\txtAltList{["#2",#1]}\else - \xdef\txtAltList{\jsTempArgs,["#2",#1]}\fi\@@argReadPC} + \ifx\txtAltList\@empty\xdef\txtAltList{["#2",#1]}\else + \xdef\txtAltList{\jsTempArgs,["#2",#1]}\fi\@@argReadPC} \def\@@argReadPC{\advance\eqtmpcnta\m@ne - \ifnum\eqtmpcnta=\z@ - \def\eq@next{\endgroup - \xdef\rbTxtAlt{\rbTxtAlt,\txtAltList}% - \if\grpquestions\eq@Zero - \ifwithinMCFI - \xdef\s@veCorrAnsFCFI{[\txtAltList]}\else - \eq@recordCorrAns{[\txtAltList]}\fi - \else - \eq@recordGrpAnsArray{[\txtAltList]}% - \fi - \eq@@RespBoxTxtPC - }% - \else - \def\eq@next{\@argReadPC}% - \fi\eq@next + \ifnum\eqtmpcnta=\z@ + \def\eq@next{\endgroup + \xdef\rbTxtAlt{\rbTxtAlt,\txtAltList}% + \if\grpquestions\eq@Zero + \ifwithinMCFI + \xdef\s@veCorrAnsFCFI{[\txtAltList]}\else + \eq@recordCorrAns{[\txtAltList]}\fi + \else + \eq@recordGrpAnsArray{[\txtAltList]}% + \fi + \eq@@RespBoxTxtPC + }% + \else + \def\eq@next{\@argReadPC}% + \fi\eq@next } -\def\eq@@RespBoxTxtPC{% - \ifeq@proofing\makebox[0pt][l]{\space\txt@correctAnswer}\fi - \eq@TextField +\def\eq@@RespBoxTxtPC{\ifeq@proofing + \makebox[0pt][l]{\space\txt@correctAnswer}\fi + \eq@TextField % \end{macrocode} % Closing of the \cs{hbox} begun above. % \begin{macrocode} - \egroup + \egroup } % \end{macrocode} % \end{macro} +% \begin{macro}{\SpellCheck}\hskip-\marginparsep\texttt{[\ameta{options}]} +% This command is designed to be used with text fill-in questions; the action of this button +% allows the user to correct spelling, but it does record the number of initially misspelled words. +% The placement of this field is after the text field (\cs{RespBoxTxt} or \cs{RespBoxTxtPC}) so +% it can pick up on the field name. The root name of this field is \texttt{spl}. Two helper commands +% are defined: \DescribeMacro{\splChkCA}\cmd{\splChkCA} and \DescribeMacro{\splChkTU}\cmd{\splChkTU}. +% \changes{v8.5.11}{2020/11/11}{Added \string\cs{SpellCheck}} +% \begin{macrocode} +\def\afterSplChkActn#1{\def\@fterSplChkActn{\r #1}} +\let\@fterSplChkActn\@empty +\newcommand{\splChkCA}{Check} +\newcommand{\splChkTU}{Check spelling} +\newcommand\SpellCheck[1][]{% + \pushButton[\CA{\splChkCA}\TU{\splChkTU}\S{S} + #1\A{\JS{% + \ifx\grpquestions\eq@One + var targetFldName=% + "grpobj.\curr@quiz.\thequestionno.\thegrpquestionno"; + \else + \ifx\annot@subtype\annot@subtype@rbe + var targetFldName="essay.\curr@quiz.\thequestionno"; + \else + var targetFldName="obj.\curr@quiz.\thequestionno"; + \fi + \fi\r + var splErrors=checkTheSpelling(targetFldName);\@fterSplChkActn + }}]{spl.\curr@quiz.\thequestionno}{}{11bp}} +% \end{macrocode} +% \end{macro} %\subsection{Essay Fill-In} % \begin{macro}{\RespBoxEssay} % Here is a simple text field with a multi-line attribute for entering @@ -8747,7 +8890,7 @@ if (!isQuizInitialized("@currQuiz")) { % \string\RespBoxEssay[\ameta{opts}]*\darg{\ameta{wd}}\darg{\ameta{ht}} % \end{quote} % The second argument declares the problem has a \env{solution} file; we define the target -% of the solution twh ways: an explicite \ameta{dest} string, or an star (\texttt*), where +% of the solution twh ways: an explicit \ameta{dest} string, or an star (\texttt*), where % the destination is automatically named. If you use \ameta{dest}, you must have % a frist optional, even if its only \texttt{[]}, to correctly parse this construction. % \changes{v8.3}{2019/08/13}{\string\env{solution} environment now defined for @@ -8757,47 +8900,46 @@ if (!isQuizInitialized("@currQuiz")) { {% \BC{0 0 0}\W{1}\S{S}\Ff{\FfMultiline}\rawPDF{}% } -\def\@@RespBoxEssayActions -{% - \AA{\if\eqQuizType\isQZ - \AAKeystroke{% - if(event.willCommit){\jsR\jsT - RecordPointValue(\eqPTs,\thequestionno);\jsR\jsT - RecordProblemType("\eqQT",\thequestionno);\jsR %\jsT - }\jsR - if (!isQuizInitialized("\curr@quiz")) {\jsR\jsT - \eqObjAlert\space eqAppAlert(% - InitMsg("\bqlabelISO"),3);\jsR\jsT - event.rc = false;\jsR - }% - }% - \fi - } +\def\@@RespBoxEssayActions{\AA{% + \if\eqQuizType\isQZ + \AAKeystroke{% + if(event.willCommit){\jsR\jsT + RecordPointValue(\eqPTs,\thequestionno);\jsR\jsT + RecordProblemType("\eqQT",\thequestionno);\jsR %\jsT + }\jsR + if (!isQuizInitialized("\curr@quiz")) {\jsR\jsT + \eqObjAlert\space eqAppAlert(% + InitMsg("\bqlabelISO"),3);\jsR\jsT + event.rc = false;\jsR + }% + }% + \fi}% } % \RespBoxEssay[opt][dest]|*{wd}{ht} -\newcommand\RespBoxEssay[1][]{\def\rbe@rgi{#1}\RespBoxEssay@i} +\def\annot@subtype@rbe{rbe} +\newcommand\RespBoxEssay[1][]{\edef\annot@subtype{\annot@subtype@rbe}% + \def\rbe@rgi{#1}\RespBoxEssay@i} \def\RespBoxEssay@i{\@ifnextchar[%] {\RespBoxEssay@ii} {\@ifstar{\RespBoxEssay@ii[\curr@quiz.\thequestionno]}}% {\RespBoxEssay@ii[]}% } % \RespBoxEssay#1[dest]{wd}{ht} -\newcommand\RespBoxEssay@ii[3][] -{% - \smallskip\addtocounter{eqpointvalue}{\eqPTs}% +\newcommand\RespBoxEssay@ii[3][]{% + \smallskip\addtocounter{eqpointvalue}{\eqPTs}% % \end{macrocode} % (2019/06/26) Added \cs{eq@AddProbToQzQuesList} for \cs{RespBoxEssay} % \changes{v8.2.13}{2019/06/26}{Added \string\cs{eq@AddProbToQzQuesList} for \string\cs{RespBoxEssay}} % \begin{macrocode} - \eq@AddProbToQzQuesList - \stepcounter{questionno}% - \xdef\@qzsolndest{#1}% - \edef\eqtmp{\aPointType}\xdef\aPointType{\eqtmp,[\eqPTs,"essay"]}% - \expandafter\mbox\expandafter{\expandafter\text@@Field - \expandafter{\rbe@rgi}{essay.\curr@quiz.\thequestionno}{#2}{#3}% - {\eq@protect\AA}{\eq@setWidgetProps - \eq@TextField}{\RespBoxEssayDefaults\@@RespBoxEssayActions - \every@eqTextField}}% + \eq@AddProbToQzQuesList + \stepcounter{questionno}% + \xdef\@qzsolndest{#1}% + \edef\eqtmp{\aPointType}\xdef\aPointType{\eqtmp,[\eqPTs,"essay"]}% + \expandafter\mbox\expandafter{\expandafter\text@@Field + \expandafter{\rbe@rgi}{essay.\curr@quiz.\thequestionno}{#2}{#3}% + {\eq@protect\AA}{\eq@setWidgetProps + \eq@TextField}{\RespBoxEssayDefaults\@@RespBoxEssayActions + \every@eqTextField}}% } % \end{macrocode} % \end{macro} @@ -8812,21 +8954,19 @@ if (!isQuizInitialized("@currQuiz")) { \@ifundefined{calcOrder}{% \ifpdf\def\@@sqTallyBoxActions{% \AA{\AAValidate{getTotalTally("\oField");}}}\fi}{} -\def\sqTallyBoxDefaults -{% +\def\sqTallyBoxDefaults{% \BC{0 0 0}\W{1}\textColor{1 0 0 rg}\S{I}\Q{2}\Ff{\FfReadOnly} } \ifpdf\def\@@sqTallyBoxActions{% - \AA{\AAValidate{getTotalTally("\oField");}}}\else - \let\@@sqTallyBoxActions\@empty + \AA{\AAValidate{getTotalTally("\oField");}}}\else + \let\@@sqTallyBoxActions\@empty \fi -\newcommand\sqTallyBox[1][] -{% - \mbox{\text@@Field{#1}{tally.\oField.\thequestionno}% - {\TBW}{\DefaultHeightOfWidget}% - {}{\eq@setWidgetProps\eq@TextField}% - {\sqTallyBoxDefaults\@@sqTallyBoxActions\every@eqTextField - \every@sqTallyBox}}% +\newcommand\sqTallyBox[1][]{% + \mbox{\text@@Field{#1}{tally.\oField.\thequestionno}% + {\TBW}{\DefaultHeightOfWidget}% + {}{\eq@setWidgetProps\eq@TextField}% + {\sqTallyBoxDefaults\@@sqTallyBoxActions\every@eqTextField + \every@sqTallyBox}}% } % \end{macrocode} % \end{macro} @@ -8835,28 +8975,24 @@ if (!isQuizInitialized("@currQuiz")) { % \texttt{shortquiz} environment. Takes on optional parameter; this % parameter can be used to modify the appearance of the fields. % \begin{macrocode} -\def\sqTallyTotalDefaults -{% - \rawPDF{}\W{1}\BC{0 0 0}\S{I}\textColor{1 0 0 rg}% - \Q{2}\Ff{\FfReadOnly}% +\def\sqTallyTotalDefaults{% + \rawPDF{}\W{1}\BC{0 0 0}\S{I}\textColor{1 0 0 rg}% + \Q{2}\Ff{\FfReadOnly}% } -\def\@@sqTallyTotalActions -{% - \AA{% - \AAKeystroke{AFNumber_Keystroke(0,0,0,0,"",true);} - \AAFormat{AFNumber_Format(0,0,0,0,"",true);} - \AACalculate{% - AFSimple_Calculate("SUM",new Array("tally.\oField")); - }} -} -\newcommand\sqTallyTotal[1][] -{% - \mbox{\text@@Field{#1}{tallytotal.\oField}{\TBW}% - {\DefaultHeightOfWidget}{\eq@protect\AA}% -% {\eq@setWidgetProps\eq@calcTextField}% - {\eq@setWidgetProps\eq@TextField}% - {\sqTallyTotalDefaults\@@sqTallyTotalActions\every@eqTextField - \every@sqTallyTotal}}% +\def\@@sqTallyTotalActions{% + \AA{% + \AAKeystroke{AFNumber_Keystroke(0,0,0,0,"",true);} + \AAFormat{AFNumber_Format(0,0,0,0,"",true);} + \AACalculate{% + AFSimple_Calculate("SUM",new Array("tally.\oField")); + }}% +} +\newcommand\sqTallyTotal[1][]{% + \mbox{\text@@Field{#1}{tallytotal.\oField}{\TBW}% + {\DefaultHeightOfWidget}{\eq@protect\AA}% + {\eq@setWidgetProps\eq@TextField}% + {\sqTallyTotalDefaults\@@sqTallyTotalActions\every@eqTextField + \every@sqTallyTotal}}% } % \end{macrocode} % \end{macro} @@ -8888,96 +9024,95 @@ if (!isQuizInitialized("@currQuiz")) { %\end{verbatim} % Here, we call a function to evaluate the answer for us. % \begin{macrocode} -\def\CorrAnsButtonDefaults -{% - \CA{\eq@local@CorrAnsButton}\W{1}\S{S} - \BC{0 0 0}\BG{.7529 .7529 .7529}\H{P} +\def\CorrAnsButtonDefaults{% + \CA{\eq@local@CorrAnsButton}\W{1}\S{S} + \BC{0 0 0}\BG{.7529 .7529 .7529}\H{P} } \def\normalCABtnBC{0 0 0} \def\qCorrAnsButtonActionHook{\JS{% \ifx\@qzsolndest\@empty\else - if (event.shift)\jsR\jsT + if(event.shift)\jsR\jsT this.gotoNamedDest("\@qzsolndest");\jsR else {\jsR\jsT\fi % \end{macrocode} % The script for the \cs{CorrAnsButton} accommodates multi-letter variables % \begin{macrocode} -\ifShowAppr % dps17 +\ifShowAppr \ifarrowDelim - if (typeof event.target.appr=="undefined")\r\JST\t + if(typeof event.target.appr=="undefined")\r\JST\t event.target.appr=false;\r\JST event.target.appr=!event.target.appr;\r\JST - if (event.target.appr) {\r\t\JST - var _substVars=\indepVars;\r\t\JST - var _substAns=getSubstValue(_substVars,"\CorrectAns");\r\t\JST - var value=RespBoxAppr("\CorrectAns");\r\JST - } else value="\CorrectAns";\r\JST + if(event.target.appr) {\r\t\JST + var\eqSP_substVars=\indepVars;\r\t\JST + var\eqSP_substAns=getSubstValue(_substVars,"\CorrectAns");\r\t\JST + var\eqSP value=RespBoxAppr("\CorrectAns");\r\JST + } else\eqSP var\eqSP value="\CorrectAns";\r\JST \else - value="\CorrectAns";\r\JST + var\eqSP value="\CorrectAns";\r\JST \fi \else - value="\CorrectAns";\r\JST + var\eqSP value="\CorrectAns";\r\JST \fi \processJSfunc("Ans.\curr@quiz",value,\currQuiz);\r -\ifx\@qzsolndest\@empty\else % dps17 +\ifx\@qzsolndest\@empty\else }\fi }} - \def\sqCorrAnsButtonActionHook - {% - \JS{% % \end{macrocode} -% Allow local definition the reset color for response boxes. The reset color -% is normally black (\cs{eqDefaultColor}). Now if \cs{sqCorrAnsResetBC} is none -% empty, we put it in as a property of the \cs{oField} object. +% \leavevmode\DescribeMacro{\sqCorrAnsCode} +% The JavaScript code for \cs{CorrAnsButton} now in a \env{defineJS} env. +% \changes{v8.6}{2020/11/29}{code for \string\cs{CorrAnsButton} now in a \string\env{defineJS} env} +% \begin{macrocode} +\begin{defineJS}[\makeesc\!\makecmt\%]{\sqCorrAnsCode} +!ifx!@qzsolndest!@empty% +!processJSfunc("obj.!oField.!thequestionno","!CorrectAns",% +!currQuiz);!else% +if (event.shift) this.gotoNamedDest("!@qzsolndest"); +else !processJSfunc("obj.!oField.!thequestionno","!CorrectAns",% +!currQuiz);!fi +\end{defineJS} +\def\sqCorrAnsButtonActionHook{\JS{\sqCorrAnsCode}} +% \end{macrocode} +% \leavevmode\DescribeMacro{\CorrAnsButton} +% The definition of \cs{CorrAnsButton} % \begin{macrocode} - \ifx\@qzsolndest\@empty\else - if (event.shift)\jsR\jsT - this.gotoNamedDest("\@qzsolndest");\jsR - else\jsR\jsT - \fi - \processJSfunc("obj.\oField.\thequestionno","\CorrectAns",% -\currQuiz); - }% - } \newcommand\CorrAnsButton[1][]{\eq@@CorrAnsButton{#1}} \def\eq@@CorrAnsButton#1#2{\bgroup\makeJSspecials % 1/12 - \@ifstar{\eq@@@CorrAnsButton{#1}{#2}}{% - \eq@@@CorrAnsButton{#1}{#2}{DisplayAnswer}}% -} + \@ifstar{\eq@@@CorrAnsButton{#1}{#2}}{% + \eq@@@CorrAnsButton{#1}{#2}{DisplayAnswer}}} \def\eq@@@CorrAnsButton#1#2#3{\gdef\CorrectAns{#2}% - \def\processJSfunc{#3}\ifx\@qzsolndest\@empty\let\JST\@empty\else - \let\JST\jsT\fi % dps17 - \ifx\eq@ProcRespIntervals\g@processJSfunc % 01/11 - \let\@inmathwarn@SAVE\@inmathwarn\let\@inmathwarn\@gobble + \def\processJSfunc{#3}\ifx\@qzsolndest\@empty\let\JST\@empty\else + \let\JST\jsT\fi % dps17 + \ifx\eq@ProcRespIntervals\g@processJSfunc % 01/11 + \let\@inmathwarn@SAVE\@inmathwarn\let\@inmathwarn\@gobble % \end{macrocode} % When the response function is \texttt{ProcRespIntervals}, there may be unbalanced parentheses, we'll % pass \cs{CorrectAns} through \cs{pdfstringdef} to escape them. % \begin{macrocode} - \pdfstringdef{\CorrectAns}{\CorrectAns}% - \let\@inmathwarn\@inmathwarn@SAVE\fi + \pdfstringdef{\CorrectAns}{\CorrectAns}% + \let\@inmathwarn\@inmathwarn@SAVE\fi \if\eqQuizType\isQZ\def\Fld@name{corr.\curr@quiz.\thequestionno}% \else\def\Fld@name{corr.\oField.\thequestionno}\fi \if\eqQuizType\isQZ - \edef\@@CorrAnsButtonActions{\noexpand\F{\FHidden}% - \ifx\@qzsolndest\@empty%\noexpand\BC{\normalCABtnBC}% - \else\noexpand\BC{\solution@Color}\fi - \noexpand\A{\noexpand\qCorrAnsButtonActionHook}}% - \ifeq@noquizsolutions\else % dps17 (\let\rpl\eq@rpl) - \mbox{\let\rpl\eq@rpl - \push@@Button{#1}{\Fld@name}{}{\DefaultHeightOfWidget}% - {\eq@protect\A}{\eq@setButtonProps\eq@Button@driver}% - {\CorrAnsButtonDefaults\@@CorrAnsButtonActions - \every@ButtonField\every@CorrAnsButton}}% - \fi + \edef\@@CorrAnsButtonActions{\noexpand\F{\FHidden}% + \ifx\@qzsolndest\@empty%\noexpand\BC{\normalCABtnBC}% + \else\noexpand\BC{\solution@Color}\fi + \noexpand\A{\noexpand\qCorrAnsButtonActionHook}}% + \ifeq@noquizsolutions\else % dps17 (\let\rpl\eq@rpl) + \mbox{\let\rpl\eq@rpl + \push@@Button{#1}{\Fld@name}{}{\DefaultHeightOfWidget}% + {\eq@protect\A}{\eq@setButtonProps\eq@Button@driver}% + {\CorrAnsButtonDefaults\@@CorrAnsButtonActions + \every@ButtonField\every@CorrAnsButton}}% + \fi \else \edef\@@CorrAnsButtonActions{% \ifx\@qzsolndest\@empty%\noexpand\BC{\normalCABtnBC} \else\noexpand\BC{\solution@Color}\fi \noexpand\A{\noexpand\sqCorrAnsButtonActionHook}}% \mbox{\push@@Button{#1}{\Fld@name}{}{\DefaultHeightOfWidget}% - {\eq@protect\A}{\eq@setButtonProps\eq@Button@driver}% - {\CorrAnsButtonDefaults\@@CorrAnsButtonActions - \every@ButtonField\every@CorrAnsButton}}% + {\eq@protect\A}{\eq@setButtonProps\eq@Button@driver}% + {\CorrAnsButtonDefaults\@@CorrAnsButtonActions + \every@ButtonField\every@CorrAnsButton}}% \fi \egroup } @@ -9003,41 +9138,40 @@ if (!isQuizInitialized("@currQuiz")) { } % \end{macrocode} % In an attempt to supply some custom colors for the shortquiz, we -% define \cmd{\sqRespBoxResetColor}. It determines the clear -% \begin{macrocode} -\def\@@sqClearButtonActions -{% - \A{\JS{ProcessIt = false;\jsR - if ( typeof \oField\space== "undefined" )\jsR\jsT - \oField\space= new Object;\jsR - if (typeof appAlerts["\oField"] == "undefined")\jsR\jsT - appAlerts["\oField"] = new Object;\jsR - this.resetForm(new Array("mc.\oField","obj.\oField",% - "tally.\oField","grpobj.\oField"));\jsR - var f = this.getField("obj.\oField");\jsR +% define \cmd{\sqRespBoxResetColor}. It determines the clear color +% \changes{v8.6}{2020/11/29}{Rewrote SQ clear button using \string\env{defineJS} env} +% \begin{macrocode} +\begin{defineJS}[\makeesc\*\makecmt\%]{\@@sqClearButtonJSCode} +ProcessIt = false; +if ( typeof *oField == "undefined" ) + *oField = new Object; +if (typeof appAlerts["*oField"] == "undefined") + appAlerts["*oField"] = new Object; +this.resetForm(new Array("mc.*oField","obj.*oField",% +"tally.*oField","grpobj.*oField")); +var f = this.getField("obj.*oField"); +if ( f != null ) f.strokeColor=*ifx*defaultColorJSLoc*@empty% +*defaultColorJS*else*defaultColorJSLoc*fi; +f = this.getField("grpobj.*oField"); % \end{macrocode} % Here, we give the user an opportunity to designate the color % of the response boxes when they are reset by the \cs{sqClearButton}. % The default is to use \cs{eqDefaultColor}. % \begin{macrocode} - if ( f != null ) f.strokeColor=\ifx\defaultColorJSLoc\@empty -\defaultColorJS\else\defaultColorJSLoc\fi;\jsR - f = this.getField("grpobj.\oField");\jsR - if ( f != null ) f.strokeColor=\ifx\defaultColorJSLoc\@empty -\defaultColorJS\else\defaultColorJSLoc\fi;\jsR - f = this.getField("rbmarkup.\oField");\jsR - if ( f != null ) f.display=display.hidden;\jsR - \oField.Grp = {};\jsR - appAlerts["\oField"].bAfterValue=false;\jsR - ProcessIt=true;}% - } -} -\newcommand\sqClearButton[1][] -{% - \mbox{\push@@Button{#1}{clear.\oField}{}{\DefaultHeightOfWidget}% - {\eq@protect\A}{\eq@setButtonProps\eq@Button@driver}% - {\sqClearButtonDefaults\@@sqClearButtonActions\every@ButtonField - \every@sqClearButton}}% +if ( f != null ) f.strokeColor=*ifx*defaultColorJSLoc*@empty% +*defaultColorJS*else*defaultColorJSLoc*fi; +f = this.getField("rbmarkup.*oField"); +if ( f != null ) f.display=display.hidden; +*oField.Grp = {}; +appAlerts["*oField"].bAfterValue=false; +ProcessIt=true; +\end{defineJS} +\def\@@sqClearButtonActions{\A{\JS{\@@sqClearButtonJSCode}}} +\newcommand\sqClearButton[1][]{% + \mbox{\push@@Button{#1}{clear.\oField}{}{\DefaultHeightOfWidget}% + {\eq@protect\A}{\eq@setButtonProps\eq@Button@driver}% + {\sqClearButtonDefaults\@@sqClearButtonActions\every@ButtonField + \every@sqClearButton}}% } % \end{macrocode} % \end{macro} @@ -9048,49 +9182,43 @@ if (!isQuizInitialized("@currQuiz")) { % the student cannot enter another answer in the text field, and the input that is already % there will be the one that is counted has the student's response. % \begin{macrocode} -\def\PromptButtonDefaults -{% - \CA{\eq@local@CorrAnsButton}\W{1}\S{S}\BC{0 0 0} - \BG{.7529 .7529 .7529}\H{P} +\def\PromptButtonDefaults{% + \CA{\eq@local@CorrAnsButton}\W{1}\S{S}\BC{0 0 0} + \BG{.7529 .7529 .7529}\H{P} } \newcommand{\promptButtonMsg}{% - "Would you like to see the correct answer at this time? "\r\t\t - + "Your current answer will be the one that will be scored. "\r\t\t - + "If you click on \\"Yes\\", - you will not be able to change your answer." + "Would you like to see the correct answer at this time? "\r\t\t + + "Your current answer will be the one that will be scored. "\r\t\t + + "If you click on \\"Yes\\", + you will not be able to change your answer." } \newcommand{\AnsPromptBtnStr}{Answer:\space} -\def\PromptButtonActionHook -{% - \JS{% - if (!isQuizInitialized("\currQuiz")) {\r\t - eqAppAlert(InitMsg("\bqlabelISO"),3);\r\t - event.rc=false;\r - } else {\r\t - if ( !\currQuiz.oAlertCheck.bAfterValue ) {\r\t - var resp=eqAppAlert({\r\t\t - cMsg:\promptButtonMsg,\r\t\t - nIcon: 2, nType: 2,\r\t\t - cTitle: ("AcroTeX Prompt Message"),\r\t\t - oCheckbox: \currQuiz.oAlertCheck\r\t - });\r\t - }\r +\begin{defineJS}[\makeesc\*\makecmt\%]{\PromptButtonActionCode} +if (!isQuizInitialized("*currQuiz")) { + eqAppAlert(InitMsg("*bqlabelISO"),3); + event.rc=false; +} else { + if ( !*currQuiz.oAlertCheck.bAfterValue ) { + var resp=eqAppAlert({ + cMsg:*promptButtonMsg, + nIcon: 2, nType: 2, + cTitle: ("AcroTeX Prompt Message"), + oCheckbox: *currQuiz.oAlertCheck + }); + } % \end{macrocode} % Correction to the if condition below % \changes{v7.8d}{2017/01/11}{Correction to the if condition in \string\cs{PromptButtonActionHook}} % \begin{macrocode} - if ( promptQuiz.oAlertCheck.bAfterValue || resp==4 )\r\t - {\r\t\t - var field=this.getField(% - "obj.\currQuiz.\thequestionno");\r\t\t - field.readonly=true;\r\t\t - field=this.getField("Ans.\currQuiz");\r\t\t - if (field!=null) - field.value = "\AnsPromptBtnStr\PromptAns";\r\t - }\r - } - }% + if ( promptQuiz.oAlertCheck.bAfterValue || resp==4 ) { + var field=this.getField("obj.*currQuiz.*thequestionno"); + field.readonly=true; + field=this.getField("Ans.*currQuiz"); + if (field!=null) field.value = ("*AnsPromptBtnStr*PromptAns"); + } } +\end{defineJS} +\def\PromptButtonActionHook{\JS{\PromptButtonActionCode}} % \end{macrocode} % This button takes the standard two arguments % \begin{flushleft} @@ -9098,22 +9226,21 @@ if (!isQuizInitialized("@currQuiz")) { % \texttt{\#2}: Prompt answer % \end{flushleft} % \begin{macrocode} -\newcommand\@PromptButton[2][] -{% - \def\PromptAns{#2}\if\eqQuizType\isQZ - \def\Fld@name{promptButton.\curr@quiz.\thequestionno}% - \else\def\Fld@name{promptButton.\oField.\thequestionno}\fi - \if\eqQuizType\isQZ - \def\@@PromptButtonActions{% - \A{\PromptButtonActionHook}}% - \mbox{\push@@Button{#1}{\Fld@name}{}% - {\DefaultHeightOfWidget}{\eq@protect\A}% - {\eq@setButtonProps\eq@Button@driver}% - {\PromptButtonDefaults\@@PromptButtonActions - \every@ButtonField\every@CorrAnsButton}}% - \else\PackageWarning{exerquiz}{The \string\PromptButton - is for quiz questions only.} - \fi +\newcommand\@PromptButton[2][]{% + \def\PromptAns{#2}\if\eqQuizType\isQZ + \def\Fld@name{promptButton.\curr@quiz.\thequestionno}% + \else\def\Fld@name{promptButton.\oField.\thequestionno}\fi + \if\eqQuizType\isQZ + \def\@@PromptButtonActions{% + \A{\PromptButtonActionHook}}% + \mbox{\push@@Button{#1}{\Fld@name}{}% + {\DefaultHeightOfWidget}{\eq@protect\A}% + {\eq@setButtonProps\eq@Button@driver}% + {\PromptButtonDefaults\@@PromptButtonActions + \every@ButtonField\every@CorrAnsButton}}% + \else\PackageWarning{exerquiz}{The \string\PromptButton + is for quiz questions only.} + \fi } % \end{macrocode} % \end{macro} @@ -9122,7 +9249,7 @@ if (!isQuizInitialized("@currQuiz")) { % \cs{CorrAnsButton} as the answer provided by the author. % \begin{macrocode} \newcommand{\PromptButton}{\makebox[0pt][r] % assumes xcolor - {\@PromptButton[\textColor{1 0 0 rg}]{\CorrectAns}}} + {\@PromptButton[\textColor{1 0 0 rg}]{\CorrectAns}}} % \end{macrocode} % \begin{environment}{mathGrp} % An environment for enclosing a collection of math/text fill-ins that are to be grouped @@ -9138,162 +9265,128 @@ if (!isQuizInitialized("@currQuiz")) { % \begin{macrocode} \let\eq@ansGrpArray\@empty \def\eq@recordGrpAnsArray#1{% - \ifx\eq@ansGrpArray\@empty - \edef\tmp@exp{\noexpand\g@addto@macro - \noexpand\eq@ansGrpArray{#1}}\else - \edef\tmp@exp{\noexpand\g@addto@macro - \noexpand\eq@ansGrpArray{,#1}}\fi - \tmp@exp + \ifx\eq@ansGrpArray\@empty + \edef\tmp@exp{\noexpand\g@addto@macro + \noexpand\eq@ansGrpArray{#1}}\else + \edef\tmp@exp{\noexpand\g@addto@macro + \noexpand\eq@ansGrpArray{,#1}}\fi + \tmp@exp } \let\grpquestions\eq@Zero \def\mathGrp{\global\let\eq@ansGrpArray\@empty - \@ifnextchar[{\@imathGrp}{\@imathGrp[groupEval]}} + \@ifnextchar[{\@imathGrp}{\@imathGrp[groupEval]}} \def\@imathGrp[#1]{\def\argi{#1}% - \@ifnextchar[{\@iimathGrp}{\@iimathGrp[]}} + \@ifnextchar[{\@iimathGrp}{\@iimathGrp[]}} \def\@iimathGrp[#1]{\def\argii{#1}% - \eq@AddProbToQzQuesList - \global\let\grpquestions\eq@One - \setcounter{grpquestionno}{0}% - \stepcounter{questionno}% - \xdef\beginGrp{\thequestionno}% - \xdef\grpPointValue{\eqPTs}% - \eq@recordThesePTs\eq@recordProbType - \if\eqQuizType\isQZ - \edef\eqtmp{\aPointType}% - \xdef\aPointType{\eqtmp,[\eqPTs,"grp"]}\fi - \addtocounter{eqpointvalue}{\eqPTs}% - \ifx\argii\@empty - \xdef\grpTotalWeight{\eqPTs}% - \xdef\grpEvalFunction{\argi}% - \else - \xdef\grpTotalWeight{\argi}% - \xdef\grpEvalFunction{\argii}% - \fi + \eq@AddProbToQzQuesList + \global\let\grpquestions\eq@One + \setcounter{grpquestionno}{0}% + \stepcounter{questionno}% + \xdef\beginGrp{\thequestionno}% + \xdef\grpPointValue{\eqPTs}% + \eq@recordThesePTs\eq@recordProbType + \if\eqQuizType\isQZ + \edef\eqtmp{\aPointType}% + \xdef\aPointType{\eqtmp,[\eqPTs,"grp"]}\fi + \addtocounter{eqpointvalue}{\eqPTs}% + \ifx\argii\@empty + \xdef\grpTotalWeight{\eqPTs}% + \xdef\grpEvalFunction{\argi}% + \else + \xdef\grpTotalWeight{\argi}% + \xdef\grpEvalFunction{\argii}% + \fi } \def\endmathGrp{\global\let\grpquestions\eq@Zero - \eq@recordCorrAns{[\eq@ansGrpArray]}% - \xdef\endGrp{\thequestionno}} + \eq@recordCorrAns{[\eq@ansGrpArray]}% + \xdef\endGrp{\thequestionno}} % \end{macrocode} % \end{environment} % \begin{macro}{\CorrAnsButtonGrp} % The correct answer button for grouped questions. +% \changes{v8.6}{2020/11/29}{Action for group answer btn now a \string\env{defineJS} env} % \begin{macrocode} -\def\CorrAnsButtonGrpDefaults -{% - \CA{\eq@local@CorrAnsButton}\W{1}\S{S}\BC{0 0 0} - \BG{.7529 .7529 .7529}\H{P} +\def\CorrAnsButtonGrpDefaults{% + \CA{\eq@local@CorrAnsButton}\W{1}\S{S}\BC{0 0 0} + \BG{.7529 .7529 .7529}\H{P} } -\def\CorrAnsButtonGrpActionHook{\JS{% -\ifx\@qzsolndest\@empty\else - if (event.shift)\jsR\jsT - this.gotoNamedDest("\@qzsolndest");\jsR - else\jsR -\fi - {\jsR\jsT - var aCorrectAns=\CorrectAns;\jsR\jsT - var beginGrp = 1;\jsR\jsT - grpOffset = beginGrp;\jsR\jsT -% if ( typeof \currQuiz == "undefined" ) {\jsR\jsT\jsT -% \currQuiz = new Object;\jsR\jsT\jsT -% \currQuiz.Grp = {};\jsR\jsT -% }\jsR\jsT - if ( \currQuiz.Grp==null ) \currQuiz.Grp = {};\jsR\jsT - if (typeof \currQuiz.Grp["\thequestionno"]=="undefined")\jsR\jsT - {\jsR\jsT\jsT - \currQuiz.Grp["\thequestionno"] = {offset: 0};\jsR\jsT\jsT - var f = this.getField(% - "grpobj.\curr@quiz.\thequestionno." - + grpOffset)\jsR\jsT\jsT +\begin{defineJS}[\makeesc\!\makecmt\%]{\cabGrpActn} +!ifx!@qzsolndest!@empty!else% +if (event.shift) this.gotoNamedDest("!@qzsolndest"); +else !fi% +{ + var aCorrectAns=!CorrectAns; + var beginGrp=1; + var grpOffset=beginGrp; + if(!currQuiz.Grp==null)!currQuiz.Grp={}; + if(typeof !currQuiz.Grp["!thequestionno"]=="undefined") + { + !currQuiz.Grp["!thequestionno"]={offset:0}; + } else { + !currQuiz.Grp["!thequestionno"].offset=% +++(!currQuiz.Grp["!thequestionno"].offset)!%aCorrectAns.length; + grpOffset=beginGrp% ++!currQuiz.Grp["!thequestionno"].offset; + } + var f=this.getField("grpobj.!curr@quiz.!thequestionno." % ++ grpOffset); % \end{macrocode} % When the field is readonly, then we cannot set the focus. We'll remove the readonly, set focus, then -% reset readonly to true again; however, we must wait a little for \texttt{setFocus} to finish. -% \begin{macrocode} - if ( f.readonly ) {\jsR\jsT\jsT - f.readonly = false;\jsR\jsT\jsT - f.setFocus();\jsR\jsT\jsT - eqDelay = app.setTimeOut(% - "f.readonly = true; - app.clearTimeOut(eqDelay);",10);\jsR\jsT - } else f.setFocus();\jsR\jsT - }\jsR\jsT - else \jsR\jsT - {\jsR\jsT\jsT - \currQuiz.Grp["\thequestionno"].offset = - ++\currQuiz.Grp["\thequestionno"].offset - \% aCorrectAns.length;\jsR\jsT\jsT - grpOffset = beginGrp - + \currQuiz.Grp["\thequestionno"].offset;\jsR\jsT\jsT - var f = this.getField("grpobj.\curr@quiz.\thequestionno." - + grpOffset);\jsR\jsT\jsT - if ( f.readonly ) {\jsR\jsT\jsT - f.readonly = false;\jsR\jsT\jsT - f.setFocus();\jsR\jsT\jsT - eqDelay = app.setTimeOut("f.readonly = true; - app.clearTimeOut(eqDelay);",10);\jsR\jsT - } else f.setFocus();\jsR\jsT - }\jsR\jsT -\if\eqQuizType\isQZ - DisplayAnswer("Ans.\curr@quiz", - aCorrectAns[\currQuiz.Grp["\thequestionno"].offset],% -\currQuiz); -%\ifx\sqCorrAnsResetBC\@empty\else,\currQuiz\fi);\jsR -\else -% \end{macrocode} -% Allow local definition the reset color for response boxes. The reset color -% is normally black (\cs{eqDefaultColor}). Now if \cs{sqCorrAnsResetBC} is none -% empty, we put it in as a property of the \cs{oField} object. -% \begin{macrocode} -%\ifx\sqCorrAnsResetBC\@empty\else -% if ( typeof \oField=="undefined")\jsR\jsT\jsT -% var \oField = new Object;\jsR\jsT -% \oField.CorrAnsResetBC=\sqCorrAnsResetBC;\jsR\jsT -%\fi - DisplayAnswer("grpobj.\oField.\thequestionno."+ grpOffset, - aCorrectAns[\currQuiz.Grp["\thequestionno"].offset],% -\oField);\jsR -\fi - } -}} -\newcommand\CorrAnsButtonGrp[2][] -{% - \makeStringArray{#2}% - \edef\CorrectAns{\stringArray}% - \if\eqQuizType\isQZ\def\Fld@name{corr.\curr@quiz.\thequestionno}% - \else\edef\currQuiz{\oField}% +% reset readonly to true again; however, we must wait a little for !texttt{setFocus} to finish. +% \begin{macrocode} + if(f.readonly){ + f.readonly=false; + f.setFocus(); + eqDelay=app.setTimeOut(% +"f.readonly=true;app.clearTimeOut(eqDelay);",10); + } else f.setFocus(); +!if!eqQuizType!isQZ% + DisplayAnswer("Ans.!curr@quiz",% +aCorrectAns[!currQuiz.Grp["!thequestionno"].offset],!currQuiz);!else% + DisplayAnswer("grpobj.!oField.!thequestionno."+ grpOffset,% +aCorrectAns[!currQuiz.Grp["!thequestionno"].offset],!oField);!fi +} +\end{defineJS} +\def\CorrAnsButtonGrpActionHook{\JS{\cabGrpActn}} +\newcommand\CorrAnsButtonGrp[2][]{% + \makeStringArray{#2}% + \edef\CorrectAns{\stringArray}% + \if\eqQuizType\isQZ\def\Fld@name{corr.\curr@quiz.\thequestionno}% + \else\edef\currQuiz{\oField}% \def\Fld@name{corr.\oField.\thequestionno}\fi - \if\eqQuizType\isQZ - \edef\@@CorrAnsButtonGrpActions{\noexpand\F{\FHidden}% - \ifx\@qzsolndest\@empty%\noexpand\BC{\normalCABtnBC} - \else\noexpand\BC{\solution@Color}\fi - \noexpand\A{\noexpand\CorrAnsButtonGrpActionHook}}% - \ifeq@noquizsolutions\else - \mbox{\push@@Button{#1}{\Fld@name}{}{\DefaultHeightOfWidget}% - {\eq@protect\A}{\eq@setButtonProps\eq@Button@driver}% - {\CorrAnsButtonGrpDefaults\@@CorrAnsButtonGrpActions - \every@ButtonField\every@CorrAnsButton}}% - \fi - \else - \edef\@@CorrAnsButtonGrpActions{% - \ifx\@qzsolndest\@empty%\noexpand\BC{\normalCABtnBC} - \else\noexpand\BC{\solution@Color}\fi - \noexpand\A{\noexpand\CorrAnsButtonGrpActionHook}}% - \mbox{\push@@Button{#1}{\Fld@name}{}{\DefaultHeightOfWidget}% - {\eq@protect\A}{\eq@setButtonProps\eq@Button@driver}% - {\CorrAnsButtonGrpDefaults\@@CorrAnsButtonGrpActions - \every@ButtonField\every@CorrAnsButton}}% - \fi + \if\eqQuizType\isQZ + \edef\@@CorrAnsButtonGrpActions{\noexpand\F{\FHidden}% + \ifx\@qzsolndest\@empty + \else\noexpand\BC{\solution@Color}\fi + \noexpand\A{\noexpand\CorrAnsButtonGrpActionHook}}% + \ifeq@noquizsolutions\let\x\relax\else + \def\x{\mbox{\push@@Button{#1}{\Fld@name}{}% + {\DefaultHeightOfWidget}{\eq@protect\A}% + {\eq@setButtonProps\eq@Button@driver}% + {\CorrAnsButtonGrpDefaults\@@CorrAnsButtonGrpActions + \every@ButtonField\every@CorrAnsButton}}}\fi\x + \else + \edef\@@CorrAnsButtonGrpActions{% + \ifx\@qzsolndest\@empty%\noexpand\BC{\normalCABtnBC} + \else\noexpand\BC{\solution@Color}\fi + \noexpand\A{\noexpand\CorrAnsButtonGrpActionHook}}% + \mbox{\push@@Button{#1}{\Fld@name}{}{\DefaultHeightOfWidget}% + {\eq@protect\A}{\eq@setButtonProps\eq@Button@driver}% + {\CorrAnsButtonGrpDefaults\@@CorrAnsButtonGrpActions + \every@ButtonField\every@CorrAnsButton}}% + \fi } \def\makeStringArray#1{\def\stringArray{[}\@makeStringArray#1,\@nil} \def\@makeStringArray#1,#2\@nil{% - \edef\eq@temp{\stringArray}\def\argii{#2}% - \ifx\argii\@empty - \edef\stringArray{\eq@temp"#1"]}% - \def\eq@next{}% - \else - \edef\stringArray{\eq@temp"#1",}% - \def\eq@next{\@makeStringArray#2\@nil}% - \fi - \eq@next + \edef\eq@temp{\stringArray}\def\argii{#2}% + \ifx\argii\@empty + \edef\stringArray{\eq@temp"#1"]}% + \def\eq@next{}% + \else + \edef\stringArray{\eq@temp"#1",}% + \def\eq@next{\@makeStringArray#2\@nil}% + \fi + \eq@next } % \end{macrocode} % \end{macro} @@ -9314,15 +9407,14 @@ if (!isQuizInitialized("@currQuiz")) { \let\@currentQues\@empty \let\eqQzQuesList\@empty \def\eq@AddProbToQzQuesList{% - \edef\eq@tmpExp{\noexpand\g@addto@macro% + \edef\eq@tmpExp{\noexpand\g@addto@macro% % \end{macrocode} % Cosmetic change replaced \cs{noexpand} with \cs{string}. % \changes{v8.2.15}{2019/08/06}{replace \string\cs{noexpand} with \string\cs{string}} % \changes{v8.5.4}{2019/11/03}{Reverted to \string\cs{noexpand}} % \begin{macrocode} - \noexpand\eqQzQuesList{\noexpand - \@eqListExp{\@currentQues}{\the\c@page}}}% -% \@eqListExp{\@currentQues}{\thepage}}}% + \noexpand\eqQzQuesList{\noexpand + \@eqListExp{\@currentQues}{\the\c@page}}}% % \end{macrocode} % We add to the list only if we are not within a \texttt{mathGrp} environment. % \begin{macrocode} @@ -9348,9 +9440,9 @@ if (!isQuizInitialized("@currQuiz")) { % the page that contains the button, the JS is executes. % \begin{macrocode} \def\pbPopulateSumTable{\pushButton[\W0\BG{}\BC{}\S{S}\autoCenter{n} - \TU{\thequestionno}\Ff{\FfReadOnly} - \AA{\AAPageVisible{try{popVisitsTbl("\currQuiz",\thequestionno)}% - catch(e){}}}]{\currQuiz activateSC}{0pt}{0pt}} + \TU{\thequestionno}\Ff{\FfReadOnly} + \AA{\AAPageVisible{try{popVisitsTbl("\currQuiz",\thequestionno)}% + catch(e){}}}]{\currQuiz activateSC}{0pt}{0pt}} % \end{macrocode} % (2013/12/29) Here are some ideas to think about. Each change in the response to a question % can execute the following code. I've put the needed information in the tooltip @@ -9411,28 +9503,28 @@ if (!isQuizInitialized("@currQuiz")) { %\end{description} % \begin{macrocode} \define@key{smrytbl}{ntables}{% - \@tempcntb=#1 - \ifnum\@tempcntb<1 \@tempcntb=1 \fi - \ifnum\@tempcntb>3 \@tempcntb=3 \fi - \edef\smrytbl@ntables{\the\@tempcntb}% + \@tempcntb=#1 + \ifnum\@tempcntb<\@ne\@tempcntb=\@ne\fi + \ifnum\@tempcntb>\thr@@\@tempcntb=\thr@@\fi + \edef\smrytbl@ntables{\the\@tempcntb}% } \def\smrytbl@ntables{2} \define@key{smrytbl}{showmarkup}[true]{% - \csname if#1\endcsname\eqshowmarkuptrue - \else\eqshowmarkupfalse\fi + \csname if#1\endcsname\eqshowmarkuptrue + \else\eqshowmarkupfalse\fi } \newif\ifsmrytbl@corrections\smrytbl@correctionstrue \define@key{smrytbl}{nocorrections}[true]{% - \csname if#1\endcsname\smrytbl@correctionsfalse - \else\smrytbl@correctionstrue\fi + \csname if#1\endcsname\smrytbl@correctionsfalse + \else\smrytbl@correctionstrue\fi } \define@key{smrytbl}{showOutOf}[true]{% - \csname if#1\endcsname\eqshowOutOftrue\def\stfmtType{OO}% - \gdef\showOutOfinSmryTbl{true}\let\stmarkupbox\relax - \else - \eqshowOutOffalse\let\stfmtType\@empty - \gdef\showOutOfinSmryTbl{false}% - \fi + \csname if#1\endcsname\eqshowOutOftrue\def\stfmtType{OO}% + \gdef\showOutOfinSmryTbl{true}\let\stmarkupbox\relax + \else + \eqshowOutOffalse\let\stfmtType\@empty + \gdef\showOutOfinSmryTbl{false}% + \fi } \let\stfmtType\@empty \define@key{smrytbl}{setDimens}[]{#1} @@ -9442,61 +9534,60 @@ if (!isQuizInitialized("@currQuiz")) { % Finally we come to the definition of \cs{displaySumryTbl}. % \begin{macrocode} \newcommand{\displaySumryTbl}[2][]{% - \begingroup\edef\currQuiz{#2}\edef\oField{#2}\edef\curr@quiz{#2}% - \setkeys{smrytbl}{#1}% - \eqtmpcnta\smrytbl@ntables\relax + \begingroup\edef\currQuiz{#2}\edef\oField{#2}\edef\curr@quiz{#2}% + \setkeys{smrytbl}{#1}% + \eqtmpcnta\smrytbl@ntables\relax % \end{macrocode} % We accept only 1 or 2 as an argument, we put it in \cs{count0}, % if not an integer, we'll stop the compile. If the argument is not 1, % we force a value of 2. % \begin{macrocode} -% \ifnum\eqtmpcnta=\@ne\else\eqtmpcnta\tw@\fi - \eq@rowcnt\z@\@tempcntb=\value{questionno}% + \eq@rowcnt\z@\@tempcntb=\value{questionno}% % \end{macrocode} % We calculate the number of rows in the first column, in case % of a two column table. When the number of questions is odd, % the the left-hand table will have one more entry than the right-hand % column. % \begin{macrocode} - \ifnum\eqtmpcnta=\tw@ - \divide\@tempcntb\tw@ - \advance\@tempcntb\ifodd\value{questionno}2\else1\fi - \xdef\@beginSecCol{\the\@tempcntb}% - \advance\@tempcntb-1\relax - \fi + \ifnum\eqtmpcnta=\tw@ + \divide\@tempcntb\tw@ + \advance\@tempcntb\ifodd\value{questionno}\tw@\else\@ne\fi + \xdef\@beginSecCol{\the\@tempcntb}\advance + \@tempcntb\m@ne + \fi % \end{macrocode} % Three table support % \begin{macrocode} - \ifnum\eqtmpcnta=\thr@@ - \edef\eq@n{\the\@tempcntb}% - \divide\@tempcntb\eqtmpcnta - \edef\eq@q{\the\@tempcntb}% - \@tempcnta=\@tempcntb\multiply\@tempcnta3 - \edef\eq@p{\the\@tempcnta}% - \@tempcnta=\eq@n - \advance\@tempcnta-\eq@p\relax - \ifnum\@tempcnta=\z@ - \@tempcntb=\eq@q \advance\@tempcntb\@ne - \xdef\@beginSecCol{\the\@tempcntb}% - \advance\@tempcntb\eq@q\relax - \xdef\@beginThrdCol{\the\@tempcntb}% - \else\ifnum\@tempcnta=\@ne - \@tempcntb=\eq@q \advance\@tempcntb\@ne - \edef\nB@lCols{\the\@tempcntb}% - \advance\@tempcntb\@ne - \xdef\@beginSecCol{\the\@tempcntb}% - \advance\@tempcntb\eq@q\relax - \xdef\@beginThrdCol{\the\@tempcntb}% - \else\ifnum\@tempcnta=2\relax - \@tempcntb=\eq@q \advance\@tempcntb1 - \edef\nB@lCols{\the\@tempcntb}% - \advance\@tempcntb\@ne - \xdef\@beginSecCol{\the\@tempcntb}% - \advance\@tempcntb\nB@lCols - \xdef\@beginThrdCol{\the\@tempcntb}% - \fi\fi\fi - \@tempcntb=\eq@n - \fi + \ifnum\eqtmpcnta=\thr@@ + \edef\eq@n{\the\@tempcntb}% + \divide\@tempcntb\eqtmpcnta + \edef\eq@q{\the\@tempcntb}% + \@tempcnta=\@tempcntb\multiply\@tempcnta3 + \edef\eq@p{\the\@tempcnta}% + \@tempcnta=\eq@n + \advance\@tempcnta-\eq@p\relax + \ifnum\@tempcnta=\z@ + \@tempcntb=\eq@q \advance\@tempcntb\@ne + \xdef\@beginSecCol{\the\@tempcntb}% + \advance\@tempcntb\eq@q\relax + \xdef\@beginThrdCol{\the\@tempcntb}% + \else\ifnum\@tempcnta=\@ne + \@tempcntb=\eq@q \advance\@tempcntb\@ne + \edef\nB@lCols{\the\@tempcntb}% + \advance\@tempcntb\@ne + \xdef\@beginSecCol{\the\@tempcntb}% + \advance\@tempcntb\eq@q\relax + \xdef\@beginThrdCol{\the\@tempcntb}% + \else\ifnum\@tempcnta=\tw@ + \@tempcntb=\eq@q \advance\@tempcntb\@ne + \edef\nB@lCols{\the\@tempcntb}% + \advance\@tempcntb\@ne + \xdef\@beginSecCol{\the\@tempcntb}% + \advance\@tempcntb\nB@lCols + \xdef\@beginThrdCol{\the\@tempcntb}% + \fi\fi\fi + \@tempcntb=\eq@n + \fi % \end{macrocode} % We \cs{let} \cs{@eqListExp} to \cs{@@eqListExp}, defined below. % \begin{macrocode} @@ -9513,9 +9604,9 @@ if (!isQuizInitialized("@currQuiz")) { % This is a definition of \cs{@eqListExp}. It appears in the % token list \cs{eqQzQuesList}. A typical entry in \cs{eqQzQuesList} is % of the form -%\begin{verbatim} -% \@eqListExp{<question_label>}{\thepage} -%\end{verbatim} +%\begin{quote}\ttfamily +%\string\@eqListExp\darg{\ameta{question\_label}}\darg{\string\thepage} +%\end{quote} % We use the two arguments to construct a table of three columns: Question (consisting % of the question label); Responded (a checkbox that is checked if that question was answered); % and Page (a hypertext link to the page containing he question). The command may be redefined @@ -9525,8 +9616,8 @@ if (!isQuizInitialized("@currQuiz")) { % headings (may be redefined). % \begin{macrocode} \def\eq@begintab{% - \begin{tabular}[t]{lcc}\sumryTblQ&\sumryTblR&\sumryTblP\\\sthline - {\Large\strut}} + \begin{tabular}[t]{lcc}\sumryTblQ&\sumryTblR&\sumryTblP\\\sthline + {\Large\strut}} % \end{macrocode} % \DescribeMacro{\sthline}\cmd{\sthline} % is a user hook to change the appearance of the horizontal line, such @@ -9563,12 +9654,13 @@ if (!isQuizInitialized("@currQuiz")) { % and stMarkup text field. % \begin{macrocode} \def\st@scndclmn{% - \checkBox[\Ff{\FfReadOnly}]% - {\ccatCurrQzWith(SanityCheck).\the\eq@rowcnt}% - {\markupHeight}{\markupHeight}{Yes}\ifeqshowmarkup - \stmarkupbox{\sumrytblCkMUsep\textField[% - \Ff\FfReadOnly\BC{}\textColor{\pcMarkupColor}% - \textSize{\stmarkupTextSize}\autoCenter{n}% + \checkBox[\Ff{\FfReadOnly}] + {\ccatCurrQzWith(SanityCheck).\the\eq@rowcnt} + {\markupHeight}{\markupHeight}{Yes}% + \ifeqshowmarkup + \stmarkupbox{\sumrytblCkMUsep\textField[% + \Ff\FfReadOnly\BC{}\textColor{\pcMarkupColor} + \textSize{\stmarkupTextSize}\autoCenter{n}] % \end{macrocode} % Key to being able to have duplicated summary fields with different \texttt{showOutOf} % options is the naming of the text field. If \texttt{showOutOf=false}, the default, @@ -9576,18 +9668,19 @@ if (!isQuizInitialized("@currQuiz")) { % text field is named \cs{currQuizSanityCheckOOPts}. When the Correct button is pressed, % the JavaScript function \texttt{correctSumryTbl()} checks for the existence of each of % these two fields, and populates them properly formatted. The command \cs{stfmtType} is -% either \cs{empty} or \cs{OO}. +% either \cs{@empty} or \cs{OO}. % \begin{macrocode} - ]{\ccatCurrQzWith(SanityCheck\stfmtType Pts).\the\eq@rowcnt}% - {\stmarkupWidth}{\stmarkupHeight}}\fi + {\ccatCurrQzWith(SanityCheck\stfmtType Pts).\the\eq@rowcnt}% + {\stmarkupWidth}{\stmarkupHeight}}% + \fi } % \end{macrocode} % \textbf{Third column.} The third column of the table consisting of a link to the % page that contains the question. % \begin{macrocode} \def\st@thrdclmn#1{% - \setLink[\linktxtcolor{\@linkcolor} - \A{\JS{this.pageNum=(#1-1)}}]{\sumrytbllinkHook{#1}}} + \setLink[\linktxtcolor{\@linkcolor} + \A{\JS{this.pageNum=(#1-1)}}]{\sumrytbllinkHook{#1}}} % \end{macrocode} % Now for the definition of \cs{@@eqListExp} which does the work in the table. % \begin{macrocode} @@ -9597,20 +9690,20 @@ if (!isQuizInitialized("@currQuiz")) { % when the page becomes visible, and we expand \cs{eq@begintab}, which % is a \texttt{tabular} environment. % \begin{macrocode} - \ifnum\eq@rowcnt=\@ne - \pbPopulateSumTable\ifsmrytbl@corrections\else - \pbDoNoCorrectSumryTbl\fi\expandafter\eq@begintab\fi + \ifnum\eq@rowcnt=\@ne + \pbPopulateSumTable\ifsmrytbl@corrections\else + \pbDoNoCorrectSumryTbl\fi\expandafter\eq@begintab\fi % \end{macrocode} % If it is the two table solution, and the row number equals the calculated % value of the first row of the second table, we emit another % \cs{eq@begintab}. % \begin{macrocode} - \ifnum\eqtmpcnta>\@ne\ifnum\eq@rowcnt=\@beginSecCol\relax - \eq@endtab\expandafter\sumrytablesep\expandafter\eq@begintab - \fi\fi - \ifnum\eqtmpcnta=\thr@@\ifnum\eq@rowcnt=\@beginThrdCol\relax - \eq@endtab\expandafter\sumrytablesep\expandafter\eq@begintab - \fi\fi + \ifnum\eqtmpcnta>\@ne\ifnum\eq@rowcnt=\@beginSecCol\relax + \eq@endtab\expandafter\sumrytablesep\expandafter\eq@begintab + \fi\fi + \ifnum\eqtmpcnta=\thr@@\ifnum\eq@rowcnt=\@beginThrdCol\relax + \eq@endtab\expandafter\sumrytablesep\expandafter\eq@begintab + \fi\fi % \end{macrocode} % We layout a row of the table, problem label, checkbox, and page. % \begin{macrocode} @@ -9619,9 +9712,7 @@ if (!isQuizInitialized("@currQuiz")) { % We set the \cs{eq@endtab} at the bottom of the first table, % and at the bottom of the second table. % \begin{macrocode} -% \ifnum\count0=\tw@\ifnum\eq@rowcnt=\@tempcntb -% \expandafter\eq@endtab\fi\fi - \ifnum\eq@rowcnt=\thequestionno\relax\expandafter\eq@endtab\fi + \ifnum\eq@rowcnt=\value{questionno}\expandafter\eq@endtab\fi } % \end{macrocode} % @@ -9640,18 +9731,18 @@ if (!isQuizInitialized("@currQuiz")) { % total number of questions. % \begin{macrocode} \def\writeProListAux{% - \eq@IWAuxOut{\string - \csarg\string\gdef{\currQuiz QzQuesList}{\eqQzQuesList}}% - \eq@IWAuxOut{\string - \csarg\string\gdef{\currQuiz nQuestions}{\thequestionno}}% + \eq@IWAuxOut{\string + \csarg\string\gdef{\currQuiz QzQuesList}{\eqQzQuesList}}% + \eq@IWAuxOut{\string + \csarg\string\gdef{\currQuiz nQuestions}{\thequestionno}}% } % \end{macrocode} % \end{macro} % \begin{macrocode} \def\setParamSumryTblAux{% - \edef\eqQzQuesList{\@nameuse{\currQuiz QzQuesList}}% - \@ifundefined{\currQuiz nQuestions}{}{% - \value{questionno}=\@nameuse{\currQuiz nQuestions}}% + \edef\eqQzQuesList{\@nameuse{\currQuiz QzQuesList}}% + \@ifundefined{\currQuiz nQuestions}{}{% + \value{questionno}=\@nameuse{\currQuiz nQuestions}}% } % \end{macrocode} % \begin{environment}{sumryTblAux} @@ -9676,7 +9767,7 @@ if (!isQuizInitialized("@currQuiz")) { % quiz. % \begin{macrocode} \newenvironment{sumryTblAux}[1]{% - \DeclareQuiz{#1}\setParamSumryTblAux}{}% + \DeclareQuiz{#1}\setParamSumryTblAux}{}% % \end{macrocode} % \end{environment} % \begin{macrocode} @@ -9686,41 +9777,40 @@ if (!isQuizInitialized("@currQuiz")) { % \end{macrocode} % \subsection{Posing MC/math fill-in questions} % \begin{macrocode} -\def\bMCFI{% - \withinMCFItrue - \ifx\qRadionActionsHook\@empty - \let\qRadionActionsHook@SAVE\@empty - \def\qRadionActionsHook{\jsR - qRadioButtonMCFI(\Ans@choice,"\currQuiz",\thequestionno);}\else - \let\qRadionActionsHook@SAVE\qRadionActionsHook - \def\qRadionActionsHook{\qRadionActionsHook@SAVE\jsR - qRadioButtonMCFI(\Ans@choice,"\currQuiz",\thequestionno);}\fi - \ifx\every@RespBoxMath\@empty - \let\every@RespBoxMath@SAVE\@empty - \def\every@RespBoxMath{% - \AddAAKeystroke{mcfiKeyStroke("\currQuiz",\thequestionno);}}% - \else - \let\every@RespBoxMath@SAVE\every@RespBoxMath - \expandafter\def\expandafter\every@RespBoxMath\expandafter{% - \every@RespBoxMath@SAVE - \AddAAKeystroke{mcfiKeyStroke("\currQuiz",\thequestionno);}}% - \fi +\def\bMCFI{\withinMCFItrue + \ifx\qRadionActionsHook\@empty + \let\qRadionActionsHook@SAVE\@empty + \def\qRadionActionsHook{\jsR + qRadioButtonMCFI(\Ans@choice,"\currQuiz",\thequestionno);}\else + \let\qRadionActionsHook@SAVE\qRadionActionsHook + \def\qRadionActionsHook{\qRadionActionsHook@SAVE\jsR + qRadioButtonMCFI(\Ans@choice,"\currQuiz",\thequestionno);}\fi + \ifx\every@RespBoxMath\@empty + \let\every@RespBoxMath@SAVE\@empty + \def\every@RespBoxMath{% + \AddAAKeystroke{mcfiKeyStroke("\currQuiz",\thequestionno);}}% + \else + \let\every@RespBoxMath@SAVE\every@RespBoxMath + \expandafter\def\expandafter\every@RespBoxMath\expandafter + {\every@RespBoxMath@SAVE + \AddAAKeystroke{mcfiKeyStroke("\currQuiz",\thequestionno);}}% + \fi } \def\eMCFI{% - \ifx\qRadionActionsHook@SAVE\@empty - \let\qRadionActionsHook\@empty\else - \let\qRadionActionsHook\qRadionActionsHook@SAVE\fi - \ifx\every@RespBoxMath@SAVE\@empty - \let\every@RespBoxMath\@empty\else - \let\every@RespBoxMath\every@RespBoxMath@SAVE\fi - \withinMCFIfalse + \ifx\qRadionActionsHook@SAVE\@empty + \let\qRadionActionsHook\@empty\else + \let\qRadionActionsHook\qRadionActionsHook@SAVE\fi + \ifx\every@RespBoxMath@SAVE\@empty + \let\every@RespBoxMath\@empty\else + \let\every@RespBoxMath\every@RespBoxMath@SAVE\fi + \withinMCFIfalse } \def\eqNA{-43252452452} \@ifundefined{text}{\let\MCFIMarkup@BOX\mbox}{\let\MCFIMarkup@BOX\text} \newcommand\mcfiMarkupfmt{\cgBdry - ${}^{\MCFIMarkup@BOX{\aeb@creditmarkup}}$} + ${}^{\MCFIMarkup@BOX{\aeb@creditmarkup}}$} \def\mcfiMarkup{\addtocounter{questionno}{-1}\mcfiMarkupfmt - \stepcounter{questionno}} + \stepcounter{questionno}} %</mcfi> %<*package> % \end{macrocode} @@ -9748,8 +9838,8 @@ if (!isQuizInitialized("@currQuiz")) { % the color without commas. For example |\solutionColor{0 .6 0}| % \begin{macrocode} \newcommand{\solutionColor}[1]{\def\eq@argi{#1}\ifx\eq@argi\@empty - \def\solution@Color{\solutionColorDef}\else - \def\solution@Color{#1}\fi} + \def\solution@Color{\solutionColorDef}\else + \def\solution@Color{#1}\fi} \newcommand{\solutionColorDef}{0 .6 0} \solutionColor{\solutionColorDef} % \end{macrocode} @@ -9766,19 +9856,19 @@ if (!isQuizInitialized("@currQuiz")) { \def\eq@getCmdName#1#2{\edef#1{\expandafter\@gobble\string#2}} \def\eq@getfirst#1#2\@nil{\def\eq@argi{#1}} \def\eq@checkValidityModel#1{% - \if#1g\else\if#1r\else\if#1c\else - \PackageError{exerquiz} - {JavaScript does not support this model} - {Use a named color from one of the models gray, rgb, or cmyk.} - \fi\fi\fi + \if#1g\else\if#1r\else\if#1c\else + \PackageError{exerquiz} + {JavaScript does not support this model} + {Use a named color from one of the models gray, rgb, or cmyk.} + \fi\fi\fi } \def\eq@jsSetColorMsg#1#2{\PackageWarning{exerquiz} - {The argument `#2' of \string#1\MessageBreak - is not of the right form.\MessageBreak Using the default}} + {The argument `#2' of \string#1\MessageBreak + is not of the right form.\MessageBreak Using the default}} \def\eqModelInfo#1#2{% - \uppercase{\def\eq@ucmodel{#1}}\def\eq@modelspec{#2}% - \eq@getfirst#1\@nil\eq@ResetModelForGray{\eq@argi}% - \eq@checkValidityModel{\eq@argi}% + \uppercase{\def\eq@ucmodel{#1}}\def\eq@modelspec{#2}% + \eq@getfirst#1\@nil\eq@ResetModelForGray{\eq@argi}% + \eq@checkValidityModel{\eq@argi}% } \def\eq@ResetModelForGray#1{\if#1g\def\eq@ucmodel{G}\fi} % \end{macrocode} @@ -9786,40 +9876,40 @@ if (!isQuizInitialized("@currQuiz")) { % as the first two tokens. % \begin{macrocode} \def\eq@checkRawJSColor#1{% - \edef\eq@argi{#1}\ifx\eq@argi\@empty - \def\eq@next{\let\eq@rawJSCol\eq@YES}\else - \def\eq@next{\expandafter\eq@@checkRawJSColor#1\@nil}\fi\eq@next + \edef\eq@argi{#1}\ifx\eq@argi\@empty + \def\eq@next{\let\eq@rawJSCol\eq@YES}\else + \def\eq@next{\expandafter\eq@@checkRawJSColor#1\@nil}\fi\eq@next } \def\eq@@checkRawJSColor#1#2#3\@nil{\let\eq@rawJSCol\eq@NO - \let\eqpredefineJSCol\eq@NO - \if[#1\if#2"\let\eq@rawJSCol\eq@YES\fi\fi - \ifx\eq@rawJSCol\eq@NO\if#1c\if#2o\let\eq@rawJSCol\eq@YES - \let\eqpredefineJSCol\eq@YES\fi\fi\fi + \let\eqpredefineJSCol\eq@NO + \if[#1\if#2"\let\eq@rawJSCol\eq@YES\fi\fi + \ifx\eq@rawJSCol\eq@NO\if#1c\if#2o\let\eq@rawJSCol\eq@YES + \let\eqpredefineJSCol\eq@YES\fi\fi\fi } \def\eq@jsColorWXColori#1#2{\edef\eq@colorDefn{#2}% - \ifx\eq@colorDefn\@empty - \ifx\is@Defined\eq@YES - \edef\eq@colorDefn{\csname\cmdName Def\endcsname}\else - \PackageError{exerquiz}{JS color \string#1 has an - empty definition}{}\fi - \fi - \eq@checkRawJSColor{\eq@colorDefn}% - \ifx\eq@rawJSCol\eq@NO - \extractcolorspec{\eq@colorDefn}{\eq@tmp@color}% - \expandafter\eqModelInfo\eq@tmp@color - \edef#1{["\eq@ucmodel",\eq@modelspec]}% - \else\edef#1{\eq@colorDefn}\fi + \ifx\eq@colorDefn\@empty + \ifx\is@Defined\eq@YES + \edef\eq@colorDefn{\csname\cmdName Def\endcsname}\else + \PackageError{exerquiz}{JS color \string#1 has an + empty definition}{}\fi + \fi + \eq@checkRawJSColor{\eq@colorDefn}% + \ifx\eq@rawJSCol\eq@NO + \extractcolorspec{\eq@colorDefn}{\eq@tmp@color}% + \expandafter\eqModelInfo\eq@tmp@color + \edef#1{["\eq@ucmodel",\eq@modelspec]}% + \else\edef#1{\eq@colorDefn}\fi } \def\eq@jsColorWOXColori#1#2{\def\eq@colorDefn{#2}% - \ifx\eq@colorDefn\@empty - \ifx\is@Defined\eq@YES - \edef\eq@colorDefn{\csname cmdName Def\endcsname}\else - \PackageError{exerquiz}{JS color \string#1 has an - empty definition}{}\fi - \fi - \eq@checkRawJSColor{\eq@colorDefn}% - \ifx\eq@rawJSCol\eq@YES\edef#1{\eq@colorDefn}\else - \eq@jsSetColorMsg{#1}{#2}\fi + \ifx\eq@colorDefn\@empty + \ifx\is@Defined\eq@YES + \edef\eq@colorDefn{\csname cmdName Def\endcsname}\else + \PackageError{exerquiz}{JS color \string#1 has an + empty definition}{}\fi + \fi + \eq@checkRawJSColor{\eq@colorDefn}% + \ifx\eq@rawJSCol\eq@YES\edef#1{\eq@colorDefn}\else + \eq@jsSetColorMsg{#1}{#2}\fi } % \end{macrocode} % \DescribeMacro{\jsColor} General command for defining a JavaScript Color, and support commands for @@ -9837,13 +9927,13 @@ if (!isQuizInitialized("@currQuiz")) { % When \textsf{xcolor} is not used, only the JavaScript format is allowed. % \begin{macrocode} \def\jsColor#1#2{\eq@getCmdName{\cmdName}{#1}% - \let\is@Defined\eq@YES - \expandafter\ifx\csname\cmdName\endcsname\relax - \PackageWarning{exerquiz}{\string#1 is not a command used by - exerquiz.\MessageBreak Will define it anyway}% - \let\is@Defined\eq@NO\fi - \HyColor@IfXcolor{\eq@jsColorWXColori{#1}{#2}}% - {\eq@jsColorWOXColori{#1}{#2}}% + \let\is@Defined\eq@YES + \expandafter\ifx\csname\cmdName\endcsname\relax + \PackageWarning{exerquiz}{\string#1 is not a command used by + exerquiz.\MessageBreak Will define it anyway}% + \let\is@Defined\eq@NO\fi + \HyColor@IfXcolor{\eq@jsColorWXColori{#1}{#2}}% + {\eq@jsColorWOXColori{#1}{#2}}% } % \end{macrocode} % \begin{macrocode} @@ -9855,10 +9945,10 @@ if (!isQuizInitialized("@currQuiz")) { % (\string\texttt{eqcolor})} % \begin{macrocode} \@ifundefined{jsColor}{% - \InputIfFileExists{eqcolor.def}{\PackageInfo{exerquiz} - {Inputting eqcolor.def}} - {\PackageError{exerquiz}{cannot find eqcolor.def} - {Refresh your file name database and try again.}} + \InputIfFileExists{eqcolor.def}{\PackageInfo{exerquiz} + {Inputting eqcolor.def}} + {\PackageError{exerquiz}{cannot find eqcolor.def} + {Refresh your file name database and try again.}} }{} % \end{macrocode} % @@ -9897,26 +9987,26 @@ if (!isQuizInitialized("@currQuiz")) { % These must be declared in the preamble. % \begin{macrocode} \def\chooseJSsymbol{\@ifstar{\let\eq@isstar\eq@YES\chooseJSsymboli} - {\let\eq@isstar\eq@NO\chooseJSsymboli}} + {\let\eq@isstar\eq@NO\chooseJSsymboli}} \def\chooseJSsymboli#1{\lowercase{\edef\eq@arg{#1}}% - \def\eq@carg{check}\ifx\eq@arg\eq@carg - \def\eq@retnStyle{style.ch}\else - \def\eq@carg{cross}\ifx\eq@arg\eq@carg - \def\eq@retnStyle{style.cr}\else - \def\eq@carg{diamond}\ifx\eq@arg\eq@carg - \def\eq@retnStyle{style.di}\else - \def\eq@carg{circle}\ifx\eq@arg\eq@carg - \def\eq@retnStyle{style.ci}\else - \def\eq@carg{star}\ifx\eq@arg\eq@carg - \def\eq@retnStyle{style.st}\else - \def\eq@carg{square}\ifx\eq@arg\eq@carg - \def\eq@retnStyle{style.sq}\else - \let\eq@retnStyle\@empty - \ifx\eq@isstar\eq@NO\PackageWarning{exerquiz} - {Argument `#1' not recognized.\MessageBreak - Permissible values are check, cross, diamond,\MessageBreak - circle, star, square. Will use the default}\fi - \fi\fi\fi\fi\fi\fi + \def\eq@carg{check}\ifx\eq@arg\eq@carg + \def\eq@retnStyle{style.ch}\else + \def\eq@carg{cross}\ifx\eq@arg\eq@carg + \def\eq@retnStyle{style.cr}\else + \def\eq@carg{diamond}\ifx\eq@arg\eq@carg + \def\eq@retnStyle{style.di}\else + \def\eq@carg{circle}\ifx\eq@arg\eq@carg + \def\eq@retnStyle{style.ci}\else + \def\eq@carg{star}\ifx\eq@arg\eq@carg + \def\eq@retnStyle{style.st}\else + \def\eq@carg{square}\ifx\eq@arg\eq@carg + \def\eq@retnStyle{style.sq}\else + \let\eq@retnStyle\@empty + \ifx\eq@isstar\eq@NO\PackageWarning{exerquiz} + {Argument `#1' not recognized.\MessageBreak + Permissible values are check, cross, diamond,\MessageBreak + circle, star, square. Will use the default}\fi + \fi\fi\fi\fi\fi\fi } % \end{macrocode} % \begin{macro}{\setRightAnsSymb} @@ -9928,41 +10018,38 @@ if (!isQuizInitialized("@currQuiz")) { % The check style when the use chooses the incorrect answer. % (def: \texttt{style.cr}) % \begin{macrocode} -%\def\defineAnsStyle#1#2{% -% \eq@getCmdName{\cmdName}{#1}\let\is@Defined\eq@YES -%} \newcommand\setRghtAnsSymb[1]{\chooseJSsymbol{#1}% - \ifx\eq@retnStyle\@empty\else - \edef\rghtAnsSymbJS{\eq@retnStyle}% - \edef\rghtAnsSymb{\eq@carg}\fi} + \ifx\eq@retnStyle\@empty\else + \edef\rghtAnsSymbJS{\eq@retnStyle}% + \edef\rghtAnsSymb{\eq@carg}\fi} \def\rghtAnsSymbJS{style.ch} \def\rghtAnsSymb{check} \newcommand\setCorrAnsSymb[1]{\chooseJSsymbol{#1}% - \ifx\eq@retnStyle\@empty\else - \edef\corrAnsSymbJS{\eq@retnStyle}% - \edef\corrAnsSymb{\eq@carg}\fi} + \ifx\eq@retnStyle\@empty\else + \edef\corrAnsSymbJS{\eq@retnStyle}% + \edef\corrAnsSymb{\eq@carg}\fi} \def\corrAnsSymbJS{style.ci} \def\corrAnsSymb{circle} \newcommand\setWrngAnsSymb[1]{\chooseJSsymbol{#1}% - \ifx\eq@retnStyle\@empty\else - \edef\wrngAnsSymbJS{\eq@retnStyle}% - \edef\wrngAnsSymb{\eq@carg}\fi} + \ifx\eq@retnStyle\@empty\else + \edef\wrngAnsSymbJS{\eq@retnStyle}% + \edef\wrngAnsSymb{\eq@carg}\fi} \def\wrngAnsSymbJS{style.cr} \def\wrngAnsSymb{cross} \def\setRghtAnsSymbLoc#1{\chooseJSsymbol*{#1}% - \ifx\eq@retnStyle\@empty - \let\rghtAnsSymbJSLoc\@empty\else - \edef\rghtAnsSymbJSLoc{\eq@retnStyle}\fi + \ifx\eq@retnStyle\@empty + \let\rghtAnsSymbJSLoc\@empty\else + \edef\rghtAnsSymbJSLoc{\eq@retnStyle}\fi } \def\setCorrAnsSymbLoc#1{\chooseJSsymbol*{#1}% - \ifx\eq@retnStyle\@empty - \let\corrAnsSymbJSLoc\@empty\else - \edef\corrAnsSymbJSLoc{\eq@retnStyle}\fi + \ifx\eq@retnStyle\@empty + \let\corrAnsSymbJSLoc\@empty\else + \edef\corrAnsSymbJSLoc{\eq@retnStyle}\fi } \def\setWrngAnsSymbLoc#1{\chooseJSsymbol*{#1}% - \ifx\eq@retnStyle\@empty - \let\wrngAnsSymbJSLoc\@empty\else - \edef\wrngAnsSymbJSLoc{\eq@retnStyle}\fi + \ifx\eq@retnStyle\@empty + \let\wrngAnsSymbJSLoc\@empty\else + \edef\wrngAnsSymbJSLoc{\eq@retnStyle}\fi } \let\rghtAnsSymbJSLoc\@empty \let\rghtAnsSymbJSLocDef\@empty @@ -10078,6 +10165,7 @@ if (!isQuizInitialized("@currQuiz")) { %\end{flushleft} % Define a special value (\cs{formatInitAltApprs}) for \cs{AddAAFormat} used in initializing \cs{RespBoxMath} problems, % where there are alternate appearances. +% See \url{http://www.acrotex.net/blog/?p=1335} for a discussion of the use of \cs{formatInitAltApprs}. % \changes{v8.1a}{2017/09/03}{Define a special value (\string\cs{formatInitAltApprs}) for \string\cs{AddAAFormat}} % \begin{macrocode} \def\formatInitAltApprs{\formatInitAltApprs} @@ -10170,7 +10258,7 @@ if (!isQuizInitialized("@currQuiz")) { %} % \begin{macrocode} \def\@eqAddAAKeystroke#1{\def\argi{#1}\ifx\argi\@empty - \def\eqAddAAKeystroke{}\else\def\eqAddAAKeystroke{#1}\fi} %\r + \def\eqAddAAKeystroke{}\else\def\eqAddAAKeystroke{#1}\fi} %\r \def\eqAddAAKeystroke{} % \end{macrocode} % \end{macro} @@ -10182,10 +10270,10 @@ if (!isQuizInitialized("@currQuiz")) { % and \string\cs{@eqAddAAMouseUpMS}} % \begin{macrocode} \def\@eqAddAAMouseUpMC#1{\def\argi{#1}\ifx\argi\@empty - \def\eqAddAAMouseUpMC{}\else\def\eqAddAAMouseUpMC{#1}\fi} + \def\eqAddAAMouseUpMC{}\else\def\eqAddAAMouseUpMC{#1}\fi} \def\eqAddAAMouseUpMC{} \def\@eqAddAAMouseUpMS#1{\def\argi{#1}\ifx\argi\@empty - \def\eqAddAAMouseUpMS{}\else\def\eqAddAAMouseUpMS{#1}\fi} + \def\eqAddAAMouseUpMS{}\else\def\eqAddAAMouseUpMS{#1}\fi} \def\eqAddAAMouseUpMS{} % \end{macrocode} % \end{macro} @@ -10203,17 +10291,15 @@ if (!isQuizInitialized("@currQuiz")) { % #4 = the height of the bounding rectangle %\end{verbatim} % \begin{macrocode} -\def\eqIconDefaults -{% - \rawPDF{}\S{}\mkIns{/TP 1}\W{} - \CA{}\RC{}\AC{}\BC{}\BG{}\H{N} - \textColor{0 g}\Ff{\FfReadOnly} +\def\eqIconDefaults{% + \rawPDF{}\S{}\mkIns{/TP 1}\W{} + \CA{}\RC{}\AC{}\BC{}\BG{}\H{N} + \textColor{0 g}\Ff{\FfReadOnly} } -\newcommand\eqIcon[4][] -{% - \mbox{\push@@Button{#1}{#2}{#3}{#4}{}{\eq@setButtonProps - \eq@Button@driver}{\eqIconDefaults\every@ButtonField - \every@eqIcon}}% +\newcommand\eqIcon[4][]{% + \mbox{\push@@Button{#1}{#2}{#3}{#4}{}{\eq@setButtonProps + \eq@Button@driver}{\eqIconDefaults\every@ButtonField + \every@eqIcon}}% } % \end{macrocode} % \end{macro} @@ -10235,15 +10321,8 @@ if (!isQuizInitialized("@currQuiz")) { % \begin{macrocode} \def\aeb@array{new Array} % \end{macrocode} -% The following definitions are associated with \texttt{requireForm()}, the JS function -% defined below. -% \begin{macrocode} -%\newcommand{\defaultReqFormMsg}{% -% "The expression is not in the expected form."} -% \end{macrocode} % (07/16/11) Some definitions that may be used by \texttt{requireForm}, a \cs{RespMathBox} filter % \begin{macrocode} -%\def\refac(#1){\\(#1\\)}\def\regrp(#1){(#1)}\def\rechrclass(#1){[#1]} \def\refac#1{\\(#1\\)}\def\regrp#1{(#1)}\def\rechrclass#1{[#1]} \def\redm{\\.}\def\remul{\\*}\def\rediv{\\/}\def\repow{\\^} \def\redigit{\\d}\def\reany{.}\def\rebstr{\string^}\def\reestr{\string$} @@ -10254,9 +10333,6 @@ if (!isQuizInitialized("@currQuiz")) { % (10/07/11) Some convenience commands to simplifying the use of the \texttt{priorParse} % and \texttt{postParse} filters. % \begin{macrocode} -%\def\preDenyForm(#1){\Array(denyForm,#1)} -%\def\preReqForm(#1){\Array(requireForm,#1)} -%\def\postDenyForm(#1){\Array(requireFormNot,#1)} \def\preReqForm{\Array(requireForm,\@gobble} \def\preDenyForm{\Array(denyForm,\@gobble} \def\postDenyForm{\Array(requireFormNot,\@gobble} @@ -10268,7 +10344,7 @@ if (!isQuizInitialized("@currQuiz")) { % of the no peeking alert box. % \begin{macrocode} \newcommand{\noPeekArgs}[1]{% - \def\NoPeekAlert{eqAppAlert(#1)}}\def\newNoPeekArgs{} + \def\NoPeekAlert{eqAppAlert(#1)}}\def\newNoPeekArgs{} \def\NoPeekAlert{eqAppAlert(\noPeekMsg,3)} % \end{macrocode} % \begin{macrocode} @@ -10281,7 +10357,7 @@ if (!isQuizInitialized("@currQuiz")) { \def\corrChoiceFullyOff{\def\eqCorrChoiceFully{false}} \corrChoiceFullyOn % \end{macrocode} -% Implement a local version of full corrections of MS and MS +% Implement a local version of full corrections of MC and MS % \changes{v8.1l}{2018/02/07}{Add local version of \string\cs{corrChoiceFullOn}} % \begin{macrocode} \def\corrLocalChoiceFullyOn{\def\eqCorrLocalChoiceFully{true}} @@ -10354,7 +10430,6 @@ var pi = Math.PI; var replaceExclaim = \replaceexclaim; var negPointsAllowed = \negpointsallowed; var negPointsMarkupAllowed = \negpointsmarkupallowed; -%var aQuizControl = new Array(); var aQuizControl = new Object; var RightWrong=new Array(); var ProbValue = new Array(); @@ -11745,6 +11820,38 @@ function eqFilter(filterMethod) { return this.toString(); } } +% \end{macrocode} +% JavaScript support of spell checking command |\SpellCheck| +% \changes{v8.5.11}{2020/11/11}{JavaScript support of spell checking command \string\cs{SpellCheck}}. +% Returns the number of misspelled words, but allows user to to correct. +% \begin{macrocode} +function checkTheSpelling(targetFieldName) { + var spellChkCnt=0; +% var thisName=event.target.name; +% \end{macrocode} +% The root name of the \cs{SpellCheck} field is \texttt{spl}. Here we replace +% the root name with \texttt{obj} to get the field name of the previous \cs{RespBoxTxt(PC)} +% field. For the \texttt{spell.checkWord()} method, \app{PDF-XChange Editor} returns \texttt{undefined}. +% This (spell checking) is a AR/AA feature only. +% \begin{macrocode} +% var fName = "obj"+thisName.substring(3); +% var f=this.getField(fName); +% if (f==null) fName="grpobj"+thisName.substring(3); + var f=this.getField(targetFieldName); + var value=f.value; + var valueStrip = value.replace(/\s+/g,""); + if ( valueStrip != "" ) { + aBrk=value.split(/\s+/); + for (var i=0; i<aBrk.length; i++){ + var word=aBrk[i]; + var aRetnSC=spell.checkWord(word); + if (aRetnSC!=null) spellChkCnt++; + } + var corrdStr=spell.checkText(value); + f.value=corrdStr; + } + return spellChkCnt; +} \end{newsegment} % \end{macrocode} % \subsection{Multiple Choice Questions} @@ -11836,12 +11943,12 @@ function InitializeQuiz(qtfield,mark) { ProcessIt = false; aQuizControl[qtfield] = 1; this.resetForm(["ScoreField." + qtfield,"mc."+qtfield, - "obj."+qtfield,"mck."+qtfield,"Ans."+qtfield, - "PointsField."+qtfield,"PercentField."+qtfield, - "essay."+qtfield,"GradeField."+qtfield, - "grpobj."+qtfield,"qMark."+qtfield, qtfield+"SanityCheck", - qtfield+"SanityCheckPts",qtfield+"SanityCheckOOPts", - "rbmarkup."+qtfield]); + "obj."+qtfield,"mck."+qtfield,"Ans."+qtfield, + "PointsField."+qtfield,"PercentField."+qtfield, + "essay."+qtfield,"GradeField."+qtfield, + "grpobj."+qtfield,"qMark."+qtfield, qtfield+"SanityCheck", + qtfield+"SanityCheckPts",qtfield+"SanityCheckOOPts", + "rbmarkup."+qtfield]); ProcessIt = true; var f = this.getField("qMark."+qtfield); if ( f != null ) f.display = display.hidden; @@ -11990,16 +12097,16 @@ function DisplayQuizResults(qtfield,nPointTotal,nQuestions) NPointTotal=nPointTotal; NQuestions=nQuestions; for (var i=1; i < RightWrong.length; i++) { - if ( (typeof RightWrong[i] == "object" ) % -&& ( RightWrong[i][0] == "grp" ) ) { + if ( (typeof RightWrong[i] == "object" ) && % +( RightWrong[i][0] == "grp" ) ) { // grouped question - Score += GrpRight(RightWrong[i], i, qtfield); - var aWeights = ProbValue[i].slice(2); - var evalGrpJS = eval(ProbValue[i][1]); - var evalGrpJSValue = evalGrpJS(this,qtfield,i, - RightWrong[i],aWeights); - ProbDist[i] = evalGrpJSValue; - ptScore = ptScore + evalGrpJSValue; + Score += GrpRight(RightWrong[i], i, qtfield); + var aWeights = ProbValue[i].slice(2); + var evalGrpJS = eval(ProbValue[i][1]); + var evalGrpJSValue = evalGrpJS(this,qtfield,i, + RightWrong[i],aWeights); + ProbDist[i] = evalGrpJSValue; + ptScore = ptScore + evalGrpJSValue; } else { if (typeof RightWrong[i] == "object") { if ( RightWrong[i][0] == 1 ) { @@ -12018,20 +12125,21 @@ function DisplayQuizResults(qtfield,nPointTotal,nQuestions) % If the user receives negative points, we change it to zero points. % \changes{v8.5.9}{2020/02/21}{If the user receives negative points, we change it to zero points.} % \begin{macrocode} - if (!negPointsAllowed && !negPointsMarkupAllowed) if (ProbDist[i]<0) ProbDist[i]=0 + if (!negPointsAllowed && % +!negPointsMarkupAllowed && (ProbDist[i]<0) ) ProbDist[i]=0; } ptScore += (1*ProbDist[i]); } } else { if (RightWrong[i]==1) { Score++; - ProbDist[i] = ( typeof ProbValue[i] == "object") ? - 1*ProbValue[i][1] : 1*ProbValue[i]; + ProbDist[i] = ( typeof ProbValue[i] == "object") ? % +1*ProbValue[i][1] : 1*ProbValue[i]; ptScore += (1*ProbDist[i]); } else { - ProbDist[i] = ( typeof ProbValue[i] == "object") ? - 1*ProbValue[i][2] : 0; + ProbDist[i] = ( typeof ProbValue[i] == "object") ? % +1*ProbValue[i][2] : 0; ptScore += (1*ProbDist[i]); } } @@ -12158,7 +12266,7 @@ function ProcessQuestion (key,letterresp,probno, function correctQuiz(qtfield,nQuestions) { % \end{macrocode} -% (2019/10/14) If \texttt{oRecordOfQuizData} is present (from \pkg{eq-save}, we use that data from the quiz. +% (2019/10/14) If \texttt{oRecordOfQuizData} is present (from \pkg{eq-save}), we use that data from the quiz. % \changes{v8.5.1}{2019/10/14}{Incorporated oRecordOfQuizData into correctQuiz()} % \begin{macrocode} var bROQD=(typeof oRecordOfQuizData=="object"); @@ -12439,6 +12547,12 @@ quizno,qtfield,pts,ppts) { var retn = [ [ scoreThisProblem, passKey ], letterResponses ] ; return retn; } +% \end{macrocode} +% \leavevmode\IndexJS{LimitSelection}\hskip-\marginparsep\texttt{(\ameta{n},\ameta{fname},\ameta{index}} +% This function supports the \cs{limitSelectionTo\darg{\ameta{n}}} command. The function determines +% whether the user has chosen more than \ameta{n} in a MS choice field. The widget that activated this +% function is \texttt{\ameta{fname}.\ameta{index}}. +% \begin{macrocode} function LimitSelection(n,fname,k) { var f = this.getField(fname); var g = f.getArray(); @@ -12941,6 +13055,9 @@ function qRadioButtonMCFI(key,qname,n) { R\texorpdfstring{\'}{\string\351}ponses} \renewcommand\eq@local@RC{Correctes} \renewcommand\eq@local@AC{SVP !} +\dlJSStr*[noquotes]{\limSelWarningMsg}{"Pour cette question, + vous \u00EAtes autoris\'{e} \`{a} faire au plus " + + n + " s\'{e}lections."} %</eqfr> % \end{macrocode} % \subsection{German} @@ -13060,7 +13177,7 @@ function qRadioButtonMCFI(key,qname,n) { + " sonst wird diese Antwort als falsch gewertet."} \dlJSStr*[noquotes]{\limSelWarningMsg}{"F\"{u}r diese Aufgabe k\"{o}nnen sie h\"{o}chstens " + n + " ausw\string\344hlen."} -\fieldJSStr*[noquotes]{\promptButtonMsg}{% +\flJSStr*[noquotes]{\promptButtonMsg}{% "M\"{o}chten Sie die richtige Antwort jetzt sehen?" + " Ihre derzeitige Antwort ist diejenige, die gewertet wird." + " Wenn Sie auf \\"Yes\\" klicken, k\"{o}nnen Sie ihre Antwort @@ -13131,6 +13248,9 @@ function qRadioButtonMCFI(key,qname,n) { \renewcommand\eq@local@AC{% V\texorpdfstring{\ae}{\string\346}r s\texorpdfstring{\r}{\string\345}snill!} +\dlJSStr*[noquotes]{\limSelWarningMsg}{"For dette sp\string\370rsm\string\345let + har du lov til \string\345 gj\string\370re p\string\345 det meste " + + n + " valg."} %</eqno> % \end{macrocode} % \subsection{Dutch} @@ -13219,6 +13339,8 @@ function qRadioButtonMCFI(key,qname,n) { \renewcommand\eq@local@CA{Corrigeer} \renewcommand\eq@local@RC{Mijn Antwoorden!} \renewcommand\eq@local@AC{AUB!} +\dlJSStr*[noquotes]{\limSelWarningMsg}{"Voor deze vraag mag je maximaal " + + n + " selecties maken."} %</eqnl> % \end{macrocode} % \subsection{Spanish} @@ -13304,6 +13426,9 @@ function qRadioButtonMCFI(key,qname,n) { \renewcommand\eq@local@CA{Correctas} \renewcommand\eq@local@RC{Mis Respuestas!} \renewcommand\eq@local@AC{Por Favor!} +\dlJSStr*[noquotes]{\limSelWarningMsg}{"Para esta pregunta, + se le permite hacer como m\'{a}ximo " + + n + " selecciones."} %</eqes> % \end{macrocode} % \subsection{Italian} @@ -13393,6 +13518,9 @@ function qRadioButtonMCFI(key,qname,n) { \renewcommand\eq@local@CA{Correggere} \renewcommand\eq@local@RC{Le mie risposte!} \renewcommand\eq@local@AC{Per favore!} +\dlJSStr*[noquotes]{\limSelWarningMsg}{"Per questa domanda, + \`{e} possibile effettuare al massimo " + + n + " selezioni."} %</eqit> % \end{macrocode} % \subsection{Russian} @@ -13483,12 +13611,9 @@ function qRadioButtonMCFI(key,qname,n) { \renewcommand\eq@sqslrtnlabel{\^{a}{\aa}ð\'{\i}\'{o}\`{o}\"{u}\~{n}\"{y}} % User access to shortquiz label \renewcommand\sqslrtnlabel{\eq@sqslrtnlabel} - \cyrCommand\eqsqslrtnlabel{\^{E} \^{o}\^{\i}ð\`{\i}\'{o}\"{e}% \`{e}ð\^{\i}\^{a}\^{e}{\aa} \c{c}\`{a}\"{a}\`{a}\'{\i}\`{e}\"{y}} \renewcommand\eq@sqslrtnlabel{\eqsqslrtnlabel} - - % Here is the default quiz label. % No formatting allowed % For Example: \renewcommand\eq@bqlabel{D\'ebut} (French) @@ -13693,6 +13818,9 @@ function qRadioButtonMCFI(key,qname,n) { \renewcommand\eq@local@AC{% V\texorpdfstring{\ae}{\string\346}r s\texorpdfstring{\r}{\string\345}god!} +\dlJSStr*[noquotes]{\limSelWarningMsg}{"Til dette sp\string\370rgsm\string\345l, + er du lov til at g\string\370re h\string\370jst " + + n + " valg."} %</eqda> % \end{macrocode} % \subsection{Polish} @@ -13779,6 +13907,9 @@ function qRadioButtonMCFI(key,qname,n) { \renewcommand\eq@local@RC{Moje odpowiedzi!} \renewcommand\eq@local@AC{Prosze!} %\renewcommand\eq@local@AC{Prosz\k{e}!} +\dlJSStr*[noquotes]{\limSelWarningMsg}{"Na to pytanie, + mo\u017Cesz dokona\u0107 co najwy\u017Cej " + + n + " wybor\string\363w."} %</eqpo> % \end{macrocode} % \subsection{Finnish} @@ -13840,6 +13971,9 @@ function qRadioButtonMCFI(key,qname,n) { \renewcommand\eq@local@CA{Oikein} \renewcommand\eq@local@RC{Omat vastaukset!} \renewcommand\eq@local@AC{Ole hyv\string\344!}} +\dlJSStr*[noquotes]{\limSelWarningMsg}{"T\string\344h\string\344n + kysymykseen, voit tehd\string\344 enint\string\344\string\344n " + + n + " valintoja."} %</eqfin> % \end{macrocode} % \subsection{catalan} @@ -13925,6 +14059,9 @@ function qRadioButtonMCFI(key,qname,n) { \renewcommand\eq@local@CA{Correctes} \renewcommand\eq@local@RC{Les meves Respostes!} \renewcommand\eq@local@AC{Si us plau!} +\dlJSStr*[noquotes]{\limSelWarningMsg}{"Per a aquesta pregunta, + se li permet fer com a m\`{a}xim " + + n + " seleccions."} %</eqcat> % \end{macrocode} % @@ -14050,6 +14187,9 @@ function qRadioButtonMCFI(key,qname,n) { + "Kliknete-li na \\"Yes\\", uvidite spravnou odpoved, ale svou stavajici odpoved na tuto otazku uz nebudete moct zmenit." } +\dlJSStr*[noquotes]{\limSelWarningMsg}{"Pro tuto ot\string\341zku + m\u016F\u017Eete prov\'{e}st maxim\'{a}ln\u011B " + + n + " v\u00FDb\u0115ry."} %</eqcz> % \end{macrocode} % \subsection{brazil} @@ -14141,6 +14281,9 @@ function qRadioButtonMCFI(key,qname,n) { \renewcommand\eq@local@CA{Corretas} \renewcommand\eq@local@RC{Minhas Respostas!} \renewcommand\eq@local@AC{Por Favor!} +\dlJSStr*[noquotes]{\limSelWarningMsg}{"Pro tuto ot\string\341zku + m\u016F\u017Eete prov\'{e}st maxim\'{a}ln\u011B " + + n + " v\u00FDb\u0115ry."} %</eqbr> % \end{macrocode} % \subsection{turkish} @@ -14233,6 +14376,8 @@ function qRadioButtonMCFI(key,qname,n) { \renewcommand\eq@local@CA{Dogru} \renewcommand\eq@local@RC{Benim Cevaplar\protect\u0131m!} \renewcommand\eq@local@AC{L\protect\374tfen!} +\dlJSStr*[noquotes]{\limSelWarningMsg}{"Bu soru i\u00E7in, en fazla " + + n + " se\u00E7im yapmak i\u00E7in izin verilir."} %</eqtr> % \end{macrocode} % \Finale |