# pagebreak and amsmath theorem environment issue

In the example below, you'll notice that when a \pagebreak is used right after the theorem, an unwanted vertical blank space is added after the theorem environment while it should not.

\documentclass[11pt,fleqn]{book}
\usepackage[showframe,top=3.4cm,bottom=3.4cm,left=3cm,right=3cm]{geometry}
\usepackage[utf8]{inputenc}
\usepackage{amsthm}
\usepackage[framemethod=tikz]{mdframed}
\usepackage{blindtext}
%----------------------------------------------
\theoremstyle{plain}
\newmdtheoremenv{theoreme}{Theorem}
\begin{document}%
\flushbottom
%----------------------------------------------
\chapter{Title}
%----------------------------------------------
\blindtext[3]
\begin{theoreme}text text text text text text text text text text text text text text text text text text text text text text text text text text text text text text text text text text text text text text\end{theoreme}
\pagebreak % TO BE COMMENTED FOR TESTING
text
\end{document}
%----------------------------------------------

• with pagebreak

• without pagebreak

• this is the expected behavior. the theorem environment has vertical space built in above and below, so when you insert a \pagebreak after the environment is ended, the space remains. space is ignored at the beginning of a page, but not at the end. – barbara beeton Sep 29 '14 at 0:52
• @barbarabeeton I see but I do not really understand the difference between an automatic pagebreak and a manual pagebreak then? It looks to me that they should behave similarly in this situation. – pluton Sep 29 '14 at 1:32
• i think the answer by andrew, with help from egreg, clarifies this somewhat. when a page breaks "on its own", the action is taken before the vertical space inserted by \end{theorem}, but when you add an explicit \pagebreak, that space is already applied, and \pagebreak doesn't try to adjust, on the assumption that you knew what you were doing; sometimes end-of-page spaces are actually wanted, so it's not safe to assume otherwise. – barbara beeton Sep 29 '14 at 12:30

As Barbara Beeton says this is expected behaviour. However, you can circumvent it by adding \unskip before the \pagebreak:

An alternative suggested by egreg is \addpenalty{-10000} instead of the combination \unskip\pagebreak. The code for \addpenalty essentially includes \unskip and \pagebreak (with no argument) is essentially \penalty-10000.

\documentclass[11pt,fleqn]{book}
\usepackage[showframe,top=3.4cm,bottom=3.4cm,left=3cm,right=3cm]{geometry}
\usepackage[utf8]{inputenc}
\usepackage{amsthm}
\usepackage[framemethod=tikz]{mdframed}
\usepackage{blindtext}
%----------------------------------------------
\theoremstyle{plain}
\newmdtheoremenv{theoreme}{Theorem}
\begin{document}%
\flushbottom
%----------------------------------------------
\chapter{Title}
%----------------------------------------------
\blindtext[3]
\begin{theoreme}text text text text text text text text text text text text text text text text text text text text text text text text text text text text text text text text text text text text text text\end{theoreme}
\unskip\pagebreak % TO BE COMMENTED FOR TESTING
text
\end{document}
%----------------------------------------------

• Or \addpenalty{-10000}, because \addpenalty ensures to remove a vertical space to reinsert it after the penalty. – egreg Sep 29 '14 at 10:53
• @egreg Thanks - suggested included in answer – Andrew Swann Sep 29 '14 at 11:22