I would like to have two commands that automate the generation of both vertical and horizontal grading tables to look the same as those manually written by me below.
\documentclass[a4paper,addpoints,11pt]{exam}
\marksnotpoints
\usepackage{tabularray}
\UseTblrLibrary{booktabs, siunitx}
\vqword{Question}
\vpword{Marks}
\begin{document}
\begin{coverpages}
\begin{tblr}
[
presep = 0pt, headsep = 0pt,
footsep = 0pt, postsep = 0pt,
]{
colsep = 1 em,
column{1} = {0.15\linewidth},
width = 0.5\linewidth,
colspec = {
X[ c, 2 ]
X[ c, 1.5 ]
X[ c, 1.5 ]
},
hline{2-Z} = {0.25pt},
vlines = {0.25pt},
rows = {m},
row{1} = {10ex, font = \bfseries},
row{2-Z} = {6ex, m},
row{Z} = {font = \bfseries},
rulesep = 0pt,
rowsep = 0ex,
}
\toprule[1.5pt]
Question & Marks & Score \\
1\textsuperscript{st} & 10 & \\
2\textsuperscript{nd} & 20 & \\
3\textsuperscript{rd} & 30 & \\
Total & 60 & \\
\bottomrule[1.5pt]
\end{tblr}
\bigskip
\begin{tblr}
[
presep = 0pt, headsep = 0pt,
footsep = 0pt, postsep = 0pt,
]{
colsep = 1 em,
column{1} = {0.15\linewidth, font = \bfseries},
column{Z} = {font = \bfseries},
width = 0.75\linewidth,
colspec = {
X[ l, 2 ]
*{3}{X[ c, 1.5 ]}
X[ c, 2 ]
},
hline{2-Z} = {0.25pt},
vlines = {0.25pt},
rows = {6ex, m},
rulesep = 0pt,
rowsep = 0ex,
}
\toprule[1.5pt]
Question & 1\textsuperscript{st} & 2\textsuperscript{nd} & 3\textsuperscript{rd} & Total \\
Marks & 10 & 20 & 30 & 60\\
Score & & & & \\
\bottomrule[1.5pt]
\end{tblr}
\end{coverpages}
\begin{questions}
\question[10]
Example question
\question[20]
Example question
\question[30]
Example question
\end{questions}
\end{document}
\csname pointsofq@i\endcsname
etc and\csname exam@numpoints\endcsname
. Creating a table with a vaiaible number of rows or columns might be trickier.