考虑一下这个 MWE
\documentclass{article}
\usepackage{longtable}
\begin{document}
\centering
\bgroup
\offinterlineskip
\begin{tabular}{cc}
\hline
foo & bar \\
\hline
\end{tabular}
\begin{tabular}{cc}
\hline
foo & bar \\
\hline
\end{tabular}
\par
\egroup
\bigskip
\bgroup
\offinterlineskip
\begin{tabular}{cc}
\hline
foo & bar \\
\hline
\end{tabular}
\begin{longtable}{cc}
\hline
foo & bar \\
\hline
\end{longtable}
\par
\egroup
\end{document}
为什么 tabular 和 longtable 之间的空格不能被删除,\offinterlineskip
比如两个简单的 tabular
答案1
\offinterlineskip
禁用基线到基线间距计算,但不禁用显示环境添加的明确空间。
longtable
\LTpre
在表格前添加空格,因此:
\documentclass{article}
\usepackage{longtable}
\begin{document}
\centering
\bgroup
\offinterlineskip
\begin{tabular}{cc}
\hline
foo & bar \\
\hline
\end{tabular}
\begin{tabular}{cc}
\hline
foo & bar \\
\hline
\end{tabular}
\par
\egroup
\bigskip
\bgroup
\offinterlineskip
\setlength\LTpre{0pt}
\setlength\LTpost{0pt}
\begin{tabular}{cc}
\hline
foo & bar \\
\hline
\end{tabular}
\begin{longtable}{cc}
\hline
foo & bar \\
\hline
\end{longtable}
\par
\egroup
\end{document}