[Tex/LaTex] Pushing \qed to the right within a displayed formula

math-modetheorems

In my own custom theorem environment, I'm using the \qed command to create a white box. This works wonderfully when the theorem ends with a regular paragraph — the box is pushed to the right where it should be.

Note that I just type out the \qed manually whenever I need it. It works fine. I don't need it automated.

However, if I use this command when the theorem ends with displayed mathmode, the box is just put there right beside the formula — it is not pushed to the right. How can I accomplish that?

Best Answer

If the QED symbol (or tombstone) is needed only rarely, I suggest to use the \qedhere feature provided by amsthm.

\documentclass{article}
\usepackage{amsthm}

\newtheorem{thm}{Theorem}
\begin{document}

\begin{thm}
Some text some text some text some text some text some text some text some text some text
some text some text some text some text some text some text\qed
\end{thm}

\begin{thm}
Some text some text some text some text some text some text some text some text some text
some text some text some text some text some text some text
\[
\pushQED{\qed} 
a=b\qedhere
\popQED
\]     
\end{thm}     

\end{document}

enter image description here