考试课中定制加分题

考试课中定制加分题

我正在使用exam课程(带有addpoints选项)来创建作业,并且我想创建一些奖励问题。我有一个自定义的问题格式,如下所示:

\qformat{Question \thequestion: [\totalpoints]}

这对于解决常规问题很有效。

但是, \totalpoints 命令不会返回奖励问题的值,因此这些问题被错误地标记为 0 分。

我通过重新定义 \qformat (在奖励问题之前)来解决这个问题

\qformat{Question \thequestion: [\totalbonuspoints]}

效果很好。但我更希望有一个适用于所有问题(奖励或非奖励)的单一指定。我该怎么做?

注意:我本可以在定义中使用 \thepoints,但是我的某些问题包含部分,因此需要 \totalpoints 来加总分数。

答案1

查看 exam.cls 的源代码,if@bonus您可以使用它来测试您排版的是奖励问题还是常规问题。您可以做一些类似的事情

\makeatletter
\newcommand\thetotalpoints{%
  \if@bonus
    [\totalbonuspoints\ bonus points]
  \else
    [\totalpoints\ points]
  \fi
}
\makeatother

\qformat{Question \thequestion: \thetotalpoints \hfill}

答案2

exam.cls 的 betatest 版本会创建命令,\bonusqformat该命令对奖励问题执行的操作与\qformat对常规问题执行的操作相同。您可以从以下位置获取 exam.cls 2.318beta 版本的副本此网页使用该版本的 exam.cls,您可以说

\qformat{Question \thequestion: [\totalpoints]\hfill}
\bonusqformat{Question \thequestion: [\totalbonuspoints]\hfill}

或者

\qformat{Question \thequestion:\dotfill [\totalpoints]}
\bonusqformat{Bonus Question \thequestion:\dotfill [\totalbonuspoints]}

或者任何其他你喜欢的变体。

相关内容