[Tex/LaTex] Aligning equal signs in equations

amsmathequationsmath-mode

Up to now, I use the align environment. As I want to give each equation a specific reference number, I want to use the equation environment. So I tried this, which works for align:

\begin{equation}
x &=2 \\
&=1+1
\end{equation}

But this throws errors. Why doesn't it work?

Of course, I've searched for similar questions but there was no question out there, that handles specific this issue. (It was always very complex code; no minimal example)

Best Answer

OK, the answer is trivial and has already been given in the comments, but since you insist on asking for a minimal working example (boldfaced :-), here it is:

\documentclass[a4paper]{article}
\usepackage{amsmath}

\begin{document}
Text before the equation.
\begin{equation}
    \begin{split}
        x &= 2 \\
          &= 1+1
    \end{split}
    \label{eq:x=2=1+1}
\end{equation}
Text after equation~\eqref{eq:x=2=1+1}, with a reference to the equation itself.
\end{document}