我对 longtable 环境有一个奇怪的问题。
一旦表格接近页面末尾,它就会强制生成一个完全空白的新空白页。
这是MWE:
\documentclass[11pt,oneside]{book}
\usepackage{longtable}
\usepackage{lipsum}
\begin{document}
\chapter*{First chapter}
\begin{center}
\scriptsize
\begin{longtable}{|c|c|c|}
\hline \multicolumn{1}{|c|}{First} & \multicolumn{1}{c|}{Second} & \multicolumn{1}{c|}{Third}
\\ \hline \hline
\endhead
\endlastfoot
One & Two & Three \\
One & Two & Three \\
One & Two & Three \\
One & Two & Three \\
One & Two & Three \\
One & Two & Three \\
One & Two & Three \\
One & Two & Three \\
One & Two & Three \\
One & Two & Three \\
One & Two & Three \\
One & Two & Three \\
One & Two & Three \\
One & Two & Three \\
One & Two & Three \\
One & Two & Three \\
One & Two & Three \\
One & Two & Three \\
One & Two & Three \\
One & Two & Three \\
One & Two & Three \\
One & Two & Three \\
One & Two & Three \\
One & Two & Three \\
One & Two & Three \\
One & Two & Three \\
One & Two & Three \\
One & Two & Three \\
One & Two & Three \\
One & Two & Three \\
One & Two & Three \\
One & Two & Three \\
One & Two & Three \\
One & Two & Three \\
One & Two & Three \\
One & Two & Three \\
One & Two & Three \\
One & Two & Three \\
One & Two & Three \\
\hline
\caption*{Wonderful caption} \\
\end{longtable}
\end{center}
\chapter*{Second chapter}
\lipsum
\end{document}
以下是生成的输出的屏幕截图:
知道为什么会发生这种情况吗?
我必须使用 longtable 包,因为该表是动态生成的,因此其长度是可变的并且可以跨越多页。
答案1
只需删除\begin{center}...\end{center}
-- alongtable
默认已居中,就会\begin{center}...\end{center}
引入太多垂直间距,从而导致出现额外的空白页!
\documentclass[11pt,oneside]{book}
\usepackage{longtable}
\usepackage{lipsum}
\begin{document}
\chapter*{First chapter}
\scriptsize
\begin{longtable}{|c|c|c|}
\hline \multicolumn{1}{|c|}{First} & \multicolumn{1}{c|}{Second} & \multicolumn{1}{c|}{Third}
\\ \hline \hline
\endhead
\endlastfoot
One & Two & Three \\
One & Two & Three \\
One & Two & Three \\
One & Two & Three \\
One & Two & Three \\
One & Two & Three \\
One & Two & Three \\
One & Two & Three \\
One & Two & Three \\
One & Two & Three \\
One & Two & Three \\
One & Two & Three \\
One & Two & Three \\
One & Two & Three \\
One & Two & Three \\
One & Two & Three \\
One & Two & Three \\
One & Two & Three \\
One & Two & Three \\
One & Two & Three \\
One & Two & Three \\
One & Two & Three \\
One & Two & Three \\
One & Two & Three \\
One & Two & Three \\
One & Two & Three \\
One & Two & Three \\
One & Two & Three \\
One & Two & Three \\
One & Two & Three \\
One & Two & Three \\
One & Two & Three \\
One & Two & Three \\
One & Two & Three \\
One & Two & Three \\
One & Two & Three \\
One & Two & Three \\
One & Two & Three \\
One & Two & Three \\
\hline
\caption*{Wonderful caption}
\end{longtable}
% \end{center}
\chapter*{Second chapter}
\lipsum
\end{document}