Hi, how can I number the last line only of an equation array I know that if I write the eqnarray command like this \begin{eqnarray*} all the equation will not be numbered, and if I remove * all the lines in the array will be numbered, but I just want the last line to be numbered.
Thank you
Math & Science ⇒ Eqnarray: numbering last line only.
NEW: TikZ book now 40% off at Amazon.com for a short time.

- Stefan Kottwitz
- Site Admin
- Posts: 10345
- Joined: Mon Mar 10, 2008 9:44 pm
Eqnarray: numbering last line only.
Hi,
don't use eqnarray, I recommend align instead, for reasons see eqnarray vs. align.
You can suppress the number of certain lines inside the align environment if you write \notag before \\, see amsmath user's guide.
Stefan
don't use eqnarray, I recommend align instead, for reasons see eqnarray vs. align.
You can suppress the number of certain lines inside the align environment if you write \notag before \\, see amsmath user's guide.
Stefan
LaTeX.org admin
- localghost
- Site Moderator
- Posts: 9202
- Joined: Fri Feb 02, 2007 12:06 pm
Eqnarray: numbering last line only.
You should not use the eqnarray environment any more [1]. Take the align environment from amsmath and prevent selected lines from numbering.
Instead of \nonumber you can also use the \notag command.
[1] The PracTeX Journal - Lars Madsen: Avoid eqnarray!
Best regards
Thorsten¹
Code: Select all
\begin{align}
(a+b)^2&=a^2+2ab+b^2 \nonumber \\
(a-b)^2&=a^2-2ab+b^2 \nonumber \\
(a+b)(a-b)&=a^2-b^2
\end{align}
[1] The PracTeX Journal - Lars Madsen: Avoid eqnarray!
Best regards
Thorsten¹
How to make a "Minimal Example"
Board Rules
Avoidable Mistakes
¹ System: TeX Live 2025 (vanilla), TeXworks 0.6.10
Board Rules
Avoidable Mistakes
¹ System: TeX Live 2025 (vanilla), TeXworks 0.6.10
Eqnarray: numbering last line only.
Thank you so much guys, its working. The problem I had with using align was when I create three columns. The third column becomes aligned to the right. For example is if I use your previous code like this:
Then the third column will be aligned to the right and I get a gap between the equal sign and the right hand side expression. I am guessing that it has to do with entering some option in \begin[option]{align}, but I am new to Latex so I really don't know. However, I didn't get this problem with using eqnarray.
Code: Select all
\begin{align}
(a+b)^2&=&a^2+2ab+b^2 \nonumber \\
(a-b)^2&=&a^2-2ab+b^2 \\
(a+b)(a-b)&=&a^2-b^2 \nonumber
\end{align}
- Stefan Kottwitz
- Site Admin
- Posts: 10345
- Joined: Mon Mar 10, 2008 9:44 pm
Re: Eqnarray: numbering last line only.
Hi,
the syntax of align is slightly different to that of eqnarray. In eqnarray the & is a column separator, in align the & marks alignment points. That's why you just need one & before the relation symbol. align generates two columns, eqnarray three.
If you want to align at several places, using several & in align, consider to use the alignat environment instead.
Stefan
the syntax of align is slightly different to that of eqnarray. In eqnarray the & is a column separator, in align the & marks alignment points. That's why you just need one & before the relation symbol. align generates two columns, eqnarray three.
If you want to align at several places, using several & in align, consider to use the alignat environment instead.
Stefan
LaTeX.org admin
Re: Eqnarray: numbering last line only.
Thank you for all your help.