Labels in aligned environment

I need to use the aligned environment to nicely format an equation but I am unable to set a label and a number to one of the equations. How could I achieve this?

\begin{align}
\begin{aligned}
&&  \text{MSD}  &= 4D \cdot t                  \nonumber \\
&\Rightarrow    &\frac{\text{MSD}}{t}   &= 4D  \label{eq:diffusion}
\end{aligned}
\end{align}


Many thanks in advance!

• why have you got aligned there? As it is you just have a single one-line equation in the align, with no alignment points specified. – David Carlisle Dec 13 '16 at 15:59
• @DavidCarlisle Without the aligned, I am unable to get this alignment with the \Rightarrow – Sam Dec 13 '16 at 16:01
• but if you use aligned then you should just use equation outside not align as there is no alignment outside that block – David Carlisle Dec 13 '16 at 16:09

2 Answers

There is no need for alignat unless you need more than one point of alignment (without spaces). In your case, it suffices to use align:

\documentclass{article}

\usepackage{amsmath}

\begin{document}

\begin{align}
\text{MSD} &= 4D \cdot t    \nonumber \\
\Rightarrow \quad \frac{\text{MSD}}{t} &= 4D \label{eq:diffusion}
\end{align}

\end{document}

• yes I used align initially but tried to get the arrow without explicit space so switched to alignat but ended up using \quad anyway. I think I'll leave my answer in place but you should probably get the tick:-) – David Carlisle Dec 13 '16 at 17:12

If I understand correctly I think you want something like

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

alignat
\begin{alignat}{2}
&&\text{MSD}  &= 4D \cdot t                  \nonumber \\
\Rightarrow \quad &&\frac{\text{MSD}}{t}  &= 4D  \label{eq:diffusion}
\end{alignat}
\end{document}