Denoting the end of example/remark
Try the following indirect method (requires amsthm):
\newtheorem{examplex}{Example}
\newenvironment{example}
{\pushQED{\qed}\renewcommand{\qedsymbol}{$\triangle$}\examplex}
{\popQED\endexamplex}
In this way also \qedhere
works exactly like in proof
.
Full example.
\documentclass{article}
\usepackage{amsmath,amsthm}
\theoremstyle{definition}
\newtheorem{examplex}{Example}
\newenvironment{example}
{\pushQED{\qed}\renewcommand{\qedsymbol}{$\triangle$}\examplex}
{\popQED\endexamplex}
\begin{document}
\begin{example}
This has only text.
\end{example}
\begin{example}
This has also a display at the end:
\begin{align*}
f(x) &= \bigl( g(x) \bigr) \\
h(x) &= \bigl( r(x) \bigr).\qedhere
\end{align*}
\end{example}
\end{document}
I think this is totally a matter of personal style. If you are using \qed
already you could use a similar symbol like \triangle
.
Whatever you do, don't just use \hfil$\triangle$
because this does not work when your example fills the last line completely. Here is a definition of \demo
that uses the flexible \xqed
:
\documentclass{minimal}
\usepackage[utf8]{inputenc}
\newcommand\xqed[1]{%
\leavevmode\unskip\penalty9999 \hbox{}\nobreak\hfill
\quad\hbox{#1}}
\newcommand\demo{\xqed{$\triangle$}}
\begin{document}
Lorem ipsum dolor sit amet, consectetur adipisicing elit, sed do eiusmod
tempor incididunt ut labore et dolore magna aliqua. Ut enim ad minim veniam.
\demo
\end{document}
The manfnt
font also provides a filled triangle pointing to the right. After declaring \font\manual=manfnt
you can use \manual\char'170
.
The very useful thmtools
package has a key for defining the qed-symbol. For example, I use the following in my documents:
\usepackage{amsthm,thmtools}
\theoremstyle{remark}
\declaretheorem[name=Example,qed={\lower-0.3ex\hbox{$◃$}}]{Ex}
...
\begin{Ex}
The numbers 2, 3 and 5 are all prime.
\end{Ex}
(I use unicode-math
to be able to use the ◃ symbol directly. Just replace it by whatever symbol you like, e.g. \triangleleft
.)
Everything is set up correctly so that you can use \qedhere
like in a standard amsthm
proof environment.