# Marking the end of a definition

I'm using the amsthm package to define a definition environment as follows:

\theoremstyle{definition}
\newtheorem{definition}{Definition}


To my surprise, this provides barely any typographic indication of where the definition ends and the following text begins (there's a new paragraph, but this is clearly not enough, especially when the definition ends with an equation).

What can I do to make this more clear? I don't want the definition text to be in a different font than normal text. Maybe a definition, like a proof, should end with a \qedsymbol - how can I add this?

• In books, definitions often are a separate paragraph and they can also be italicized. For clarity, you can add a certain symbol at the end or put the definition in a box or give it a coloured background. – Karlo Feb 11 '16 at 14:15
• – Karlo Feb 11 '16 at 14:15
• Some mathematical books use different end symbols to mark the end of definitions, proofs and examples. – Karlo Feb 11 '16 at 14:16
• @MWijnand The answer to the question you referenced basically denies the problem. "There's no need for other visual clues." I'm reminded that there is a problem again and again when reading my text, where definitions may end with equations, so that it is not clear whether the following text still belongs to the definition. – clstaudt Feb 11 '16 at 14:19
• @MWijnand An end symbol would be great - how can I achieve that? – clstaudt Feb 11 '16 at 14:20

The amsthm isn't the best on its own; however, thmtools provides a really neat 'front-end' for amsthm and other theorem packages.

In particular, thmtools includes a prefoothook and postfoothook which can be used for your need. Below is a small use case of thmtools in conjunction with amsthm which finishes examples with a simple horizontal line. You can easily adapt this to your need. For example, you could combine this with the tcolorbox for really fancy boxes, or you could flush right the text "End of Example".

\documentclass{article}
\usepackage{amsmath}
\usepackage{amsthm}
\usepackage{thmtools}
\usepackage{lipsum}

\declaretheoremstyle[
numbered=unless unique,
bodyfont=\normalfont,
spaceabove=1em plus 0.75em minus 0.25em,
prefoothook=\newline\rule{\linewidth}{1pt},
spacebelow=1em plus 0.75em minus 0.25em,
]{exmpstyle}

\declaretheorem[
style=exmpstyle,
title=Example,
refname={example,examples},
Refname={Example,Examples}
]{exmp}

\begin{document}
Lorem ipsum dolor sit amet, consectetuer adipiscing elit. Ut pustibulum ut,
placerat ac, adipiscing vitae, felis. Curabitur dictum uris. Nam arcu libero,
nonummy eget, consectetuer id, vulputate a, nec vehicula augue eu
neque. Pellentesque habitant morbi tristique t netus et malesuada fames ac
turpis egestas. Mauris ut leo.
\begin{exmp}
\lipsum*[1]
\end{exmp}
\lipsum[2-3]
\begin{exmp}
\lipsum*[4]
\end{exmp}
\end{document}


and the output:

As mentioned by Caramdir and requested by Barbara Beeton in the comments, here is an example that works with equations and uses the qed option:

\documentclass{article}
\usepackage{amsmath}
\usepackage{amsthm}
\usepackage{thmtools}
\usepackage{lipsum}

\declaretheoremstyle[
numbered=unless unique,
bodyfont=\normalfont,
spaceabove=1em plus 0.75em minus 0.25em,
spacebelow=1em plus 0.75em minus 0.25em,
qed={\itshape That's All Folks!},
]{exmpstyle2}

\declaretheorem[
style=exmpstyle2,
title=Example,
refname={example,examples},
Refname={Example,Examples}
]{exmp2}

\begin{document}
Lorem ipsum dolor sit amet, consectetuer adipiscing elit. Ut pustibulum ut,
placerat ac, adipiscing vitae, felis. Curabitur dictum uris. Nam arcu libero,
nonummy eget, consectetuer id, vulputate a, nec vehicula augue eu
neque. Pellentesque habitant morbi tristique t netus et malesuada fames ac
turpis egestas. Mauris ut leo.
\begin{exmp2}
\lipsum*[1]
\end{exmp2}
\lipsum[2-3]
\begin{exmp2}
\lipsum*[4]
\begin{equation*}
\mathcal{L} = \overline \psi (i \gamma \cdot \partial - m) \psi
\qedhere
\end{equation*}
\end{exmp2}
\end{document}


which produces:

• If you just want a symbol (or some text) at the end, then the qed option is an easier alternative to prefoothook. – Caramdir Feb 11 '16 at 23:26
• one of the requests was for something that works when the theorem-class object ends with an equation. please illustrate that. – barbara beeton Feb 12 '16 at 16:52
• @barbarabeeton, I have added an example that uses the qed option (thanks Caramdir! I nearly forgot about that) and illustrate how it interacts with equations. – JP-Ellis Feb 13 '16 at 1:53

I really can't see the need for it. But since you're asking,

\documentclass{article}
\usepackage{amsthm}

\usepackage{lipsum}

\theoremstyle{definition}
\newtheorem{defi/}{Definition}

\newenvironment{defi}
{\renewcommand{\qedsymbol}{$\heartsuit$}%
\pushQED{\qed}\begin{defi/}}
{\popQED\end{defi/}}

\begin{document}

\lipsum[2]

\begin{defi}
This is the definition of \emph{definition}.
\end{defi}

\lipsum[3]

\begin{defi}
This is the definition of recursion,
$x\gets x+1 \qedhere$
\end{defi}

\lipsum[2]

\end{document}


I just assume you don't have proofs in the middle of definitions.

• there is a real need for this! it's been on our radar for years! but the best approach we'd found when the object ends with an equation is a real hack, involving explicit measurement of the remaining space available. i'm going to give this a thorough workout, and add it to our bag of tricks if it really works. – barbara beeton Feb 12 '16 at 17:47
• @barbarabeeton if it really works? ;-) – egreg Feb 12 '16 at 17:48
• i'm not expecting that it won't, but i have to be absolutely convinced that it works everywhere where our authors have requested the facility before i can recommend and publicize it. don't worry, i'll let you know. – barbara beeton Feb 12 '16 at 17:49
• @barbarabeeton It won't work if there's a proof inside the defi environment, of course. One might define a new stack for this, but it doesn't seem so crucial. – egreg Feb 12 '16 at 17:51
• To my knowledge, the ntheorem package to date is the only package that tackles the problem of QED markers being placed automatically - also in the case the definition-like environment ends with a math construct. The empheq package provides some additional automatic support for this, see §3.2 of it's documentation. Not perfect, I know. The fundamental problem is really about migrating the typesetting instruction back up the document tree. – Morten Høgholm Feb 15 '16 at 16:50

You can define another environment (eg. myproof) to use another QED symbol. In the example below, the new QED symbol \myqed is a vertical bar.

\documentclass{report}
\usepackage{amsthm}
\usepackage{lipsum}

\newcommand{\myqed}{\rule{2pt}{1em}}
\newenvironment{myproof}{\begin{proof}}{\let\qedsymbol\myqed\end{proof}}

\begin{document}
\begin{proof}
\lipsum*[1]
\end{proof}

\begin{myproof}
\lipsum*[2]
\end{myproof}

\begin{proof}
\lipsum*[3]
\end{proof}

\end{document}


• the question wasn't about a proof, but about a theorem-class object. with amsthm, these don't behave in the same way as proofs. but if you just want to change the symbol, the easiest method is \renewcommand{\qedsymbol}{<whatever}) which can be done locally on a case-by-case basis.. – barbara beeton Feb 12 '16 at 16:55
• @barbarabeeton, yes, you are right. I noticed later that proof is not good. – Sigur Feb 12 '16 at 16:57

One solution is to indent (by a given amount) the whole proof and play a little bit with the fontsize. You can consider the following redefinition of the proof environment:

\makeatletter
\renewenvironment{proof}[1][\proofname]{\par
\pushQED{\qed}%
\normalfont\small\topsep6\p@\@plus6\p@\relax
%\trivlist %%%% old
\list{}{\leftmargin=\parindent
\rightmargin=0pt
\settowidth{\itemindent}{\itshape#1}%
\labelwidth=\itemindent}
}{%
\popQED
%\endtrivlist %%OLD
\endlist %%NEW
\@endpefalse
}
\makeatother

• the question wasn't about a proof, but about a theorem-class object. with amsthm, these don't behave in the same way as proofs. – barbara beeton Feb 12 '16 at 16:54
• @barbarabeeton yes you are right. I'm not sure why I focused on the proof environment. – pluton Feb 12 '16 at 16:56

The thmbox package provides a nice way to display theorem-like environments.

For instance, using the three pre-defined styles, you can have:

\documentclass{article}
\usepackage{mathtools}
\usepackage{thmbox} % Overrides \newtheorem command! See [nothm] to disable this feature.
\usepackage{lipsum} % Useless, just for the demo.

\newtheorem[S, bodystyle=\normalfont\noindent]{defiS}{Definition}[section]
\newtheorem[M]{defiM}{Definition}[section]
\newtheorem[L]{defiL}{Definition}[section]

\begin{document}

\section{My nice demo}

\begin{defiS}[Inverse of a relation]
Let $$R$$ be a relation, \emph{the inverse of $$R$$} is
$R^{-1} = \{(x,y) \mid (y, x) \in R\}$
\end{defiS}

\lipsum[2] % Just for the demo

\begin{defiM}[Union]
Let $$R$$ and $$S$$ be relations, the \emph{union of $$R$$ and $$S$$} is defined as
$R \cup S = \{(x, y) \mid (x,y) \in R \text{ or } (x,y) \in S\}$
\end{defiM}

\lipsum[1] % Just for the demo

\begin{defiL}[Graph of a function]
Let $$f$$ be a fuction, the \emph{graph of $$f$$}  is
$\langle f \rangle = \{(x, y) \mid f x = y\}$
\end{defiL}

\end{document}


• I set the font to normalfont (i.e., not slanted) only for the first example (environment defiS),
• The numbering is 1.1 in the three cases because I used three different environments (i.e. defiS, defiM and defiL), but if you stick to one environment, the numbers will be correct (i.e. 1.1, 1.2, 1.3, etc.).