在没有垂直线的表格中,如何删除两列之间一半的空间?
这里:如何让“e”和“f”之间的间距等于“i”和“j”之间的间距?
梅威瑟:
\documentclass{article}
\begin{document}
\begin{tabular}{r|l}
a & b
\end{tabular}
\begin{tabular}{rl}
c & d
\end{tabular}
\begin{tabular}{r@{}l}
e & f $\leftarrow$ both column seperators deleted instead of only one
\end{tabular}
\begin{tabular}{r@{}@{}l}
g & h
\end{tabular}
\begin{tabular}{r@{}|l}
i & j
\end{tabular}
\end{document}
答案1
默认情况下,LaTeX 会在、、、和环境2\tabcolsep
的列之间插入 数量的空白填充。在我熟悉的所有 LaTeX 文档类中, 的默认值为。tabular
tabular*
longtable
tabularx
tabulary
\tabcolsep
6pt
如果你希望给定的列间距为默认值的一半,只需将其写入@{\hspace{\tabcolsep}}
所讨论的列间距说明符即可。另一方面,如果你想全部列间空白填充为默认宽度的一半,只需写入\setlength{\tabcolsep}{3pt}
。
\documentclass{article}
\begin{document}
\begin{tabular}{cc}
x & x
\end{tabular}
\begin{tabular}{c@{\hspace{2\tabcolsep}}c} % same outcome as above
x & x
\end{tabular}
\begin{tabular}{c@{\hspace{\tabcolsep}}c}
x & x
\end{tabular}
\begin{tabular}{c@{}c}
x & x
\end{tabular}
\end{document}