Take the 2-minute tour ×
TeX - LaTeX Stack Exchange is a question and answer site for users of TeX, LaTeX, ConTeXt, and related typesetting systems. It's 100% free, no registration required.

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.

share|improve this question

2 Answers 2

up vote 6 down vote accepted

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
\theoremstyle{definition}
\newtheorem{defin}[thm]{Definition}
share|improve this answer
    
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 May 11 '11 at 19:45
    
@P.A.: I'll add it in the answer. –  egreg May 11 '11 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 May 11 '11 at 20:18
    
@P.A. This is basic LaTeX: define the first environment by \newtheorem{thm}{Theorem}[section] –  egreg May 11 '11 at 20:27
    
THANK YOU! You're a lifesaver. –  P.A May 11 '11 at 20:33

I made two defs:

\def\qeds{\qed\par\medskip}

\def\qedsf{\vskip-6mm\qeds}

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.

share|improve this answer

Your Answer

 
discard

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.