
我想使用 \numquestions 和 \numparts 而不像 \numpoints 那樣計算獎金問題和 -parts。我怎樣才能實現這個目標?
舉個例子;我想說的是“考試包含 2 題和一道附加題。」
\documentclass[addpoints]{exam}
\begin{document}
This exams contains \numquestions\ questions and a bonusquestion.
\begin{questions}
\question[100]
Is this the first question?
\question[100]
Is this the second question?
\bonusquestion[100]
Does this question count?
\end{questions}
\end{document}
答案1
使用包totcount
和命令\qquestion
and\bbonusquestion
代替\question
and \bonusquestion
。
\documentclass[addpoints]{exam}
%****************************** added <<<<<<<<<<<<<<<<<<
\usepackage{totcount}
\newtotcounter{q}
\setcounter{q}{0}
\newtotcounter{b}
\setcounter{b}{0}
\newcommand{\qquestion}[0]{\stepcounter{q}\question}
\newcommand{\bbonusquestion}[0]{\stepcounter{b}\bonusquestion}
%******************************
\begin{document}
This exams contains \total{q}\ question(s) and \total{b}\ bonusquestion(s).
\begin{questions}
\qquestion[100]
Is this the first question?
\qquestion[100]
Is this the second question?
\bbonusquestion[100]
Does this question count?
\bbonusquestion[100]
Does this question count?
\end{questions}
\end{document}
靈感來自於分別統計問題數量...