# Denoting the end of example/remark

What is the etiquette to denote the end of an example or remark? For proofs, it's the QED symbol (white box). I know it's not necessary for everyone, but I would like to use it to break up the text a little. What should I use? A circle or filled box or what?

• Why not the same QED symbol? – Emre Apr 23 '11 at 16:18
• I already use it for proofs so I don't want to use it for anything else. – P.A Apr 24 '11 at 10:33

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
\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.

• Thanks, I'll try it out and get back. Maybe I'll use a different shape than a triangle though. – P.A Apr 24 '11 at 9:17
• The triangle pointing the right looks as though it is a link to somewhere else. What specifically is it supposed to denote? – brannerchinese Apr 24 '11 at 9:34
• @brannerchinese I had no specific meaning in mind, it is just one of the lesser known symbols in the standard fonts. I agree that it suggests a continuation and as such is not appropriate for denoting the end of a section. – Christian Lindig Apr 24 '11 at 9:49
• If I have an equation as the last line in my example, unfortunately the character appears a few lines before my last line. Is there a way to change that? I tried putting the \demo before the end of equation, but that makes the symbol not align properly. – P.A Apr 24 '11 at 11:01
• @P.A It works for me so you need to provide an example that does not work. – Christian Lindig Apr 24 '11 at 12:13

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}


• Seems there's a couple of syntax problems here. (Feel free to remove this comment when fixed.) – badroit Jul 17 '12 at 16:35
• @AndrewSwann That could be an alternative way. – egreg Nov 21 '17 at 14:19
• @AndrewSwann That is an awesome solution, but there is a small typo: \AtBeginEnvironment{#1 should be \AtBeginEnvironment{#1} -> the final brace is missing ;-) – wmnorth Nov 29 '18 at 21:59
• @wmnorth Yes thanks - unfortunately I can no longer edit my comment. – Andrew Swann Nov 30 '18 at 7:38

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.

Maybe you’ll like to use the {leftbar}-environment?

\documentclass{minimal}
\usepackage{framed}
\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.
\begin{leftbar}
Lorem ipsum dolor sit amet, consectetur adipisicing elit, sed do eiusmod
tempor incididunt ut labore et dolore magna aliqua. Ut enim ad minim veniam.
Lorem ipsum dolor sit amet, consectetur adipisicing elit, sed do eiusmod
tempor incididunt ut labore et dolore magna aliqua. Ut enim ad minim veniam.
\end{leftbar}
Lorem ipsum dolor sit amet, consectetur adipisicing elit, sed do eiusmod
tempor incididunt ut labore et dolore magna aliqua. Ut enim ad minim veniam.
\end{document}


If you like it I can show an extended example with a colored bar, no indention of first line an support for floating objects in the environment.

Use \qed right before \end{example} :

\newtheorem{example}[definition]{Example}
.
.
.
\begin{example}
5+6=11
\qed
\end{example}

• I believe the downvotes are because the OP specifically stated that \qed was not sufficient for this purpose. – musarithmia Jan 19 '15 at 19:57
• @AndrewCashner: Yes, probably, but it's not necessary to downvote even more (whoever did it ;-) – user31729 Jan 19 '15 at 20:08
• @ChristianHupfer Wasn't me. +1 to restore balance and welcome a new user. – musarithmia Jan 19 '15 at 20:10
• @AndrewCashner: I did not suspect you at all ... – user31729 Jan 19 '15 at 22:19