2

How could I create an automatic grading key for an exam, based on previously defined percentages? If the total points change, I don't want to change the whole grading key, but let TeX do it automatically. My current solution is a bit complicated. Is there a more simple version?

(By grading key I mean a table where the ranges for a certain mark are given, as the figure shows.)

\documentclass[addpoints,12pt]{exam}

\usepackage[nomessages]{fp}

\begin{document}


\begin{center}
    \gradetable[h][questions]
\end{center}

Grading key:


\begin{center}
    \begin{tabular}{lclll}
        \FPeval{\result}{round(0.8*\numpoints,0)}\result&-&\numpoints&&5\\
        \FPeval{\result}{round(0.6*\numpoints,0)}\result&-&\FPeval{\result}{round(0.8*\numpoints-1,0)}\result&&4\\
        \FPeval{\result}{round(0.4*\numpoints,0)}\result&-&\FPeval{\result}{round(0.6*\numpoints-1,0)}\result&&3\\
        \FPeval{\result}{round(0.2*\numpoints,0)}\result&-&\FPeval{\result}{round(0.4*\numpoints-1,0)}\result&&2\\
        0&-&\FPeval{\result}{round(0.2*\numpoints-1,0)}\result&&1\\
    \end{tabular}
\end{center}

\begin{questions}
    \question[10] Question 1.
    \question[5] Question 2.
    \question[10] Question 3.
    \question[10] Question 4.
    \question[5] Question 5.
    \question[5] Question 6.
    \question[5] Question 7.
\end{questions}
\end{document}

enter image description here

1
  • The total number of points is available as \exam@numpoints, and one could use pgfmath to divide by 5. Check out the aux file for what else is available. Dec 2 '17 at 3:17
0

Finally, I decided to implement my own command for grading keys. A general and a special command I developed. Here they are:

\newcommand{\gradekey}[4]{\begin{tabular}{rcrl>\bfseries l}
        \FPeval{\result}{round(#4*\numpoints,0)}\result&-&\numpoints&&5\\
        \FPeval{\result}{round(#3*\numpoints,0)}\result&-&\FPeval{\result}{round(#4*\numpoints-1,0)}\result&&4\\
        \FPeval{\result}{round(#2*\numpoints,0)}\result&-&\FPeval{\result}{round(#3*\numpoints-1,0)}\result&&3\\
        \FPeval{\result}{round(#1*\numpoints,0)}\result&-&\FPeval{\result}{round(#2*\numpoints-1,0)}\result&&2\\
        0&-&\FPeval{\result}{round(#1*\numpoints-1,0)}\result&&1\\
    \end{tabular}
}
\newcommand{\defaultgradekey}{%
    \begin{center}\gradekey{0.35}{0.5}{0.75}{0.9}\end{center}
}

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.