Last active
November 3, 2024 20:19
-
-
Save vicapow/0dc4c44f59b22d42d2a0b2f5d12b5470 to your computer and use it in GitHub Desktop.
Attempting to replicate the gradetable macro of the exam package in Latex
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
% In response to the stackexchange question: https://tex.stackexchange.com/questions/680066/customising-gradetable-to-group-multiple-choice-into-1-column-with-the-exam-cl | |
% You can compile and view the pdf version of this Latex document at: https://crixet.com/?gist=d433f7deda0eb630dad9b98bb3b281b9 | |
\documentclass[addpoints]{exam} | |
\usepackage{tabularx} | |
\usepackage{xcolor} | |
\usepackage{multicol} | |
\begin{document} | |
Original from \textbackslash gradetable | |
\vspace{1em} | |
% Uncomment to double check the second table matches the first. | |
\gradetable[h] | |
\vspace{1em} | |
Manual recreation of \textbackslash gradetable | |
\vspace{1em} | |
% Manually create a duplicate of the table above, with MC columns consolidated. | |
\renewcommand{\arraystretch}{1.6} % Adjusts the row height | |
\setlength{\tabcolsep}{12pt} % Adjusts the column width | |
\begin{tabular}{|@{\hskip 5pt}l|*{5}{c|}} % first column is left-aligned with a 5pt horizontal padding, and the next 8 columns are centered. | |
\hline | |
Question: & MC & \multicolumn{1}{c|}{5} & \multicolumn{1}{c|}{6} & \multicolumn{1}{c|}{7} & Total \\ % Merged cells for questions 1 to 4, and individual cells for questions 5 to 8, now using numbers only for questions 5 to 8 | |
\hline | |
Points: & 4 & 12 & 12 & 12 & 40 \\ | |
\hline | |
Score: & & & & & \\ | |
\hline | |
\end{tabular} | |
\begin{questions} | |
\question[1] | |
\question[1] | |
\question[1] | |
\question[1] | |
\question[12] | |
\question[12] | |
\question[12] | |
\end{questions} | |
% The issue was that the number of columns in the header did not match the number of columns in the rows below. Added an extra column to each row to fix the alignment. | |
\end{document} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment