# End of theorem marker placement

I have a question about marker placement after theorems. I am using a style file provided by Oxford University Press, which I am not used to. It is available here:

http://www.oxfordjournals.org/our_journals/imrn/for_authors/tex_template.zip

This style file wants to put an \openbox at the end of the statement of each theorem, and a \filledbox at the end of every proof.

If one concludes a proof with an equation, I know to use \qedhere to position the end of proof marker correctly. But I don't know how to do something similar in the above situation (after the statement of a theorem). Many of the thoerems, propositions etc. end with equations, and if I use the above style sheet the box is placed too low.

How do I fix this?

-
Did you try using the \qedhere command? If so, what are the results? –  Willie Wong Oct 5 '10 at 23:59
(Also, if you are submitting to IMRN, why not just let the publisher/copyeditor worry about it?) –  Willie Wong Oct 6 '10 at 0:00
I tried using \qedhere, but it puts a black box, rather than a white box, at the desired spot! You are right that I should just let the publisher deal with it, but it is really annoying me (and makes the document more difficult to read). –  geordie Oct 6 '10 at 8:44
I should also mention that when I use \qedhere the white box is replaced by the black box, so it is almost the right thing to do. –  geordie Oct 6 '10 at 8:44

You can redefine \qedsymbol just before using \qedhere as in:

\begin{proposition}
This is a funny equation
\begin{equation*}
a = b + c\,. \let\qedsymbol\openbox\qedhere
\end{equation*}
\end{proposition}


I don't know if it is possible, but you could maybe also suggest the people from the journal to fix their class file so that \qedhere works as expected?

-
thanks ... this works very nicely. Willie Wong's suggestion below also works, but the alignment is better with the above option. (That is, it is right aligned as it should be, not just next to the final equation etc.) –  geordie Oct 9 '10 at 23:08
this is all very well, but it only works if equation numbers are on the right side of the page. the ams document class default is for equation numbers on the left, so simply dropping the qed box into the equation number position doesn't work. that's why the definition of \qedhere in amsthm is so complicated. more comments on other answers. –  barbara beeton Jan 6 '11 at 17:52
@barbara, thanks for your comment! I've checked the link you posted below and indeed it looks very useful. If you could craft a short new answer pointing to the link and with a small example that would be great! –  Juan A. Navarro Jan 7 '11 at 11:37

Try this: in the math environment, put the \qedhere command inside of an \mbox, as in

$.... some numbers and equation. \mbox{\qedhere}$


it won't work completely correctly, but now the mark inserted is the openbox, and not the filled box. I think this is a bug with amsthm (see below the cut), so you'd be best off just leaving well-enough alone and let the journal deal with it later.

The oupau class apparently uses amsthm and not ntheorem for its theorem needs. And this is how it defines the open-box symbol for the QED in the theorem environment:

\providecommand{\qedsymbolthm}{\openbox}
\DeclareRobustCommand{\qedthm}{%
\ifmmode \mathqed
\else
\leavevmode\unskip\penalty9999 \hbox{}\nobreak\hfill
\fi
}
\def\@begintheorem#1#2[#3]{%
\@ifempty{#1}{\let\thmname\@gobble}{\let\thmname\@iden}%
\@ifempty{#2}{\let\thmnumber\@gobble}{\let\thmnumber\@iden}%
\@ifempty{#3}{\let\thmnote\@gobble}{\let\thmnote\@iden}%
\thmheadnl % possibly a newline.
}%
\ignorespaces}
\def\@endtheorem{\popQED\endtrivlist\@endpefalse }


I don't think the problem is actually with Oxford University Press! I think the problem lies in amsthm! See the definition there for \qedhere

\newcommand{\qedhere}{%
\begingroup \let\mathqed\math@qedhere
\let\qed@elt\setQED@elt \QED@stack\relax\relax \endgroup
}


and the definition for the proof environment

\providecommand{\qedsymbol}{\openbox}%
\newenvironment{proof}[1][\proofname]{\par
\pushQED{\qed}%
\normalfont \topsep6\p@\@plus6\p@\relax
\trivlist
\item[\hskip\labelsep
\itshape
}{%
\popQED\endtrivlist\@endpefalse
}


I'm thinking that the pushQED and popQED commands are defined just so they can accomodate different end symbols! The problem, apparently, lies in the definition of \qedhere, which calls \math@qedhere when it sits in a math environment. And unfortunately, instead of the definitions used in \setQED@elt (which is called in text mode), which process the current qed symbol that's in the QED stack, \math@qedhere depends on

\newcommand{\mathqed}{\quad\hbox{\qedsymbol}}
\def\linebox@qed{\hfil\hbox{\qedsymbol}\hfilneg}


which explictly references the \qedsymbol, which is defined to be the filled box in oupau.cls. So in short, the amsthm package, uses two different ways of accessing the QED symbol depending on whether the environment ends naturally (with \popQED) or if you insert the symbol using \qedhere inside a math environment. This, I think, is a bug.

-
It is a bit hard to say what should the “correct” behavior of internal (not documented) macros of amsthm. In their definitions \qedsymbol is used all over the place, not just in the definition of \qed so I'm not sure if they really intended the push/pop pair of commands to accomodate for different symbols. –  Juan A. Navarro Oct 8 '10 at 15:48
...which is why I'm glad you took a look also. I agree it is hard to figure out what the "intent" is. I am a bit surprised that OUP opted for hacking amsthm instead of ntheorem, which, IIRC, already has the same sets of defaults (open box for thms and filled box for proofs), and works better. –  Willie Wong Oct 8 '10 at 16:29
the documentation of the qed handling in amsthm is sketchy, but not entirely absent. see amsclass.pdf -- the source from which amsthm.sty was generated (amsclass.dtx) is identified at the top of that file. i have added a request to our "open" list to improve this documentation. –  barbara beeton Jan 6 '11 at 18:28
it was not originally recognized that "boxes" would be wanted at the end of anything other than proofs, but over the past year there have been numerous requests for this facility. a wholesale upgrade of this feature, including adding the ability to mark non-proofs, is on our to-do list. in the meantime, see this entry in the ams author faq: ams.org/faq?faq_id=212 . it contains a link to an example file that demonstrates various tactics that can be used with amsthm to get different symbols and put them in different locations. –  barbara beeton Jan 6 '11 at 18:37
@SamNead -- sadly, although there have been many requests to make it available also within theorem-class environments, the basic \qedhere works only in the proof environment. (this was a design decision.) it is likely that it will be extended, but certainly not for many months (the upgrade has been delayed many times for other priorities, and may be delayed again). until then, adjusting the spacing by hand is the only alternative i know of, and i've tried many things. –  barbara beeton Jan 9 '13 at 13:19
show 5 more comments