我有类似的问题这个问题,但稍微复杂一些。我需要让示例中的 parbox 始终出现在页面底部,无论 TeX 是否将其单独放置在页面上. (此示例针对letterpaper
输出进行了定制)
\documentclass{report}
\begin{document}
This text might fit onto one page
\vskip 7.2in %% compare result when set to 7in
but push the following parbox onto the next page.
\par\null\vfill
\parbox{\textwidth}{This parbox should always
appear at the bottom of the page.}
\clearpage
More stuff.
\end{document}
只要 parbox 不会自行刷新到下一页(例如,尝试将设置vskip
为7.0in
或更小),此方法便可按预期工作。但是,如果 parbox 之前的元素大小合适(如示例中所示),则 parbox 将出现在下一页的顶部,而不是底部。
据我所知,问题在于我无法找到一种方法来确保\null\vfill
始终将其放置在与 parbox 相同的页面上,而不仅仅是插入到“完整”页面的底部。(因为 vfill 没有最小高度?)
需要说明的是,我确实不是想要强制 parbox 单独出现在其自己页面的底部,如果布局需要它,它应该只单独出现在页面上。
答案1
这里我使用\needspace{1\baselineskip}
,因为你的\parbox
是一行高。 的参数应该是后面\needspace
所需的高度。\parbox
在 MWE 中,我会显示您的跳过值为 6.8、7.0、7.2 和 7.4。在所有情况下,都会\parbox
被推送到页面底部。
\documentclass{report}
\usepackage{needspace}
\begin{document}
This text might fit onto one page
\vskip 6.8in %% compare result when set to 7in
but push the following parbox onto the next page.
\par\needspace{1\baselineskip}%
\null\vfill
\parbox{\textwidth}{This parbox should always
appear at the bottom of the page.}
\clearpage
This text might fit onto one page
\vskip 7.0in %% compare result when set to 7in
but push the following parbox onto the next page.
\par\needspace{1\baselineskip}%
\null\vfill
\parbox{\textwidth}{This parbox should always
appear at the bottom of the page.}
\clearpage
This text might fit onto one page
\vskip 7.2in %% compare result when set to 7in
but push the following parbox onto the next page.
\par\needspace{1\baselineskip}%
\null\vfill
\parbox{\textwidth}{This parbox should always
appear at the bottom of the page.}
\clearpage
This text might fit onto one page
\vskip 7.4in %% compare result when set to 7in
but push the following parbox onto the next page.
\par\needspace{1\baselineskip}%
\null\vfill
\parbox{\textwidth}{This parbox should always
appear at the bottom of the page.}
\clearpage
More stuff.
\end{document}
答案2
这种方法似乎\nopagebreak
也有效,尽管我还不确定它到底有多么强大。
\documentclass{report}
\begin{document}
This text might fit onto one page
\vskip 7.2in %% compare when this changes to 7.0in
but push the parbox onto the next page.
\par\vbox{}\null\vfill\nopagebreak
\parbox{\textwidth}{\hfill This parbox should always
appear at the bottom of the page.}
\clearpage
More stuff.
\end{document}
编辑:没关系,这并不能在所有情况下解决问题。不过,有时它确实能解决问题。