Skip to content

Instantly share code, notes, and snippets.

What would you like to do?
% \rlap{\hbox to#1{\hfil\llap{\ensuremath{#2}}}}}
\leavevmode\unskip\penalty9999 \hbox{}\nobreak\hfill
\newtheorem{XxmpX}{Example} % \newtheorem establishes the object heading
\newenvironment{example} % this is the environment name for the input
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).
This is now proved by
a + b = c \qedhere
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.
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.
If the proper definitions have been established, the end-of-line marker
is added automatically when the environment ends with ordinary text.
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 \]
Similarly if the object ends with a list.
\item First.
\item Second. \qedhere
With \verb+\qedhere+, a \textsc{qed} box is positioned on the common
baseline of a multi-line expression such as a case statement:
x + y = \begin{cases}
-1 & \text{if } x < 2,\\
0 & \text{if } x = 2,\\
1 & \text{if } x > 2.\end{cases}\qedhere
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}
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.
%% based on

This comment has been minimized.

Copy link
Owner Author

wchargin commented Oct 14, 2016

Copied verbatim from 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.