# parbox exceeds to bottom

In the following MWE, the parbox at the end of the page appears half below the bottom margin.

\documentclass{book}

\begin{document}
\Large
a\par a\par a\par a\par a\par a\par a\par a\par a\par a\par a\par a\par a\par a\par a\par a\par a\par Ap

\parbox{1cm}{ap ap}

\end{document}


Is there any penalty or other settings I can assign, so TeX (I use xelatex, but latex produces the same result) will automatically either:

• break and put the parbox on the next page, or

• preferably, stretch lines in this page a little bit less and place the parbox inside the text height area.

• parbox default insertion point is vertically centered. Try \parbox[t]{1cm}{ap ap} (t =top aligned). By default it is like\parbox[c] - centered. Jul 1 '16 at 8:56
• The problem is that the size of the parbox is right at the hairy edge of causing a pagebreak. If you make it just slightly larger by adding a \strut, it will go to the next page. You could adjust the glue, especially \parskip, to allow more shrinkage. You could adjust the badness to not allow text to overhang the bottom. You could add \pagebreak[3]. Jul 1 '16 at 12:58
• @john, how do I adjust the badness to not allow text to overhang the bottom? Jul 4 '16 at 8:44

To answer your question about badness, the macro \pagebreak[3] uses (effectively)
\ifvmode

where \@highpenalty is a count register. A quick test run showed \the\csname @highpenalty\endcsname as 301.