1

Question: Is there a way to "clear" the contents of the points column using the gradetable for the exam document class?

Edit (2): I was able to use some code from exam.cls to print a table that uses a given number (9 in this case), but I'd like to not default to 0 if no point value is given for a question but just an empty space. If I try that instead of the 9, then I get ! Missing number, treated as zero error. I feel like I am close to a solution to my problem, but I am having a hard time working it out. (See end of this question for new code and output.)


Using the code

\documentclass[addpoints]{exam}

\begin{document}
\gradetable[v]
\begin{questions}
\question[10] Question 1
\question[20] Question 2
\end{questions}
\end{document}

produces

enter image description here

Though it may sound odd, I'd like to be able to clear out the contents of the points column (so I only have empty boxes or spaces). I tinkered with a number of things including \pointformat and looked at a few questions on TeX.SE about how to "hide" the point totals in the document body itself (i.e., not printing the points in the margin), but I cannot come up with any fix to have each point value printed in the table as {} or something similar.

Is there a way to do this using \renewcommand or something of that nature? [I don't have the know-how to fully understand the package code itself to know what command to "renew" that ends up printing the point values in the table.] (I'm ultimately trying to take advantage of the exam gradetable structure, but I cannot figure out a way to alter the table as communicated.)


Edit (2):

enter image description here

The above is produced by the following:

\documentclass[addpoints]{exam}

\makeatletter
\renewcommand*\set@hlfcntr[2]{%
  \begingroup
    \global\csname #1@halffalse\endcsname
    % If there as a `\half' present, it will be executed
    % right after the assignment of the digit part of #2
    % to the counter #1.
    \def\half{%
      \global\csname #1@halftrue\endcsname
    }%
    % We insert a `0' in case there are no digits present:
    % We avoid using \setcounter, because calc.sty redefines
    % \setcounter in a way that conflicts with the \half trick
    % we're using:
    %    \setcounter{#1}{0#2}\relax
    %%%\global\csname c@#1\endcsname 0#2\relax%%% <== ORIGINAL CODE
    \global\csname c@#1\endcsname 9\relax
  \endgroup
}% set@hlfcntr
\makeatother

\begin{document}
\gradetable[v]
\begin{questions}
\question Question 1
\question Question 2
\end{questions}
\end{document}
  • 1
    Stating the obvious: Without the points and scores is just a simple (mostly empty) table. Wouldn't it be easier just type yourself a normal table that dismember \gradetable ? – Fran Sep 5 '17 at 17:29
2

Updated to also cover partial tables. Note that the order of the arguments for \emptypartialgradetable and \emptypartialbonusgradetable differs from the corresponding macros in the class - here, the optional arguments come first, before the range. That is because I used \newcommandtwoopt to define them.

\documentclass[addpoints]{exam}
\usepackage{twoopt}

\makeatletter

\newcommandtwoopt{\emptygradetable}[2][v][questions]{{%
  \renewcommand{\pointsofquestion}[1]{}
  \renewcommand{\prt@tablepoints}{}
  \@scorestrue
  \@bonusfalse
  \@partialfalse
  \@combinedfalse
  \ii@gtable{#1}[#2]%
}}

\newcommandtwoopt{\emptybonusgradetable}[2][v][questions]{{%
  \renewcommand{\bonuspointsofquestion}[1]{}
  \renewcommand{\prt@tablebonuspoints}{}
  \@scorestrue
  \@bonustrue
  \@partialfalse
  \@combinedfalse
  \ii@gtable{#1}[#2]%
}}

\newcommandtwoopt{\emptypartialgradetable}[3][v][questions]{{%
  \renewcommand{\pointsofquestion}[1]{}
  \renewcommand{\prt@tablepoints}{}
  \@scorestrue
  \@bonusfalse
  \@partialtrue
  \@combinedfalse
  \def\tbl@range{#3}%
  \ii@gtable{#1}[#2]%
}}%

\newcommandtwoopt{\emptypartialbonusgradetable}[3][v][questions]{{%
  \renewcommand{\bonuspointsofquestion}[1]{}
  \renewcommand{\prt@tablebonuspoints}{}
  \@scorestrue
  \@bonustrue      
  \@partialtrue
  \@combinedfalse
  \def\tbl@range{#3}%
  \ii@gtable{#1}[#2]%
}}%

\makeatother

\begin{document}
\emptygradetable[h]

\bigskip

\emptybonusgradetable[v]

\bigskip

\emptypartialgradetable[h][questions]{myrange}

\bigskip

\emptypartialbonusgradetable[v][questions]{myrange}   

\bigskip

\begin{questions}
\question[10] Question 1
\question[20] Question 2

\begingradingrange{myrange}
\bonusquestion[15] Question 3
\question[10] Question 4
\question[15] Question 5
\endgradingrange{myrange}
\end{questions}

\end{document}

enter image description here

  • Ah, OK, I didn't realise one could drop one's comments. I got something out of this, too - I have to give exams also, but so far had not come across the exam class, which seems very handy. Now if it could also take care of the marking ;) – Michael Palmer Sep 6 '17 at 18:21

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.