The building of the tables is a little bit tricky in class exams
. În my eyes the horizontal table is much more better.
With the following MWE both table are changed. The needed changes you find in the part of the preamble, enclosed with \makeatletter
and \makeatother
.
% !Mode:: "TeX:UTF-8"
\documentclass[a4paper,addpoints,11pt]{exam}
%\usepackage{fontspec} % No LuaLaTeX !!!!
%\usepackage{polyglossia} % No LuaLaTeX !!!!
\usepackage{booktabs}
% Change table layout
\makeatletter % @ a normal letter
%first table:
\def\@vpttblquestions{%
% Vertical non-bonus point table, indexed by questions:
\set@hlfcntr{tbl@points}{0}%
\begin{tabular}{cc}
% \hline % topline
{\@vqword}& {\@vpword}\\
\midrule
\setcounter{question}{\tbl@firstq}%
\addtocounter{question}{-1}\do@vptloop
{\@vtword}& \prt@tablepoints\\
% \hline % endrule
\end{tabular}%
}% @vpttblquestions
\def\do@vptloop{%
% \do@vptloop is used by \@vpttblquestions
\addtocounter{question}{1}%
\ref{question@\arabic{question}} &
\pointsofquestion{\arabic{question}}\\
% \hline
\@ifundefined{pointsofq@\romannumeral \c@question}%
{}%
{\addto@hlfcntr{tbl@points}
{\csname pointsofq@\romannumeral \c@question\endcsname}}%
\ifnum \value{question} < \tbl@lastq\relax
\let\next@vptloop=\do@vptloop
\else
\let\next@vptloop=\relax
\fi
\next@vptloop
}% do@vptloop
% second table
\def\@htblquestions{%
% We get here from \@tblquestions.
% The table is horizontal and indexed by question numbers.
% The question range has already been determined.
% Set num@cols equal to the number of questions on the table, and
% do either bonus, combined, or non-bonus table, in each case
% putting in a line for scores only if it's a gradetable:
\@ifundefined{exam@numquestions}%
{}%
{%
\setcounter{num@cols}{\tbl@lastq}%
\addtocounter{num@cols}{-\tbl@firstq}%
\addtocounter{num@cols}{1}%
}%
% Do either bonus, combined, or non-bonus table. In each case, put
% in a line for scores if it's a gradetable:
\begingroup
% Save the current value of question in @iterator, so that
% we can restore it after doing the table:
\setcounter{@iterator}{\value{question}}%
\renewcommand\arraystretch{\@gtblstretch}%
\if@bonus
% It's a horizontal bonus table, by questions:
\begin{tabular}{l*{\thenum@cols}{c}c}
% \hline
{\@bhqword}& \setcounter{question}{\tbl@firstq}%
\addtocounter{question}{-1}\do@qnumloop
{\@bhtword}\\
% \hline
\set@hlfcntr{tbl@bonuspoints}{0}%
{\@bhpword}& \setcounter{question}{\tbl@firstq}%
\addtocounter{question}{-1}\do@bptloop
\prt@tablebonuspoints\\
% \hline
% If it's a grade table, add in the score line:
\if@scores
{\@bhsword}& \setcounter{question}{\tbl@firstq}%
\addtocounter{question}{-1}\do@sloop
\\
% \hline
\fi
\end{tabular}%
\else
\if@combined
% It's a horizontal combined table, by questions:
\begin{tabular}{l*{\thenum@cols}{c}c}
% \hline
{\@chqword}& \setcounter{question}{\tbl@firstq}%
\addtocounter{question}{-1}\do@qnumloop
{\@chtword}\\
% \hline
\set@hlfcntr{tbl@points}{0}%
{\@chpword}& \setcounter{question}{\tbl@firstq}%
\addtocounter{question}{-1}\do@ptloop
\prt@tablepoints\\
% \hline
\set@hlfcntr{tbl@bonuspoints}{0}%
{\@chbpword}& \setcounter{question}{\tbl@firstq}%
\addtocounter{question}{-1}\do@bptloop
\prt@tablebonuspoints\\
% \hline
% If it's a grade table, add in the score line:
\if@scores
{\@chsword}& \setcounter{question}{\tbl@firstq}%
\addtocounter{question}{-1}\do@sloop
\\
% \hline
\fi
\end{tabular}%
\else
% Horizontal non-bonus table, indexed by question number:
\set@hlfcntr{tbl@points}{0}%
\begin{tabular}{l*{\thenum@cols}{c}c}
% \hline
{\@hqword}& \setcounter{question}{\tbl@firstq}%
\addtocounter{question}{-1}\do@qnumloop
{\@htword}\\
\midrule
{\@hpword}& \setcounter{question}{\tbl@firstq}%
\addtocounter{question}{-1}\do@ptloop
\prt@tablepoints\\
% \hline
% If it's a grade table, add in the score line:
\if@scores
{\@hsword}& \setcounter{question}{\tbl@firstq}%
\addtocounter{question}{-1}\do@sloop
\\
% \hline
\fi
\end{tabular}%
\fi
\fi
% Restore the saved value of question:
\setcounter{question}{\value{@iterator}}%
\endgroup
}% @htblquestions
\makeatother
\begin{document}
\begin{questions}
\question[10]
Example question
\question[20]
Example question
\question[30]
Example question
\question[40]
Example question
\question[50]
Example question
\end{questions}
\begin{center}
\pointtable[v][questions]
\end{center}
\begin{center}
\pointtable[h][questions]
\end{center}
\end{document}
With the result:

It would be better if the author of the class would integrate two different layouts for the tables in his class.