当 Windows 7 TeXLive 下的 randomizeanswers=true 时,mcexam 会抛出“不完整的 \ifx”

当 Windows 7 TeXLive 下的 randomizeanswers=true 时,mcexam 会抛出“不完整的 \ifx”

鉴于以下 MWE、Windows 7、TeX Live 2019/W32TeX 和 LuaTeX,版本 1.10.0(或 pdfTeX,版本 3.14159265-2.6-1.40.20 或 XeTeX,版本 3.14159265-2.6-0.999991):

  1. 我正确编译了randomizeanswers=false
  2. 只要randomizeanswers=true每个mcanswerslist设置ordinalfixlast
  3. 我收到错误Incomplete \ifx; all text was ignored after line 34(明确或默认)randomizeanswers=truepermuteall

第 34 行是\end{mcquestions}之前的\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

mc@randomizeAnswers@permuteall我昨天也遇到了这个错误,我自己已经通过对中的函数进行以下几行更改(第 1060 行添加一项,第 1063 行更新一项)来修复它mcexam.sty。希望这对您有所帮助。

我也想知道在哪里提交这样的补丁。

--- /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}      
       }
     }
   }    

相关内容