# How to align an equation reference (1) to the right

I have a centred equation and I'd like to place a (1) on the same line as the equation, but aligned to the right, so that I can refer back to the equation in future. What I have at the moment is:

\center  $\begin{pmatrix} e & \frac{f}{2} \\ \frac{f}{5} & g \end{pmatrix} = L^T % \begin{pmatrix} a & b \\ c & d \end{pmatrix} L$ \flushright' (1)

-
I recommend reading chapter 3 of The Not So Short Introduction to LaTeX. – Ian Thompson Jan 6 '12 at 17:23

\documentclass{article}
\usepackage{amsmath}
\begin{document}

\begin{align} \label{foo}
\begin{pmatrix} e & \frac{f}{2} \\ \frac{f}{5} & g \end{pmatrix}
&= L^T   \begin{pmatrix} a & b \\ c & d \end{pmatrix} L
\end{align}

See Eqn~\ref{foo}
\end{document}

-
Why align instead of equation? – egreg Jan 6 '12 at 21:20
why not? and it is not a good idea when you change my code in a way that it did not work! – Herbert Jan 6 '12 at 21:30
align gives different spacing than equation and the latter is surely preferable for single line equations. Of course the & before the = serves no purpose in a single line equation. I believe that simplicity is better. – egreg Jan 6 '12 at 21:36
sure, if I want the spacing of equation then I'd used it ... – Herbert Jan 6 '12 at 21:39

What is wrong with

$$\label{eq:1} \begin{pmatrix} e & \frac{f}{2} \\ \frac{f}{5} & g \end{pmatrix} = L^T \begin{pmatrix} a & b \\ c & d \end{pmatrix} L$$


then use \eqref{eq:1} (assuming amsmath)

-