[Tex/LaTex] Modify proof environment

environmentsformattingtheorems

I'm looking to modify the proof environment given in amsthm so that

  1. There is a space after the word "proof"
  2. The qed symbol is inserted a little bit after end of the proof, rather than flushed right.
  3. The word "proof" is printed in bold rather than italic.

Number 3 has been asked before, and I've accomplished it via the code

\let\oldproofname=\proofname
\renewcommand{\proofname}{\rm\bf{\oldproofname}}

Number 2 I'm happy to manually type in the command every time, by turning off the old qed symbol and making a new one via

\renewcommand{\qedsymbol}{}
\newcommand{\qd}{\,\, \raisebox{-2pt}{\scalebox{2}{$\square$}}}

but I'm sure there's a much better way than this.

Number 1 I don't know how to accomplish.

I like everything else about the proof environment, and I'd like to preserve it.

One possibility: If I knew the defaults of the proof environment I could do \renewenvironment and keep it mostly the same, but where do I find these, and an explanation of what each one means?

Best Answer

Here are the changes you need (but I didn't change \qedhere, it would require much more work).

\documentclass{article}
\usepackage{amsthm}

\makeatletter
\renewenvironment{proof}[1][\proofname]{\par
  \pushQED{\qed}%
  \normalfont \topsep6\p@\@plus6\p@\relax
  \trivlist
  \item[%
    \hskip\labelsep
    \normalfont\bfseries % was \itshape
    #1%
    \@addpunct{.}% remove this if you don't want punctuation
  ]\ignorespaces
}{%
  \popQED\endtrivlist\@endpefalse
}
\let\qed\relax % avoid a warning
\DeclareRobustCommand{\qed}{%
  \ifmmode \mathqed
  \else
    \leavevmode\unskip\penalty\@M\hbox{}\nobreak\hspace{.5em minus .1em}% was \hfill
    \hbox{\qedsymbol}%
  \fi
}
\makeatother

\begin{document}

\begin{proof}
This proof ends here.
\end{proof}

\begin{proof}
This proof is quite longer
quite longer
quite longer
quite longer
quite longer
quite longer
quite longer
quite longer
quite longer
quite longer
quite longer
quite longer
quite longer
quite longer
quite longer
quite longer
longerrrrr.
\end{proof}

\noindent\textbf{Proof.}
This proof is quite longer
quite longer
quite longer
quite longer
quite longer
quite longer
quite longer
quite longer
quite longer
quite longer
quite longer
quite longer
quite longer
quite longer
quite longer
quite longer
longerrrrr.


\end{document}

enter image description here

The final paragraph is to show how the QED does not end up in a line by itself. The minus .1em bit is to give small flexibility in tough situations.

Related Question