# How can we force one line proof environment to stick to its associated theorem environment?

In my LaTeX document, some of the proofs are one-liners:

\documentclass[letterpaper]{article}
\usepackage{amsmath}
\usepackage{amsthm}
\usepackage{lipsum}

\theoremstyle{plain}
\newtheorem{theorem}{Theorem}
\newtheorem{property}[theorem]{Property}

\begin{document}

\lipsum[2-5]

\begin{property}
\lipsum[1]
\end{property}
\begin{proof}
By construction.
\end{proof}

\lipsum[6-8]

\end{document}


Sometimes, the proof is printed at the top of a page, which really looks ridiculous. What is the best way to stick this kind of one-line proof to its associated theorem environment ?

• Can you provide a working document, not just fragments out of context? – user31729 Dec 31 '15 at 10:26
• I have just reworked the sample. – Spherical Triangle Dec 31 '15 at 10:41
• this is ordinarily considered a good place to break a page, so the only way i can think of to "force" it not to break is to use \needspace. (would be glad to learn of something better.) – barbara beeton Dec 31 '15 at 12:18
• The rereworked sample, where the package lipsum is used instead of the package blindtext, reproduce the issue on my Debian Jessie box. – Spherical Triangle Jan 1 '16 at 3:21
• @barbarabeeton I put your suggestion as answer. Thanks. – Spherical Triangle Jan 1 '16 at 5:08

I think you're facing a trade-off between two less-than-ideal outcomes: Either move the entire theorem-like environment (which can contain quite a few lines, right?) to the following page in order to avoid a page break between the theorem-like environment and the associated one-life proof environment, or enlarge the current page by 1 or 2 lines. You've already provided a solution for the former option; its downside is that you might have a sizable "hole" at the bottom of a page. To implement the second option, you could write something like

...
\begin{property}
\lipsum[1]
\end{property}
\enlargethispage{1\baselineskip} % or, possibly, "2\baselineskip"
\begin{proof}
By construction.
\end{proof}
...


At any rate, I wouldn't apply this modification until the very end of the writing of the article.

Please find below the solution suggested by Barbara:

\documentclass[letterpaper]{article}
\usepackage{amsmath}
\usepackage{amsthm}
\usepackage{needspace}
\usepackage{lipsum}

\theoremstyle{plain}
\newtheorem{theorem}{Theorem}
\newtheorem{property}[theorem]{Property}

\begin{document}

\lipsum[2-5]

\needspace{13\baselineskip}
\begin{property}
\lipsum[1]
\end{property}
\begin{proof}
By construction.
\end{proof}

\lipsum[6-8]

\end{document}