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 have a theorem environment I've made called "ex" (using the theoremstyle "definition"), which I use for examples in a book document class. I like that I can number the examples, but I want a proof symbol to occur at the end of every example.

I have something that looks like:

\newtheorem{ex}{Example}[section]  
\renewenvironment{ex}{}{\qed \\}

However, I want "Example 1.1.1" to show up when I call \begin{ex}. How do I change the environment so that there is no change to the beginning definition, but changes the ending definition to the qed symbol?

Here is a MWE:

\documentclass{book}
\usepackage{amssymb, amsmath, amsthm}
\newtheorem{ex}{Example}[chapter]
\begin{document}
\begin{ex}
This is my example
\end{ex}
\end{document}
share|improve this question
    
I've added a MWE. –  Christopher Aden May 23 '12 at 0:29

1 Answer 1

up vote 10 down vote accepted

You can change just the end environment via:

\let\Oldendex\endex%
\def\endex{\qed\Oldendex}%

Here is a before and after:

enter image description here enter image description here

Code:

\documentclass{book}
\usepackage{amssymb, amsmath, amsthm}

\newtheorem{ex}{Example}[chapter]

\let\Oldendex\endex%
\def\endex{\qed\Oldendex}%

\begin{document}
\begin{ex}
This is my example
\end{ex}
\end{document}
share|improve this answer
    
Works like a charm. Thanks, Peter! –  Christopher Aden May 23 '12 at 0:30

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.