Math & ScienceAdding Number to certain Equation does not work

Information and discussion about LaTeX's math and science related features (e.g. formulas, graphs).
ahmedlasheen
Posts: 43
Joined: Wed Oct 27, 2010 10:25 pm

Adding Number to certain Equation does not work

Post by ahmedlasheen »

Hello all
i am trying to addnumber to equation array as in the following example
but it doesnot work , i donot know why

Code: Select all

\documentclass[a4paper]{report}
\usepackage{amsmath,amsthm,amssymb,amsfonts}

\begin{document}
\begin{eqnarray*}
a &=& b\\ 
c &=& d \\   \addnumber
e &=& f\\
g &=& h\\
i &=& j
\end{eqnarray*}
\end{document} 
and i get the error message
! Undefined control sequence.
i am using texlive 2011
thanks in advance
Last edited by ahmedlasheen on Tue Aug 30, 2011 9:47 pm, edited 1 time in total.

Recommended reading 2024:

LaTeXguide.org • LaTeX-Cookbook.net • TikZ.org

NEW: TikZ book now 40% off at Amazon.com for a short time.

frabjous
Posts: 2064
Joined: Fri Mar 06, 2009 12:20 am

Adding Number to certain Equation does not work

Post by frabjous »

I've never heard of a command \addnumber. What are you actually trying to do? Does this TeX.SE question and answer help?
ahmedlasheen
Posts: 43
Joined: Wed Oct 27, 2010 10:25 pm

Re: addnumber doesnot work

Post by ahmedlasheen »

i just wanna to put the number of the equation on the second line
as the whole equation has no numbers due to using the equnarray*
User avatar
frabjous
Posts: 2064
Joined: Fri Mar 06, 2009 12:20 am

Re: Adding Number to certain Equation does not work

Post by frabjous »

The link I gave answers that question, and also explains why you should not use eqnarray*, but align* instead.
User avatar
localghost
Site Moderator
Posts: 9202
Joined: Fri Feb 02, 2007 12:06 pm

Adding Number to certain Equation does not work

Post by localghost »

The eqnarray* environment is obsolete [1]. Use the environments provided by the amsmath package. For more useful stuff about math typesetting refer to the »Math mode« document.

Code: Select all

\documentclass[11pt,a4paper]{report}
\usepackage{amsmath}

\begin{document}
  \begin{align}
    a &= b \nonumber \\
    c &= d \\
    e &= f \nonumber \\
    g &= h \nonumber \\
    i &= j \nonumber
  \end{align}
\end{document} 
[1] The PracTeX Journal - TeX Users Group, Lars Madsen: Avoid eqnarray!


Thorsten
ahmedlasheen
Posts: 43
Joined: Wed Oct 27, 2010 10:25 pm

Re: Adding Number to certain Equation does not work

Post by ahmedlasheen »

thanks for your reply this solve the problem ,
but i was wondering if the reverse is possible espically if i have large number of equation for example 30 equations so that i have to write /nonumber for all 29 .but if i use the align* so that i only have to put something to make anumber on the line i want .
User avatar
localghost
Site Moderator
Posts: 9202
Joined: Fri Feb 02, 2007 12:06 pm

Adding Number to certain Equation does not work

Post by localghost »

ahmedlasheen wrote:[…] but i was wondering if the reverse is possible espically if i have large number of equation for example 30 equations so that i have to write /nonumber for all 29 .but if i use the align* so that i only have to put something to make anumber on the line i want .
I'm not aware of such a solution. I you want to give the equation system as a whole one single number, you should choose another method.

Code: Select all

\documentclass[11pt,a4paper]{report}
\usepackage{amsmath}

\begin{document}
  \begin{equation}
    \begin{aligned}
      a &= b \\
      c &= d \\
      e &= f \\
      g &= h \\
      i &= j
    \end{aligned}
  \end{equation}
\end{document}
User avatar
Stefan Kottwitz
Site Admin
Posts: 10345
Joined: Mon Mar 10, 2008 9:44 pm

Adding Number to certain Equation does not work

Post by Stefan Kottwitz »

Or use split:

Code: Select all

\documentclass[11pt,a4paper]{report}
\usepackage{amsmath}
\begin{document}
  \begin{equation}
    \begin{split}
      a &= b \\
      c &= d \\
      e &= f \\
      g &= h \\
      i &= j
    \end{split}
  \end{equation}
\end{document}
Stefan
LaTeX.org admin
ahmedlasheen
Posts: 43
Joined: Wed Oct 27, 2010 10:25 pm

Adding Number to certain Equation does not work

Post by ahmedlasheen »

this is not what i mean . what i means is that i wanna to use the align* so that no numbers for all line then i wanna to use some command to put the a number on certain line . i just wanna to put a number on certain line

Code: Select all

   
\documentclass[a4paper]{report}
\usepackage{amsmath,amsthm,amssymb,amsfonts}
\begin{document}
  \begin{align*}
      a &= b \\
      c &= d \\
      e &= f \\ 
      g &= h  \a command to put the number on that line
      i &= j \\
    \end{align*}
\end{document}
User avatar
frabjous
Posts: 2064
Joined: Fri Mar 06, 2009 12:20 am

Adding Number to certain Equation does not work

Post by frabjous »

Sigh. Is there some reason you didn't want to click on the link I gave?

Code: Select all

\documentclass[a4paper]{report}
\usepackage{amsmath,amsthm,amssymb,amsfonts}
\newcommand\addtag{\refstepcounter{equation}\tag{\theequation}}

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