4

I use the amsbook document class and I would like to show \qed symbols at the end of statements without proofs (using the theorem environment, such as theorem, proposition, lemma, ...) to indicate that these are known but I do not present a proof.

Is there a simple (or even predefined way) of doing so, such as using

\begin{mytheorem}{\qed}
...
\end{mytheorem}

for any theorem environment mytheorem without doing

\newtheorem{mytheorem}[theorem]{Theorem}
\newtheorem{mytheoremqed}[theorem]{Theorem}
\AtEndEnvironment{mytheoremqed}{\null\hfill\qedsymbol}
... % repeat for proposition, lemma, corollary, ...

for every theorem environment I have (this solution was described in \qed for theorems without proofs) ?

Preferrably, also both versions

\begin{mytheorem}[{\cite{myref}}]

and

\begin{mytheorem}{\qed}[{\cite{myref}}]

should work.

  • Why not the simpler solution by Marco Daniel? That is, adding \qed at the end of the statement. It is the only good answer to the question you link to. – egreg Oct 14 '16 at 8:38
  • Because I prefer to handle situations uniformly instead of taking care of them individually. First, I could remove them all simultaneously when I (or the journal) decide to do so (okay, I could do so as well using a \myqed). Second, I could properly adjust where to show them. Third, I can much easier search for those statements I have which I do not prove. – Christian Oct 14 '16 at 8:43
  • Well, it's not a big deal, and I guess I could also do this individually as you suggest. – Christian Oct 14 '16 at 8:44
  • So, just to be clear, you'd like to have \begin{mytheorem}{} for theorems with a proof and \begin{mytheorem}{\qed} for those without one? – egreg Oct 14 '16 at 8:46
  • I'd prefer to use the to-often-used-to-change \begin{mytheorem} and a new \begin{mytheorem}{\qed}. Added additional preferred property to question. – Christian Oct 14 '16 at 8:52
5

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}

enter image description here

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.

enter image description here

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.

  • Many thanks for your effort, and for presenting a negative example for \null\hfill\qedsymbol! I like the star version the most. But what I do not like about it, though, is that I have to repeat the same lines for for every environment (e.g., proposition and proposition*, lemma and lemma*, and so on). Do you see any way to avoid this code duplication? – Christian Oct 14 '16 at 9:25
  • @ChristianStump I added an “abstraction layer”. – egreg Oct 14 '16 at 9:39
  • Great, I will start playing with it -- thanks again! – Christian Oct 14 '16 at 9:41

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.