0

When I write this:

\begin{eqnarray}
 K(t) &=& \arccos\left(\frac{k\cos\alpha}{b}t + \frac{A}{b}\right) \\
 \textit{ side A:    }\\
 K(t) &=& \arccos\left(\frac{k\cos\alpha}{b}t + \frac{B}{b}\right)
\end{eqnarray}

all three lines are labeled/numbered at the end like (1),(2) and (3). When I put \nonumber at the end of the text on 2nd line:

\begin{eqnarray}
 K(t) &=& \arccos\left(\frac{k\cos\alpha}{b}t + \frac{A}{b}\right) \\
 \textit{ side A:    }\nonumber \\
 K(t) &=& \arccos\left(\frac{k\cos\alpha}{b}t + \frac{B}{b}\right)
\end{eqnarray}

text line is not labeled/numbered but 1st and 3rd lines are labeled/numbered same way, like (1),(1). I need these two equations to be labeled/numbered differently. Any suggestions? Thanks.

Mensch
  • 65,388
  • Welcome to TeX.SX! That does not answer your question, but as stated here or there, you should avoid using eqnarray. – KersouMan Sep 29 '21 at 07:23
  • 1
    Please provide a small test file that shows the problem. With the standard definitions I get (1) and (2) – David Carlisle Sep 29 '21 at 07:37
  • Dear David Carlisle; Thanks for taking the time to try. When I tried posting the code I put on the question onto a test file, I got (1) and (2) as well. I guess, somewhere in the actual TeX file, something I write creates a confliction kind of thing. I will try one more time, thanks again. – Mustafa Kesir Sep 29 '21 at 07:50
  • 1
    that is why we always ask that questions include a test file. You can easily make one start with your real document profile plus that math display and if it shows the problem delete every package that you can delete while showing the issue and post the result here, – David Carlisle Sep 29 '21 at 08:14

2 Answers2

4

This is a well-known issue with the eqnarray environment. Because of the way that \nonumber works, you need to have it come in the column where the number would be output:

\begin{eqnarray}
 K(t) &=& \arccos\left(\frac{k\cos\alpha}{b}t + \frac{A}{b}\right) \\
 \textit{ side A:    }&&\nonumber \\
 K(t) &=& \arccos\left(\frac{k\cos\alpha}{b}t + \frac{B}{b}\right)
\end{eqnarray}

That said, eqnarray gives suboptimal results in many ways (particularly with the spacing around the =. I (and many others) recommend the use of the align environment from the amsmath package. It works almost the same except that you won't put a second & after the = and it also doesn't require the \nonumber to appear in the last column:

\begin{align}
 K(t) &= \arccos\left(\frac{k\cos\alpha}{b}t + \frac{A}{b}\right) \\
 \textit{ side A:    }\nonumber \\
 K(t) &= \arccos\left(\frac{k\cos\alpha}{b}t + \frac{B}{b}\right)
\end{align}
Don Hosek
  • 14,078
  • Sure about that? If I add \documentclass{article}\begin{document} before the code provided by the OP and \end{document} after and I compile that, I get the lines numbers as (1) and (2). – José Carlos Santos Sep 29 '21 at 07:33
  • as @JoséCarlosSantos says, I can't reproduce this – David Carlisle Sep 29 '21 at 07:35
  • Silly me, I didn't bother to test the failing case. – Don Hosek Sep 29 '21 at 07:46
  • Thank you all for your valuable comments. Like I said above, when I test the code seperately, I did get (1) and (2). However, when I did the correction Mr. Don Hosek suggested, it still did not solve the problem. My guess is, somewhere in the TeX file, there occurs a problem that affects the rest of the file and I somehow can not get the desired labels. I will look into that one more time. Thanks again... – Mustafa Kesir Sep 29 '21 at 07:53
  • and I forgot to say that the \begin{align} ... \end{align} did not solve the problem either... – Mustafa Kesir Sep 29 '21 at 07:58
  • In that case, you definitely have something happening weird in your document. I'm guessing that perhaps \theequation is getting rewritten. – Don Hosek Sep 29 '21 at 07:59
0

OK, I think I found the cause of the problem; in a previous eqnarray block, I put a \nonumber at the end of the block, just like this:

\begin{eqnarray}
...
\end{eqnarray}\nonumber

this \nonumber cripples the entire functionality of the thing in a way; no matter what you use, eqnarray or align do not function properly in labeling. Once I removed the \nonumber following the preceding \end{eqnarray}, the problem is resolved. Thanks...