# Two equation numbers within one set of brackets

The following outputs two equations side-by-side, with the equation number after each equation:

\begin{minipage}{.5\linewidth}
$$x = y$$
\end{minipage}%
\begin{minipage}{.5\linewidth}
$$y = z$$
\end{minipage}


I would like to see if it looks better if the two equations stay in the same position, but with the (1) removed and the (2) becoming (1, 2) to reflect the numbers of both equations (in an assumed respective order). Is this possible?

I have searched but have only found questions asking if it is possible to only have one equation number for two equations. I want something similar to this, but displaying both equation numbers and only one set of brackets.

-
how automated should this be? The simplest is the manual \tag{1,2}. – percusse Mar 2 '13 at 20:54
This is part of a document with about 100 equations, and the order is liable to change, so if possible it'd be ideal if it take its number from the equation counter. – dplanet Mar 2 '13 at 21:04

I hope you are not doing this very often, because that's not a good bookkeeping of equations.

\documentclass{article}
\usepackage{amsmath}

\begin{document}\noindent
From a distance real numbers are all the same
$$\pi = 3$$
$$e = 3$$
Then,
$$\stepcounter{equation} \cos(x)=\cot(x)\quad\implies s(x)=t(x)\tag{\theequation,\number\numexpr\theequation+1\relax}$$
\stepcounter{equation}
since some mathematical pompous statement,
$$\int x=\sum y$$
\end{document}


-
Thanks, but what do you mean when you say it's not good bookkeeping - in terms of "nobody does it like that" or in terms of LaTeX getting mixed up? – dplanet Mar 2 '13 at 21:37
@dplanet In terms of referring to them and also in terms of back-tracking one might search for formula 4 if it appears on an isolated page. – percusse Mar 2 '13 at 21:41
Okay may try a different strategy. Thanks. – dplanet Mar 2 '13 at 21:53

The following is mildly different from percusses' answer, but allows the user to reference each equation separately if needed:

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

\refstepcounter{equation}\label{eqn:first}%
\refstepcounter{equation}\label{eqn:second}%
$$f(x) = ax^2 + bx + c, \qquad g(x) = dx^2 + ex + f \tag{\ref{eqn:first},\,\ref{eqn:second}}$$
See \eqref{eqn:first} and \eqref{eqn:second}.

\end{document}


A hyperref-compatible version would require the use of \ref* within the \tag. The hyperlink will jump you to a location above the equation, since that's where the reference is marked. The following is a work-around to jump to the correct location and uses the original \label in the form of \ltx@label:

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

\makeatletter
\begin{equation*}
\refstepcounter{equation}\ltx@label{eqn:first}f(x) = ax^2 + bx + c, \qquad
\refstepcounter{equation}\ltx@label{eqn:second}g(x) = dx^2 + ex + f
\tag{\ref*{eqn:first},\,\ref*{eqn:second}}
\end{equation*}
\makeatother%
See \eqref{eqn:first} and \eqref{eqn:second}.

\end{document}

-