Equation numbers do not align to rightmost in beamer

After a bit of messing around, the issue seems to be a bad \label placement.

               \end{bmatrix} \\
&=
\label{eq:4} %<----
             \begin{bmatrix}

Note that the marked label is after &=, the whatsit probably ends up confusing the math spacing. Moving the \label up as the first thing on this line, removes the problem.

The solution is to start or end the row with \label, don't add it the middle of the formula. For the sniplet above use

               \end{bmatrix} \\
\label{eq:4} %<----
&=
             \begin{bmatrix}

I have no idea why this causes the equation numbers to be placed misaligned.


I think the problem is caused by the bmatrix environment. Use {\begin{bmatrix}...\end{bmatrix}}! Try this code:

\documentclass{beamer}
\begin{document}
\begin{frame}
  \texttt{align} environment:
\begin{align}
  {\begin{bmatrix}
    x\\y\\z
  \end{bmatrix}}&=
                 {\begin{bmatrix}
                   1&&\\&2&\\&&3
                 \end{bmatrix}}
                 {\begin{bmatrix}
                   1\\2\\3
                 \end{bmatrix}}\label{eq:1}\\
  &=
                 {\begin{bmatrix}
                   1&&\\&2&\\&&3
                 \end{bmatrix}}
                 {\begin{bmatrix}
                   d\\e\\f
                 \end{bmatrix}}\label{eq:2}\\
  a&=b\label{eq:3}
\end{align}
\texttt{equation} environment:
\begin{equation}\label{eq:4}
  a^{2}+b^{2}=c^{2}
\end{equation}
\end{frame}
\end{document}

enter image description here