4

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

\begin{minipage}{.5\linewidth}
\begin{equation}
 x = y
\end{equation}
\end{minipage}%
\begin{minipage}{.5\linewidth}
\begin{equation}
  y = z
\end{equation}
\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.

  • 1
    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
8

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
\begin{equation}
\pi = 3
\end{equation}
\begin{equation}
e = 3
\end{equation}
Then, 
\begin{equation}
\stepcounter{equation}
\cos(x)=\cot(x)\quad\implies s(x)=t(x)\tag{\theequation,\number\numexpr\theequation+1\relax}
\end{equation}
\stepcounter{equation}
since some mathematical pompous statement,
\begin{equation}
\int x=\sum y
\end{equation}
\end{document}

enter image description here

  • 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
  • Just to say sorry for this, I should have checked if an answer exists before reinventing the wheel.... (but honestly I didn't know that this question existed nor did I find it in my quick first search.) Anyway, that's just to say sorry. – user121799 Jun 9 '18 at 3:32
3

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

enter image description here

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

\refstepcounter{equation}\label{eqn:first}%
\refstepcounter{equation}\label{eqn:second}%
\begin{equation}
  f(x) = ax^2 + bx + c, \qquad 
  g(x) = dx^2 + ex + f 
  \tag{\ref{eqn:first},\,\ref{eqn:second}}
\end{equation}
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}

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.