TeX - LaTeX Stack Exchange is a question and answer site for users of TeX, LaTeX, ConTeXt, and related typesetting systems. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

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.

share|improve this question
See this or this or this question. – Marco Nov 7 '11 at 19:09
up vote 17 down vote accepted

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.

share|improve this answer
Link appears dead. – wchargin Jul 18 '15 at 3:33

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:

enter image description here



Lorem ipsum \QEDA

Lorem ipsum \QEDB

share|improve this answer

Sometimes it is usefull to create a minimal example:

Text Text Text \qed
share|improve this answer

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>}.

enter image description here

\usepackage{amsthm}% http://ctan.org/pkg/amsthm
\usepackage{etoolbox}% http://ctan.org/pkg/etoolbox
This is an important theorem.

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.
share|improve this answer
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:

\begin{theorem}Foo is a bar.\eolqed
share|improve this answer
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.

share|improve this answer
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

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.