[Tex/LaTex] thmtools: How to prevent pagebreak between theorem and proof


I am using thmtools to format a collection of theorems and their proofs.

Is there any way to prevent a pagebreak from happening between the last line of a theorem statement and the first line of the proof?

I tried inserting \nopagebreak, like this


…but it failed to suppress the pagebreak.

The first line of the first proof on any one page should be preceded by at least two lines from the theorem statement. (The proof always follows immediately after the statement; there never is intervening text not belonging to either environment).

FWIW: I searched for multiple variants of "pagebreak", "page break", "nopagebreak" in the thmtools docs, but got no hits.


Best Answer

Given that the theorem and proof environments are quite separate, it's indeed a bit tricky to forbid categorically all pagebreaks between them. All I can suggest is that you load the package needspace and insert the command


close to the end of the statement of the theorem/corollary/whatever; note the uppercase N at the start of the macro. According to the manual of the needspace package, the command "\Needspace{} is less efficient [than \needspace{}] but reserves the requested space exactly. It should only be used between paragraphs." Given that you're basically facing this situation, you may want to give it a try.

You'll probably have to practice a bit to determine the best placement of this command and the number of baseline skips you require in order to always get at least two lines of the proof statement to show up on the same page as the associated theorem.

Related Question