5

It seems there is an issue within the ams packages, which results in an incompatibility between the fleqn option, and the \qedhere command.

If those are used together, the qed symbol is flushed to the left of the equation, instead of the right.

In the ams revision history, I see a line about a bugfix with "fleqn/qedhere" issues, which is about amscls version 2.02, while I'm using amsclass (and thus amsthm) version 2.20. I have no idea if the bug they fixed is the same I'm experiencing, though.

MWE:

\documentclass{article}

\usepackage{amsthm}
\usepackage[fleqn]{amsmath}

\begin{document}
This is a statement.
\begin{proof}
  This is the equation settling it all:
  \begin{equation}
    1 + 1 = 3 \qedhere
  \end{equation}
\end{proof}
\end{document}

Enclosing the \qedhere in a \mbox{}, as suggested in amsthm's manual, doesn't produce the wanted output either (the qed is one quad right of the equation).

I'm sure there exists plenty of complicated solutions to this problem, however I'd like to avoid them if possible. More precisely, if I could fix it without changing anything out of my preamble, it would be great.

I have hope, because it seems google can't give me anything relevant to that problem, but I don't believe I'm the only one with it. So I might be missing something obvious.

Thanks in advance

2
  • It's surely a bug; but I'd avoid ending a proof with a numbered display. Unfortunately, the placement is wrong also with equation*. :(
    – egreg
    Sep 20, 2012 at 9:57
  • I'm actually using the mathtools package to number only the equations I need. Even if I will never need this one, it spares the hassle of deciding each time whether the equation should or shouldn't be numbered.
    – T. Verron
    Sep 20, 2012 at 11:12

2 Answers 2

2

A better solution is to use the ntheorem package:

\documentclass{article}

\usepackage{amssymb}
\newcommand{\qedsymbol}{$\Box$}
\usepackage[fleqn]{amsmath}
\usepackage[amsmath,amsthm,thmmarks]{ntheorem}

\begin{document}
This is a statement.  Make it long enough that the right margin is clearly delimited.
\begin{proof}
  Use an explicit tag to get the qed box:
  \begin{equation*}
    1 + 1 = 3
  \end{equation*}
  \let\qed\relax
\end{proof}
\end{document}

This produces:

enter image description here

1
  • Nice! The \let\qed\relax line doesn't appear to be necessary. It also works for numbered equations (in which case the qed appears under the equation number), which is undoubtedly ugly. However, surprisingly, with mathtool's showonlyrefs, it works for equation* but not for equation (the qed doesn't appear at all).
    – T. Verron
    Aug 8, 2014 at 17:02
7

this definitely is a (known) bug in amsmath. and it's worse than you may realize -- when the qed box is set with \qedhere, fleqn and an equation number, the equation number protrudes into the right-hand margin.

here's a workaround if you are using fleqn and want an end-of-proof box on an equation without an equation number that ends a proof:

\documentclass{article}

\usepackage{amssymb}
\newcommand{\qedsymbol}{$\Box$}
\usepackage{amsthm}
\usepackage[fleqn]{amsmath}

\begin{document}
This is a statement.  Make it long enough that the right margin is clearly delimited.
\begin{proof}
  Use an explicit tag to get the qed box:
  \begin{equation*}
    1 + 1 = 3 \tag*{\qedsymbol}
  \end{equation*}
  \let\qed\relax
\end{proof}
\end{document}

do observe the distinction between \qedsymbol and \qed; if only the \qedsymbol is made to disappear, an extra blank line will be inserted after the display to hold the now-invisible box.

there are several other known problems with fleqn, and all are on the list to be looked at and corrected the next time the code is opened up for an overhaul.

1
  • Thank you for that answer! It does indeed work, but I'd rather avoid the use of this \let... line at each equation. An alternative would be to use a custom proof environment, but that wouldn't seem natural either.
    – T. Verron
    Sep 25, 2012 at 17:47

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .