我在编写文档时遇到了一个奇怪的问题。当我插入表格时,LaTeX 会在文本行之间产生巨大的白色间隙,并将表格发送到下一页。我想到两种可能的解决方案,要么对文本或表格进行一些小的修改,以便表格可以适合所需的页面,要么通过命令强制表格转到下一页\newpage
。
我的问题更多的是理论性的而非实际性的,不过如果有人有更好的解决方案那就太好了!所以实际的问题是:
“LaTeX 是否会自动更改换行符之间的垂直间距,就像更改文本之间的水平间距一样?”
如果确实如此,我第一次注意到这一点似乎很奇怪,但这可能是因为我很少使用表格。 一个最小的例子是这样的:
\documentclass{book}
\usepackage{float}
\usepackage{tabularx}%expands the tabular environment }
\date{}
\author{Me!}
\title{Some Book}
\begin{document}
\frontmatter%
\maketitle
\mainmatter%
\chapter*{The First Chapter}
\section*{The first section}
Some text some text some test Some text some text some test Some
some text some test Some text some text some test Some text some text
textSome text some text some test Some text some text some test Some
text some text some test Some text some text some test Some text some
text some textSome text some text some test Some text some text some
test Some text some text some test Some text some text some test Some
text some text some textSome text some text some test Some text some
text some test Some text some text some test Some text some text some
test Some text some text some textSome text some text some test Some
text some text some test Some text some text some test Some text some
text some test Some text some text some text
Some text some text some test Some text some text some test Some text
some text some test Some text some text some test Some text some text
some textSome text some text some test Some text some text some test
Some text some text some test Some text some text some test Some text
some text some textSome text some text some test Some text some text
some test Some text some text some test Some text some text some test
Some text some text some text
Some text some text some test Some text some text some test Some text
some text some test Some text some text some test Some text some text
some textSome text some text some test Some text some text some test
Some text some text some test Some text some text some test Some text
some text some textSome text some text some test Some text some text
some test Some text some text some test Some text some text some test
Some text some text some text
Some text some text some test Some text some text some test Some text
some text some test Some text some text some test Some text some text
some textSome text some text some test Some text some text some test
Some text some text some test Some text some text some test Some text
some text some textSome text some text some test Some text some text
some test Some text some text some test Some text some text some test
Some text some text some text
Some text some text some test Some text some text some test Some text
some text some test Some text some text some test Some text some text
some textSome text some text some test Some text some text some test
Some text some text some test Some text some text some test Some text
some text some textSome text some text some test Some text some text
some test Some text some text some test Some text some text some test
Some text some text some textSome text some text some test Some text
some text some test Some text some text some test Some text some text
some test Some text some text some textSome text some text some test
Some text some text some test Some text some text some test Some text
some text some test Some text some text some textSome text some text
some test Some text some text some test Some text some text some test
Some text some text some test Some text some text some text
Some text some text some test Some text some text some test Some text
some text some test Some text some text some test Some text some text
some text
Some text some text some test Some text some text some test Some text
some text some test Some text some text some test Some text some text
some text
Some text some text some test Some text some text some test Some text
some text some test Some text some text some test Some text some text
some textSome text some text some test Some text some text some test
Some text some text some test Some text some text some test Some text
some text some text Some text some text some test Some text some text
some test Some text some text some test Some text some text some test
Some text some text some textSome text some text some test Some text
some text some test Some text some text some test Some text some text
some test Some text some text some text
Some text some text some test Some text some text some test Some text
some text some test Some text some text some test Some text some text
some text
Some text some text some test Some text some text some test Some text
some text some test Some text some text some test Some text some text
some textSome text some text some test Some text some text some test
Some text some text some test Some text some text some test Some text
some text some textSome text some text some test Some text some text
some test Some text some text some test Some text some text some test
Some text some text some text
\section*{Some text}
\large{\begin{center}\begin{tabularx}{\columnwidth}{|c|c|X|}
\hline
\textbf{Some text} &\textbf{Some text} &\textbf{Some text}\\
\hline
Some text &Some text &Some text\\
\hline
Some text &Some text &Some text\\
\hline
Some text &Some text &Some text\\
\hline
Some text &Some text &Some text\\
\hline
Some text &Some text &Some text\\
\hline
Some text &Some text &Some text\\
\hline
Some text &Some text &Some text\\
\hline
Some text &Some text &Some text\\
\hline
Some text &Some text &Some text\\
\hline
Some text &Some text &Some text\\
\hline
Some text &Some text &Some text\\
\hline
Some text &Some text &Some text\\
\hline
Some text &Some text &Some text\\
\hline
Some text &Some text &Some text\\
\hline
Some text &Some text &Some text\\
\hline
Some text &Some text &Some text\\
\hline
Some text &Some text &Some text\\
\hline
Some text &Some text &Some text\\
\end{tabularx}
\end{center}}
\backmatter%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
\end{document}
提前感谢任何回复!
答案1
它与表格没有直接关系,只不过它是一个大的牢不可破的盒子。第 2 页上的额外空白不是行间空间而是段落间空间。在书籍类中,该空间为 0 但略有弹性。书籍类默认为,\flushbottom
因此它会尝试将最后一行带到页面底部,并且在该页面上唯一的可拉伸粘合是段落跳过。您可以将其添加\raggedbottom
到序言中(或该页面之前的任何位置),然后页面将被允许变短而不会拉伸空间。当然,为了避免这些问题,将大表格和图像放入浮动环境中是正常的,例如table
以便 LaTeX 可以移动表格以避免分页符处出现空白问题。