28

How would I define a proof environment that is basically used with

\begin{proof}
some proof here
\end{proof}

and it would be equivalent to:

\paragraph{Proof:} some proof here
\hfill \box

?

2
  • You probably want to add a “qed” box at the end of a proof. For this, it is enough to load a package such as amsmath. Feb 3, 2011 at 7:25
  • 11
    Environments for proofs, theorems etc. are provided by either the amsthm or the ntheorem package. Feb 3, 2011 at 8:34

6 Answers 6

24

With LaTeX syntax:

\newenvironment{proof}{\paragraph{Proof:}}{\hfill$\square$}

I assume here that you mean \hbox{} not \box in your code. The \null macro is short for \hbox{}. The \box is a TeX primitive and is more like \usebox.

8
  • 3
    this "box" at the end is quite invisible. and if the proof ends with a display or a list, there's an extra blank line. May 21, 2013 at 21:29
  • @barbarabeeton: It was not my original intension to draw a real box there because I took the \box macro of the OP with it's normal TeX meaning ;-) I modified the answer now to draw a real box. I don't have a quick fix for blank line issue. IMHO Someone should post an answer based on amsthm or a similar package. May 22, 2013 at 6:44
  • This solution gave me an extra blank line at the beginning. Replacing \paragraph{Proof:}} with \textbf{Proof:} solved the problem.
    – ntc2
    Jan 28, 2014 at 4:46
  • 1
    @martin The square at the end is carried to the next line if in math display mode. Is there a workaround for that?
    – blackened
    Mar 31, 2017 at 16:59
  • 1
    Beware! This fails to guarantee correct positioning of the QED symbol.
    – egreg
    Feb 8, 2023 at 21:18
16

You can also use the amsthm package which is a really nice and quick way of creating a proof.

Implementation

\documentclass{article}
\usepackage{amsthm}

\begin{document}
\begin{proof}
    Your proof here.
\end{proof}

\end{document}

It will add Proof in italics at the beginning of the text given as argument and a white square (Q.E.D. symbol) at the end of it.

I found this easy solution at 1. You can also look up there how you define your own environments using this package.

1
  • 1
    amsthm's proof has the (known) flaw of introducing too much space when the proof directly starts with an enumerate or itemize environment. Apr 26, 2014 at 18:55
3

A small extension due to the case that the proofs are in the section "Proofs:"

\documentclass[11pt]{amsart}
\newtheorem{pro}{Proposition}[section]
\newtheorem{theo}[pro]{Theorem}

\newenvironment{myproof}[2] {\paragraph{Proof of {#1} {#2} :}}{\hfill$\square$}
\begin{document}
\begin{theo} \label{theo}
Hello
\end{theo}

\begin{myproof}{Theorem}{\ref{theo}}
This is the proof
\end{myproof}
\end{document}
1
  • 2
    Beware! This fails to guarantee correct positioning of the QED symbol.
    – egreg
    Feb 8, 2023 at 21:19
2
\def\QEDmark{\ensuremath{\square}}
\def\proof{\paragraph{Proof:}}
\def\endproof{\hfill\QEDmark}
6
  • this one seems to be giving an error about \begin{document} missing whenever I try to use \begin{proof} \end{proof}
    – kloop
    Feb 2, 2011 at 23:46
  • @kloop: I think it's the problem Martin pointed out - \box is a Tex primitive that looks ahead for the box number, and I guess then will eat the closing parenthesis. I've changed the code. Feb 2, 2011 at 23:58
  • Aaahhh, he meant to draw a box using \box, ok ... I sometimes I think to complicated. Feb 3, 2011 at 0:20
  • The \square should be enclosed in $ signs: \def\QEDmark{$\square$}.
    – user31011
    May 21, 2013 at 3:10
  • 2
    Beware! This fails to guarantee correct positioning of the QED symbol.
    – egreg
    Feb 8, 2023 at 21:19
2

I use ams package and changed a predefined "proof" environment in the following way and it works for me in LaTeX:

\renewenvironment{proof}{{\bf \emph{Proof.} }}{\hfill $\Box$ \\} 

It changes the "proof" word to an italic bold "Proof.", adds a white QED. mark at the end of the last line of the proof, and creates a line space from whatever comes after the proof.

2
1

This is a solution using the ntheorem package. Here some explanations:

  • amssymb is loaded to use \blacksquare
  • The package ntheorem is loaded using the option thmmarks to support the placement of endmarks.
  • \theoremheaderfont{\bfseries} sets the theorem title in bold.
  • \theorembodyfont{\normalfont} preserves the normal text font for the theorem content.
  • \theoremseparator{:} set : to be the separator between title and content.
  • \theoremsymbol{$\blacksquare$} will place a solid black square at the end of every theorem environment.
  • \newtheorem*{proof}{Proof} sets up a new unnumbered environment named proof with the default title "Proof".

Afterwards you can use \begin{proof} ... \end{proof} just like any other environment.

Implementation

\documentclass{article}
\usepackage{amssymb}
\usepackage[thmmarks]{ntheorem}
\theoremheaderfont{\bfseries}
\theorembodyfont{\normalfont}
\theoremseparator{:}
\theoremsymbol{$\blacksquare$}
\newtheorem*{proof}{Proof}
\begin{document}
\begin{proof}
    We immediately see, that
    \[ 1 + 1 = 2. \]
    Thus the proof is done.
\end{proof}
\end{document}

Output

image

4
  • the box won't be there if the proof ends with a display or a list. regarding ending with a display, that's not great style; better to finish off with text as in this example. but a list might be harder to avoid. May 21, 2013 at 21:23
  • Actually in some case the box will be there when ending with a dislay (although the order of appearance seems very random to me). Nevertheless I agree with you on the style issue. May 21, 2013 at 21:37
  • The claimed output is not the one I get when i compile the given code.
    – anderstood
    Oct 7, 2014 at 15:57
  • OK I see: the figure is wrapped in a SE environment...
    – anderstood
    Oct 7, 2014 at 15:58

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .