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.

I know how to use \nonumber or \notag in \begin{eqnarray} \end{eqnarray} environment.

But is there something like \addnumber or \addtag in \begin{eqnarray*} \end{eqnarray*} environment ?

For example, if I want only the second equation below be tagged, what should I do?

\begin{eqnarray*}
a &=& b\\ 
c &=& d  \addnumber\\ 
e &=& f\\
g &=& h\\
i &=& j
\end{eqnarray*} 
share|improve this question
    
For some reason \\ shows like \ above. –  TCL Feb 6 '11 at 5:39
1  
a tip: If you indent lines by 4 spaces, then they're marked as a code sample. You can also highlight the code and click the "code" button (with "101010" on it). Then the "\\" shows as it should. (Leo did this for you.) –  Hendrik Vogt Feb 6 '11 at 8:16
7  
Do not use eqnarray: tex.ac.uk/cgi-bin/texfaq2html?label=eqnarray –  Joseph Wright Feb 6 '11 at 8:17
add comment

1 Answer

\documentclass {article}
\usepackage{amsmath}
\newcommand\addtag{\refstepcounter{equation}\tag{\theequation}}

\begin{document}

\begin{align*}
a &= b\\ 
c &= d  \addtag \\ 
e &= f\\
g &= h\\
i &= j
\end{align*}

\end{document}
share|improve this answer
9  
Note that Leo replaced eqnarray with align, which is the recommended thing. –  Hendrik Vogt Feb 6 '11 at 8:22
    
I'm sure there's already a command defined by amsmath that does exactly this... But I can't remember what it's called. –  Seamus Feb 6 '11 at 12:38
    
@Seamus: I tried to find it in amsmath and mathtools, but failed. –  Leo Liu Feb 6 '11 at 15:09
2  
@Seamus: This is almost how standard LaTeX does: use \refstepcounter to set the counter and cross reference, and output the number. Maybe this command should be put into mathtools. –  Leo Liu Feb 7 '11 at 11:03
1  
@Seamus: Yes. Use \label after \addtag. hyperref just redefine \refstepcounter etc. –  Leo Liu Feb 7 '11 at 11:18
show 2 more comments

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.