I use this code to define a symbol that I put at end of (maths) examples in my file.
\newcommand\xqed[1]{%
\leavevmode\unskip\penalty9999 \hbox{}\nobreak\hfill
\quad\hbox{#1}}
\newcommand\demo{\xqed{$\bigcirc$}}
And I use it like follows:
\begin{defn}The spectrum is:
\begin{equation*}
\sigma(T) = \{ \lambda : (T-\lambda I)^{-1} \text{ does not exist} \}.
\end{equation*}
\demo
\end{defn}
Which looks like this:

I want the circle symbol on the same line as the equation. How do I do that? If I put the \demo on the line before the \end{equation*}, it looks even worse; it's pretty much only two spaces to the right of the equation.
\newtheorem{thm}{Theorem}[section]– egreg May 11 '11 at 20:27