First let me show an example where \null\hfill\qedsymbol
doesn't do the right thing. Note that adding \null\hfill\qedsymbol
explicitly is the same as doing it with \AtEndEnvironment
, with the only difference that the indirect method does not take care of a possible space before \null
, making things worse.
\documentclass{amsbook}
\usepackage{amsthm}
\newtheorem{theorem}{Theorem}
\begin{document}
\begin{theorem}
Some long theorem statement,
long long long long long
long long long long long
long long long long long
long long long long
enough to show bad effect.\null\hfill\qedsymbol
\end{theorem}
\end{document}
You have several better choices for this. The simpler, in my opinion, is to append \qed
at the end of statements you don't give a proof of.
\documentclass{amsbook}
\usepackage{amsthm}
\newtheorem{theorem}{Theorem}
\begin{document}
\begin{theorem}
Some long theorem statement,
long long long long long
long long long long long
long long long long long
long long long long
enough to show bad effect.\qed
\end{theorem}
\end{document}
Same text as before, but the tombstone ends up where desired.
A different approach would be to define a different environment, say a *
-variant:
\documentclass{amsbook}
\usepackage{amsthm}
\newtheorem{theorem}{Theorem}
\newenvironment{theorem*}
{\pushQED{\qed}\theorem}
{\popQED\endtheorem}
\begin{document}
\begin{theorem*}
Some long theorem statement,
long long long long long
long long long long long
long long long long long
long long long long
enough to show bad effect.
\end{theorem*}
\end{document}
This has the disadvantage of requiring the *
in both the \begin
and \end
part, but has some advantages: you don't need to change the input in case you decide for suppressing those tombstones; you can easily change the tombstone for these cases.
A third possibility could be defining theorem
as an environment with a mandatory argument, like
\begin{theorem}{}
...<statement>...
\end{theorem}
when you don't want a tombstone and
\begin{theorem}{\qed}
...<statement>...
\end{theorem}
It could be arranged so as to support
\begin{theorem}
...<statement>...
\end{theorem}
\begin{theorem}\qed
...<statement>...
\end{theorem}
with the following trick:
\documentclass{amsbook}
\usepackage{amsthm}
\newif\ifstumpqed
\newtheorem{theoremInner}{Theorem}
\newenvironment{theorem}[1]
{\ifx#1\qed\stumpqedtrue\pushQED{\qed}\fi\theoremInner}
{\ifstumpqed\popQED\fi\endtheoremInner}
\begin{document}
\begin{theorem}
Some long theorem statement,
long long long long long
long long long long long
long long long long long
long long long long
enough to show bad effect.
\end{theorem}
\begin{theorem}\qed
Some long theorem statement,
long long long long long
long long long long long
long long long long long
long long long long
enough to show bad effect.
\end{theorem}
\begin{theorem}\qed\label{whatever}
Some long theorem statement,
long long long long long
long long long long long
long long long long long
long long long long
enough to show bad effect.
\end{theorem}
\begin{theorem}\qed[Whatever]\label{foo}
Some long theorem statement,
long long long long long
long long long long long
long long long long long
long long long long
enough to show bad effect.
\end{theorem}
\end{document}
If you have several of these declarations to manage, you can abstract the procedure:
\documentclass{amsbook}
\usepackage{amsthm}
\newcommand{\addqed}[1]{%
\expandafter\let\csname #1Inner\expandafter\endcsname\csname #1\endcsname
\expandafter\let\csname end#1Inner\expandafter\endcsname\csname end#1\endcsname
\expandafter\def\csname #1\endcsname##1{%
\ifx##1\qed\stumpqedtrue\pushQED{\qed}\fi\csname #1Inner\endcsname
}%
\expandafter\def\csname end#1\endcsname{%
\ifstumpqed\popQED\fi\csname end#1Inner\endcsname
}%
}
\newif\ifstumpqed
\newtheorem{theorem}{Theorem}[chapter]
\addqed{theorem}
\begin{document}
\begin{theorem}
Some long theorem statement,
long long long long long
long long long long long
long long long long long
long long long long
enough to show bad effect.
\end{theorem}
\begin{theorem}\qed
Some long theorem statement,
long long long long long
long long long long long
long long long long long
long long long long
enough to show bad effect.
\end{theorem}
\begin{theorem}\qed\label{whatever}
Some long theorem statement,
long long long long long
long long long long long
long long long long long
long long long long
enough to show bad effect.
\end{theorem}
\begin{theorem}\qed[Whatever]\label{foo}
Some long theorem statement,
long long long long long
long long long long long
long long long long long
long long long long
enough to show bad effect.
\end{theorem}
\end{document}
So, after a \newtheorem
declaration with the usual methods, add
\addqed{<env name>}
and you're done.
In this particular case, in which you defined solution as a newtheorem
you can proceed as in section 2.1 of amsthm manual. One way is with \leavemode
command, but it has some problems explained in the manual.
\documentclass[a4paper]{article}
\usepackage{amsthm}
\newtheorem{ex}{Exercise}[subsection]
\newtheorem*{sol}{Solution}
\begin{document}
\renewcommand{\theenumi}{\alph{enumi}}
\renewcommand{\labelenumi}{\theenumi}
\begin{sol}
\leavevmode
\begin{enumerate}
\item First part
\item Second part
\end{enumerate}
\end{sol}
\end{document}
An alternative method is to define a theorem style to perform this breaks (also from the manual):
\newtheoremstyle{break}%
{}{}%
{\itshape}{}%
{\bfseries}{}% % Note that final punctuation is omitted.
{\newline}{}
Best Answer
I suggest to have a
theo
environment and atheo*
environment for theorems which don't need a proof. Using the tombstone for all theorem statements doesn't seem a good idea, because theorem statements, contrary to proofs, are well delimited.