Re: Examdesign and Matching Environment



On Apr 24, 11:51 am, Dan <lueck...@xxxxxxxx> wrote:
On Apr 22, 8:25 pm, palegreenhorse <palegreenho...@xxxxxxxxx> wrote:



i am unsure if it my coding that is wrong (i might need to reset a
variable?) or if the examdesign class has a code error. when i
compile the following example the key does not correctly match the two
matchingenvironments. instead it seems to be wrapping thematching
items between the two sections. i tried looking at examdesign.cls to
try and trouble shoot the problem but i am still a noobie to
understanding a lot of the TeX code though i am trying to understand
more so i can help contribute more in the future. thanks for any
help!

******START:Min. Example.

\documentclass{examdesign}

\begin{document}

\begin{matching}[title={One}]

\pair{One}{1}
\pair{Two}{2}
\pair{Three}{3}

\end{matching}

\begin{matching}[title={Roman}]

\pair{r1}{i}
\pair{r2}{ii}
\pair{r3}{iii}
\pair{r4}{iv}

\end{matching}

\end{document}

******End:Min. Example.

My Results for the KEY

Section 1. One
(d) Three (a) 1
(c) Two (b) 3
(b) One (c) 2

Section 2. Roman
(c) r2 (a) iv
(a) r4 (b) i
(b) r3 (c) ii
(a) r1 (d) iii

It appears that thematchingenvironment does not
correctly distinguish which of the two environments
an answer applies to. Consider "(b) One" and "(d) Three"
(in Section 1 of the key). These are the answers of the
first and third questions in the _second_ section.
The same happens with "(a) r1" and "(b) r3": these are
the answers to the first and third questions of the first
section.

The second question in both section happens to have
the same answer "(c)" so that comes out correct. The
fourth question only exists in the second section, so
perhaps it is not surprising it has the correct answer.

This points to a bug in the code that is supposed to
uniquely associate an answer with a question when
there are multiplematchingenvironments. Unfortunately,
the code is not well documented and I can't determine
where the bug occurs.

Dan

The code is not performing as desired because of a multiple use of the
counter \temp
I was able to resolve the problem by modifying examdesign.cls to
introduce another counter \tempp
I think I did an almost passable job modifying the code, but as a
newbie to this it is possible I didn't. Also I am unsure about the
procedure for modifying and distributing a fix. Is there a "Not So
Short Introduction to Coding/Helping Code Latex Pacakages"??
In any case if anyone else has the problem and wants to fix it I've
included my changes below

\newenvironment{matching}[1][] %line 802 of unmodified file
{\begin{section}
\def\@currentsectionname{matching}
\exam@definesectiontype{matching}
\exam@SetDefaultRearrangeBehavior
\exam@SetDefaultSectionTitle{\exam@notitle}
\exam@SetDefaultRecountState{\exam@DefaultNumberingBehavior}
\setkeys{section}{#1}%
% \setcounter{temp}{1}% %line 810 of unmodified file instead of
commenting out could delete
\exam@GetInstructionsForMatchingSection}
{\end{section}}

\long\def\exam@GetInstructionsForMatchingSection#1\pair{%
\@ifundefined{sec\thesection q\thequestion break}
{\@toklist={}}
{\@toklist={\old@pagebreak}}
\expandafter
\xdef\csname inst@sec\thesection\endcsname{\the\@toklist#1}\pair}

\def\exam@MatchingLineLength{.5in}
\def\exam@MatchingLineAfterSkip{6pt}
\def\pair#1#2{%
\expandafter
\xdef\csname sec\thesection @\thequestion @tag\endcsname{\thetempp}
%line 825 of unmodified code here changed \thetemp to \thetempp%
\expandafter
\gdef\csname sec\thesection @qst\thequestion\endcsname{%
\exam@PairA{\item[]\hskip-\leftmargin
\ifanswer
\underline{\makebox[\exam@MatchingLineLength][c]
{\exam@GetMatchingAnswer}}%
\hskip\exam@MatchingLineAfterSkip #1
\else
\rule{\exam@MatchingLineLength}{.4pt}%
\hskip\exam@MatchingLineAfterSkip #1
\fi}}
\stepcounter{question}
\expandafter
\xdef\csname sec\thesection @\thequestion @tag\endcsname{\thetempp}
%line 838 of unmodified code here changed \thetemp to \thetempp%
\expandafter
\gdef\csname sec\thesection @qst\thequestion\endcsname{%
\exam@PairB{\item\relax\exam@SaveMatchingAnswer #2}}
\stepcounter{tempp}
%line 842 of unmodified code here changed \thetemp to \thetempp%
\stepcounter{question}}

also need to add around line 280 with the other counter definitions
\newcounter{tempp} \setcounter{tempp}{1}

.



Relevant Pages

  • mmap vs mtime in 2.6.26
    ... It has some literature, most notably kernel bug #2645, but that's ... http://lkml.org/lkml/2008/1/22/370 is present in my kernel. ... Not modifying junk... ... Flushing data using msync... ...
    (Linux-Kernel)
  • Re: mmap vs mtime in 2.6.26 and up
    ... literature, most notably kernel bug #2645, but that's closed long ago ... Failure: time not changed. ... Not modifying junk... ... Flushing data using msync... ...
    (Linux-Kernel)
  • mmap vs mtime in 2.6.26 and up
    ... the test program (version 3 from the bug report) ... Failure: time not changed. ... Not modifying junk... ... Flushing data using msync... ...
    (Linux-Kernel)
  • Re: Moving open files
    ... modifying an old file - and doesn't bother to inform the user that the file ... _That_ should be fairly simple to both fix and get attention for. ...
    (Ubuntu)
  • Re: [PATCH] [26/31] CPA: Fix reference counting when changing already changed pages
    ... Doesn't this change require modifying the BUG() here into a BUG_ONso ... More majordomo info at http://vger.kernel.org/majordomo-info.html ... Please read the FAQ at http://www.tux.org/lkml/ ...
    (Linux-Kernel)