![对齐表头](https://linux22.com/image/449463/%E5%AF%B9%E9%BD%90%E8%A1%A8%E5%A4%B4.png)
我正在尝试将标题设置 1 和设置 2 对齐为获胜和最佳得分列的标题。但是它不起作用,我认为是因为扩展命令使用不正确。我将非常感谢您帮助解决这个问题。这是我的代码:
\begin{calstable}[c] % Centred CALS tabular
% Calculate the column width
\colwidths{{\dimexpr(\columnwidth)/5\relax}
{\dimexpr(\columnwidth)/5\relax}
{\dimexpr(\columnwidth)/5\relax}
{\dimexpr(\columnwidth)/5\relax}
{\dimexpr(\columnwidth)/5\relax}}
% The tabular fills the text area if sum of all columns is 4
% Set up the tabular
\makeatletter
\def\cals@framers@width{0.3pt} % Outside horizontal frame rules
\def\cals@framecs@width{0,3pt} % Outside vertical frame rules
\def\cals@bodyrs@width{0.3pt} % Rule between header and tabular body
\def\cals@cs@width{0.3pt} % Inside vertical rules
\def\cals@rs@width{0.3pt} % Inside horizontal rules
\def\cals@bgcolor{} % To avoid undefined
\def\gray{\ifx\cals@bgcolor\empty % "Switch" to turn on and off colour
\def\cals@bgcolor{gray!30}
\else \def\cals@bgcolor{} \fi}
% R1H1 % Just a comment: Row one, header row one
\thead{
\brow
\gray\alignC\nc{lrt} % Switch to gray background and centred text, works until switched off
\cell{\vfil}
\nc{rtb}\sc{Setting 1}
\nc{tb}\sc{\vfil Setting 2}
\erow
%R2H2 % Row two, header row two
\brow
\nc{lrb}\sc{\vfil Game set} % "vfil" centres the cell content vertically
\cell{\vfil Wins}
\cell{\vfil Best score}
\cell{\vfil Wins}
\cell{\vfil Best score}\gray % Always reset colour at end of header
\erow
} % closing 'thead' clause
%R3B1 % Row three, body row one
\brow
\gray\cell{1}\gray % Switch to gray background for first cell (column 1)
\cell{\vfil 13.00}
\cell{\vfil 13.00}
\cell{\vfil 13.00}
\cell{\vfil 9.12}
\erow
%R4B2
\brow
\gray\cell{2}\gray
\cell{\vfil 11.89}
\cell{\vfil 11.89}
\cell{\vfil 11.89}
\cell{\vfil 10.45}
\erow
%R4B2
\brow
\gray\cell{3}\gray
\cell{\vfil 11.89}
\cell{\vfil 11.89}
\cell{\vfil 11.89}
\cell{\vfil 10.45}
\erow
%R4B2
\brow
\gray\cell{4}\gray
\cell{\vfil 11.89}
\cell{\vfil 11.89}
\cell{\vfil 11.89}
\cell{\vfil 10.45}
\erow
%R4B2
\brow
\gray\cell{5}\gray
\cell{\vfil 11.89}
\cell{\vfil 11.89}
\cell{\vfil 11.89}
\cell{\vfil 10.45}
\erow
%R3B1 % Row three, body row one
\brow
\gray\cell{6}\gray % Switch to gray background for first cell (column 1)
\cell{\vfil 13.00}
\cell{\vfil 13.00}
\cell{\vfil 13.00}
\cell{\vfil 9.12}
\erow
%R4B2
\brow
\gray\cell{7}\gray
\cell{\vfil 11.89}
\cell{\vfil 11.89}
\cell{\vfil 11.89}
\cell{\vfil 10.45}
\erow
%R4B2
\brow
\gray\cell{8}\gray
\cell{\vfil 11.89}
\cell{\vfil 11.89}
\cell{\vfil 11.89}
\cell{\vfil 10.45}
\erow
%R4B2
\brow
\gray\cell{9}\gray
\cell{\vfil 11.89}
\cell{\vfil 11.89}
\cell{\vfil 11.89}
\cell{\vfil 10.45}
\erow
%R4B2
\brow
\gray\cell{10}\gray
\cell{\vfil 11.89}
\cell{\vfil 11.89}
\cell{\vfil 11.89}
\cell{\vfil 10.45}
\erow
%TOTAL
\brow
\gray\cell{TOTAL}\gray
\cell{\vfil 11.89}
\cell{\vfil 11.89}
\cell{\vfil 11.89}
\cell{\vfil 10.45}
\erow
\makeatletter
\end{calstable}