简单的tabular
环境
\documentclass{article}
% \usepackage{array} % <-- uncomment this line
\begin{document}
\begin{tabular}{|c|c|}
a & b \\ c & d
\end{tabular}
\end{document}
根据array
包是否加载会产生略有不同的结果,如以下两张图片所示:
(上部没有array
,下部有 。)诚然,这是一个几乎无法确定的变化,34.55pt vs. 35.75pt,但我很好奇想知道差异从何而来。\@tabarray
in的定义latex.ltx
包含 ,而\m@th
中缺少 ,array.sty
但这似乎并不相关(我试过放入\mathsurround=0pt
,但没有任何区别)。
谁是罪魁祸首?(除了大卫和弗兰克:-)
)
答案1
罪魁祸首是其中之一,但不是我。
这是记录的行为array
包改变的含义,|
以便表格变得更宽,标准表格实现在规则的两侧添加负空间,以便|
稍微将列覆盖到两侧(或者通常它会覆盖空间\tabcolsep
)。
\begin{macro}{\@arrayrule}
There is only one incompatibility with the original definition:
the definition of =\@arrayrule=. In the original a line without
width\footnote{So the space between \texttt{cc} and \texttt{c|c}
is equal.} is created by multiple insertions of
=\hskip .5\arrayrulewidth=.
We only insert a vertical line into the
preamble. This is done to prevent problems with \TeX's main
memory when generating tables with many vertical lines in them
(especially in the case of \textsf{floats}).