LaTeX: Text/Parbox at bottom of page

I have a problem similar to this question, but slightly more involved. I need for the parbox in my example to always appear at the bottom of the page, regardless of whether TeX places it on a page by itself or not. (This example is tailored for letterpaper output)

\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}


This method works as intended as long as the parbox is not flushed to the next page by itself (e.g., try setting the vskip to 7.0in or less). However, if the element preceeding the parbox is perfectly sized, as in the example, then the parbox will appear at the top of the next page instead of at the bottom.

As far as I understand the problem is that I cannot figure out a way to make sure that the \null\vfill always gets placed on the same page as the parbox, and not just inserted at the bottom of the "full" page. (since the vfill has no minimum height?)

Just to be clear, I do not want to force the parbox appear alone at the bottom of its own page, it should only be alone on the page if the layout requires it.

Here I use \needspace{1\baselineskip}, since your \parbox is one row high. The argument of \needspace should be the needed height of the \parbox that follows.

In the MWE, I show if for your skip value of 6.8, 7.0, 7.2, and 7.4 in. In all cases, the \parbox gets pushed to the page bottom.

\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}

• Thanks, that worked great. I would still like to know if there is a solution that doesn't require you to know the height of the parbox. – Grady Jan 20 '15 at 3:49
• @Grady I would be surprised if you found an alternative. The bottom line is, if your current vertical location is closer to the bottom of a page than the height of the \parbox to come, the \vfill will fit on this page, but the \parbox won't. The only solution is to clear the page prior to the \vfill, and that is what \needspace checks for. – Steven B. Segletes Jan 20 '15 at 3:55
• Do you know of anything problematic about the alternative solution I posted below? It does not appear to require knowledge of the parbox height. – Grady Jan 20 '15 at 4:26
• @Grady Well, I don't know all the ins and outs of \nopagebreak, but if it does what its name implies, then you have a winner. (+1) – Steven B. Segletes Jan 20 '15 at 4:35
• @StevenBSegletes Unfortunately, upon further investigation, that method doesn't seem to get it right 100% of the time. – Grady Jan 20 '15 at 4:37

This approach with \nopagebreak appears to work as well, although I am not sure exactly how robust it is yet.

\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}


Edit: Nevermind, this does not solve the problem in all cases. It does appear to get it right sometimes, however.