# Avoid extra linebreak at the end of modified “proof” environment

This question is related to How to change the word "Proof" in the proof environment?. I would like that the proofs in my document begin with "Proof. ---", instead of the standard "Proof." by default. But if I try to modify this setting, whatever solution I tried, I also get an extra line break at the end of the proof (and the \qed is placed on the extra blank line).

Here is a MWE:

\documentclass[a4paper,11pt]{article}
\usepackage[french]{babel}
\usepackage[latin1]{inputenc}
\usepackage[T1]{fontenc}
\usepackage{amsthm}
\usepackage{enumitem}

\newtheorem{theo}{Theorem}[section]
\renewenvironment{proof}{{\noindent \itshape Proof. ---}}{\qed}

\begin{document}

\begin{theo}
My theorem.
\end{theo}

\begin{proof} In two steps:
\begin{enumerate}[label=(\roman*)]
\item The first step
\item The second step
\qedhere
\end{enumerate}
\end{proof}

\end{document}


As you can see in this MWE, the "Proof. ---" is correctly set, but I get an extra new line. I tried some solutions (found on SE) to remove the extra new line, but it seems that none of them is compatible with the "renaming" of proof environment. How can I do both?

Thanks!

• There is a reason why the proof env is defined the way it is. Copy the definition from amsthm.sty to your preamble and modify that. This very naïvely approach in the MWE is asking for trouble. – daleif Nov 29 '19 at 9:28
• Well, that's a bit heavy for such a little issue... I kept trying other solutions and found a satisfactory one, posted below as an answer, just in case. – Philopolis Nov 29 '19 at 9:57
• In any case you need to look at the original definition to figure out what to change (as you did below) – daleif Nov 29 '19 at 11:28
• – Cragfelt Nov 29 '19 at 11:58

A solution: using the xpatch package to modify only the \@addpunct instruction. This is working:

\documentclass[a4paper,11pt]{article}
\usepackage[french]{babel}
\usepackage[latin1]{inputenc}
\usepackage[T1]{fontenc}
\usepackage{amsthm}
\usepackage{enumitem}
\usepackage{xpatch}

\makeatletter
\makeatother

\newtheorem{theo}{Theorem}[section]

\begin{document}

\begin{theo}
My theorem.
\end{theo}

\begin{proof} In two steps:
\begin{enumerate}[label=(\roman*)]
\item The first step
\item The second step
\qedhere
\end{enumerate}
\end{proof}

\end{document}

• Yes, this is the right way to do the job. Actually, it should be \@addpunct{.} --- – egreg Nov 29 '19 at 10:34
• Thanks! What is the difference, or which problems could arise with \@addpunct{. ---}? – Philopolis Nov 29 '19 at 11:26
• Try with \begin{proof}[Démonstration?] with both codes. – egreg Nov 29 '19 at 11:31