From 29458b25776677bea7ac847f20cda7161a9d816b Mon Sep 17 00:00:00 2001 From: Norbert Preining Date: Thu, 28 May 2020 14:00:54 +0900 Subject: eqexam 20200528 --- texmf-dist/doc/latex/eqexam/README.md | 7 +- texmf-dist/doc/latex/eqexam/eqexam.pdf | Bin 790391 -> 806244 bytes texmf-dist/doc/latex/eqexam/eqexamman.pdf | Bin 618511 -> 624926 bytes texmf-dist/doc/latex/eqexam/eqexamman.tex | 69 +++- texmf-dist/doc/latex/eqexam/examples/test01.tex | 2 +- texmf-dist/doc/latex/eqexam/fortextbook.zip | Bin 718935 -> 812490 bytes texmf-dist/source/latex/eqexam/eqexam.dtx | 410 +++++++++++++++++++----- texmf-dist/source/latex/eqexam/eqexam.ins | 2 +- texmf-dist/tex/latex/eqexam/aebrandom.def | 2 +- texmf-dist/tex/latex/eqexam/eqexam.def | 27 +- texmf-dist/tex/latex/eqexam/eqexam.sty | 229 +++++++++---- 11 files changed, 588 insertions(+), 160 deletions(-) diff --git a/texmf-dist/doc/latex/eqexam/README.md b/texmf-dist/doc/latex/eqexam/README.md index 60949c12..ab464cab 100644 --- a/texmf-dist/doc/latex/eqexam/README.md +++ b/texmf-dist/doc/latex/eqexam/README.md @@ -1,5 +1,5 @@ The eqexam Package -Dated: 2020-01-06 +Dated: 2020-03-14 Author: D. P. Story eqExam is a LaTeX package for writing exams, tests, quizzes, @@ -40,6 +40,11 @@ this package are as follows: folder. See also the series of blogs at http://www.acrotex.net/blog/?tag=fortextbook +What's New (2020-03-14) Defined several commands and one environment to +support the insertion of a figure into a problem. Demo file that illustrates +these new commands and environment is found at +http://www.acrotex.net/blog/?p=1419 + What's New (2020-01-06) Fixed a bug in eqexam, so that now comment.sty is fully supported. For consistency, aeb-comment.sty is nothing more than version 3.8 dating to July 2016. diff --git a/texmf-dist/doc/latex/eqexam/eqexam.pdf b/texmf-dist/doc/latex/eqexam/eqexam.pdf index 7441d010..ea03c1f8 100644 Binary files a/texmf-dist/doc/latex/eqexam/eqexam.pdf and b/texmf-dist/doc/latex/eqexam/eqexam.pdf differ diff --git a/texmf-dist/doc/latex/eqexam/eqexamman.pdf b/texmf-dist/doc/latex/eqexam/eqexamman.pdf index 97f43ca1..9684fd4f 100644 Binary files a/texmf-dist/doc/latex/eqexam/eqexamman.pdf and b/texmf-dist/doc/latex/eqexam/eqexamman.pdf differ diff --git a/texmf-dist/doc/latex/eqexam/eqexamman.tex b/texmf-dist/doc/latex/eqexam/eqexamman.tex index bef910e6..258bf562 100644 --- a/texmf-dist/doc/latex/eqexam/eqexamman.tex +++ b/texmf-dist/doc/latex/eqexam/eqexamman.tex @@ -150,7 +150,7 @@ part of the\texorpdfstring{\\}{ }\texorpdfstring{\AcroTeX}{AcroTeX} eDucation Bu \keywords{LaTeX, hyperref, PDF, exercises, quizzes} \university{{\AcroT} Software Development Team} \email{dpstory@acrotex.net} -\version{5.1.8, 2020/01/06} +\version{5.1.10, 2020/03/14} \copyrightyears{2005-\the\year} \renewcommand{\exsectitletext}{Solutions to exams in this manual} @@ -1727,7 +1727,7 @@ parameter is the value of the \texttt{label} key. I have a couple of crazy gizmos that you can use. -\subsubsection{The \texttt{workarea} Environment} +\subsubsection{The \texttt{workarea} Environment}\label{sss:workarea} For a mathematics test, we often pose a question that needs to be worked out. Vertical space is created @@ -1784,7 +1784,7 @@ is not provided, and the \texttt{workarea} does nothing. If \texttt{solutionsafter} is specified, that space is replaced by the provided solution. -\subsubsection{The \texorpdfstring{\cs{placeAtxy}}{\textbackslash placeAtxy} Command} +\subsubsection{The \texorpdfstring{\cs{placeAtxy}}{\textbackslash placeAtxy} Command}\label{sss:placeatxy} The \cs{placeAtxy} command is another device that I've used to place a block of text or a graphic on top of the vertical space @@ -1829,7 +1829,7 @@ combination with the \texttt{workarea} environment. % on the \hyperref[problem]{\texttt{problem} environment}, on % page~\hyperref[problem]{\pageref*{problem}}. -\subsubsection{The \texttt{splitsolution} Environment} +\subsubsection{The \texttt{splitsolution} Environment}\label{sss:splitsoln} I developed this environment to solve a problem with the \texttt{online} and \texttt{email} options. The white space @@ -5126,7 +5126,66 @@ in your \texttt{exam} environment. %\handpoint The demo file for this feature is named \texttt{markqs.tex}. \exAeBBlogPDF{p=1231} The demo file for this feature is named -\texttt{\href{\urlAcroTeXBlog/?p=1231}{markqs.pdf}} +\texttt{\href{\urlAcroTeXBlog/?p=1231}{markqs.pdf}} and is found on the {\AcroBlog}. + +\subsection{Methods for working figures into a problem}\label{s:insFigProbs} + +A figure is sometimes an integral part of a problem and is referred to in the +statement of the problem. This section discusses methods of incorporating the +figure into the problem. + +There are two placement locations for the figure: (1) in the work area or +solution area depending on the state of the exam document, and (2) in the +questions area. Traditionally, a figure is included as part of the work area; +these methods are documented and illustrated in the earlier discussions on +the \env{workarea} environment on page~\pageref{sss:workarea}, the +\cs{placeAtxy} command on page~\pageref{sss:placeatxy}, and the +\env{splitsolution} environment on page~\pageref{sss:splitsoln}. The primary +focus, therefore, is on positioning the figure within the question itself. + +To insert a figure into the question, there are two methods: (1) enclose the +problem in a \env{minipage}, enclose the figure in a \env{minipage}, and +place them side-by-side; and~(2) use a wrapping package, such as \pkg{picins}, to +insert and wrap the question text around the figure. We present commands in +support of these two methods. + +\paragraph*{The \env{minipage} approach.} +When a \env{problem} environment or an \cs{item} in a \env{problem*} +environment is enclosed in a \env{minipage} to reduce the width of the +problem to accommodate a figure, precede the outer \env{minipage} with +the command \cs{probInMinipage} and follow the outer \env{minipage} with the +environment \env{vadjustForSolnInBx}. +%\begin{fullwidthEnv}[priorskip=0pt] +\settowidth{\aebdimen}{\ttfamily\string\begin\darg{vadjForSolnInBx}\darg{\meta{width}}}% +\def\1{\rlap{\hskip\linewidth\texttt{ \%}\textsf{ marks a problem in a \env{minipage}}}}% +\def\2{\rlap{\hskip\linewidth\texttt{ \%}\textsf{ an environment that follows a problem ...}}}% +\def\3{\rlap{\hskip\linewidth\texttt{ \%}\textsf{ marked with \cs{probInMinipage}}}}% +\begin{dCmd}[commandchars=!()]{\aebdimen+2\fboxsep+2\fboxrule} +!1\probInMinipage +!2\begin{vadjForSolnInBx}{!meta(width)} +!3!qquad!ameta(solution) +\end{vadjForSolnInBx} +\end{dCmd} + +\paragraph*{The wrap-the-figure method.} The next set of command supports wrapping +the figure around the text of the question. + +\settowidth{\aebdimen}{\ttfamily\string\probInsertSoln\darg{\meta{content}}}% +\def\2{\rlap{\hskip\linewidth\texttt{ \%}\textsf{ for \env{problem} env}}}% +\def\3{\rlap{\hskip\linewidth\texttt{ \%}\textsf{ for \cs{item} of \env{problem*} environment}}}% +\def\4{\rlap{\hskip\linewidth\texttt{ \%}\textsf{ close group begun by two prior cmds}}}% +\def\5{\rlap{\hskip\linewidth\texttt{ \%}\textsf{ write figure to the solution page}}}% +\begin{dCmd}[commandchars=!()]{\aebdimen+2\fboxsep+2\fboxrule} +!2\bProbInsert{!meta(content)} +!3\bItemInsert{!meta(content)} +!4\eProbInsert +!5\probInsertSoln{!meta(content)} +\end{dCmd} + +\exAeBBlogPDF{p=1419} The demo file that illustrates these commands and +environment, named \texttt{\href{\urlAcroTeXBlog/?p=1419}{ins-fig.pdf}}, +is found on the {\AcroBlog}. + \newpage \markright{References} diff --git a/texmf-dist/doc/latex/eqexam/examples/test01.tex b/texmf-dist/doc/latex/eqexam/examples/test01.tex index 4f7d39e4..102b7b61 100644 --- a/texmf-dist/doc/latex/eqexam/examples/test01.tex +++ b/texmf-dist/doc/latex/eqexam/examples/test01.tex @@ -2,7 +2,7 @@ \usepackage{amsmath} \usepackage{graphicx} \usepackage[% - online, % try commenting out this option to get a paper document +% online, % try commenting out this option to get a paper document % nosolutions, % answerkey, vspacewithsolns, diff --git a/texmf-dist/doc/latex/eqexam/fortextbook.zip b/texmf-dist/doc/latex/eqexam/fortextbook.zip index e3210cfd..a21725cb 100644 Binary files a/texmf-dist/doc/latex/eqexam/fortextbook.zip and b/texmf-dist/doc/latex/eqexam/fortextbook.zip differ diff --git a/texmf-dist/source/latex/eqexam/eqexam.dtx b/texmf-dist/source/latex/eqexam/eqexam.dtx index abd1da2c..d27fe475 100644 --- a/texmf-dist/source/latex/eqexam/eqexam.dtx +++ b/texmf-dist/source/latex/eqexam/eqexam.dtx @@ -16,8 +16,8 @@ % %\NeedsTeXFormat{LaTeX2e} %\ProvidesPackage{eqexam} -% [2020/01/06 v5.1.8 An Exam Construction Package (dps)] -%\def\eqexamdefReq{2020/01/01} +% [2020/03/14 v5.1.10 An Exam Construction Package (dps)] +%\def\eqexamdefReq{2020/03/14} %<*driver> \documentclass{ltxdoc} \GlossaryPrologue{\section{{Change History}}}% @@ -405,7 +405,7 @@ \def\eqe@auto@chk@drivers{\ifpdf\ExecuteOptionsX{pdftex}\else \ifxetex\ExecuteOptionsX{xetex}\fi\fi} \newif\ifeqeonline \eqeonlinefalse -\DeclareOptionX{online}{\eqe@auto@chk@drivers +\DeclareOptionX{online}{\eqe@auto@chk@drivers\displayworkareafalse \let\eq@online\eqe@YES\eqeonlinetrue\ExecuteOptionsX{links}} \DeclareOptionX{pdf}{\eqe@auto@chk@drivers\let\load@web\eqe@YES} \DeclareOptionX{links}{\eqe@auto@chk@drivers @@ -676,6 +676,7 @@ \newif\ifeq@proofing \eq@proofingfalse \newif\ifeq@nolink \eq@nolinkfalse \@ifundefined{ifpreview}{\newif\ifpreview \previewfalse}{} +\def\previewOn{\previewtrue}\def\previewOff{\previewfalse} \newif\ifeqforpaper \eqforpaperfalse % \end{macrocode} % We define the commands for inputting the CFG files. @@ -836,8 +837,14 @@ \ifx\eqeAEFormatting\@empty\else \eqe@IWO\quiz@solns{\string\eqeAEFormatting}\fi \fi + \protect\cqqsfalse } -\def\writeWithSolDocTrue{\writeT@SolnFile{\protect\withinsoldoctrue}} +% \end{macrocode} +% \changes{v5.1.10}{2020/03/14}{Added \string\cs{cqqsfalse} to definition of +% \string\cs{writeWithSolDocTrue}} +% \begin{macrocode} +\def\writeWithSolDocTrue{\writeT@SolnFile{% + \protect\withinsoldoctrue\protect\cqqsfalse}} % \end{macrocode} % \end{macro} % \end{macro} @@ -894,6 +901,7 @@ % \texttt{nosolutions}. % \begin{macrocode} \def\csarg#1#2{\expandafter#1\csname#2\endcsname} +\let\w@csarg\csarg \def\saveIFEQE#1{\def\ARG{#1ifSave}% \expandafter\csarg\expandafter \let\expandafter\ARG\csname#1\if#1true\else false\fi\endcsname} @@ -1033,7 +1041,7 @@ % Here, I input the \texttt{verbatim} package after the comment package. % \begin{macrocode} \RequirePackage{verbatim} -\@ifundefined{dlcomment}{\typeout{!! defining dlcomment}% +\@ifundefined{dlcomment}{%\typeout{!! defining dlcomment}% \let\dlcomment\comment \let\enddlcomment\endcomment \let\eqSavedComment\dlcomment @@ -1177,6 +1185,7 @@ \let\marginpoints\eqrightmarginbox} \def\PointsOnBothSides{\def\@reportpoints{3}\relax \let\marginpoints\eqbothmargins} +\let\PointsOnBoth\PointsOnBothSides \newif\ifeqe@nopoints \eqe@nopointsfalse \def\NoPoints{\if\isInExamEnv\eqe@NO \eqe@nopointstrue\def\@reporttotals{0}\let\totalsbox=\hfil @@ -2280,11 +2289,25 @@ \eq@hspanner\ignorespaces } % \end{macrocode} -% \DescribeMacro{\optsMlTextField} is used to pass options to the multi-line +% \DescribeMacro{\optsMlTxtFld} is used to pass options to the multi-line % text field. +% \changes{v5.1.10}{2020/03/14}{Introduced control over width of text field in +% for \string\texttt{online} option.} % \begin{macrocode} -\def\optsMlTextField#1{\def\eqe@optsmltf{#1}} +\def\optsMlTxtFld#1{\def\eqe@optsmltf{#1}} \let\eqe@optsmltf\@empty +% \end{macrocode} +% \DescribeMacro{\wdthMlTxtFld}\hskip-\marginparsep\texttt{\darg{\ameta{length}}} +% sets the underlying multi-line text field, when \texttt{online} option is in effect, +% to \ameta{length}. The default length of \cs{linewidth} is reset after the field +% has been created. +% \changes{v5.1.10}{2020/03/14}{Introduced control over width of text field in +% for \string\texttt{online} option.} +% \begin{macrocode} +\def\eqeLW{\linewidth} +\def\wdthMlTxtFld#1{\setlength\eqetmplengtha{#1}% + \edef\eqeLW{\the\eqetmplengtha}} +\def\resetFldWdth{\gdef\eqeLW{\linewidth}}% \def\eqExamPriorVspace#1{% \edef\fieldName{% \if\probstar*eqexam.\curr@quiz.% @@ -2294,7 +2317,7 @@ \fi }% \nobreak\noindent\textField[\BC{}\presets{\eqe@optsmltf} - \Ff\FfMultiline]{\fieldName}{\linewidth}{#1}\@gobble + \Ff\FfMultiline]{\fieldName}{\eqeLW}{#1}\resetFldWdth\@gobble } % \end{macrocode} % @@ -2655,8 +2678,7 @@ % If the reference \texttt{r@\#1} is defined, define the value to be % the second argument of \cs{r@\#1} expanded % \begin{macrocode} - \expandafter\xdef\csname nRefii@#1\endcsname - {\expandafter\expandafter\expandafter + \csarg\xdef{nRefii@#1}{\expandafter\expandafter\expandafter \@getsecondOf\csname r@#1\endcsname}% }% } @@ -3373,7 +3395,7 @@ new Array("pointsgiven.\curr@quiz.page\thepage"));}}] {\fieldName}{\widthtpboxes}{15pt}% } -\ifx\use@email y +\ifx\use@email\eqe@YES \let\insertPointsBoxPDF\@insertPointsBoxPDF \let\insertTotalsBoxPDF\@insertTotalsBoxPDF \else @@ -3387,18 +3409,29 @@ % At the bottom of the box goes the points for the problem, if the \texttt{email} option % is used, in the top, a text field is inserted. % \begin{macrocode} -\newcommand{\eqrightmarginbox}[2]{\makebox[0pt][l]{% - \setlength\tabcolsep{0pt}% +\newcommand{\eqrightmarginbox}[2]{% + \makebox[0pt][l]{% +% \end{macrocode} +% If this problem is in a minipage, (as declared by \cs{probInMinipage}), we adjust +% the text width to be the original text width, rather than the text width determined +% by the width of the minipage. +% \changes{v5.1.9}{2020/13/06}{Allow adjustment of \string\cs{textwidth} with a problem +% is within a minipage.} +% \begin{macrocode} + \ifx\probInMinip@ge\relax + \let\eq@TW\textwidth\else + \let\eq@TW\eqTWSave\fi + \setlength\tabcolsep{0pt}% % \end{macrocode} % (2011/05/08) new calculation for the right point box. % \begin{macrocode} - \setlength{\@tempdima}{\textwidth-\eqemargin+\marginparsep}% - \hspace*{\@tempdima}% - \raisebox{-.5\height}[0pt][0pt]{% - \marginboxdesign[\insertPointsBoxPDF]% - {\marginpointsboxtext{#1}{#2}}% - }\hfil - }% + \setlength{\@tempdima}{\eq@TW-\eqemargin+\marginparsep}% + \hspace*{\@tempdima}% + \raisebox{-.5\height}[0pt][0pt] + {\marginboxdesign[\insertPointsBoxPDF]% + {\marginpointsboxtext{#1}{#2}}% + }\hfil + }\let\probInMinip@ge\relax } % \end{macrocode} % At the end of each exam \verb!\end{exam}! the part totals can be optionally @@ -3852,7 +3885,7 @@ %\textbf{New Syntax}\\[3pt] %\begingroup\small % \switchCats\ttfamily -% \string\begin{splitsolution}[\meta(width)][\meta(depth)]\\ +% \string\begin{splitsolution}[\meta(width)][\meta(height)]\\ % \string\begin{panel}[l\string|r]\\ % ...\\ % \string\end{panel}\\ @@ -3866,7 +3899,7 @@ %\textbf{Old Syntax}\\[3pt] %\begingroup\small % \switchCats\ttfamily -% \string\begin{splitsolution}{\meta(depth)}\\ +% \string\begin{splitsolution}{\meta(height)}\\ % \string\begin{panel}[l\string|r]{\meta(width)}\\ % ...\\ % \string\end{panel}\\ @@ -4087,6 +4120,8 @@ \newenvironment{@ssSolution}[1][\ss@Argii]% {% \def\eqe@argi{#1}\ifx\eqe@argi\@empty\else + \setlength{\@tempdima}{\ss@Argii}% chng + \edef\ss@Argii{\the\@tempdima}% \let\soln@keys@nLines\@empty \edef\panelheight{\the\panelheight}% \edef\panelwidth{\the\panelwidth}% @@ -4193,13 +4228,20 @@ \string\setlength{\string\panelwidth}{\ss@Argiii}% \string\def\string\eqedepth {\ifeq@nosolutions\ss@Argii\else\ss@Argii\fi}C}}}% - {\lccode`C=`\%\lowercase{\eqe@IW{% - \string\strut\string\noindent% -% \string\strut\par\string\nobreak\string\noindent% - \string\hbox\space to\string\linewidth\bgroup^^J% - \eqe@lPanel\string\minipage[b][\string\eqedepth][t]% - {\string\linewidth\eqe@subleftgutter% - -\string\panelwidth-\string\panelgap}C +% \end{macrocode} +% (2020/03/14) Change to \verb~\noindent\hskip\eqemargin~ to get the margin +% correct within the \env{eqequestions} environment on the solutions page. +%\changes{v5.1.10}{2020/03/14}{Change to reflect \string\env{eqequestions}} +% \begin{macrocode} + {\lccode`C=`\%\lowercase{\eqe@IW{\string\vskip2pt + \string\noindent\string\hskip\string\eqemargin +% \string\strut\string\noindent% +% \string\strut\par\string\nobreak\string\noindent% +% \string\vskip2pt\string\noindent% + \string\hbox\space to\string\linewidth\bgroup^^J% + \eqe@lPanel\string\minipage[b][\string\eqedepth][t]% + {\string\linewidth\eqe@subleftgutter% + -\string\panelwidth-\string\panelgap}C }}}% \ifeq@solutionsafter \noindent\strut\hbox to\linewidth\bgroup @@ -4389,7 +4431,6 @@ \label{\thisexamlabel PageBegin}% \eqe@IWO\@auxout{\string\csarg\string\gdef {\thisexamlabel pageno}{\thepage}}% -% \let\sq@priorhook\@empty \ifeqfortextbook \global\examenvtrue\tb@beginexam@code \fi @@ -4402,31 +4443,60 @@ % \begin{macrocode} \def\tb@insmargmark{\ifisinstred\ifismarginans \insMidMarg{\mark{}}\fi\fi} -\def\eqe@adjForSepRule{\if\eq@parttotals\eqe@YES +\def\eqe@adjForSepRule{\ifx\eq@parttotals\eqe@YES \eq@pointboxtotalheight\halfHtPtBox\relax \advance\eq@pointboxtotalheight\dpPtBox\relax \advance\eq@pointboxtotalheight\pointsmarginparpush \vspace*{\eq@pointboxtotalheight}\fi} \def\eqe@afterexamsepcode{% - \if\eq@parttotals\eqe@YES - \@actionsAtPageBreak{\global\let\@spacetobreak1}% - {\global\let\@spacetobreak0}% - \ifx\@spacetobreak0\relax - \bgroup\@tempdima=\pagetotal - \advance\@tempdima\eq@pointboxtotalheight - \ifdim\@tempdima>\pagegoal\aftergroup\newpage - \else\ifnum\arabic{eq@count}>0\relax - \removelastskip\vskip6pt\kern0pt - \if\@reportpoints\eqe@One\else\@checkSpacing{0}\fi - \textcolor{\endexamtotal@color}% - {\eqeomarginbox{\arabic{eq@count}}{0}}\fi - \ifx\eqx@separationrule\eqe@YES - \separationrule\eqe@adjForSepRule\fi - \fi\egroup + \ifx\eq@parttotals\eqe@YES + \@actionsAtPageBreak{\global\let\@spacetobreak\eqe@One}% + {\global\let\@spacetobreak\eqe@Zero}% + \ifx\@spacetobreak\eqe@One + \bgroup\@tempdima=\pagetotal + \advance\@tempdima\eq@pointboxtotalheight + \ifdim\@tempdima>\pagegoal\aftergroup\newpage + \else + \ifnum\arabic{eq@count}>\z@ + \removelastskip\vskip6pt\kern0pt + \ifx\@reportpoints\eqe@One\else\@checkSpacing{0}\fi + \def\@emitPartTotalsBox{\textcolor{\endexamtotal@color}% + {\eqeomarginbox{\arabic{eq@count}}{0}}}% + \insertContent\@emitPartTotalsBox + \fi + \ifx\eqx@separationrule\eqe@YES + \def\@emitSepRule{\separationrule\eqe@adjForSepRule}% + \insertContent\@emitSepRule \fi - \else\ifx\eqx@separationrule\eqe@YES - \separationrule\eqe@adjForSepRule\fi + \fi\egroup + \else + \ifnum\arabic{eq@count}>\z@ + \ifx\@reportpoints\eqe@One\else\@checkSpacing{0}\fi + \def\@emitPartTotalsBox{\textcolor{\endexamtotal@color}% + {\eqeomarginbox{\arabic{eq@count}}{0}}}% + \insertContent\@emitPartTotalsBox + \fi + \ifx\eqx@separationrule\eqe@YES + \def\@emitSepRule{\separationrule\eqe@adjForSepRule}% + \insertContent\@emitSepRule + \else + \eqe@adjForSepRule + \fi \fi + \else + \ifx\eqx@separationrule\eqe@YES + \def\@emitSepRule{\separationrule\bigskip}% + \insertContent\@emitSepRule\fi + \fi +} +\def\insertContent#1{% + \@ifundefined{NextAfter\currExamName} + {#1} + {\edef\x{% + \numFirstPageOfExam{\@nameuse{NextAfter\currExamName}}}% + \edef\y{\numLastPageOfExam{\currExamName}}% + \ifnum\x=\y\relax#1\fi + }% } \def\examenddef {% @@ -4545,40 +4615,55 @@ % \end{macrocode} % The beginning of the \env{exam} environment. % \begin{macrocode} +\let\currExamName\@empty +\let\prevExamName\@empty +\let\nextExamName\@empty \newenvironment{exam}[2][] {% - \ifDoNotRecordThisExam % dpsf02 + \xdef\eqTWSave{\the\textwidth}% + \ifDoNotRecordThisExam \expandafter\bIFFalseWrtSolns\fi - \makeRoomForProb{\@fvsizeskip\textheight}{0}% - \let\isInExamEnv\eqe@YES - \stepcounter{eq@numparts}% + \makeRoomForProb{\@fvsizeskip\textheight}{0}% + \ifx\currExamName\@empty % chng + \xdef\currExamName{#2}\else + \xdef\prevExamName{\currExamName}% + \eqe@IWO\@auxout{\string\csarg\string + \gdef{NextAfter\prevExamName}{#2}}% + \xdef\currExamName{#2}% + \eqe@IWO\@auxout{\string\csarg\string + \gdef{PrevTo\currExamName}{\prevExamName}}% + \fi + \let\isInExamEnv\eqe@YES + \stepcounter{eq@numparts}% % \end{macrocode} % If \texttt{\#2} is empty, use \cs{autoExamName} % \begin{macrocode} - \def\eqexamargii{#2}\ifx\eqexamargii\@empty - \edef\eqexamargii{\autoExamName}\fi - \xdef\thisexamlabel{\eqexamargii}\xdef\curr@quiz{\eqexamargii}% - \def\eqexamargi{#1}\ifx\eqexamargi\@empty - \edef\eqexamargi{\eqexamargii}\fi - \expandafter\gdef\expandafter\thisUFexamlabel - \expandafter{\eqexamargi}% - \edef\eq@tmp{\the\partNames\string\\{\eqexamargii}}% - \global\partNames=\expandafter{\eq@tmp}% - \csarg\ifx{NumberOfParts}\relax\else -\ifx\eqeWrtExamTitleToSolns\eqe@YES - \ifnum\nNumberOfP@rts=1\relax\else - \def\eqe@argi{#1}\ifx\eqe@argi\@empty - \eqe@writetoSolns{\eqexamargii}\eqe@writetoAux{\string - \csarg\string\gdef{userFriendly\eqexamargii}{\eqexamargii}} + \def\eqexamargii{#2}\ifx\eqexamargii\@empty + \edef\eqexamargii{\autoExamName}\fi + \xdef\thisexamlabel{\eqexamargii}\xdef\curr@quiz{\eqexamargii}% + \def\eqexamargi{#1}\ifx\eqexamargi\@empty + \edef\eqexamargi{\eqexamargii}\fi + \expandafter\gdef\expandafter\thisUFexamlabel + \expandafter{\eqexamargi}% + \edef\eq@tmp{\the\partNames\string\\{\eqexamargii}}% + \global\partNames=\expandafter{\eq@tmp}% + \csarg\ifx{NumberOfParts}\relax\else + \ifx\eqeWrtExamTitleToSolns\eqe@YES + \ifnum\nNumberOfP@rts=1\relax + \else + \def\eqe@argi{#1}% + \ifx\eqe@argi\@empty + \eqe@writetoSolns{\eqexamargii}\eqe@writetoAux{\string + \csarg\string\gdef{userFriendly\eqexamargii}{\eqexamargii}} \else - \eqe@writetoSolns{#1}\eqe@writetoAux{\string - \csarg\string\gdef{userFriendly#2}{#1}} + \eqe@writetoSolns{#1}\eqe@writetoAux{\string + \csarg\string\gdef{userFriendly#2}{#1}}% \fi - \fi\fi -\fi - \exambegdef - \edef\temp@Exp{\noexpand\shortquiz\sqstar[\eqexamargii]}\temp@Exp -% \expandafter\shortquiz\sqstar[\eqexamargii]% + \fi + \fi + \fi + \exambegdef + \edef\temp@Exp{\noexpand\shortquiz\sqstar[\eqexamargii]}\temp@Exp }{% \examenddef % \end{macrocode} @@ -7108,6 +7193,183 @@ \if@bypasseqexamheading\else \pagestyle{eqExamheadings}\fi\fi % \end{macrocode} +% \section{Insertion of figures into a problem or solution} +% Over the years, there have been many requests for ``easy'' methods of inserting +% images (or other content) into a problem. In this section, we provide some basic tools +% for doing just that. +% +% There are two methods for inserting content (without disturbing the layout of the document): +% (1) using a minipage; and (2) using a wrap-figure package, such as \pkg{picins} (recommended). +% +% The demo file for these features is \texttt{ins-fig.tex} +% \changes{v5.1.10}{2020/03/14}{Added commands for inserting figures in a problem} +% +% \subsection{Enclose problem in a minipage} +% The idea is to include the \env{problem} environment in a \env{minipage} with a width smaller than +% \cs{linewidth}; then place the figure in another \env{minipage} next to the question. To use this +% methods, precede the enclosing \env{minipage} with the command \cs{probInMinipage}; illustration follows. +%\begin{verbatim} +%\def\PROB{The problem ...} +%\def\FIG{\includegraphics[width=4.5cm]{figura1}} +%\probInMinipage +%\begin{minipage}{\linewidth} +%\begin{minipage}[t]{\textwidth-4.5cm-11pt}\kern0pt +%\begin{problem}[10]\PROB +%\begin{solution}[1in] +%This is the solution to ``\PROB'' +%\end{solution} +%\end{problem} +%\end{minipage} +%\begin{minipage}[t]{4.5cm}\kern0pt\FIG +%\end{minipage}\end{minipage} +%\end{verbatim} +%The same technique is used for multi-part problems. +%\begin{verbatim} +%\probInMinipage +%\begin{minipage}[t]{\linewidth-4.5cm-11pt}\kern0pt\parindent15pt +% \item \PROB +%\begin{solution}[1in] +%This is the solution to ``\PROB'' +%\end{solution} +%\begin{workarea}{\sameVspace} +%\end{minipage}\hfill +%\begin{minipage}[t]{4.5cm}\kern0pt\FIG\end{minipage} +%\end{verbatim} +%\begin{macro}{\probInMinipage} +%Place in front of a \env{minipage} environment that encloses side-by-side +%content: the problem on the left and the figure on the right. The big problem +%here is inserting the figure without disturbing the right margin totals. +%The \cs{eqTWSave} is the saved value of the \cs{textwidth} in effect when +%the \env{exam} environment is opened. The right totals box is placed in the right +%margin based on this value. +% \begin{macrocode} +\def\probInMinipage{% + \ifanswerkey + \ifkeepdeclaredvspacing + \global\let\w@sKeyOn\eqe@YES + \vspacewithkeyOff + \else + \global\let\w@sKeyOn\eqe@NO + \fi + \fi + \let\probInMinip@ge\eqTWSave\noindent} +\let\probInMinip@ge\relax +% \end{macrocode} +% \end{macro} +% \begin{environment}{vadjForSolnInBx}\hskip-\marginparsep\texttt{\darg{\ameta{width}}} +% When the \env{problem} environment environment +% is enclosed in a minipage, the space left for the solution is not correct when +% \cs{vspacewithkeyOn} is in effect. +% +% This is companion environment to the \cs{probInMinipage} command whose intension is +% to get the spacing correct. It it placed after all \env{minipage}s +% are closed that enclosed the whole \env{problem}. The argument, \ameta{width}, is the same +% width of \env{minipage} that encloses the problem. The content of the environment should +% be the same content as the \env{solution} environment. \env{vadjForSolnInBx} calculates +% the total height of the typeset solution. It then calculates the difference between +% \cs{sameVspace}, which should hold the value of the optional argument of \env{solution}, +% and the actual height of the solution. It then executes a \cs{vspace} for that amount calculated. +% +% \begin{macrocode} +\newenvironment{vadjForSolnInBx}[1]{% + \setlength\@tempdima{#1}% + \setbox\z@\vbox\bgroup\hsize\@tempdima +}{% + \egroup + \ifanswerkey + \ifx\w@sKeyOn\eqe@YES + \global\vspacewithkeyOn\fi + \setlength{\@tempdima}{\ht\z@+\dp\z@}% + \setlength{\@tempdima}{\sameVspace-\@tempdima}% + \par\vspace{\@tempdima}\fi + \setbox\z@\box\voidb@x +} +% \end{macrocode} +% \end{environment} +% +% \subsection{Insertions using a wrapping package} +% A technique for wrapping text around the figure has been developed, and is an ugly hack. +% The example below is typical: define \cs{insertFig} (for convenience). Prior to the +% opening of \env{problem}, expand \verb~\bProbInsert{\insertFig}~. +% \begin{macro}{\bProbInsert}\hskip-\marginparsep\texttt{\darg{\ameta{fig}}} +% Use this command above the \env{problem} (or \env{problem*}) environment only. Prior to opening the \env{problem} +% use \cs{bProbInsert} with its argument. Place \DescribeMacro{\eProbInsert}\cs{eProbInsert} at the end of the statement of the +% question, as illustrated below. \cs{bProbInsert} puts the question into a group, +% \cs{eProbInsert} gets us out of the group. +%\begin{verbatim} +%\def\insertFig{\parpic[r]{\FIG}} +%\bProbInsert{\insertFig} +%\begin{problem}[10]\PROB +%\PROB\space\PROB\eProbInsert +%\begin{solution}[1in] +%This is the solution: \PROB +%\end{solution} +%\end{problem} +%\end{verbatim} +% \begin{macrocode} +\def\bProbInsert#1{\def\@rgi{#1}\ifx\@rgi\@empty + \global\let\insE@rlyAtQues\@empty\else + \gdef\insE@rlyAtQues{\begingroup#1}\fi} +% \end{macrocode} +% \end{macro} +% \begin{macro}{\bItemInsert}\hskip-\marginparsep\texttt{\darg{\ameta{fig}}\ameta{content}\cs{eProbInsert}}\\ +% The \cs{bItemInsert} command is the \cs{item}-version of \cs{bProbInsert}. Place \cs{bItemInsert} with its argument +% just after the \cs{item}, as illustrated below. At the end of the question place \cs{eProbInsert}. +%\begin{verbatim} +%\begin{problem*}[5ea] +%Solve each without error. +%\begin{parts} +% \item \bItemInsert{\insertFig} \PROB +% \PROB\space\PROB\space\PROB\eProbInsert +%\begin{solution}[1in] +%This is the solution. \PROB +%\end{solution} +% ... +%\end{parts} +%\end{problem*} +%\end{verbatim} +% \begin{macrocode} +\def\bItemInsert#1{\begingroup#1\noindent\ignorespaces} +\def\eProbInsert{\par\endgroup\@restorepar\par} +% \end{macrocode} +% \end{macro} +% \section{Insertions in the solution section} +% Its a bit trickier to include a wrapped graphic in the solution section. The primary +% command for doing this is \DescribeMacro{\probInsertSoln}\cs{probInsertSoln} +%\begin{verbatim} +%\bProbInsert{\insertFig} +%\probInsertSoln[\protect\vskip3pt]{\insertFig} +%\begin{problem}[10]\begin{cq*} +%\PROB\space\PROB +% +%\PROB\space\PROB\space\PROB\space\PROB\cqQS{}{\RESTOREPAR} +% +%\PROB\cqQS{\eProbInsert}{} +%\end{cq*} +%\begin{solution}[1in] +%\ifcqSA\else\textit{Question}: \cqCopiedQues +%\par\medskip\noindent\textit{Solution}:\space\fi +%This is the solution: \PROB +%\end{solution} +%\end{problem} +%\end{verbatim} +% \begin{macro}{\probInsertSoln}\hskip-\marginparsep\texttt{[\ameta{opt}]\darg{\ameta{\cs{cmd}}}} +% The command \ameta{\cs{cmd}} is a expands to the figure insertion; for example, +% \verb~\gdef\insertFig{\parpic[r]{\FIG}}~, the second argument would read \cs{insertFig}. +% The first argument was designed for vertical adjustment, as needed. In the sample file +% \texttt{ins-fig.tex}, we insert an extra 3pts, see the verbatim listing above. +% \begin{macrocode} +\newcommand{\probInsertSoln}[2][]{\writeToSolnFile{#1% + \protect\def\protect + \priorexlabelheader{\protect#2\protect\noindent +}}} +% \end{macrocode} +% Sometimes you need to insert \cs{RESTOREPAR} to make the paragraphs layout as they should. +% This is illustrated above. +% \begin{macrocode} +\def\RESTOREPAR{\let\par\@@par} +% \end{macrocode} +% \end{macro} % \begin{macrocode} % %<*textbook> diff --git a/texmf-dist/source/latex/eqexam/eqexam.ins b/texmf-dist/source/latex/eqexam/eqexam.ins index a5fd9e53..3cecb5ff 100644 --- a/texmf-dist/source/latex/eqexam/eqexam.ins +++ b/texmf-dist/source/latex/eqexam/eqexam.ins @@ -3,7 +3,7 @@ %% driver files from the doc files in this package when run through %% LaTeX or TeX. %% -%% Copyright 2005--2018 D. P. Story +%% Copyright 2005--2020 D. P. Story %% %% This file is part of the `AcroTeX eDucation Bundle'. %% ------------------------------------------- diff --git a/texmf-dist/tex/latex/eqexam/aebrandom.def b/texmf-dist/tex/latex/eqexam/aebrandom.def index 2906805a..f2952e46 100644 --- a/texmf-dist/tex/latex/eqexam/aebrandom.def +++ b/texmf-dist/tex/latex/eqexam/aebrandom.def @@ -18,7 +18,7 @@ %% License, or (at your option) any later version. %% %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% \ProvidesFile{aebrandom.def} - [2020/01/01 v8.5.8 % + [2020/03/14 v8.5.10 % Exerquiz support for randomization (dps)] \@ifundefined{nextrandom}{\input{random.tex}}{} \def\nextrandom{\begingroup diff --git a/texmf-dist/tex/latex/eqexam/eqexam.def b/texmf-dist/tex/latex/eqexam/eqexam.def index 53d9fc0f..0d865559 100644 --- a/texmf-dist/tex/latex/eqexam/eqexam.def +++ b/texmf-dist/tex/latex/eqexam/eqexam.def @@ -7,7 +7,7 @@ %% exerquiz.dtx (with options: `eqexam') %% \ProvidesFile{eqexam.def} - [2020/01/01 v8.5.8 % + [2020/03/14 v8.5.10 % Exerquiz support file for eqexam (dps)] \let\eq@YES=y \let\eq@NO=n \let\eq@One=1 \let\eq@Zero=0 @@ -257,6 +257,7 @@ {\if\exerstar*\def\eq@next{\@exercise}\else \def\eq@next{\exercise@@}\fi\eq@next}% }{\eq@postexerciseHook\endexerhook\par + \global\let\insE@rlyAtQues\@empty \global\eq@exerciseheadingtrue\removelastskip\eq@exerskip} \def\exercise@[#1]{\edef\eq@arg{#1}% \if\eq@arg h\def\currhideopt{h}% @@ -304,7 +305,8 @@ \newcommand\exerSolnHeader[3]{% \prior@exerSolnHeaderHook \ifeqforpaper\else\webnewpage\fi\markright{#1}%\par\noindent% - #3% + \priorexlabelheader + #3\global\let\priorexlabelheader\relax \solnhspace } \let\solnItemMngt\relax @@ -363,7 +365,8 @@ \fi \eq@initializeContAnnot \ifeq@exerciseheading - \prior@questionsHook\marginparpriorhook\noindent\eqexheader@wrapper + \prior@questionsHook + \insE@rlyAtQues\marginparpriorhook\noindent\eqexheader@wrapper \afterlabelhskip\marginparafterhook\gEx@CommonCmd \eq@setPrbSolnAftrIndnt\ignorespaces\fi} \newif\ifterminexchanged \terminexchangedfalse % dps cq @@ -374,6 +377,7 @@ \def\makeExSolnsLocalOn{\makeExSlLocaltrue} \def\makeExSolnsLocalOff{\makeExSlLocalfalse} \let\eqMrkSoln\@gobble +\let\priorexlabelheader\relax \def\eqExerSolnHeaderSngl{% \ifmakeExSlLocal\protect\begingroup^^J\fi \ifx\eqMrkCpyArg\@empty\else @@ -677,7 +681,7 @@ \endsolnexerhook\penalty0\relax} \let\eq@exerstarEnv\relax \newenvironment{exercise*}{\def\eq@exerstarEnv{*}\exercise} -{\endexercise} +{\global\let\insE@rlyAtQues\@empty\endexercise} \def\exerwparts@cols{0} \let\topofpartshook\relax \let\@listiiredefined\eq@NO @@ -730,6 +734,7 @@ \let\eqp@rtc@lcm@rk\relax \let\eq@insertContAnnot\relax \def\eq@item@common{\eq@insertContAnnot\eqp@rtc@lcm@rk + \global\let\probInMinip@ge\relax \def\currhideopt{x}\eq@hidesolutionfalse\eq@nolinkfalse \@ifnextchar[{\@ckhide}{\eq@item}} \newcommand{\partsitemsep}[1]{{% @@ -762,6 +767,7 @@ \eq@item@latex\eq@optArg\exlisttabheaderafterhook} \newif\ifwithinparts \let\ex@listtabheader@fterhook\@empty +\let\probInMinip@ge\relax \newenvironment{exercise@parts@list}{% \settowidth{\eq@tmplength}{\parts@indent}% \edef\widthOfParts{\the\eq@tmplength}% @@ -817,9 +823,11 @@ {\eq@item@latex\ex@listtabheader@fterhook \exlisttabheaderafterhook}}% \def\eqthisenv{parts}\withinpartstrue - \def\item{\ifx\@currenvir\eqthisenv + \def\item{\ifx\probInMinip@ge\relax + \ifx\@currenvir\eqthisenv \def\eq@next{\eq@item@common}\else \def\eq@next{\eq@item}\fi + \else\def\eq@next{\eq@item@common}\fi \eq@next}% }}{\endlist\global\let\leadinitem\leadinitem@external \post@parts@hook\belowpartshook} @@ -1055,9 +1063,8 @@ \newcommand{\exerSolnInput} {% \@ifundefined{eqe@IWO}{}{\ifsolutionsAtEnd - \eqe@IWO\@auxout{\string\expandafter\string\gdef - \string\csname\space eqExamQuesLastPage\string\endcsname - {\arabic{page}}}\fi}\let\webnewpage\relax + \eqe@IWO\@auxout{\string\csarg\string\gdef + {eqExamQuesLastPage}{\arabic{page}}}\fi}\let\webnewpage\relax \ifsolutionsonly\else \bgroup\OKToWriteExamDatatrue \writeT@ExSolns{\string\endinput}\egroup @@ -1086,6 +1093,7 @@ \exerSolnInput } \newcommand{\prior@questionsHook}{} +\let\insE@rlyAtQues\@empty \let\qMark@Hook\@empty \let\aebtitleQuiz\@empty \newcommand{\post@questionsHook}{} @@ -1125,7 +1133,8 @@ \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\gdef\eqPTs{1}% + \list{\qMark@Hook\prior@questionsHook + \insE@rlyAtQues\gdef\eqPTs{1}% \global\let\eqQT\eq@na% {\@tempcnta=0 \let\@thispr@b\@empty \@whilenum\@tempcnta<\@eqquestiondepth\do{\advance\@tempcnta\@ne diff --git a/texmf-dist/tex/latex/eqexam/eqexam.sty b/texmf-dist/tex/latex/eqexam/eqexam.sty index 18ef5a68..92f13ee9 100644 --- a/texmf-dist/tex/latex/eqexam/eqexam.sty +++ b/texmf-dist/tex/latex/eqexam/eqexam.sty @@ -19,8 +19,8 @@ %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% \NeedsTeXFormat{LaTeX2e} \ProvidesPackage{eqexam} - [2020/01/06 v5.1.8 An Exam Construction Package (dps)] -\def\eqexamdefReq{2020/01/01} + [2020/03/14 v5.1.10 An Exam Construction Package (dps)] +\def\eqexamdefReq{2020/03/14} \RequirePackage{ifpdf}[2006/02/20] \RequirePackage{ifxetex}[2006/08/21] \usepackage{xkeyval} @@ -135,7 +135,7 @@ \def\eqe@auto@chk@drivers{\ifpdf\ExecuteOptionsX{pdftex}\else \ifxetex\ExecuteOptionsX{xetex}\fi\fi} \newif\ifeqeonline \eqeonlinefalse -\DeclareOptionX{online}{\eqe@auto@chk@drivers +\DeclareOptionX{online}{\eqe@auto@chk@drivers\displayworkareafalse \let\eq@online\eqe@YES\eqeonlinetrue\ExecuteOptionsX{links}} \DeclareOptionX{pdf}{\eqe@auto@chk@drivers\let\load@web\eqe@YES} \DeclareOptionX{links}{\eqe@auto@chk@drivers @@ -257,6 +257,7 @@ \newif\ifeq@proofing \eq@proofingfalse \newif\ifeq@nolink \eq@nolinkfalse \@ifundefined{ifpreview}{\newif\ifpreview \previewfalse}{} +\def\previewOn{\previewtrue}\def\previewOff{\previewfalse} \newif\ifeqforpaper \eqforpaperfalse \def\eqe@csarg#1#2{\expandafter#1\csname#2\endcsname} \@for\eqe@tmp@i:={},i,ii,iii,iv,v,vi\do{\eqe@csarg @@ -315,8 +316,10 @@ \ifx\eqeAEFormatting\@empty\else \eqe@IWO\quiz@solns{\string\eqeAEFormatting}\fi \fi + \protect\cqqsfalse } -\def\writeWithSolDocTrue{\writeT@SolnFile{\protect\withinsoldoctrue}} +\def\writeWithSolDocTrue{\writeT@SolnFile{% + \protect\withinsoldoctrue\protect\cqqsfalse}} \newcommand{\setSolnMargins}[1]{\setlength\eqemargin{#1}\ignorespaces} \def\altSetSolnMargins#1{\def\alt@SetSolnMargins{#1}} \let\alt@SetSolnMargins\@empty @@ -345,6 +348,7 @@ \fi\fi } \def\csarg#1#2{\expandafter#1\csname#2\endcsname} +\let\w@csarg\csarg \def\saveIFEQE#1{\def\ARG{#1ifSave}% \expandafter\csarg\expandafter \let\expandafter\ARG\csname#1\if#1true\else false\fi\endcsname} @@ -422,7 +426,7 @@ \RequirePackage{pifont} \RequirePackage{array} \RequirePackage{verbatim} -\@ifundefined{dlcomment}{\typeout{!! defining dlcomment}% +\@ifundefined{dlcomment}{%\typeout{!! defining dlcomment}% \let\dlcomment\comment \let\enddlcomment\endcomment \let\eqSavedComment\dlcomment @@ -504,6 +508,7 @@ \let\marginpoints\eqrightmarginbox} \def\PointsOnBothSides{\def\@reportpoints{3}\relax \let\marginpoints\eqbothmargins} +\let\PointsOnBoth\PointsOnBothSides \newif\ifeqe@nopoints \eqe@nopointsfalse \def\NoPoints{\if\isInExamEnv\eqe@NO \eqe@nopointstrue\def\@reporttotals{0}\let\totalsbox=\hfil @@ -1091,8 +1096,12 @@ \Ans@proofing{\RadioFieldSize}% \eq@hspanner\ignorespaces } -\def\optsMlTextField#1{\def\eqe@optsmltf{#1}} +\def\optsMlTxtFld#1{\def\eqe@optsmltf{#1}} \let\eqe@optsmltf\@empty +\def\eqeLW{\linewidth} +\def\wdthMlTxtFld#1{\setlength\eqetmplengtha{#1}% + \edef\eqeLW{\the\eqetmplengtha}} +\def\resetFldWdth{\gdef\eqeLW{\linewidth}}% \def\eqExamPriorVspace#1{% \edef\fieldName{% \if\probstar*eqexam.\curr@quiz.% @@ -1102,7 +1111,7 @@ \fi }% \nobreak\noindent\textField[\BC{}\presets{\eqe@optsmltf} - \Ff\FfMultiline]{\fieldName}{\linewidth}{#1}\@gobble + \Ff\FfMultiline]{\fieldName}{\eqeLW}{#1}\resetFldWdth\@gobble } \@ifpackageloaded{exerquiz}{% \let\Ans@sq@l\eqExam@Ans@sq@l @@ -1249,8 +1258,7 @@ {\let\@getsecondOf\@secondoffive}% \@ifundefined{r@#1}{% \csarg\gdef{nRefii@#1}{0}}{% - \expandafter\xdef\csname nRefii@#1\endcsname - {\expandafter\expandafter\expandafter + \csarg\xdef{nRefii@#1}{\expandafter\expandafter\expandafter \@getsecondOf\csname r@#1\endcsname}% }% } @@ -1579,22 +1587,26 @@ new Array("pointsgiven.\curr@quiz.page\thepage"));}}] {\fieldName}{\widthtpboxes}{15pt}% } -\ifx\use@email y +\ifx\use@email\eqe@YES \let\insertPointsBoxPDF\@insertPointsBoxPDF \let\insertTotalsBoxPDF\@insertTotalsBoxPDF \else \let\insertPointsBoxPDF\@empty \let\insertTotalsBoxPDF\@empty \fi -\newcommand{\eqrightmarginbox}[2]{\makebox[0pt][l]{% - \setlength\tabcolsep{0pt}% - \setlength{\@tempdima}{\textwidth-\eqemargin+\marginparsep}% - \hspace*{\@tempdima}% - \raisebox{-.5\height}[0pt][0pt]{% - \marginboxdesign[\insertPointsBoxPDF]% - {\marginpointsboxtext{#1}{#2}}% - }\hfil - }% +\newcommand{\eqrightmarginbox}[2]{% + \makebox[0pt][l]{% + \ifx\probInMinip@ge\relax + \let\eq@TW\textwidth\else + \let\eq@TW\eqTWSave\fi + \setlength\tabcolsep{0pt}% + \setlength{\@tempdima}{\eq@TW-\eqemargin+\marginparsep}% + \hspace*{\@tempdima}% + \raisebox{-.5\height}[0pt][0pt] + {\marginboxdesign[\insertPointsBoxPDF]% + {\marginpointsboxtext{#1}{#2}}% + }\hfil + }\let\probInMinip@ge\relax } \newcommand{\eqeomarginboxright}[2]{\makebox[0pt][l]{% \setlength\tabcolsep{0pt}% @@ -1904,6 +1916,8 @@ \newenvironment{@ssSolution}[1][\ss@Argii]% {% \def\eqe@argi{#1}\ifx\eqe@argi\@empty\else + \setlength{\@tempdima}{\ss@Argii}% chng + \edef\ss@Argii{\the\@tempdima}% \let\soln@keys@nLines\@empty \edef\panelheight{\the\panelheight}% \edef\panelwidth{\the\panelwidth}% @@ -1977,12 +1991,12 @@ \string\setlength{\string\panelwidth}{\ss@Argiii}% \string\def\string\eqedepth {\ifeq@nosolutions\ss@Argii\else\ss@Argii\fi}C}}}% - {\lccode`C=`\%\lowercase{\eqe@IW{% - \string\strut\string\noindent% - \string\hbox\space to\string\linewidth\bgroup^^J% - \eqe@lPanel\string\minipage[b][\string\eqedepth][t]% - {\string\linewidth\eqe@subleftgutter% - -\string\panelwidth-\string\panelgap}C + {\lccode`C=`\%\lowercase{\eqe@IW{\string\vskip2pt + \string\noindent\string\hskip\string\eqemargin + \string\hbox\space to\string\linewidth\bgroup^^J% + \eqe@lPanel\string\minipage[b][\string\eqedepth][t]% + {\string\linewidth\eqe@subleftgutter% + -\string\panelwidth-\string\panelgap}C }}}% \ifeq@solutionsafter \noindent\strut\hbox to\linewidth\bgroup @@ -2113,31 +2127,60 @@ } \def\tb@insmargmark{\ifisinstred\ifismarginans \insMidMarg{\mark{}}\fi\fi} -\def\eqe@adjForSepRule{\if\eq@parttotals\eqe@YES +\def\eqe@adjForSepRule{\ifx\eq@parttotals\eqe@YES \eq@pointboxtotalheight\halfHtPtBox\relax \advance\eq@pointboxtotalheight\dpPtBox\relax \advance\eq@pointboxtotalheight\pointsmarginparpush \vspace*{\eq@pointboxtotalheight}\fi} \def\eqe@afterexamsepcode{% - \if\eq@parttotals\eqe@YES - \@actionsAtPageBreak{\global\let\@spacetobreak1}% - {\global\let\@spacetobreak0}% - \ifx\@spacetobreak0\relax - \bgroup\@tempdima=\pagetotal - \advance\@tempdima\eq@pointboxtotalheight - \ifdim\@tempdima>\pagegoal\aftergroup\newpage - \else\ifnum\arabic{eq@count}>0\relax - \removelastskip\vskip6pt\kern0pt - \if\@reportpoints\eqe@One\else\@checkSpacing{0}\fi - \textcolor{\endexamtotal@color}% - {\eqeomarginbox{\arabic{eq@count}}{0}}\fi - \ifx\eqx@separationrule\eqe@YES - \separationrule\eqe@adjForSepRule\fi - \fi\egroup + \ifx\eq@parttotals\eqe@YES + \@actionsAtPageBreak{\global\let\@spacetobreak\eqe@One}% + {\global\let\@spacetobreak\eqe@Zero}% + \ifx\@spacetobreak\eqe@One + \bgroup\@tempdima=\pagetotal + \advance\@tempdima\eq@pointboxtotalheight + \ifdim\@tempdima>\pagegoal\aftergroup\newpage + \else + \ifnum\arabic{eq@count}>\z@ + \removelastskip\vskip6pt\kern0pt + \ifx\@reportpoints\eqe@One\else\@checkSpacing{0}\fi + \def\@emitPartTotalsBox{\textcolor{\endexamtotal@color}% + {\eqeomarginbox{\arabic{eq@count}}{0}}}% + \insertContent\@emitPartTotalsBox + \fi + \ifx\eqx@separationrule\eqe@YES + \def\@emitSepRule{\separationrule\eqe@adjForSepRule}% + \insertContent\@emitSepRule \fi - \else\ifx\eqx@separationrule\eqe@YES - \separationrule\eqe@adjForSepRule\fi + \fi\egroup + \else + \ifnum\arabic{eq@count}>\z@ + \ifx\@reportpoints\eqe@One\else\@checkSpacing{0}\fi + \def\@emitPartTotalsBox{\textcolor{\endexamtotal@color}% + {\eqeomarginbox{\arabic{eq@count}}{0}}}% + \insertContent\@emitPartTotalsBox + \fi + \ifx\eqx@separationrule\eqe@YES + \def\@emitSepRule{\separationrule\eqe@adjForSepRule}% + \insertContent\@emitSepRule + \else + \eqe@adjForSepRule + \fi \fi + \else + \ifx\eqx@separationrule\eqe@YES + \def\@emitSepRule{\separationrule\bigskip}% + \insertContent\@emitSepRule\fi + \fi +} +\def\insertContent#1{% + \@ifundefined{NextAfter\currExamName} + {#1} + {\edef\x{% + \numFirstPageOfExam{\@nameuse{NextAfter\currExamName}}}% + \edef\y{\numLastPageOfExam{\currExamName}}% + \ifnum\x=\y\relax#1\fi + }% } \def\examenddef {% @@ -2211,36 +2254,52 @@ \def\RecordThisExamOff{\DoNotRecordThisExamtrue} % dpsf02 \def\bIFFalseWrtSolns{\writeT@SolnFile{\protect\iffalse^^J}} \def\eIFFalseWrtSolns{\writeT@SolnFile{\protect\fi^^J}} +\let\currExamName\@empty +\let\prevExamName\@empty +\let\nextExamName\@empty \newenvironment{exam}[2][] {% - \ifDoNotRecordThisExam % dpsf02 + \xdef\eqTWSave{\the\textwidth}% + \ifDoNotRecordThisExam \expandafter\bIFFalseWrtSolns\fi - \makeRoomForProb{\@fvsizeskip\textheight}{0}% - \let\isInExamEnv\eqe@YES - \stepcounter{eq@numparts}% - \def\eqexamargii{#2}\ifx\eqexamargii\@empty - \edef\eqexamargii{\autoExamName}\fi - \xdef\thisexamlabel{\eqexamargii}\xdef\curr@quiz{\eqexamargii}% - \def\eqexamargi{#1}\ifx\eqexamargi\@empty - \edef\eqexamargi{\eqexamargii}\fi - \expandafter\gdef\expandafter\thisUFexamlabel - \expandafter{\eqexamargi}% - \edef\eq@tmp{\the\partNames\string\\{\eqexamargii}}% - \global\partNames=\expandafter{\eq@tmp}% - \csarg\ifx{NumberOfParts}\relax\else -\ifx\eqeWrtExamTitleToSolns\eqe@YES - \ifnum\nNumberOfP@rts=1\relax\else - \def\eqe@argi{#1}\ifx\eqe@argi\@empty - \eqe@writetoSolns{\eqexamargii}\eqe@writetoAux{\string - \csarg\string\gdef{userFriendly\eqexamargii}{\eqexamargii}} + \makeRoomForProb{\@fvsizeskip\textheight}{0}% + \ifx\currExamName\@empty % chng + \xdef\currExamName{#2}\else + \xdef\prevExamName{\currExamName}% + \eqe@IWO\@auxout{\string\csarg\string + \gdef{NextAfter\prevExamName}{#2}}% + \xdef\currExamName{#2}% + \eqe@IWO\@auxout{\string\csarg\string + \gdef{PrevTo\currExamName}{\prevExamName}}% + \fi + \let\isInExamEnv\eqe@YES + \stepcounter{eq@numparts}% + \def\eqexamargii{#2}\ifx\eqexamargii\@empty + \edef\eqexamargii{\autoExamName}\fi + \xdef\thisexamlabel{\eqexamargii}\xdef\curr@quiz{\eqexamargii}% + \def\eqexamargi{#1}\ifx\eqexamargi\@empty + \edef\eqexamargi{\eqexamargii}\fi + \expandafter\gdef\expandafter\thisUFexamlabel + \expandafter{\eqexamargi}% + \edef\eq@tmp{\the\partNames\string\\{\eqexamargii}}% + \global\partNames=\expandafter{\eq@tmp}% + \csarg\ifx{NumberOfParts}\relax\else + \ifx\eqeWrtExamTitleToSolns\eqe@YES + \ifnum\nNumberOfP@rts=1\relax + \else + \def\eqe@argi{#1}% + \ifx\eqe@argi\@empty + \eqe@writetoSolns{\eqexamargii}\eqe@writetoAux{\string + \csarg\string\gdef{userFriendly\eqexamargii}{\eqexamargii}} \else - \eqe@writetoSolns{#1}\eqe@writetoAux{\string - \csarg\string\gdef{userFriendly#2}{#1}} + \eqe@writetoSolns{#1}\eqe@writetoAux{\string + \csarg\string\gdef{userFriendly#2}{#1}}% \fi - \fi\fi -\fi - \exambegdef - \edef\temp@Exp{\noexpand\shortquiz\sqstar[\eqexamargii]}\temp@Exp + \fi + \fi + \fi + \exambegdef + \edef\temp@Exp{\noexpand\shortquiz\sqstar[\eqexamargii]}\temp@Exp }{% \examenddef \vskip\eqeques@parsep\relax\kern0pt %dps88 @@ -3447,6 +3506,40 @@ \ifeqfortextbook\else \if@bypasseqexamheading\else \pagestyle{eqExamheadings}\fi\fi +\def\probInMinipage{% + \ifanswerkey + \ifkeepdeclaredvspacing + \global\let\w@sKeyOn\eqe@YES + \vspacewithkeyOff + \else + \global\let\w@sKeyOn\eqe@NO + \fi + \fi + \let\probInMinip@ge\eqTWSave\noindent} +\let\probInMinip@ge\relax +\newenvironment{vadjForSolnInBx}[1]{% + \setlength\@tempdima{#1}% + \setbox\z@\vbox\bgroup\hsize\@tempdima +}{% + \egroup + \ifanswerkey + \ifx\w@sKeyOn\eqe@YES + \global\vspacewithkeyOn\fi + \setlength{\@tempdima}{\ht\z@+\dp\z@}% + \setlength{\@tempdima}{\sameVspace-\@tempdima}% + \par\vspace{\@tempdima}\fi + \setbox\z@\box\voidb@x +} +\def\bProbInsert#1{\def\@rgi{#1}\ifx\@rgi\@empty + \global\let\insE@rlyAtQues\@empty\else + \gdef\insE@rlyAtQues{\begingroup#1}\fi} +\def\bItemInsert#1{\begingroup#1\noindent\ignorespaces} +\def\eProbInsert{\par\endgroup\@restorepar\par} +\newcommand{\probInsertSoln}[2][]{\writeToSolnFile{#1% + \protect\def\protect + \priorexlabelheader{\protect#2\protect\noindent +}}} +\def\RESTOREPAR{\let\par\@@par} \ifeqfortextbook \AtBeginDocument{\tb@soln@choice \ifeqwritetomargins\chkmarginboxwidth -- cgit v1.2.3