![表格列标题中的多余空格](https://linux22.com/image/349857/%E8%A1%A8%E6%A0%BC%E5%88%97%E6%A0%87%E9%A2%98%E4%B8%AD%E7%9A%84%E5%A4%9A%E4%BD%99%E7%A9%BA%E6%A0%BC.png)
我有下表。它包含多列标题。
我希望多列标题在可用空间中均匀分布。现在不对称。前两个标题太近,第三个标题之间有一个空格。
我如何调整它们以使各列的宽度相等?
\documentclass{article}
\newcommand*{\zerobox}[2][l]{%
\raisebox{0pt}[0pt][0pt]{\makebox[0pt][#1]{#2}}
}
\newcommand*{\anglelabel}[1]{%
\multicolumn{1}{c}{\rotatebox{45}{\zerobox{#1}}}%
}
\newcommand*{\rotLabel}[1]{%
\anglelabel{\zerobox{#1}}
}
\usepackage{tikz}
\usepackage{mathtools}
\newcommand{\filledcirc}{${\color{black}\bullet}\mathllap{\circ}$}
\newcommand{\normalcirc}{${\color{white}\bullet}\mathllap{\circ}$}
\begin{document}
\begin{tabular}{ccc}
\rotLabel{Xxxxxxx}
& \rotLabel{Ccccccccccccc}
& \rotLabel{Rrrrrrrr Rrrrr}
\\
\hline
\multicolumn{3}{|c|}{\textit{Ddddddddd Dddd}}\\
\hline
\end{tabular}
\end{document}
答案1
代码取自这个答案:
\documentclass{article}
\usepackage{adjustbox}
\usepackage{array}
\newcolumntype{R}[2]{%
>{\adjustbox{angle=#1,lap=\width-(#2)}\bgroup}%
l%
<{\egroup}%
}
\newcommand*\rot{\multicolumn{1}{R{45}{1.4em}}}% I've changed only 1.4 instead of 1
\begin{document}
\begin{tabular}{ccc}
\rot{Xxxxxxx} & \rot{Ccccccccccccc} & \rot{Rrrrrrrr Rrrrr}\\
\hline
\multicolumn{3}{|c|}{\textit{Ddddddddd Dddd}}\\
\hline
\end{tabular}
\end{document}