4

I am having some issues with the positioning of a page break with align.

My code is roughly the following.

\documentclass{article}
\usepackage{amsmath, amsthm}
\begin{document}
%Lots of text to force the page break.
Lots of text. Lots of text. Lots of text. Lots of text. Lots of text. Lots of text. Lots of text. Lots of text. Lots of text. Lots of text. Lots of text. Lots of text. Lots of text. Lots of text. Lots of text. Lots of text. Lots of text. Lots of text. Lots of text. Lots of text. Lots of text. Lots of text. Lots of text. Lots of text. Lots of text. Lots of text. Lots of text. Lots of text. Lots of text. Lots of text. Lots of text. Lots of text. Lots of text. Lots of text. Lots of text. Lots of text. Lots of text. Lots of text. Lots of text. Lots of text. Lots of text. Lots of text. Lots of text. Lots of text. Lots of text. Lots of text. Lots of text. Lots of text. Lots of text. Lots of text. Lots of text. Lots of text. Lots of text. Lots of text. Lots of text. Lots of text. Lots of text. Lots of text. Lots of text. Lots of text. Lots of text. Lots of text. Lots of text. Lots of text. Lots of text. Lots of text. Lots of text. Lots of text. Lots of text. Lots of text. Lots of text. Lots of text. Lots of text. Lots of text. Lots of text. Lots of text. Lots of text. Lots of text. Lots of text. Lots of text. Lots of text. Lots of text. Lots of text. Lots of text. Lots of text. Lots of text. Lots of text. Lots of text. Lots of text. Lots of text. Lots of text. Lots of text. Lots of text. Lots of text. Lots of text. Lots of text. Lots of text. Lots of text. Lots of text. Lots of text. Lots of text. Lots of text. Lots of text. Lots of text. Lots of text. Lots of text. Lots of text. Lots of text. Lots of text. Lots of text. Lots of text. Lots of text. Lots of text. Lots of text. Lots of text. Lots of text. Lots of text. 

\begin{proof}
%Some more text to force the page break and get the "$a=b$." in the correct position.
Some more text. Some more text. Some more text. Some more text. Some more text. Some more text. Some more text. Some more text. Some more text. Some more text. Some more text. Some more text. Some more text. Some more text. Some more text. Some more text. Some more text. Some $a=b$.
\begin{align*}
%Something pretty long to force a new page whilst leaving a blank area.
a&b\\a&b\\a&b\\a&b\\a&b\\a&b\\a&b\\a&b\\a&b\\a&b\\a&b\\a&b\\a&b\\a&b\\a&b\\a&b
\end{align*}
\end{proof}
\end{document}

Now, align takes a new page and leaves a large blank bit at the bottom of the previous page, which is fine. However, it also takes the last line of text with it, and the last line of text is simply $a=b$. Which is silly! So I want to utilise this large blank space by putting the $a=b$. there. Is there a proper way of doing this? (I got a "hackey" answer by putting a \newpage before the \align, but this is immoral!)

I believe the standard answer would be to use a \minipage. However, the \proof reacts oddly to this.

Note: I found this question, this one, and this one. All have close-but-no-cigar answers (the last one seems promising, but has the same issue as minipage does).

user1729
  • 817
  • 7
  • 18
  • 1
    This is standard. LaTeX does not like to start a page with display math. And also by standard an align cannot be broken across pages. You can tell it is allowed to break the align (see the amsmath manual), or you can add some comments using \intertext{...} or \shortintertext from mathtools), with add break points. – daleif May 20 '14 at 11:23
  • Yes, I understand what LaTeX is trying to do. I just want to not let it do it. Also, aren't your comments suggestions as rigid as the \newpage hack (although I am not sure I understand what you mean by them)? – user1729 May 20 '14 at 11:28
  • No, my solution would be to break the align instead of attempting to control what it brings along to the next page and leaving behind an unfinished page. – daleif May 20 '14 at 11:35
  • You can add \pagebreak between two words in the last but two line before the display; or simply have ~ instead of a space before $a=b$. If you are keen to split the display, add \displaybreak before the \\ that ends one line. – egreg May 20 '14 at 12:40
  • @egreg The pagebreak isn't what I am after - I want to utilise the large empty space, but also want to do it dynamically (so if the earlier test changes then I don't have a random page break). I tried ~$a=b$. before I posted this question, and really should have mentioned this because it was so impressively not what I was expecting to happen - it kept the a= on the first page and I was left with b. on the next page. Which is impressively worse! In the example above, it brings the "some" onto the next page also, so you get Some $a=b$. on the next page. Again, this is not ideal. – user1729 May 20 '14 at 12:44
  • Also, I really don't want to split the display. At all. – user1729 May 20 '14 at 12:47
  • Some~$a=\nolinebreak b$; if you don't want to split the display, you have no way: it doesn't fit on the page, so it goes to a new page. If the needed space is small, you can use \enlargethispage; actually if I say \enlargethispage{\baselineskip} just before the display, it fits. – egreg May 20 '14 at 12:56
  • @egreg I think one of us isn't understanding something - what do you mean by "display"? Because Andrew Swann's answer does exactly what I want, and you are saying that there is "no way" if I don't want to split the display. By "display" I thought you were meaning the stuff in the align environment (which is what daleif was wanting to split, and as there are no other \s...). – user1729 May 20 '14 at 13:01
  • The “display” is the whole align environment. If Andrew Swann's answer is good for you, then I see a contradiction with you saying “I want to utilise the large empty space”, for the display will entirely go to the next page, so you're left with a big blank chunk. – egreg May 20 '14 at 13:14
  • @egreg Hmm, yes, what I was meaning was that I just wanted the $a=b$. to go there, but I didn't mind the space in principle. I just wanted to stop the (in my specific case) silliness of having to turn a page to see $a=b$. rather than it being on the same page as the rest of the text. – user1729 May 20 '14 at 13:26
  • 1
    this suggestion violates all principles. however, leaving a blank line before the display (the align) will allow a page break there. but if you rewrite anything before that, and the display then fits, the vertical spacing will be all wrong. – barbara beeton May 20 '14 at 14:38

1 Answers1

3

This is controlled by \predisplaypenalty which latex sets to the maximum 10000. Reducing this to say 9900 will allow a page break here:

Sample from page 1

\documentclass{article}
\usepackage{amsmath, amsthm}
\begin{document}
%Lots of text to force the page break.
Lots of text. Lots of text. Lots of text. Lots of text. Lots of text. Lots of text. Lots of text. Lots of text. Lots of text. Lots of text. Lots of text. Lots of text. Lots of text. Lots of text. Lots of text. Lots of text. Lots of text. Lots of text. Lots of text. Lots of text. Lots of text. Lots of text. Lots of text. Lots of text. Lots of text. Lots of text. Lots of text. Lots of text. Lots of text. Lots of text. Lots of text. Lots of text. Lots of text. Lots of text. Lots of text. Lots of text. Lots of text. Lots of text. Lots of text. Lots of text. Lots of text. Lots of text. Lots of text. Lots of text. Lots of text. Lots of text. Lots of text. Lots of text. Lots of text. Lots of text. Lots of text. Lots of text. Lots of text. Lots of text. Lots of text. Lots of text. Lots of text. Lots of text. Lots of text. Lots of text. Lots of text. Lots of text. Lots of text. Lots of text. Lots of text. Lots of text. Lots of text. Lots of text. Lots of text. Lots of text. Lots of text. Lots of text. Lots of text. Lots of text. Lots of text. Lots of text. Lots of text. Lots of text. Lots of text. Lots of text. Lots of text. Lots of text. Lots of text. Lots of text. Lots of text. Lots of text. Lots of text. Lots of text. Lots of text. Lots of text. Lots of text. Lots of text. Lots of text. Lots of text. Lots of text. Lots of text. Lots of text. Lots of text. Lots of text. Lots of text. Lots of text. Lots of text. Lots of text. Lots of text. Lots of text. Lots of text. Lots of text. Lots of text. Lots of text. Lots of text. Lots of text. Lots of text. Lots of text. Lots of text. Lots of text. Lots of text. Lots of text. 

\begin{proof}\predisplaypenalty=9900
%Some more text to force the page break and get the "$a=b$." in the correct position.
Some more text. Some more text. Some more text. Some more text. Some more text. Some more text. Some more text. Some more text. Some more text. Some more text. Some more text. Some more text. Some more text. Some more text. Some more text. Some more text. Some more text. Some $a=b$.
\begin{align*}
%Something pretty long to force a new page whilst leaving a blank area.
a&b\\a&b\\a&b\\a&b\\a&b\\a&b\\a&b\\a&b\\a&b\\a&b\\a&b\\a&b\\a&b\\a&b\\a&b\\a&b
\end{align*}
\end{proof}
\end{document}
Andrew Swann
  • 95,762
  • Thanks, this is great! I am presuming that your code just changes the penalty in this proof environment? – user1729 May 20 '14 at 11:33
  • 1
    Yes, in the above code the change is limited to that environment. You can set the penalty in the preamble if you really want this value for the whole document. – Andrew Swann May 20 '14 at 11:39