我正在尝试使用考试包在单个文件中创建带有编号副本的考试。我已设法使一切正常运行,但 \gradetable 包含的问题副本数量与考试副本数量 (NumCopy) 相同。有没有办法重置成绩表?
\documentclass[addpoints]{exam}
\begin{document}
\newcounter{copynum} % copy number, to be printed in the footer
\newcounter{NumCopy} % how many copies do we want?
\setcounter{NumCopy}{3} % we want 3
\whiledo{\thecopynum<\theNumCopy}{%
\setcounter{page}{1} % start numbering pages for the current copy at 1
\addtocounter{copynum}{1} % the number of the current copy
\setcounter{question}{1} % make questions start at 1 again
\setcounter{part}{1} % make parts start at 1 again
...
% exam content goes here
....
\gradetable[v][questions] % BUG: contains NumCopy*(number of questions) many entries
}
\end{document}
答案1
还有其他类的计数器exam
需要重置:numquestions
,,numpoints
...
首次运行后,\label
需要禁用以避免多次定义标签。还会exam
写入.aux
文件,可通过重新定义来防止这种情况\PgInfo@write
。
完整示例,问题取自文档类别exam
:
\documentclass[addpoints]{exam}
\makeatletter
\newcommand*{\ExamResetAfterFirstRun}{%
\renewcommand*{\PgInfo@write}[1]{}%
\renewcommand*{\label}[1]{\@bsphack\@esphack}%
}
\makeatother
\begin{document}
\newcounter{copynum} % copy number, to be printed in the footer
\newcounter{NumCopy} % how many copies do we want?
\setcounter{NumCopy}{3} % we want 3
\whiledo{\thecopynum<\theNumCopy}{%
\setcounter{page}{1} % start numbering pages for the current copy at 1
\addtocounter{copynum}{1} % the number of the current copy
\setcounter{question}{1} % make questions start at 1 again
\setcounter{part}{1} % make parts start at 1 again
\setcounter{numquestions}{0}
\setcounter{numpoints}{0}
\setcounter{numbonuspoints}{0}
\setcounter{numparts}{0}
\setcounter{numsubparts}{0}
\setcounter{numsubsubparts}{0}
\ifnum\value{copynum}>1 %
\ExamResetAfterFirstRun
\fi
\begin{questions}
\question[10]
Why is there air?
\question[15]
How much wood would a woodchuck chuck if a woodchuck could cuck
wood?
\question[10]
Compute $\displaystyle\int_0^1 x^2 \, dx$.
\end{questions}
\gradetable[v][questions]
}
\end{document}