# \qed for theorems without proofs

It is common to place a \qed-Box at the end of a theorem statement (or lemma, corollary, ...) if we give no proof for that statement.

How can I do this in LaTeX? If I place a qed-box at the end of the statement there is an additional linebreak, which is inacceptable formating.

-
See this or this or this question. –  Marco Nov 7 '11 at 19:09

if you are using amsthm or an ams document class, this problem is addressed by an item in the ams author faq. this in turn links to an example document that covers quite a few of the possible situations in which such a marker could be wanted. the most extreme situations require some manual effort, but i believe that nearly all reasonable possibilities (including the non-proof ending with a display) are covered.

-
This is a good reference! –  Werner Nov 7 '11 at 19:28

With the theorem packages you would normally use \qed or \qedhere. Without those you use the commands below depending on if you want the filled square or empty:

\documentclass[border=2pt]{standalone}
\usepackage{amssymb}

\newcommand*{\QEDA}{\hfill\ensuremath{\blacksquare}}%
\newcommand*{\QEDB}{\hfill\ensuremath{\square}}%

\begin{document}
Lorem ipsum \QEDA

Lorem ipsum \QEDB

\end{document}

-

Sometimes it is usefull to create a minimal example:

\documentclass{article}
\usepackage{amsmath,amsthm}
\newtheorem{lem}{Lemma}
\usepackage{lipsum}
\begin{document}
\begin{lem}
Text Text Text \qed
\end{lem}
\end{document}

-

You could add the \qedsymbol to the end of your theorem automatically. The etoolbox package provides the means to tap into the end of an environment using \AtEndEnvironment{<env>}{<code>}. This adds <code> at \end{<env>}.

\documentclass{article}
\usepackage{amsthm}% http://ctan.org/pkg/amsthm
\usepackage{etoolbox}% http://ctan.org/pkg/etoolbox
\newtheorem{theorem}{Theorem}%
\AtEndEnvironment{theorem}{\null\hfill\qedsymbol}%
\begin{document}
\begin{theorem}
This is an important theorem.
\end{theorem}
\end{document}


However, this is only beneficial if you do not also include a \qedsymbol with your proofs. Moreover, it may cause undesired effects if you end your theorem with an equation. Regardless, you have some options:

• Define a non-proof-theorem environment which adds this automatically; or
• add it manually using some of the other answers provided; or
• provide (say) a starred version of theorem (that is, theorem*) which does the above.
-
Peter Grill gives a nice answer,it works! –  user16950 Jul 26 '12 at 8:44

To get the symbol used for typesetting the QED, use \qedsymbol:

\documentclass{minimal}
\usepackage{amsmath,amsthm}
\newtheorem{theorem}{Theorem}
\def\eolqed{\hspace{\stretch1}\ensuremath\qedsymbol}
\begin{document}
\begin{theorem}Foo is a bar.\eolqed
\end{theorem}
\end{document}

-
There is no need for \ensuremath here. –  Werner Nov 7 '11 at 19:20

Late to the party, but my answer is as follows:

To insert a QED symbol:

Case 1: Last line of text is to be centre-aligned:

\hfill <last line of code> \hfill $\square$


Case 2: Centre-alignement is not required:

<last line of code> \hfill $\square$


This works inside any environment and even if the last line is an equation, in which case you have to use $\displaystyle <equation>$ instead of 

Or if you like, use \lozenge instead of $\square$ to have a different QED symbol.

-
Might not be such a good idea, it does not disencourage a page break before the square and if the line is full, the hfill will probably die and the square ends up at the left margin instead of the right. Have a look at the \qed implementation in amsthm, we see a lot of the constructions like you present here, they are not to be encouraged. –  daleif Jan 30 '14 at 10:06
Ah point to be noted! Thank you. –  Host-website-on-iPage Jan 30 '14 at 10:08