21

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
  • 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 1 '12 at 9: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 1 '12 at 10:57
20

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

  • I like how this avoids redefining the entire proof environment. – A.Ellett Dec 1 '12 at 14:25
  • this could leave Proof orphaned on a page though... – cmhughes Dec 1 '12 at 16:26
  • @cmhughes -- fair point. updated to avoid the possible break. – barbara beeton Dec 1 '12 at 17:11
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

  • 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 1 '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 1 '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 1 '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 1 '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 1 '12 at 14:06
3

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).

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.