19

Consider the following commands to create a labelled multi-line equation array:

\begin{eqnarray}
\label{eqn:1}
X&=&Y+Z\\
&\leq & U \times W.

\end{eqnarray}

It creates a two-line equations with two numbers. How can I associate only one equation number to this two-line equations? or better, how can I associated different equation numbers to each line? (of course, without breaking the equation array into several disjoint equations!)

2
  • 2
    Please don't use eqnarray. See \eqnarray vs \align.
    – Werner
    Sep 29 '13 at 6:04
  • I have the exact same question. Have to use \eqnarray because that's required by the journal template.
    – Drumy
    Apr 22 '20 at 9:01
18

amsmath provides a similar interface to eqnarray, but is better in terms of it's horizontal spacing/alignment:

enter image description here

\documentclass{article}
\usepackage{amsmath}% http://ctan.org/pkg/amsmath
\begin{document}
\begin{align}
  X &= Y + Z \label{eqn:1} \\
    &\leq U \times W. \nonumber \\
    & = Y + Z \tag{a}
\end{align}
\end{document}

\nonumber removes the number for that line in the align environment. \tag can also be used to create a manual tag.

2
  • 1
    Though I never use it myself. I still forget when answering questions on this site that it's recommended not to use eqnarray.
    – A.Ellett
    Sep 29 '13 at 6:18
  • 2
    \tag*{a} for labels without parentheses
    – user2478
    Sep 29 '13 at 6:33
7

if only one equation number is wanted for a group, the split environment from amsmath is a reasonable candidate; it must be "wrapped" in an equation environment for the equation number to appear.

if all the equations in a group are to be numbered, then (as pointed out in other answers) the align environment is more suitable.

\begin{equation}
\begin{split}
 X &=Y+Z\\
   &\leq U \times W
\end{split}
 \label{eqn:1}
\end{equation}

\begin{align}
 X &=Y+Z \label{eqn:2}\\
   &\leq U \times W \label{eqn:3}
\end{align}

output of example code

1
  • All these cases are applicable from time to time. Thanks for your answer.
    – user24323
    Sep 29 '13 at 14:50
2

Use \notag:

\begin{eqnarray}
\label{eqn:1}
X&=&Y+Z\\
\notag
&\leq & U \times W.    
\end{eqnarray}

But, as @werner reminds us, it is not advised to use eqnarray, align does a better job:

\begin{align}
\label{eqn:1}
     X & = Y + Z \\
\notag & \leq  U \times W.    
\end{align}

This requires that you load the package amsmath to have access to \notag

Math environments in LaTeX are not happy with empty lines. If you want each line to have a number, just don't use \notag.

See How to get only one vertically centered equation number in align environment with two equations for how to get one equation number for multiple lines.

2
  • Thanks for your answer. How can I label each line individually?
    – user24323
    Sep 29 '13 at 5:50
  • 2
    @VahidShirbisheh -- instead of \notag, put a \label on the second line. each line can be individually labeled for later reference. Sep 29 '13 at 13:24

Your Answer

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