我正在将 LuaLaTeX 与考试文档类一起使用,并且我想(如果可能的话)将评分表的默认布局更改为更像 booktabs 包中的表格。我该怎么做?我阅读了手册,即使 table 命令有很多选项,我也没有找到这样做的方法。我也读过一个关于 exsheet 包的类似问题,但提供的答案无法编译。
这是一个最小的工作示例,其中有我想要更改的表格。
% !Mode:: "TeX:UTF-8"
\documentclass[a4paper,addpoints,11pt]{exam}
\usepackage{fontspec}
\usepackage{polyglossia}
\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}
结果如下
答案1
课堂上桌子的摆放有点棘手exams
。在我看来,水平桌子要好得多。
使用以下 MWE,两个表格都进行了更改。所需的更改可以在序言部分中找到,用 和 括\makeatletter
起来\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}
结果是:
如果课程的作者能够将课程中的表格的两种不同布局整合在一起,那就更好了。