
我正在使用具有多個版本的 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] 選項,但該包不允許第一個問題具有 follow-選項。
我還嘗試調整 mcexam.sty 套件以從隨機化中排除前兩個問題或引入 [fixposition] 選項。我設法讓前兩個問題始終為問題 1 和 2,但隨機化也會將其他一些問題分配為 #1 和 #2,並覆蓋我想要的問題 1 和 2。
我還嘗試在啟動 mcquestion 環境之前包含兩個問題,但我不知道如何告訴 mcquestion 環境在 3 處啟動計數器。
最後,我嘗試只擁有 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 考試中都會遇到與標題問題完全相同的兩個問題,因此這對我有用。
然而,這不是一個非常優雅的解決方案,我仍然對更好的解決方案感興趣。