长桌垂直空间

长桌垂直空间

如果我制作 longtable,如何删除前面的文本与它之间的间距?Tabular 没有这个间距。

这个例子应该能让你明白我所要求的是什么:

\documentclass[a4paper]{article}
\usepackage[margin = 5mm]{geometry}
\usepackage{longtable}
\begin{document}
\centering
Can you see how little vertical space there is between this line and the table down here \ldots\\
\begin{tabular}{|c|c|c|c|}
        \hline
        0 & 1 & 2 & 3 \tabularnewline
        \hline
        4 & 5 & 6 & 7 \tabularnewline
        \hline
        8 & 9 & 0 & 1 \tabularnewline
        \hline
        2 & 3 & 4 & 5 \tabularnewline
        \hline
        6 & 7 & 8 & 9 \tabularnewline
        \hline
\end{tabular}\\
\vspace{3cm}
\ldots compared to this line and this table?\\
\begin{longtable}{|c|c|c|c|}
        \hline
        0 & 1 & 2 & 3 \tabularnewline
        \hline
        4 & 5 & 6 & 7 \tabularnewline
        \hline
        8 & 9 & 0 & 1 \tabularnewline
        \hline
        2 & 3 & 4 & 5 \tabularnewline
        \hline
        6 & 7 & 8 & 9 \tabularnewline
        \hline
\end{longtable}
\end{document}

答案1

tabular是一个内联结构,就像一个大字母,所以它没有任何与之关联的间距。longtable是一个显示结构,就像一个显示的方程式或quote环境,所以总是占据整个页面的宽度,并与垂直空间偏移。前面的空格\LTpre可以设置为 0。

\\避免在段落末尾误用9,例如之前longtable,这样做的不良影响在这里被实现的怪癖所隐藏\centering,但通常它会产生一个未满的坏处框 10000

在此处输入图片描述

\documentclass[a4paper]{article}
\usepackage[margin = 5mm]{geometry}
\usepackage{longtable}
\setlength\LTpre{0pt}

\begin{document}
\centering
Can you see how little vertical space there is between this line and the table down here \ldots

\begin{tabular}{|c|c|c|c|}
        \hline
        0 & 1 & 2 & 3 \tabularnewline
        \hline
        4 & 5 & 6 & 7 \tabularnewline
        \hline
        8 & 9 & 0 & 1 \tabularnewline
        \hline
        2 & 3 & 4 & 5 \tabularnewline
        \hline
        6 & 7 & 8 & 9 \tabularnewline
        \hline
\end{tabular}

\vspace{3cm}
\ldots compared to this line and this table?

\begin{longtable}{|c|c|c|c|}
        \hline
        0 & 1 & 2 & 3 \tabularnewline
        \hline
        4 & 5 & 6 & 7 \tabularnewline
        \hline
        8 & 9 & 0 & 1 \tabularnewline
        \hline
        2 & 3 & 4 & 5 \tabularnewline
        \hline
        6 & 7 & 8 & 9 \tabularnewline
        \hline
\end{longtable}
\end{document}

相关内容