3

My question is really similar to "How to place and number 3 short equations in one line?", except that I have more than one line of equations. So basically, I'd like to continue using {gather}, but having numbers on the side of each equation.

Is there a means to do that?

Below I showing what I would like to get. And of course, I'd like to get some light syntax :)

Thanks!

\documentclass{article}
\usepackage{amsmath}
\begin{document}
\begin{gather}
  x + 0 = x
  \qquad
  0 + x = x
  \qquad
  x + y = y + x
  \\
  x * 1 = x
  \qquad
  1 * x = x
\end{gather}

\begin{gather*}
  x + 0 = x\quad(1)
  \qquad
  0 + x = x\quad(2)
  \qquad
  x + y = y + x\quad(3)
  \\
  x * 1 = x\quad(4)
  \qquad
  1 * x = x\quad(5)
\end{gather*}
\end{document}

enter image description here

akim
  • 407
  • If you are satisfied with http://tex.stackexchange.com/a/33454/14757 you can insert another line in the table and insert more equations. – Sigur Aug 26 '15 at 13:20
  • 2
    I do not think that is a particularly good numbering from the point of view of the reader. If you are just browsing through the material looking for a particular eqn number, the reader is usually used to looking for these numbers at the right edge of the text. Now he/she has to skim the more. – daleif Aug 26 '15 at 13:48
  • @Sigur But not all the lines have the same number of equations. I guess multicolumn can help, but then the syntax is really horrible, even more than the expected result :) – akim Aug 27 '15 at 07:12

1 Answers1

4

I'm not really sure your readers will be happy:

\documentclass{article}
\usepackage{amsmath}
\usepackage{environ}

\usepackage{lipsum}

\makeatletter
\NewEnviron{shortequation}{%
  \sbox\z@{\let\label\@gobble$\displaystyle\BODY$}%
  \parbox{\dimexpr\wd\z@+4em}{
    \vspace{-\baselineskip}
    \begin{gather}
    \BODY
    \end{gather}
    \vspace{-\baselineskip}
  }%
}[\ignorespaces]
\makeatother

\begin{document}

\lipsum[2]
\begin{center}
\begin{shortequation}
  x + 0 = x
\end{shortequation}
\begin{shortequation}
  0 + x = x
\end{shortequation}
\begin{shortequation}
  x + y = y + x
\end{shortequation}

\begin{shortequation}
  x * 1 = x
\end{shortequation}
\begin{shortequation}
  1 * x = x
\end{shortequation}
\end{center}
\lipsum[3]

\end{document}

enter image description here

You can also add \label to your shortequation environments.

egreg
  • 1,121,712
  • That's brilliant, thanks! Yes, I agree my readers might appreciate mildly, but I have to save vertical space, and I want numbering. I plan to also check if using subequation would not give a friendlier result. – akim Aug 27 '15 at 06:35