更新。longtable
下面的和组合figure
导致以下文本错位。文本应该转到第三页,但事实并非如此。相反,它越过了第二页的边界。
\documentclass[a4paper]{article}
\usepackage[cm]{fullpage}
\usepackage[dvips]{graphicx}
\usepackage{longtable}
\usepackage{lipsum}
\begin{document}
\lipsum[1-8]
\begin{figure}[ht]
\rule{7cm}{7cm}\\
Picture 1.
\end{figure}
\lipsum[1-2]
\begin{longtable}{|c|}
\hline
N \\
\endfirsthead
\hline
1 \\
\hline
2 \\
\hline
3 \\
\hline
4 \\
\hline
5 \\
\hline
6 \\
\hline
7 \\
\hline
8 \\
\hline
9 \\
\hline
10 \\
\hline
\end{longtable}
\lipsum[1]
\lipsum[1]
\lipsum[1]
\lipsum[1]
\lipsum[1]
\end{document}
答案1
临时答案,可能会帮助其他人做出答案。我稍后会更新或删除。
这看起来应该重复
longtabu 和 floats:带有 floats 的页面上的表格分隔符错误
但是下面的操作应该相当于在 latex 错误数据库中应用补丁,但似乎无法修复您的测试用例,我稍后会查看,但我没时间了。如果其他人回答,我会删除这个非答案。
\documentclass[a4paper]{article}
\usepackage[cm]{fullpage}
\usepackage[dvips]{graphicx}
\usepackage{longtable}
\usepackage{lipsum}
\makeatletter
\def\LT@start{%
\let\LT@start\endgraf
\endgraf\penalty\z@\vskip\LTpre
\dimen@\pagetotal
\advance\dimen@ \ht\ifvoid\LT@firsthead\LT@head\else\LT@firsthead\fi
\advance\dimen@ \dp\ifvoid\LT@firsthead\LT@head\else\LT@firsthead\fi
\advance\dimen@ \ht\LT@foot
\dimen@ii\vfuzz
\vfuzz\maxdimen
\setbox\tw@\copy\z@
\setbox\tw@\vsplit\tw@ to \ht\@arstrutbox
\setbox\tw@\vbox{\unvbox\tw@}%
\vfuzz\dimen@ii
\advance\dimen@ \ht
\ifdim\ht\@arstrutbox>\ht\tw@\@arstrutbox\else\tw@\fi
\advance\dimen@\dp
\ifdim\dp\@arstrutbox>\dp\tw@\@arstrutbox\else\tw@\fi
\advance\dimen@ -\pagegoal
\ifdim \dimen@>\z@\vfil\break\fi
\global\@colroom\@colht
\ifvoid\LT@foot\else
% \advance\vsize-\ht\LT@foot
\global\advance\vsize-\ht\LT@foot
%
\global\advance\@colroom-\ht\LT@foot
\dimen@\pagegoal\advance\dimen@-\ht\LT@foot\pagegoal\dimen@
\maxdepth\z@
\fi
\ifvoid\LT@firsthead\copy\LT@head\else\box\LT@firsthead\fi\nobreak
\output{\LT@output}}
\def\endlongtable{%
\crcr
\noalign{%
\let\LT@entry\LT@entry@chop
\xdef\LT@save@row{\LT@save@row}}%
\LT@echunk
\LT@start
\unvbox\z@
\LT@get@widths
\if@filesw
{\let\LT@entry\LT@entry@write\immediate\write\@auxout{%
\gdef\expandafter\noexpand
\csname LT@\romannumeral\c@LT@tables\endcsname
{\LT@save@row}}}%
\fi
\ifx\LT@save@row\LT@@save@row
\else
\LT@warn{Column \@width s have changed\MessageBreak
in table \thetable}%
\LT@final@warn
\fi
\endgraf\penalty -\LT@end@pen
%
\ifvoid\LT@foot\else
\global\advance\vsize\ht\LT@foot
\global\advance\@colroom\ht\LT@foot
\dimen@\pagegoal\advance\dimen@\ht\LT@foot\pagegoal\dimen@
\fi
%
\endgroup
\global\@mparbottom\z@
% \pagegoal\vsize
\endgraf\penalty\z@\addvspace\LTpost
\ifvoid\footins\else\insert\footins{}\fi}
\def\LT@output{%
\ifnum\outputpenalty <-\@Mi
\ifnum\outputpenalty > -\LT@end@pen
\LT@err{floats and marginpars not allowed in a longtable}\@ehc
\else
\setbox\z@\vbox{\unvbox\@cclv}%
\ifdim \ht\LT@lastfoot>\ht\LT@foot
\dimen@\pagegoal
%
\advance\dimen@\ht\LT@foot
%
\advance\dimen@-\ht\LT@lastfoot
\ifdim\dimen@<\ht\z@
\setbox\@cclv\vbox{\unvbox\z@\copy\LT@foot\vss}%
\@makecol
\@outputpage
%
\global\vsize\@colroom
%
\setbox\z@\vbox{\box\LT@head}%
\fi
\fi
% \global\@colroom\@colht
% \global\vsize\@colht
% \vbox
% {\unvbox\z@\box\ifvoid\LT@lastfoot\LT@foot\else\LT@lastfoot\fi}%
\unvbox\z@\ifvoid\LT@lastfoot\copy\LT@foot\else\box\LT@lastfoot\fi
%
\fi
\else
\setbox\@cclv\vbox{\unvbox\@cclv\copy\LT@foot\vss}%
\@makecol
\@outputpage
\global\vsize\@colroom
\copy\LT@head\nobreak
\fi}
\makeatother
\begin{document}
\lipsum[1-8]
\begin{figure}[ht]
\rule{7cm}{7cm}\\
Picture 1.
\end{figure}
\lipsum[1-2]
\begin{longtable}{|c|}
\hline
N \\
\endfirsthead
\hline
1 \\
\hline
2 \\
\hline
3 \\
\hline
4 \\
\hline
5 \\
\hline
6 \\
\hline
7 \\
\hline
8 \\
\hline
9 \\
\hline
10 \\
\hline
\end{longtable}
\lipsum[1-2]
% Wrong figure!!!
\begin{figure}[ht]
This figure goes out of paper. \\
\rule{5cm}{10cm}\\
\end{figure}
\end{document}