我有时会发布我以前的考试,我认为如果首页上的成绩表报告了每个问题的平均分数(从考试那一年开始),这些考试作为参考文件会更有用。我的目标是在标准成绩表中添加一个额外的“平均”列。
我已经创建了一个 MWE,它得到了一些东西关闭通过劫持奖励积分机制(我不使用)来实现我想要的效果。问题是,我希望能够为常规问题“分配奖励积分”(记录平均分数),而不是像我在 MWE 中所做的那样为此添加单独的部分
\documentclass[addpoints]{exam}
\begin{document}
% Rename "Bonus Points" entry in grade tables
\bvpword{Average} % Vertical Bonus Tables
\bhpword{Average} % Horizontal Bonus Tables
\cvbpword{Average} % Combined Vertical Tables
\chbpword{Average} % Combined Horizontal Tables
% Combined point table
\combinedpointtable
% Questions
\begin{questions}
\question
\begin{parts}
\part[20] Why?
\bonuspart[15] Dummy part to indicate that the average score on this question was 15
\end{parts}
\question
\begin{parts}
\part[20] Why not?
\bonuspart[15] Dummy part to indicate that the average score on this question was 15
\end{parts}
\end{questions}
\end{document}
是否有一种简单的方法可以为常规问题分配加分,或者是否有更好的方法来记录考试类别中的平均分数?
答案1
我想到了一种只在表格打印时修改奖励机制的方法。关键思想是只劫持最低级别的函数(负责从文件中报告奖励积分的函数),并使用开关使其恢复正常。MWE 是
\documentclass[addpoints]{exam}
\begin{document}
\makeatletter
% New variables
\def\avgword#1{\def\@avgword{#1}}
\avgword{Average} % Used in column/row heading
\newif\if@bonus@is@average
\@bonus@is@averagefalse
% Command for writing average score to file
\newcommand{\avgWas}[1]{%
\if@filesw
\ifnum \value{question} > 0\relax
% Now do bonus points:
\immediate\write\@mainaux
{\string\gdef\string\avgpointsofq@
\romannumeral \csname c@question\endcsname
{#1}}%
\fi
\fi
}
% Re-write bonuspointsofquestion to possibly report average points instead (depending on value of \@bonus@is@average)
\let\bonuspointsofquestion\relax
\newcommand{\bonuspointsofquestion}[1]{%
\if@bonus@is@average%
\@ifundefined{avgpointsofq@\romannumeral #1}%
{\mbox{\normalfont\bfseries ??}}%
{\csname avgpointsofq@\romannumeral #1\endcsname}%
\else%
\@ifundefined{bonuspointsofq@\romannumeral #1}%
{\mbox{\normalfont\bfseries ??}}%
{\csname bonuspointsofq@\romannumeral #1\endcsname}%
\fi%
}
% Command for bonus points table
\def\averagepointtable{% Allow optional argument with default
\@ifnextchar[{\i@atable}{\i@atable[v]}
}
\def\i@atable[#1]{% Internal averagepointtable
\begingroup
% Locally re-label "Bonus Points" row/column as an "Average" row/column
\bvpword{\@avgword} % Vertical Bonus Tables
\bhpword{\@avgword:} % Horizontal Bonus Tables
\cvbpword{\@avgword} % Combined Vertical Tables
\chbpword{\@avgword:} % Combined Horizontal Tables
% Locally look up average points, not bonus points
\@bonus@is@averagetrue
% The modifications above turn the "combined" table into an "average" table
\combinedpointtable[#1]
\endgroup
}
\makeatother
% Print
\section{Point Tables}
\subsection{Average Points}
% Re-title average column (optional)
%\avgword{Average (last year)}
\begin{center}
\averagepointtable
\hspace*{1in}
\averagepointtable[h]
\end{center}
\subsection{Bonus Points}
\begin{center}
\combinedpointtable
\hspace*{1in}
\combinedpointtable[h]
\end{center}
% Questions
\section{Questions}
\begin{questions}
\question[20] Why? (The average score for this question was 15) \avgWas{15}
\question (The average score for this question was 5) \avgWas{5}
\begin{parts}
\part[20] Why not?
\bonuspart[15] Dummy part to indicate that the average score on this question was 15
\end{parts}
\end{questions}
\end{document}
我没有尝试同时报告常规积分和奖励积分,因为这不是这里的目标用例。这可以做到,但需要重写几层不同的表格写入函数来添加额外的行/列。