# line break after the word “proof” in proof environment

I would like a proof environment that satisfies the following constraints:

1. The proof must start on a new line after the word “Proof”.
2. The word “Proof” and the first line have to be on the same page.
3. The syntax to use must be \begin{proof}...\end{proof}, because I have already used this in many different documents.

I read the answers from here, but I think that the are not satisfying my 2nd and 3rd condition.

Also I'm writing the code with some changes (I get error reports, here is the log file).

\documentclass{article}
\usepackage{amsmath,amsthm}

\renewenvironment{proof}[1][\proofname]{%I changed \newenvironment to \renewenvironment!!!!
\begin{proof}[#1]\par\nobreak\ignorespaces
}{%
\end{proof}
}

\begin{document}

\begin{proof}[Proof of my theorem]
First line of my proof

Intermediary lines of my proof:
\begin{itemize}
\item next-to-last line
\item last line of my proof
\qedhere
\end{itemize}
\end{proof}

\begin{proof}
First line of my proof

Intermediary lines of my proof:
\begin{itemize}
\item next-to-last line
\item last line of my proof
\qedhere
\end{itemize}
\end{proof}

\end{document}


• Potential duplicate: Proof environment - line break after the “Proof.” – barbara beeton Jul 15 '19 at 13:21
• @barbarabeeton , it's not the same. I wrote that I read this post, but I have some different needings. – Kώστας Κούδας Jul 15 '19 at 13:39
• You say that the code you quote doesn't satisfy your second condition. That is not so; it does, and was thoroughly tested (and used in a production environment) before posting. – barbara beeton Jul 15 '19 at 14:10
• @barbarabeeton , if the code I quote satisfies my second condition, I 'm sorry, I didn't understand it. Cap_sensitive didn't say that he wanted something like this, so I suppose that your answer hadn't mentioned this. Also my 3rd condition is not satisfied. Thank's for your answers! – Kώστας Κούδας Jul 15 '19 at 14:38

You just need to patch proof.

\documentclass{article}
\usepackage{amsmath,amsthm}

\usepackage{xpatch}

\xapptocmd{\proof}{\mbox{}\par\nobreak}{}{}

\textheight=6.2cm % just for the example

\begin{document}

\begin{proof}[Proof of my theorem]
First line of my proof.

Intermediary lines of my proof:
\begin{itemize}
\item next-to-last line
\item last line of my proof
\qedhere
\end{itemize}
\end{proof}

\begin{proof}
First line of my proof.

Intermediary lines of my proof:
\begin{itemize}
\item next-to-last line
\item last line of my proof
\qedhere
\end{itemize}
\end{proof}

\begin{proof}
This will be in the next page. Some filler text.
Some filler text. Some filler text. Some filler text.
Some filler text. Some filler text. Some filler text.
Some filler text. Some filler text. Some filler text.
Some filler text. Some filler text. Some filler text.
Some filler text. Some filler text. Some filler text.
Some filler text. Some filler text. Some filler text.
Some filler text. Some filler text. Some filler text.
Some filler text. Some filler text. Some filler text.
Some filler text. Some filler text. Some filler text.
\end{proof}

\end{document}


Just for testing, if you try and remove \nobreak, you'll see that the final “Proof” line will appear by itself at the bottom.

from your post, I understand that you need to set the heading Proof in a line and the following text to be in the next line, (if not so, please correct me). If I am correct, please try with the below code:

\documentclass{article}
\usepackage{amsmath,amsthm}

\makeatletter
\renewenvironment{proof}[1][\proofname]{\par
\pushQED{\qed}%
\normalfont \topsep6\p@\@plus6\p@\relax
\trivlist
\item[\hskip\labelsep
\itshape
}{%
\popQED\endtrivlist\@endpefalse
}
\makeatother

\begin{document}

\begin{proof}[Proof of my theorem]
First line of my proof

Intermediary lines of my proof:
\begin{itemize}
\item next-to-last line
\item last line of my proof
\qedhere
\end{itemize}
\end{proof}

\begin{proof}
First line of my proof

Intermediary lines of my proof:
\begin{itemize}
\item next-to-last line
\item last line of my proof
\qedhere
\end{itemize}
\end{proof}

\end{document}

• I'm afraid this doesn't respect constraint number 2 of the question (“the word "proof" and the first line have to be on the same page”). Try with \usepackage{lipsum} and \lipsum[1-4]\par\lipsum[5][1-12] right after \begin{document}. ;-) – frougon Jul 15 '19 at 8:53

You can apply Bruno Le Floch's magic powder (see below), but there is a simpler solution using the letltxmacro package, as egreg kindly pointed out. So, let's start with the simpler solution:

# Redefining \proof using letltxmacro

\documentclass{article}
\usepackage{amsthm}
\usepackage{letltxmacro}
% \usepackage{lipsum} % uncomment to test the behavior at a page break

\makeatletter
\LetLtxMacro{\proof@ORIG}{\proof}

\renewcommand{\proof}[1][\proofname]{%
\proof@ORIG[#1]\mbox{}\par\nobreak
}
\makeatother

\begin{document}

% To test the behavior at a page break, use \lipsum[1-4]\par\lipsum[5][1-11]
% here, then add a few words in order to see the proof pushed to the next page.
\begin{proof}[Proof of my theorem]
First line of my proof.

Intermediary lines of my proof:
\begin{itemize}
\item next-to-last line
\item last line of my proof
\qedhere
\end{itemize}
\end{proof}

\begin{proof}
First line of my proof.

Intermediary lines of my proof:
\begin{itemize}
\item next-to-last line
\item last line of my proof
\qedhere
\end{itemize}
\end{proof}

\end{document}


# Without using letltxmacro

Note: this is not better than what precedes! The problem one faces with a naive redefinition of \proof using \let is due to the optional argument of \proof: \\proof (with two backslashes) is an intermediate macro defined by the \newcommand machinery internally used by \newenvironment; \\proof accepts \proof's optional argument as a delimited argument (TeX macros don't have the concept of optional arguments—LaTeX added this concept).

\\proof:
\long macro:[#1]->\par \pushQED (...)


Here is code that does what you want, based on Bruno Le Floch's magic powder:

\documentclass{article}
\usepackage{amsmath,amsthm}
% \usepackage{lipsum} % uncomment to test the behavior at a page break

% Redefinition that combines <https://tex.stackexchange.com/a/8091> (Bruno Le
% Floch) and <https://tex.stackexchange.com/a/85081> (Barbara Beeton).
% Actually, the latter has been modified a bit here after egreg's feedback.
% ;-)
\expandafter\let\expandafter\oldproof\csname\string\proof\endcsname
\let\oldendproof\endproof
\renewenvironment{proof}[1][\proofname]{%
\oldproof[#1]\mbox{}\par\nobreak
}{%
\oldendproof
}

\begin{document}

% To test the behavior at a page break, use \lipsum[1-4]\par\lipsum[5][1-11]
% here, then add a few words in order to see the proof pushed to the next page.
\begin{proof}[Proof of my theorem]
First line of my proof.

Intermediary lines of my proof:
\begin{itemize}
\item next-to-last line
\item last line of my proof
\qedhere
\end{itemize}
\end{proof}

\begin{proof}
First line of my proof.

Intermediary lines of my proof:
\begin{itemize}
\item next-to-last line
\item last line of my proof
\qedhere
\end{itemize}
\end{proof}

\end{document}

• I know a much better magic powder, the letltxmacro package. By the way,  is horrible (\mbox{} is way better) and \ignorespaces in vertical mode is useless. – egreg Jul 15 '19 at 8:57
• @egreg I gave all my sources, I said it was a combined work! ;-)) Of course, I've incorporated your suggestions and will have a look at this letltxmacro package, thanks! (and I have to say, your solution is more elegant) – frougon Jul 15 '19 at 9:16
• @egreg This letltxmacro magic powder is fantastic, thanks! – frougon Jul 15 '19 at 9:44
• @frougon , thank's for your answer and for correcting my horrible English! Your answer solved my problem, but also does egreg's answers. I checked egreg's because I can understand it better. Thank's! – Kώστας Κούδας Jul 15 '19 at 14:30
• @KώσταςΚούδας Thanks for your message. You were right to accept egreg's answer, no problem. :-) – frougon Jul 15 '19 at 15:27