TransWikia.com

mcexam throws "incomplete ifx" when randomizeanswers=true under Windows 7 TeXLive

TeX - LaTeX Asked by Colin Rowat on June 20, 2021

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}

One Answer

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 @@

 defmc@randomizeAnswers@permuteall{
   foreach a in {1,...,csuse{mc@totalNumberOfAnswersQq}}{
     csxdef{mc@answerTempnuma}{a}
     }
+  numdef@numberofpermuteanswers{csuse{mc@totalNumberOfAnswersQq}}
   numdef@numberofswaps{csuse{mc@totalNumberOfAnswersQq}-1}
   foreach v in {1,...,mc@totalNumberOfVersions}{  
     foreach x in {1,...,@numberofswaps}{
-      pgfmathrandominteger{r}{x}{csuse{mc@totalNumberOfAnswersQq}}
+      pgfmathrandominteger{r}{x}{@numberofpermuteanswers}
       letcs@temp{mc@answerTempnumx}   
       globalcsletcs{mc@answerTempnumx}{mc@answerTempnumr}
       globalcslet{mc@answerTempnumr}{@temp}
       }
     foreach a in {1,...,csuse{mc@totalNumberOfAnswersQq}}{
        csxdef{mc@randomAnswerNumberVv Qq Aa}{csuse{mc@answerTempnuma}}
        csxdef{mc@originalAnswerNumberVv Qq Acsuse{mc@answerTempnuma}}{a}      
       }
     }
   }    

Answered by liyistc on June 20, 2021

Add your own answers!

Ask a Question

Get help from others!

© 2024 TransWikia.com. All rights reserved. Sites we Love: PCI Database, UKBizDB, Menu Kuliner, Sharing RPP