# [texhax] On \qed macros

Steve Schwartz s.schwartz at imperial.ac.uk
Wed Jan 2 17:54:02 CET 2008

On Wed, 2008-01-02 at 10:19 -0500, Barbara Beeton wrote:
> it's really a rather nasty problem to get
> something that's both robust and works in
> all possible situations.
>
> i think no one has mentioned that this is
> built in to the amsthm package,
....snip...
>  the code is pretty nasty, but
> comments in amsclass.dtx (from which amsthm
> and the documentclasses are generated) are

Thanks Barabar. You've now nearly scared me off this task completely.
But I've learned in the process that what I tried to do using \eqno
works in TeX-style display math $$...$$ but throws a bad math delimiter
error with  and a "you can't use \eqno in math mode" :-) in
$$...$$ constructs [it's the equation
numbering implicit \eqno that throws this - because the first \eqno has
changed the mode to a non-display math mode]. Interestingly, pressing s
to ignore the errors and press on yields the desired results, with latex
doing what it needs to fix things. As predicted, with ordinary equation
numbers the result is not great, as my marks and the equation number are
typeset one after the other, but using leqno yields (apart from the
error message) exactly what is desired. (including pushing my marks to
the next line if the equation is too long).

So here's my "final" version:

\newcommand{\qmarks}[1]{\ifmmode \eqno \hbox{[#1~qmarks]} \else

This, combined with leqno, covers everything I need, with the nuisance
of throwing errors.

So, is there a way for me to trap the errors myself and ignore them? I
realise this is (a) very bad style (b) probably taboo (c) unaesthetic.
But the real programmers and the hackers live side-by-side in harmony
most of the time.

Warm wishes,
Steve

--
+-------------------------------------------------------------------+
Professor Steven J Schwartz      Phone: +44-(0)20-7594-7660
Space and Atmospheric Physics    Fax:   +44-(0)20-7594-7772
The Blackett Laboratory          E-mail: s.schwartz at imperial.ac.uk
Imperial College London          Office: Huxley 6M70
London SW7 2BW, U.K.             Web: http://www.sp.ph.ic.ac.uk/~sjs
+-------------------------------------------------------------------+