1

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

\documentclass{book}
\usepackage[paperwidth=21cm,paperheight=14.8cm,inner=2.2cm,outer=2.8cm,headsep=0cm,headheight=0.8cm,top=1.3cm,bottom=1.4cm,footskip=0pt,marginparwidth=0.5cm,marginparsep=1.1cm,showframe]{geometry}

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

exmaple result

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. – alwaysask 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]. – John Kormylo Jul 1 '16 at 12:58
  • @john, how do I adjust the badness to not allow text to overhang the bottom? – Avner Shapiro Jul 4 '16 at 8:44
1

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

\ifvmode
 \penalty -\@highpenalty%
\else
 \@bsphack
 \vadjust{\penalty -\@highpenalty}%
 \@esphack
\fi

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

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.