右列标题(多列条目)与下方应左对齐的列的对齐方式略有偏移。如果@{\hspace{1em}}
从表格中删除,则列会对齐得很好,但只要有\hspace
或\hskip
,第二列的多列标题就会略有偏移。
如何在不破坏对齐的情况下添加列之间的空间?
\documentclass{article}
\begin{document}
\begin{tabular}{ll@{\hspace{1em}}ll}
\multicolumn{2}{l}{multicolumn header 1} & \multicolumn{2}{l}{I, too, am a multicolumn header 2}\\
\hline
Thing 1 & ‘I am a quote’ & Thing 4 & ‘Last column, cell 1’\\
Thing 2 & ‘I am quote 2’ & Thing 5 & ‘Last column, cell 2’\\
Thing 3 & ‘I am quote 3’ & Thing 6 & ‘Last column, cell 3’\\
\end{tabular}
\end{document}
答案1
您必须\tabcolsep
在第二次\multicolumn
使用之前手动抑制默认值的插入@{}
。
\documentclass{article}
\begin{document}
\begin{tabular}{ll@{\hspace{1em}}ll}
\multicolumn{2}{l}{multicolumn header 1} & \multicolumn{2}{@{}l}{I, too, am a multicolumn header 2}\\
\hline
Thing 1 & ‘I am a quote’ & Thing 4 & ‘Last column, cell 1’\\
Thing 2 & ‘I am quote 2’ & Thing 5 & ‘Last column, cell 2’\\
Thing 3 & ‘I am quote 3’ & Thing 6 & ‘Last column, cell 3’\\
\end{tabular}
\end{document}
答案2
为什么不在中间添加一些空白列?
\documentclass{article}
\begin{document}
\begin{tabular}{llllll}
\multicolumn{2}{c}{multicolumn header 1} &&& \multicolumn{2}{c}{I, too, am a multicolumn header 2}\\
\hline
Thing 1 & ‘I am a quote’ & &&Thing 4 & ‘Last column, cell 1’\\
Thing 2 & ‘I am quote 2’ & &&Thing 5 & ‘Last column, cell 2’\\
Thing 3 & ‘I am quote 3’ &&&Thing 6 & ‘Last column, cell 3’\\
\end{tabular}
\end{document}