使用多列和@{\hskip} 時出現對齊問題嗎?

使用多列和@{\hskip} 時出現對齊問題嗎?

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

相關內容