[Tex/LaTex] Misplaced QED symbol with \qedhere inside align* environment

amsthm

I have an align* environment finishing a proof. The environment has three columns. I tried to place the QED symbol using \qedhere, but the symbol collides with the right column. Is this a bug, or should I proceed in an other way? Any hint toward a solution?

\documentclass{article}
\usepackage{amsmath}
\usepackage{amsthm}

\begin{document}

\begin{proof}
The $\qedsymbol$ is misplaced.
\begin{align*}
A &= B\\
  &= C & = D\qedhere
\end{align*}
\end{proof}

\end{document}

Example of misplaced qed symbol

I have Texlive 2016, amsmath 2016/03/10 v2.15b and amsthm 2015/03/04 v2.20.2.

Best Answer

It's undoubtedly a bug in amsthm; I checked with all TeX Live versions from 2012 on and it's exactly the same.

Workaround: add & somewhere in the affected line: for instance

\documentclass{article}
\usepackage{amsmath}
\usepackage{amsthm}

\begin{document}

\begin{proof}
The $\qedsymbol$ is misplaced.
\begin{align*}
A &= B \\
  &= C && = D\qedhere
\end{align*}
\end{proof}

\end{document}

enter image description here

Depending on what the column is for you might need

  &= C & = D & \qedhere

(this will provide right alignment for the =D part).