使用 McExam 包修复前(两个)个问题

使用 McExam 包修复前(两个)个问题

我正在使用具有多个版本的 McExam 包编写 McExam。前两个问题应该是

\documentclass{article}
\usepackage{mcexam}
\begin{document}
    \begin{mcquestions}

    %%%% Header questions (not be included in randomization) %%%

    \question What is the version of your question booklet?
    \begin{mcanswerslist}
        \answer[correct] Version A
        \answer Version B
    \end{mcanswerslist}

    \question Your exam will be graded only if you write your version on top of the bubble
    sheet provided. Did you write the version number on top of the bubble sheet?
    \begin{mcanswerslist}
        \answer[correct] Yes, I have written the version number on top of the bubble sheet.
        \answer No, I have not yet written the version number on top of the bubble sheet.
    \end{mcanswerslist}

    %%%% Main test questions (starting with #3, included in randomization) %%%       

    \question What is 5 + 2?
    \begin{mcanswerslist}
        \answer[correct] 7
        \answer 5
        \answer 3   
    \end{mcanswerslist}

    \question What is 1 + 3?
    \begin{mcanswerslist}
        \answer[correct] 4
        \answer 6
        \answer 2   
    \end{mcanswerslist}
    \end{mcquestions}

\end{document}

在这两个版本的考试中,标题问题应该是问题 1 和问题 2。

但是,我不知道如何在随机化中排除这两个问题。

我曾尝试使用 [follow] 选项,但是包不允许第一个问题有后续选项。

我还尝试过调整 mcexam.sty 包以将前两个问题排除在随机化之外或引入 [fixposition] 选项。我设法让前两个问题始终是问题 1 和问题 2,但随机化也会将其他一些问题分配为问题 1 和问题 2,并覆盖我预期的问题 1 和问题 2。

我也尝试在启动 mcquestion 环境之前包含这两个问题,但是我不知道如何告诉 mcquestion 环境从 3 开始计数器。我尝试使用 \setcounter,但不知道要设置哪个计数器。

最后,我尝试只拥有 mcquestion 环境的两个部分,但这会在第二个环境中将计数器重置为 1。

有什么想法或建议吗?

答案1

在对 .sty 文件进行了一些修改之后,我找到了一些可以工作的东西。

在 .sty 文件的 3.1 节中,问题是随机的。我将原始代码中的 978 至 1007 行替换为

\def\mc@randomizeQuestions{{    
  % Make the mcquestionblock control sequences which include macro's to set the randomization question counters 
  % exclude first two questions from randomization by setting counter to 2 and assigning the first two questions the first two numbers
  \setcounter{mc@counter}{2}
  \foreach \v in {1,...,\mc@totalNumberOfVersions}{
    \foreach \q in {1,...,2}{
      \csxdef{mc@randomQuestionNumberV\v Q\q}{\q}
      \csxdef{mc@originalQuestionNumberV\v Q\q}{\q} 
       }
    }   % For the randomization start at question q=3
  \foreach \q in {3,...,\mc@totalNumberOfQuestions}{
    \ifcsstring{mc@questionOption\q}{follow}{}{
      \refstepcounter{mc@counter}
      \csgdef{mc@questionblock\arabic{mc@counter}}{}
      }
    \csxappto{mc@questionblock\arabic{mc@counter}}{
      \noexpand\refstepcounter{mc@counter}
      \noexpand\csxdef{mc@randomQuestionNumberV\noexpand\v Q\q}{\noexpand\arabic{mc@counter}}
      \noexpand\csxdef{mc@originalQuestionNumberV\noexpand\v Q\noexpand\arabic{mc@counter}}{\q}        
      }  
    }
  % randomize question blocks
  \numdef\@numberofswaps{\mc@totalNumberOfQuestionblocks-1}
  \foreach \v in {1,...,\mc@totalNumberOfVersions}{
    \foreach \q in {1,...,\@numberofswaps}{
      \pgfmathrandominteger{\r}{\q}{\@numberofswaps}
      \numdef\r{\r+1}
      \global\letcs\@swap{mc@questionblock\r}
      \global\csletcs{mc@questionblock\r}{mc@questionblock\q}  
      \global\cslet{mc@questionblock\q}{\@swap}
      } % For the randomization  question block 2
    \setcounter{mc@counter}{2}  
    \foreach \q in {1,...,\mc@totalNumberOfQuestionblocks}{  
      \csuse{mc@questionblock\q}
      }
    }  
  }}

这有效

  • 将前两个问题指定为 1 和 2,并且
  • 在随机化中分别增加 mc@counter 和起始计数器。

由于在每次 MC 考试中我都会遇到完全相同的两个标题问题,所以这对我来说很有用。

然而,这不是非常优雅的解决方案,我仍然对更好的解决方案感兴趣。

相关内容