# Change only the ending with renewenvironment

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}

-
I've added a MWE. –  Christopher Aden May 23 '12 at 0:29

You can change just the end environment via:

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


Here is a before and after:

## 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}

-
Works like a charm. Thanks, Peter! –  Christopher Aden May 23 '12 at 0:30