Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
\documentclass{amsart}
\usepackage{amssymb}
\usepackage{verbatim}
\nofiles
%\newcommand{\xqedhere}[2]{%
% \rlap{\hbox to#1{\hfil\llap{\ensuremath{#2}}}}}
\newcommand{\xqed}[1]{%
\leavevmode\unskip\penalty9999 \hbox{}\nobreak\hfill
\quad\hbox{\ensuremath{#1}}}
\theoremstyle{remark}
\newtheorem{XxmpX}{Example} % \newtheorem establishes the object heading
\newenvironment{example} % this is the environment name for the input
{\renewcommand{\qedsymbol}{$\lozenge$}%
\pushQED{\qed}\begin{XxmpX}}
{\popQED\end{XxmpX}}
\begin{document}
A symbol like the \textsc{qed} box for a proof is sometimes applied to
other theorem-class objects. For example, a lozenge ($\lozenge$) might
be used to mark the end of a remark or example, so that there is no
confusion if it ends at a page break. AMS document classes and the
\texttt{amsthm} package do not support such use. The technique
described here can be used to remedy that gap, without the need for
such tactics as measuring the space left on the last line of a display,
as was formerly the case.
When a proof ends with a list or display math, \verb+\qedhere+ can be
applied to set the \textsc{qed} box in the proper location, i.e., flush
right on the last line. A two-stage definition can be made to cater for
the theorem-class objects; if more than one such object is to be served,
a separate pair of definitions must be made for each one. See the code
for details.
The methods shown here work best when display labels are at the left
margin (the default for AMS document classes).
\begin{proof}
This is now proved by
\begin{equation*}
a + b = c \qedhere
\end{equation*}
\end{proof}
Sometimes an end marker is wanted outside of a proof or theorem-class
object. In that situation, \verb+\qed+ works at the end of a text line.
\qed
A slight redefinition of \verb+\qed+ --- \verb+\xqed+ --- can be made
to accept any symbol to be placed at the end of a line of text.
\xqed{\blacktriangle}
\begin{example}
If the proper definitions have been established, the end-of-line marker
is added automatically when the environment ends with ordinary text.
\end{example}
\begin{example}
If the theorem-class object ends with a one-line display, \verb+\qedhere+
adds the assigned symbol as it does for a proof.
\[ c + d = e \qedhere \]
\end{example}
\begin{example}
Similarly if the object ends with a list.
\begin{enumerate}
\item First.
\item Second. \qedhere
\end{enumerate}
\end{example}
\begin{example}
With \verb+\qedhere+, a \textsc{qed} box is positioned on the common
baseline of a multi-line expression such as a case statement:
\begin{equation*}
x + y = \begin{cases}
-1 & \text{if } x < 2,\\
0 & \text{if } x = 2,\\
1 & \text{if } x > 2.\end{cases}\qedhere
\end{equation*}
\end{example}
\begin{example}
Insert \verb+\par \vspace{-1.7\baselineskip}+ between the display and
\verb+\qedhere+ to reposition. (Vertical spacing may need adjustment.)
\[
x + y = \begin{cases}
-1 & \text{if } x < 2,\\
0 & \text{if } x = 2,\\
1 & \text{if } x > 2.\end{cases}
\]
\par \vspace{-1.7\baselineskip}
\qedhere
\end{example}
The negative \verb+\vspace+ approach will even work if applied at the
end of a non-floating \verb+tabular+ environment.
This \TeX{}nique was developed by Enrico Gregorio, whom we thank.
\vspace{4\baselineskip}
\verbatiminput{\jobname.tex}
\end{document}
%% based on http://tex.stackexchange.com/a/292371
@wchargin

This comment has been minimized.

Copy link
Owner Author

wchargin commented Oct 14, 2016

Copied verbatim from ftp://ftp.ams.org/pub/author-info/documentation/howto/extra-qed.tex. I claim no credit and am simply rehosting over HTTP, not FTP.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.