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
?
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
?
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.
\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.
– Martin Scharrer
May 22 '13 at 06:44
\paragraph{Proof:}} with \textbf{Proof:} solved the problem.
– ntc2
Jan 28 '14 at 04:46
\vspace{-\baselineskip} before or after \hfill? (untested)
– Martin Scharrer
Apr 11 '17 at 10:20
\square requires package amssymb to be included.
– user118967
Jan 17 '23 at 18:06
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.
amsthm's proof has the (known) flaw of introducing too much space when the proof directly starts with an enumerate or itemize environment.
– Marius Hofert
Apr 26 '14 at 18:55
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}
\def\QEDmark{\ensuremath{\square}}
\def\proof{\paragraph{Proof:}}
\def\endproof{\hfill\QEDmark}
\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.
– Charles Stewart
Feb 02 '11 at 23:58
\box, ok ... I sometimes I think to complicated.
– Martin Scharrer
Feb 03 '11 at 00:20
\ensuremath, but cf. http://tex.stackexchange.com/questions/34830/when-not-to-use-ensuremath-for-math-macro
– Charles Stewart
May 22 '13 at 07:22
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.
This is a solution using the ntheorem package. Here some explanations:
amssymb is loaded to use \blacksquarentheorem 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
amsmath. – Juan A. Navarro Feb 03 '11 at 07:25amsthmor thentheorempackage. – Carsten Thiel Feb 03 '11 at 08:34