
右列標題(這是一個多列條目)和下面應該左對齊的列有輕微的對齊偏移。如果@{\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}