placement of QED symbol on numbered equation line

This question is both on LaTeX and on mathematics writing style; I hope that's still apropriate here.

I have a proof that ends with a (right) numbered equation, and I'm pondering about where to put the QED symbol. The standard right margin position conflicts with the equation number, so what would be considered best style for the QED placement?

Secondly, I use the ntheorem package, but cannot place the QED symbol using \qedhere on this equation line. Is there a (simple) way to solve this?

-
If equation numbers are on the right, I'd suggest never ending a proof with an equation as there's no sensible placement for the QED symbol. –  egreg Nov 2 '11 at 14:15
Have you checked out the question "End of theorem marker placement" (tex.stackexchange.com/questions/3799/…) and the answers that were provided? Also, have you tried loading the ntheorem package with the options amsmath and thmmarks -- as in \usepackage[amsmath,thmmarks]{ntheorem} -- to enable the automatic placement of end-of-theorem marks (and to improve compatibility with amsmath)? –  Mico Nov 2 '11 at 14:19
@Mico: Thanks for that link, but I don't see a solution there. I'm loading ntheorem with options including these. If I use an unnumbered equation, then the QED symbol is placed fine, with and without an explicit \qedhere. –  eldering Nov 2 '11 at 15:37
@eldering: Would you be able to provide an MWE that shows your current set up? Perhaps for a theorem with and without an ending equation. –  Werner Nov 3 '11 at 5:25
@Werner: see MWE in edited answer below. Note that my question is about the proof environment. –  eldering Nov 3 '11 at 13:34

I have the following two suggestions:

1. Reword your proof. Even if you merely state the obvious:

...
x^n + y^n = z^n
which completes the proof.


or

Proof. It follows trivially that for
x^n + y^n = z^n
there exist no solutions.

2. Place the QED symbol manually next to the equation and correct for horizontal alignment with \phantom or use \rlap. Hopefully this is not something that has to be done frequently.

\documentclass[a4paper,11pt]{article}

\usepackage{amsmath,amssymb}
\usepackage[thmmarks,amsmath,amsthm,hyperref]{ntheorem}

\newtheorem{theorem}{Theorem}[section]
\begin{document}

\begin{proof}
foo.
\end{proof}

\begin{proof}
It follows trivially that no solutions exist for
\begin{equation*}\label{eq:fermat1}
x^n + y^n = z^n.
\refstepcounter{equation}
\tag*{(\theequation)}
\end{equation*}
\end{proof}

\begin{proof}
It follows trivially that no solutions exist for
$$\label{eq:fermat2} x^n + y^n = z^n. \rlap{\qquad \Box}$$
\end{proof}

\end{document}

-
You can use \rlap{\qquad\qedsymbol} instead of \phantom on the other side. –  egreg Nov 3 '11 at 14:13
Ahhh, yes. Much simpler, thanks! –  Werner Nov 3 '11 at 14:16
Thanks: this confirms my ideas for possible solutions. The \rlap placement of the QED symbol is neat. –  eldering Nov 4 '11 at 20:56

The following (somewhat dirty) solution seems to work:

\documentclass[a4paper,11pt]{article}

\usepackage{amsmath}
\usepackage[thmmarks,amsmath,amsthm,hyperref]{ntheorem}

\newtheorem{theorem}{Theorem}[section]

\begin{document}

\begin{proof}
foo.
\end{proof}

\begin{proof}
It follows trivially that no solutions exist for
\begin{equation*}\label{eq:fermat}
x^n + y^n = z^n.
\refstepcounter{equation}
\tag*{(\theequation)}
\end{equation*}
\end{proof}

\end{document}


It places the QED symbol right below the equation number, which is not as ugly as I had thought it would be.

I must acknowledge @egreg's comment, though, that it is not perfect from a stylistic point of view.

Edit: Now a full MWE, and I noticed that I had defined

\newcommand{\qedhere}{}


for backward compatibility with amsmath because ntheorem automatically places the QED symbol.

-
Please post fully compilable examples including \documentclass and all the packages required, as opposed to code snippets. –  Peter Grill Nov 2 '11 at 16:19