2

I sometimes post my old exams, and I think that these would be more useful as reference documents if the grade table on the front page reported the average score for each question (from the year that the exam was given). My goal is to add an extra "Average" column to the standard grade table.

I have created a MWE that gets something close to what I want by hijacking the bonus points mechanism (which I don't use). The issue is that I would like to be able to "assign bonus points" (record the average score) for a regular question, rather than adding a separate part for this as I have done in the 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}

Is there an easy way of assigning bonus points to regular questions, or a better way of recording the average score within the exam class?

1 Answer 1

1

I figured out an approach which only modifies the bonus mechanism at table-printing time. The key idea was to only hijack the lowest-level function (the one responsible for reporting the bonus points from file), and use a switch so that it can be reverted to normal. MWE is

\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}

I didn't try reporting regular points and bonus points together because that's not the target use case here. It could be done, but would require re-writing several different layers of table-writing functions to add extra rows/columns.

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .