15

I'm trying to expand the amsmath package to get two different proof environments:

  • \begin{proof} ... \end{proof} and
  • \begin{proof*} ... \end{proof*}

so proof* should act exactly like proof except of the QED Symbol. proof should provide be a blacksquare while proof* provides the normal square.

I found

\let\proof*\proof

and

\renewcommand{\qedsymbol}{$\blacksquare$}

in some questions but this changes every QED symbol. Any advice?

egreg
  • 1,121,712
Frank
  • 501
  • 2
    Not an answer/advice: \let\proof*\proof is wrong, it will let \proof be * and then use \proof which is equal to *. In case you want to copy something like that (for some reason), with etoolbox you can \cslet{proof*}\proof. – Manuel Jul 18 '14 at 10:41
  • 1
    I think there's a seperate command for this. Consider thmtools, there's a good example that I found in the http://tex.stackexchange.com/a/35093/44160 (Show off your LaTeX skills), which uses gridenv for QED-symbols but other theorems without it. – 1010011010 Jul 18 '14 at 10:43
  • ok i used
    \usepackage{etoolbox} \cslet{proof*}\proof \renewenvironment{proof*}{{\qedsymbol}}{$\blacksquare$}
    but now proof* doesn't provide a linebreak behind the \blacksquare. so it doesn't act like proof :(
    – Frank Jul 18 '14 at 10:53
  • Add in a \par after the last dollar sign? :D – 1010011010 Jul 18 '14 at 11:00
  • \cslet{proof*}\proof doesn't work at all :/ – Frank Jul 18 '14 at 11:04
  • Another option is to hook your environment (automatic version, this is the manual version), by basically renewing \qedsymbol several times through your document, e.g.: \let\bs{\renewcommand\qedsymbol{$\blacksquare$}}\relax\let\ns{\renewcommand\qedsymbol{\rule[1pt]{5pt}{5pt}}\relax or something, I'm not sure what the sign is for the regular QED symbol. – 1010011010 Jul 18 '14 at 11:06
  • @Frank don't attempt to \let your way out of defining proof*, it is much better to just define the proof* env. – daleif Jul 18 '14 at 11:14
  • 2
    @ Frank I did not meant you to do so, just explained that it didn't do what you expected (although I don't see a reason to do so, as seen in the answers, it's not needed). @1010011010 What is that? \let\bs{… wil let \bs to be exactly {. \let command only picks the first two tokens, no a group {…} – Manuel Jul 18 '14 at 11:15
  • @Manuel Thanks for spotting the mistake. I suppose \newcommand will do the trick then. – 1010011010 Jul 18 '14 at 11:36

4 Answers4

14

Here is a direct solution just using the AMS packages. We set up a new environment myproof, which is proof but containing a redefinition of the \qedsymbol.

Sample output

\documentclass{article}

\usepackage{amsthm,amsmath,amssymb}

\newcommand*{\myproofname}{My proof}
\newenvironment{myproof}[1][\myproofname]{\begin{proof}[#1]\renewcommand*{\qedsymbol}{\(\blacksquare\)}}{\end{proof}}

\begin{document}

\begin{proof}
  Usual proof.
\end{proof}

\begin{myproof}
  New proof style.
\end{myproof}

\begin{proof}[Short]
  Standard proof
  \begin{equation*}
    a = b. \qedhere
  \end{equation*}
\end{proof}

\begin{myproof}[Short new style]
  New proof style
  \begin{equation*}
    a = b. \qedhere
  \end{equation*}
\end{myproof}

\end{document}
Andrew Swann
  • 95,762
8

I also tend to use ntheorem as Bernard show. Just wanted to add how I'd do this with amsthm:

\documentclass[a4paper]{memoir}
\usepackage{amsthm}

\newenvironment{proof*}[1][\proofname]{
  \renewcommand\qedsymbol{\rule{3mm}{3mm}}
  \begin{proof}[#1]}{\end{proof}}

\begin{document}

\begin{proof}
  sfadf
\end{proof}

\begin{proof}[Proof of ...]
  sfadf
\end{proof}


\begin{proof*}
  asdfsf
\end{proof*}

\begin{proof*}[Proof of ...]
  sfadf
\end{proof*}



\end{document}
daleif
  • 54,450
  • 1
    You don't need etoolbox or \ifblank if you use \newenvironment{proof*}[1][\proofname]{…} you just pass #1 to \begin{proof}[#1] and it automatically works. – Manuel Jul 18 '14 at 11:22
  • @Manuel, your're right, updated – daleif Jul 18 '14 at 11:33
7

This is quite easy with the ntheorem package. Moreover, it manages correctly the placement of end-of-proof symbols when the proof ends in a displayed equation. I added the cleveref package to show how it manages reference types (if the cited theorem were to become a proposition, for instance, its reference would be changed accordingly):

\documentclass{article}
\usepackage[utf8]{inputenc}
\usepackage[T1]{fontenc}

 \usepackage{amsmath}
\usepackage[thmmarks, amsmath, thref]{ntheorem}
\usepackage{cleveref}

\theoremstyle{plain}
\theoremheaderfont{\bfseries}
\theoremseparator{.}
\theorembodyfont{\itshape}
\newtheorem{theorem}{Theorem}

\theoremstyle{nonumberplain}
\theoremheaderfont{\scshape}
\theorembodyfont{\upshape}
\theoremsymbol{\ensuremath{\square}}
\newtheorem{proof}{Proof}

\theoremsymbol{\ensuremath{\blacksquare}}
\newtheorem{blackproof}{Proof}
\begin{document}

\begin{theorem}[Some theorem]\label{thm:some-theorem}
This is an important theorem.
\end{theorem}

\begin{proof}
This is a very important proof.
\end{proof}

\begin{proof}[of \cref{thm:some-theorem}]
This is a very important proof.
\end{proof}

\begin{blackproof}[of \cref{thm:some-theorem}]
This is a very important proof.
\begin{align*}
    a & = b\\ c & = d.
\end{align*}
\end{blackproof}

\end{document} 

enter image description here

Bernard
  • 271,350
  • You add a lot of packages to most of your answers, although it's not wrong, I think it's not desired. Since you remove some clarity on the answer, and new users may not know which package does what and just copy all of them to their “never ending template”. – Manuel Jul 18 '14 at 11:18
  • @Manuel: Sorry, I simply slighly modified an old file, and forgot to remove fonts loading. I'll delete it at once ( but leave the image as is, I think it's unimportant). – Bernard Jul 18 '14 at 11:23
  • No need to “sorry”, I was just pointing that out because it was my opinion. I like your fourierised answers, by the way :) – Manuel Jul 18 '14 at 11:26
4

Here's a solution with thmtools

\documentclass{article}
\usepackage{amsthm,amssymb,thmtools}

\declaretheoremstyle[
  spaceabove=6pt plus 6pt,
  spacebelow=6pt plus 6pt,
  headfont=\itshape,
  bodyfont=\normalfont,
  postheadspace={ },
  qed=\protect\thisproofqed,
]{proof}

\declaretheorem[
  name=\protect\thisproofname,
  style=proof,
  numbered=no,
]{gproof}

\newcommand\thisproofname{}
\newcommand\thisproofqed{}

\renewenvironment{proof}[1][\proofname]
  {\renewcommand\thisproofname{#1}%
   \renewcommand\thisproofqed{$\blacksquare$}%
   \gproof}
  {\endgproof}

\newenvironment{proof*}[1][\proofname]
  {\renewcommand\thisproofname{#1}%
   \renewcommand\thisproofqed{\openbox}%
   \gproof}
  {\endgproof}


\begin{document}

A starred proof follows.

\begin{proof*}
Something.
\end{proof*}

An unstarred proof follows.

\begin{proof}
Something.
\end{proof}

A starred proof follows.

\begin{proof*}
Something.
\end{proof*}

Let's see if we can nest them.

\begin{proof*}
Something depending on a lemma.
\begin{proof}[Proof of the lemma]
Wow!
\end{proof}
The end.
\end{proof*}

\end{document}

The advantage is of not using ntheorem and so being able to use \qedhere as provided by amsthm.

enter image description here

egreg
  • 1,121,712