33

I want to make the proof environment in amsthm package to auto add a line break right after the "Proof."

I tried the following code, which also removed the QED sign, but it doesn't work: No linebreak is added.

\makeatletter
\renewenvironment{proof}[1][\proofname]{\par
    \normalfont \topsep6\p@\@plus6\p@\relax
    \trivlist
    \item[\hskip\labelsep
        \itshape
        #1\@addpunct{.} \newline] }%\ignorespaces}
\makeatother
lockstep
  • 250,273
  • Welcome to TeX.SE. While code snippets are useful in explanations, it is always best to compose a fully compilable MWE that illustrates the problem including the \documentclass and the appropriate packages so that those trying to help don't have to recreate it. – Peter Grill Dec 01 '12 at 09:52
  • Did you try with \mbox{}\\ after the closing ] instead of \newline before it? Usually I advise against having "Proof" in a line by itself: it creates a lot of white space and is not necessary as the italic shape used for "Proof" already makes it prominent. – egreg Dec 01 '12 at 10:57

4 Answers4

35

a manual way to drop to a new line immediately after the proof heading is to insert

$ $\newline

but it's possible to build on the existing proof definition and thereby retain the ability to use the \qedhere facility to move the "tombstone" up to the actual last line of the proof.

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

\newenvironment{myproof}[1][\proofname]{%
  \begin{proof}[#1]$ $\par\nobreak\ignorespaces
}{%
  \end{proof}
}

\begin{document}

\begin{proof}
  $ $\newline
    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{myproof}[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{myproof}

\begin{myproof}
    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{myproof}

\end{document}

enter image description here

6

I would definitely consider the ntheorem package for this; it has a lot of very useful pre-defined styles, including break which is perfect for what you want; note that this won't ever orphan your Proof from its body.

screenshot

\theoremstyle{nonumberbreak}
\theoremsymbol{\ensuremath{\diamondsuit}}
\theorembodyfont{}
\theoremheaderfont{\itshape}
\renewtheorem{proof}{Proof}

It also has a robust algorithm for assigning a theoremmark, which can be whatever symbol you want.

\documentclass{article}
\usepackage{amsmath}
\usepackage[amsmath,standard,thmmarks]{ntheorem} 

\theoremstyle{nonumberbreak}
\theoremsymbol{\ensuremath{\diamondsuit}}
\theorembodyfont{}
\theoremheaderfont{\itshape}
\renewtheorem{proof}{Proof}

\begin{document}

\begin{proof}
  Your proof goes here
  Your proof goes here
  Your proof goes here
  Your proof goes here
  Your proof goes here
  Your proof goes here
  Your proof goes here
  Your proof goes here
  Your proof goes here
  Your proof goes here
  Your proof goes here
\end{proof}

\end{document}

For further reading, you might also like to have a look at the question and answers here Definitive guide to trivlists; you'll see it is all about having an environment with a heading on a new line (that won't get orphaned).

cmhughes
  • 100,947
4

First, I wouldn't redefine the proof environment. I would just make my own. Secondly, the placement of your \newline needs to be placed outside of the square brackets. Here's a working example:

\documentclass{article}
\usepackage{amsmath,amssymb,amsthm}
\makeatletter
\newenvironment{myproof}[1][\proofname]{\par
    \pushQED{\qed}%
    \normalfont \topsep6\p@\@plus6\p@\relax
    \trivlist
    \item[\hskip\labelsep
        \itshape
        #1\@addpunct{.} ]\mbox{}\par\nobreak}
    {\popQED\endtrivlist\@endpefalse}
\makeatother
\usepackage{lipsum}
\begin{document}

\begin{myproof}
    First line of my proof

    Intermediary lines of my proof:
    \lipsum[1]

    last line of my proof
\end{myproof}

\end{document}

enter image description here

But because of the \newline The indentation of the paragraphs doesn't look good to me. So, I would recommend changing the \newline to \par to force a paragraph break. So the code for the new environment would be

\makeatletter
\newenvironment{myproof}[1][\proofname]{\par
    \pushQED{\qed}%
    \normalfont \topsep6\p@\@plus6\p@\relax
    \trivlist
    \item[\hskip\labelsep
        \itshape
        #1\@addpunct{.} ]\mbox{}\par\nobreak}
    {\popQED\endtrivlist\@endpefalse}
\makeatother

which results inenter image description here

A.Ellett
  • 50,533
  • The \par allows a page break, so it may cause detaching the proof body from the heading. Probably \mbox{}\\*\indent or \mbox{}\par\nobreak are more sensible choices. But with or without indenting the first line the result is bad. Contrary to you, I would redefine the proof environment. – egreg Dec 01 '12 at 13:32
  • @egreg. I agree with you about the proof. just floating there by itself. I don't think it should be on a separate line. I'll change to code to reflect your suggestion about the use of \par. I do have a question, why the mbox? Why not just \hfill or some cousin of it? – A.Ellett Dec 01 '12 at 13:44
  • The important thing is to start horizontal mode, so even \leavevmode would suffice. It's not necessary to "fill the line", as \\ or \par are perfectly happy to break a line, provided the line has started (which it doesn't with the simple \item[...] command). – egreg Dec 01 '12 at 13:58
  • @egreg. Thank you! You've just made sense of some issues I've long been perplexed about. It hadn't occurred to me that I had to start horizontal mode here. – A.Ellett Dec 01 '12 at 14:05
  • 1
    this definition loses the ability to use \qedhere, which is useful when a proof ends with a list or a display. – barbara beeton Dec 01 '12 at 14:06
  • @barbarabeeton, I'm not familiar with \qedhere. If I restore the \pushQED{\qed} to the beginning of the environment definition and \popQED to the end of it, will that fix \qedhere? – A.Ellett Dec 01 '12 at 14:19
  • @A.Ellett -- i've just posted an answer showing the use of \qedhere, along with a redefinition of proof based on the existing definition that avoids mucking around with the pushQED. – barbara beeton Dec 01 '12 at 14:25
  • @barbarabeeton. Just in case someone really wants to go through the effort to rewrite the proof environment, I've fixed my solution so that \qedhere now works. But, I think @barbarabeeton's solution is really a better one than mine. – A.Ellett Dec 01 '12 at 14:32
-2

Summarize your proof in one line, and // at the end.

because not everyone wants to read you proof word by word to know what you are saying.

Here's an example:

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

\begin{document}

\begin{proof} We prove it by contradiction.\ Suppose the contrary that blablabla is not true, then blabla does not exists. Contradiction.] \end{proof}

\end{document}

1

  • 1
    Can you please explain, how double slash could help to get a line break? Best would be to also show a working example to illustrate, what you are meaning. Currently this one liner seems to be not very useful and not very clear. – cabohah Nov 17 '23 at 07:45