I use this code to define a symbol that I put at end of (maths) examples in my file.

\leavevmode\unskip\penalty9999 \hbox{}\nobreak\hfill

And I use it like follows:

\begin{defn}The spectrum is:
\sigma(T) = \{ \lambda : (T-\lambda I)^{-1} \text{ does not exist} \}.

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.

2 Answers 2


Look at packages amsthm and ntheorem that provide answers for this. For example the former package defines a proof environment and the \qedhere command just suitable for your needs.

With these packages the procedure for defining theorems uses also the concept of "theorem style":

% default style
\newtheorem{thm}{Theorem} % defines a "thm" counter; 
\newtheorem{cor}[thm]{Corollary} % numbering in common with thm
  • Thanks. With ntheorem, how do I make it so the theorems, defns, lemmas, etc. number successively? Eg, I want: 1.1.1 Theorem, then 1.1.2 Defn, not 1.1.1 Theorem, then 1.1.1 Defn.
    – P.A
    Commented May 11, 2011 at 19:45
  • @P.A.: I'll add it in the answer.
    – egreg
    Commented May 11, 2011 at 20:12
  • I already have that, but that produces: 1 Thm, 2 Eg, 3 Thm, 4 Defn etc. I want the section numbers: 1.1.1 Thm, 1.1.2 Eg, 1.1.3 Thm, 1.2.1 Defn for example. Adding \numberwithin{equation}{section} doesn't seem to change it. I appreciate your help.
    – P.A
    Commented May 11, 2011 at 20:18
  • @P.A. This is basic LaTeX: define the first environment by \newtheorem{thm}{Theorem}[section]
    – egreg
    Commented May 11, 2011 at 20:27

I made two defs:



and I use the first one at hte text-end-of-proof and the second at the formula-end-of-proof.

It works much better, but is not perfect.

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .