[Tex/LaTex] Including end mark in definitions and examples (using amsthm)

amsthmtheorems

I am using the amsthm package, and I have this in the preamble:

\theoremstyle{definition}
\newtheorem{definition}{Definition}[chapter]
\newtheorem{example}[definition]{Example}

\theoremstyle{plain}
\newtheorem{theorem}[definition]{Theorem}
\newtheorem{lemma}[definition]{Lemma}

(I use only one counter for all environments — this is intentional)

Now, I'd like the example environment to actually have an end mark similar to proofs (but with a different symbol). (Maybe also for the definition environment)

The \newtheoremstyle command from amsthm doesn't seem to help.

Is there some easy way to do this, or should I just define new LaTeX environments (with \newenvironment?

Best Answer

You can use the thmtools package as a front-end to amsthm; adding the end marks is then an easy matter:

\documentclass{book}
\usepackage{amssymb}
\usepackage{amsthm}
\usepackage{thmtools}

\declaretheorem[style=definition,qed=$\blacksquare$,numberwithin=chapter]{definition}
\declaretheorem[style=definition,qed=$\blacktriangle$,sibling=definition]{example}

\declaretheorem[style=plain,sibling=definition]{theorem}
\declaretheorem[style=plain,sibling=definition]{lemma}

\begin{document}

\chapter{Test Chapter}
\begin{definition}
Test
\end{definition}

\begin{example}
Test
\end{example}

\end{document}

enter image description here