[Tex/LaTex] Problem with gather and labels

amsmath

This gives a way of combining two different math environments (so there is no extra vertical skip):

Adjusting vertical skip between equations

But add labels to that exsample

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

\begin{gather}
  \begin{split}
    1 + 1 = 2\\
    1 * 2 * 3 * 4 * 5 * 6 * 7 = 7!
  \end{split}\\
  \begin{align}
    7 + 5 &= 12\label{a}\\
    12 &= 11 + 1\label{b}
  \end{align}
\end{gather}

\end{document}

and a problem occurs:

! Package amsmath Error: Multiple \label's: label 'a' will be lost.

What to do?

Best Answer

Use aligned, together with the trick in the previous answer:

\documentclass{article}
\usepackage{amsmath}

\begin{document}

\begin{align}
\multispan{2}\hfill$
  {\begin{aligned}
   & 1 + 1 = 2\\
   & 1 * 2 * 3 * 4 * 5 * 6 * 7 = 7!
  \end{aligned}}
  $\hfill \label{A} \\
  7 + 5 &= 12+1-1+1-1+1-1+1-1 \label{B} \\
     12 &= 11 + 1 \label{C}
\end{align}
Equations \eqref{A}, \eqref{B} and \eqref{C}

\end{document}

enter image description here