[Tex/LaTex] Two labels on the same equation line

cross-referencingequationsnumbering

I would like to have a compact set of two equations on the same line, each one labeled, with both labels on the far right.
The code would be something like:

\documentclass{article}
\usepackage{amsmath}
\begin{document}
We have
\begin{equation}
a = b \label{eqab} \quad \text{and} \quad c = d \label{eqcd}
\end{equation}
and equations \ref{eqab} and \ref{eqcd} are nice.
\end{document}

(the positions of the labels within the source line would not matter),
and would appear something like:

We have\vspace{3ex}

\hfill $a=b \quad \text{and} \quad c=d$ \hfill (1) and (2)\vspace{3ex}

and equations (1) and (2) are nice.

But putting two \label on the same line results in a `Package amsmath Error:

Multiple \label...` (the same for `\tag`).

Best Answer

Maybe you looking for something like this:

enter image description here

\documentclass{article}
\usepackage{amsmath}

\usepackage[a4paper,showframe]{geometry}

\begin{document}
We have:

    \noindent\begin{minipage}{0.4\textwidth}
\begin{equation}
a = b \label{eqab}
\end{equation} 
    \end{minipage}%
    \begin{minipage}{0.2\textwidth}\centering
    and 
    \end{minipage}%
    \begin{minipage}{0.4\textwidth}
\begin{equation}
c = d \label{eqcd}
\end{equation}
    \end{minipage}\vskip1em

Equations \ref{eqab} and \ref{eqcd} are nice. The same is valid for the next two:

\begin{subequations}\label{eq:3}
    \noindent\begin{minipage}{0.4\textwidth}
\begin{equation}
a = b \label{eq:3a}
\end{equation}
    \end{minipage}%
    \begin{minipage}{0.2\textwidth}\centering
    and
    \end{minipage}%
    \begin{minipage}{0.4\textwidth}
\begin{equation}
c = d \label{eq:3b}
\end{equation}
    \end{minipage}\vskip1em
\end{subequations}

which are  \ref{eq:3a} and \ref{eq:3b}.
    \end{document}