Take the 2-minute tour ×
TeX - LaTeX Stack Exchange is a question and answer site for users of TeX, LaTeX, ConTeXt, and related typesetting systems. It's 100% free, no registration required.

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!)

share|improve this question
1  
Please don't use eqnarray. See \eqnarray vs \align. –  Werner Sep 29 '13 at 6:04
add comment

3 Answers

up vote 2 down vote accepted

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.

share|improve this answer
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
1  
\tag*{a} for labels without parentheses –  Herbert Sep 29 '13 at 6:33
    
Thanks for your answer. –  Vahid Shirbisheh Sep 29 '13 at 6:41
add comment

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

share|improve this answer
    
All these cases are applicable from time to time. Thanks for your answer. –  Vahid Shirbisheh Sep 29 '13 at 14:50
add comment

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.

share|improve this answer
    
Thanks for your answer. How can I label each line individually? –  Vahid Shirbisheh 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. –  barbara beeton Sep 29 '13 at 13:24
add comment

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

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