4

Given the MWE below, Windows 7, TeX Live 2019/W32TeX and LuaTeX, Version 1.10.0 (or pdfTeX, Version 3.14159265-2.6-1.40.20 or XeTeX, Version 3.14159265-2.6-0.999991):

  1. I compile properly with randomizeanswers=false
  2. I compile properly with randomizeanswers=true as long as each mcanswerslist sets either ordinal or fixlast
  3. I get a Incomplete \ifx; all text was ignored after line 34 error with randomizeanswers=true and permuteall (either explicitly or by default)

Line 34 is the \end{mcquestions} before \end{document}.

\documentclass{article}

\usepackage[output=exam
  ,numberofversions=1
  ,version=1
  ,seed=1
  ,randomizequestions=true
  ,randomizeanswers=true
  ,writeRfile=false
  ]{mcexam}

\begin{document}

\begin{mcquestions}

\question What is going to be on the exam
\begin{mcanswerslist}[fixlast] % `fixlast` allows compilation
  \answer Russell's antinomy
  \answer Gödel's numbering
  \answer Borges' library
  \answer Smullyan's What Is The Name Of This Book
  \answer[correct] all of the above
\end{mcanswerslist}

\question Have you ever danced with the devil in the pale moonlight?
\begin{mcanswerslist}%[ordinal] % `ordinal` crashes
  \answer Cesar Romero
  \answer[correct] Jack Nicholson
  \answer Heath Ledger
  \answer Joaquin Phoenix
  \answer Mark Hamill
\end{mcanswerslist}

\end{mcquestions}

\end{document}
  • 1
    You should report this to the package author if you think it is a bug (take a look at mcexam's documentation for contact info). – Skillmon Nov 02 '19 at 12:26
  • I've reported it to the package author, without reply – Colin Rowat Nov 02 '19 at 16:12
  • 1
    When did you notified the author? Today, give him some time. We (the package authors) have a life, too, and some of those lives don't take place in the same time zone as yours. But it is important that the authors get notified through the channels they offer in their documentation or on CTAN, you can't expect every package author to roam every community and mailing list there is. – Skillmon Nov 02 '19 at 18:46
  • 1
    I first wrote two weeks ago, and then a second time earlier this week – Colin Rowat Nov 02 '19 at 19:33
  • The bug has been fixed in the latest version of mcexam (dated September 12, 2021) which is on CTAN. – Marijn Oct 29 '21 at 19:39

1 Answers1

3

I also got this error yesterday, and I've fixed it myself with the following lines of changes (one addition on Line 1060 and one update on Line 1063) to the mc@randomizeAnswers@permuteall function in mcexam.sty. Hope this helps.

I'm also wondering where to submit a patch like this.

--- /usr/local/texlive/2019/texmf-dist/tex/latex/mcexam/mcexam.sty
+++ mcexam.sty
@@ -1055,23 +1055,24 @@

 \def\mc@randomizeAnswers@permuteall{
   \foreach \a in {1,...,\csuse{mc@totalNumberOfAnswersQ\q}}{
     \csxdef{mc@answerTempnum\a}{\a}
     }
+  \numdef\@numberofpermuteanswers{\csuse{mc@totalNumberOfAnswersQ\q}}
   \numdef\@numberofswaps{\csuse{mc@totalNumberOfAnswersQ\q}-1}
   \foreach \v in {1,...,\mc@totalNumberOfVersions}{  
     \foreach \x in {1,...,\@numberofswaps}{
-      \pgfmathrandominteger{\r}{\x}{\csuse{mc@totalNumberOfAnswersQ\q}}
+      \pgfmathrandominteger{\r}{\x}{\@numberofpermuteanswers}
       \letcs\@temp{mc@answerTempnum\x}   
       \global\csletcs{mc@answerTempnum\x}{mc@answerTempnum\r}
       \global\cslet{mc@answerTempnum\r}{\@temp}
       }
     \foreach \a in {1,...,\csuse{mc@totalNumberOfAnswersQ\q}}{
        \csxdef{mc@randomAnswerNumberV\v Q\q A\a}{\csuse{mc@answerTempnum\a}}
        \csxdef{mc@originalAnswerNumberV\v Q\q A\csuse{mc@answerTempnum\a}}{\a}      
       }
     }
   }    

liyistc
  • 51