# [OS X TeX] unwanted page break

Ross Moore ross.moore at mq.edu.au
Wed Jun 15 19:41:30 EDT 2011

Hi Art,

On 16/06/2011, at 5:41 AM, Art Werschulz wrote:

> Hi.
>
> Attached you will find two files that illustrate a problem I'm having.  As you can see in the PDF file, there's a page break between the "Exercise 3.4" heading and the solution.   Needless to say, this is a really bad place for a page break.  It would make much more sense for the page break to appear before the heading, so that the heading and the solution would be together.
>

But that spreads the other exercises out by an inordinate amount.
That can be fixed with a \filbreak which puts all the excess space
at the bottom of the page.

\end{solution}
\filbreak
\begin{solution}{3.4}
$$\begin{tabular}{c|c|c||c|c||c|c|c} p&q&r&q\land r&p\lor(q\land r)& p\lor q&p\lor r&(p\lor q)\land(p\lor r) \\ (Note how I use$$...$$to get the centering. After all it is a maths problem that is being shown.) Or maybe you would prefer to squeeze that 4th exercise onto the same page. \end{solution} \enlargethispage{.1cm} \begin{solution}{3.4}$$
\begin{tabular}{c|c|c||c|c||c|c|c}
$p$&$q$&$r$&$q\land r$&$p\lor(q\land r)$&
$p\lor q$&$p\lor r$&$(p\lor q)\land(p\lor r)$ \\

It only takes an extra 1mm to get this onto the same page.
But then maybe that becomes too cramped.

When you have large blocks of material like this,
then have to manually check that each page is set sufficiently
nicely. Be prepared to add extra sentences to fill in places
that otherwise seem too sparse.

> Note that the definition of the "solution" environment includes a \nopagebreak.  Moreover, I even inserted a \nopagebreak within the solution to this exercise.  This availed me not.

No. Because LaTeX's \begin{center} does quite complicated
things to ensure that there is a sufficient amount of space
after the preceding text. This includes both \skip and glue,
and the effect of \nopagebreak is rendered redundant.

Since these are math problems, I'd use $$...$$ (or $...$ )
around the tables, to get the centering.

>
> Of course, I could insert a \newpage before the solution to Exercise 3.4.  But this is a pretty brittle solution.  What I'm showing you here is really a stripped-down example of the real thing, which is the solutions manual to a textbook.  Moreover, rather than manually maintaining separate files for the text and the solutions manual, we're using the "answers" package to generate the solutions manual file automatically, which adds a bit more indirection to the stew.  So going back and fixing things manually would be a tedious, error-prone solution, which would break if we were to include additional exercises.
>
> Do any of you have suggestions about how to fix this?  Many thanks!!
>
> Art Werschulz (8-{)}   "Metaphors be with you."  -- bumper sticker
> GCS/M (GAT): d? -p+ c++ l u+(-) e--- m* s n+ h f g+ w+ t++ r- y?
> Internet: agw STRUDEL comcast.net

Hope this helps,

Ross

------------------------------------------------------------------------
Ross Moore                                       ross.moore at mq.edu.au
Mathematics Department                           office: E7A-419
Macquarie University                             tel: +61 (0)2 9850 8955
Sydney, Australia  2109                          fax: +61 (0)2 9850 8114
------------------------------------------------------------------------