1

So far, I haven't been able to find this question, so I'll post it:

I have a quiz I've written with the mcexam package. On my mac, it compiles flawlessly, but for some reason on ALL my windows boxes (I've tried it with both TeXLive 2019 and MikTeX just to make sure), if I use the option randomizeanswers=true, I get the following error during compilation:

"Incomplete \ifx; all text was ignored after line 74."

For reference, line 74 is the very end of the document just after "\end{mcquestions}"

Again, the identical file compiles without complaint on MacTex, but not on the windows TeXLive and I'm stumped.

MWE:

\documentclass{article}
\usepackage[left=0.5in,right=0.5in,top=1in,bottom=1in,headsep=3ex]{geometry}
\usepackage[output=concept,numberofversions=5,version=1,seed=09092019,randomizeanswers=false,randomizequestions=false]{mcexam}
\usepackage{physics}
\usepackage{graphicx}
\usepackage{calc}
\usepackage[per-mode=symbol,inter-unit-product=\cdot]{siunitx}
\title{Test, \mctheversion}
\author{Test}
\date{9/9/2019}

\renewcommand\mcversionlabelfmt[1]{\arabic{#1}}
\renewenvironment{setmcquestion}{\begin{minipage}[t]{\linewidth-\labelwidth}}{\end{minipage}\par}

\begin{document}
    \maketitle
    \begin{mcquestions}
        \question What is the answer to question 1 on the homework?
        \begin{mcanswerslist}
            \answer[correct] \SI{39.8}{\km} N, \SI{35.0}{\km} W
            \answer \SI{35.0}{\m} N, \SI{39.8}{\m} W
            \answer \SI{39.8}{\m} N, \SI{35.0}{\m} W
            \answer \SI{35.0}{\km} N, \SI{39.8}{\km} W
        \end{mcanswerslist}
    \end{mcquestions}
\end{document}

In the example above, this code compiles if, as written I have "randomizeanswers=false", if I switch it to "randomizeanswers=true" then it fails on my windows machines but is still fine on my mac.

From windows machines:

 article.cls    2018/09/03 v1.4i Standard LaTeX document class
  size10.clo    2018/09/03 v1.4i Standard LaTeX file (size option)
geometry.sty    2018/04/16 v5.8 Page Geometry
  keyval.sty    2014/10/28 v1.15 key=value parser (DPC)
   ifpdf.sty    2018/09/07 v3.3 Provides the ifpdf switch
  ifvtex.sty    2016/05/16 v1.6 Detect VTeX and its facilities (HO)
 ifxetex.sty    2010/09/12 v0.6 Provides ifxetex conditional
  mcexam.sty    2017/12/26 v0.4 LaTeX package for creating randomized Multiple 
Choice questions
 xkeyval.sty    2014/12/03 v2.7a package option processing (HA)
 xkeyval.tex    2014/12/03 v2.7a key=value parser (HA)
etoolbox.sty    2018/08/19 v2.5f e-TeX tools for LaTeX (JAW)
 environ.sty    2014/05/04 v0.3 A new way to define environments
trimspaces.sty    2009/09/17 v1.1 Trim spaces around a token list
 newfile.sty    2009/09/03 v1.0c Output and input files
verbatim.sty    2014/10/28 v1.5q LaTeX2e package for verbatim enhancements
enumitem.sty    2019/06/20 v3.9 Customized lists
longtable.sty    2014/10/28 v4.11 Multi-page Table package (DPC)+ FMi change
  pgffor.sty    2019/08/03 v3.1.4b (3.1.4b)
  pgfrcs.sty    2019/08/03 v3.1.4b (3.1.4b)
everyshi.sty    2001/05/15 v3.00 EveryShipout Package (MS)
  pgfrcs.code.tex
 pgfkeys.sty    
 pgfkeys.code.tex
 pgfmath.sty    
 pgfmath.code.tex
  pgffor.code.tex
 xstring.sty    2019/02/06 v1.83 String manipulations (CT)
 physics.sty    
  xparse.sty    2019-05-28 L3 Experimental document command parser
   expl3.sty    2019-09-05 L3 programming layer (loader) 
expl3-code.tex    2019-09-05 L3 programming layer 
l3backend-pdfmode.def    2019-04-06 v L3 backend support: PDF mode
 amsmath.sty    2018/12/01 v2.17b AMS math features
 amstext.sty    2000/06/29 v2.01 AMS text
  amsgen.sty    1999/11/30 v2.0 generic functions
  amsbsy.sty    1999/11/29 v1.2d Bold Symbols
  amsopn.sty    2016/03/08 v2.02 operator names
graphicx.sty    2017/06/01 v1.1a Enhanced LaTeX Graphics (DPC,SPQR)
graphics.sty    2017/06/25 v1.2c Standard LaTeX Graphics (DPC,SPQR)
    trig.sty    2016/01/03 v1.10 sin cos tan (DPC)
graphics.cfg    2016/06/04 v1.11 sample graphics configuration
  pdftex.def    2018/01/08 v1.0l Graphics/color driver for pdftex
    calc.sty    2017/05/25 v4.3 Infix arithmetic (KKT,FJ)
 siunitx.sty    2018/05/17 v2.7s A comprehensive (SI) units package
   array.sty    2018/12/30 v2.4k Tabular extension package (FMi)
l3keys2e.sty    2019-05-28 LaTeX2e option processing using LaTeX3 keys
translator.sty    2019-05-31 v1.12a Easy translation of strings in LaTeX
supp-pdf.mkii
epstopdf-base.sty    2016/05/15 v2.6 Base part for package epstopdf
infwarerr.sty    2016/05/16 v1.4 Providing info/warning/error messages (HO)
  grfext.sty    2016/05/16 v1.2 Manage graphics extensions (HO)
kvdefinekeys.sty    2016/05/16 v1.4 Define keys (HO)
 ltxcmds.sty    2016/05/16 v1.23 LaTeX kernel commands for general use (HO)
kvoptions.sty    2016/05/16 v3.12 Key value format for package options (HO)
kvsetkeys.sty    2016/05/16 v1.17 Key value parser (HO)
etexcmds.sty    2016/05/16 v1.6 Avoid name clashes with e-TeX commands (HO)
ifluatex.sty    2016/05/16 v1.4 Provides the ifluatex switch (HO)
pdftexcmds.sty    2019/07/25 v0.30 Utility functions of pdfTeX for LuaTeX (HO)
epstopdf-sys.cfg    2010/07/13 v1.3 Configuration of (r)epstopdf for TeX Live
  ts1enc.dfu    2018/10/05 v1.2f UTF-8 support for inputenc
translator-basic-dictionary-English.dict    
siunitx-abbreviations.cfg    2017/11/26 v2.7k siunitx: Abbreviated units
 ***********

From mac

*File List*
 article.cls    2018/09/03 v1.4i Standard LaTeX document class
  size10.clo    2018/09/03 v1.4i Standard LaTeX file (size option)
geometry.sty    2018/04/16 v5.8 Page Geometry
  keyval.sty    2014/10/28 v1.15 key=value parser (DPC)
   ifpdf.sty    2018/09/07 v3.3 Provides the ifpdf switch
  ifvtex.sty    2016/05/16 v1.6 Detect VTeX and its facilities (HO)
 ifxetex.sty    2010/09/12 v0.6 Provides ifxetex conditional
  mcexam.sty    2017/12/26 v0.4 LaTeX package for creating randomized Multiple 
Choice questions
 xkeyval.sty    2014/12/03 v2.7a package option processing (HA)
 xkeyval.tex    2014/12/03 v2.7a key=value parser (HA)
etoolbox.sty    2018/08/19 v2.5f e-TeX tools for LaTeX (JAW)
 environ.sty    2014/05/04 v0.3 A new way to define environments
trimspaces.sty    2009/09/17 v1.1 Trim spaces around a token list
 newfile.sty    2009/09/03 v1.0c Output and input files
verbatim.sty    2014/10/28 v1.5q LaTeX2e package for verbatim enhancements
enumitem.sty    2019/06/20 v3.9 Customized lists
longtable.sty    2014/10/28 v4.11 Multi-page Table package (DPC)+ FMi change
  pgffor.sty    2019/05/09 v3.1.3 (3.1.3)
  pgfrcs.sty    2019/05/09 v3.1.3 (3.1.3)
everyshi.sty    2001/05/15 v3.00 EveryShipout Package (MS)
  pgfrcs.code.tex
 pgfkeys.sty    
 pgfkeys.code.tex
 pgfmath.sty    
 pgfmath.code.tex
  pgffor.code.tex
 xstring.sty    2019/02/06 v1.83 String manipulations (CT)
 physics.sty    
  xparse.sty    2019-05-28 L3 Experimental document command parser
   expl3.sty    2019-05-28 L3 programming layer (loader) 
expl3-code.tex    2019-05-28 L3 programming layer 
l3pdfmode.def    2019-04-06 v L3 Experimental driver: PDF mode
 amsmath.sty    2018/12/01 v2.17b AMS math features
 amstext.sty    2000/06/29 v2.01 AMS text
  amsgen.sty    1999/11/30 v2.0 generic functions
  amsbsy.sty    1999/11/29 v1.2d Bold Symbols
  amsopn.sty    2016/03/08 v2.02 operator names
graphicx.sty    2017/06/01 v1.1a Enhanced LaTeX Graphics (DPC,SPQR)
graphics.sty    2017/06/25 v1.2c Standard LaTeX Graphics (DPC,SPQR)
    trig.sty    2016/01/03 v1.10 sin cos tan (DPC)
graphics.cfg    2016/06/04 v1.11 sample graphics configuration
  pdftex.def    2018/01/08 v1.0l Graphics/color driver for pdftex
    calc.sty    2017/05/25 v4.3 Infix arithmetic (KKT,FJ)
 siunitx.sty    2018/05/17 v2.7s A comprehensive (SI) units package
   array.sty    2018/12/30 v2.4k Tabular extension package (FMi)
l3keys2e.sty    2019-05-28 LaTeX2e option processing using LaTeX3 keys
translator.sty    2019-05-31 v1.12a Easy translation of strings in LaTeX
supp-pdf.mkii
epstopdf-base.sty    2016/05/15 v2.6 Base part for package epstopdf
infwarerr.sty    2016/05/16 v1.4 Providing info/warning/error messages (HO)
  grfext.sty    2016/05/16 v1.2 Manage graphics extensions (HO)
kvdefinekeys.sty    2016/05/16 v1.4 Define keys (HO)
 ltxcmds.sty    2016/05/16 v1.23 LaTeX kernel commands for general use (HO)
kvoptions.sty    2016/05/16 v3.12 Key value format for package options (HO)
kvsetkeys.sty    2016/05/16 v1.17 Key value parser (HO)
etexcmds.sty    2016/05/16 v1.6 Avoid name clashes with e-TeX commands (HO)
ifluatex.sty    2016/05/16 v1.4 Provides the ifluatex switch (HO)
pdftexcmds.sty    2018/09/10 v0.29 Utility functions of pdfTeX for LuaTeX (HO)
epstopdf-sys.cfg    2010/07/13 v1.3 Configuration of (r)epstopdf for TeX Live
  ts1enc.dfu    2018/10/05 v1.2f UTF-8 support for inputenc
translator-basic-dictionary-English.dict    
siunitx-abbreviations.cfg    2017/11/26 v2.7k siunitx: Abbreviated units
 ***********
  • Yes they are exactly the same. I'll see if I can get a MWE put up, but honestly the only change to make it work on a windows machine is that if I make it randomizeanswers=false it will compile fine. Such a bizarre error. – Matt Haddad Sep 08 '19 at 13:41
  • almost always the operating system will not be the problem, add \listfiles to your preamble and compare the file versions in the list at the end of the log. – David Carlisle Sep 08 '19 at 14:04
  • Hi, the files are the exact same version and same date, but thanks for the tip anyway! – Matt Haddad Sep 08 '19 at 14:15
  • @MattHaddad the two results of \listfiles are not the same. You have differences in multiple packages (pgffor pgfrcs expl3 and pdftexcmds, at least) – BambOo Sep 08 '19 at 14:39
  • Okay, but these are both the 2019 versions of MacTex and TexLive. Since this is a standard part of the distribution with nothing custom added, I'm hoping there is a way to fix this file so that it will compile on both platforms. So far, I haven't been able to find a fix for this. – Matt Haddad Sep 08 '19 at 14:42
  • On Linux (TeX Live 2017) it works fine with both randomizeanswers=true and randomizeanswers=false. So it looks like it is something Windows-specific (maybe the implementation of the random generator?) and it is also not a problem that your packages or LaTeX engine are too new - which is a problem sometimes when packages are a bit behind on the development of other packages or LaTeX itself. – Marijn Sep 08 '19 at 19:52
  • Alright, I'll just have to implement what I want some other way without the mcexam package for now, since I think @Marijn is right. Thank you all so much for lending me your time and trying to help with this! – Matt Haddad Sep 12 '19 at 00:34

1 Answers1

0

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.

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