Math & Scienceproblem with \nonumber using align

Information and discussion about LaTeX's math and science related features (e.g. formulas, graphs).
Post Reply
NELLLY
Posts: 113
Joined: Thu Nov 26, 2009 2:21 am

problem with \nonumber using align

Post by NELLLY »

Hello
when I use the following commands

Code: Select all

\begin{align}
 P(S_0=0, D_{S_0}\in I_1)&=0\label{S0::I1}
\\[-4mm]
\intertext{and}\\[-10mm]
 P(S_0 = 0, D_{S_0} \in I'_2)&=P(0< T_A \leq h_2)\times P(D_{S_0} \in I'_2) \nonumber\\
 &=1-e^{-\lambda
 h_2},\label{S0::I2}
\end{align}
the second equation is also numbered although I use the \nonumber or \notag at its end. What should I do?

Recommended reading 2024:

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

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

svend_tveskaeg
Posts: 478
Joined: Sun Jul 12, 2009 5:31 am

Re: problem with \nonumber using align

Post by svend_tveskaeg »

Provide a minimal working example.
``In the game of chess, you can never let your adversary see your pieces.''
-- Zapp Brannigan, Futurama (season 1, episode 4)
User avatar
cgnieder
Site Moderator
Posts: 2000
Joined: Sat Apr 16, 2011 7:27 pm

problem with \nonumber using align

Post by cgnieder »

svend_tveskaeg wrote:Provide a minimal working example.
The example actually works if you click on the writeLaTeX link ;)

The second line is not numbered but an additional line in between as you can see if you remove the [-10mm] argument:

Code: Select all

\documentclass{article}
\usepackage{amsmath}
\begin{document}
\begin{align}
 a &= b
\intertext{and}\\
 a &= b \nonumber\\
   &= c \label{S0::I2}
\end{align}
\end{document}
I guess what you actually want is this

Code: Select all

\documentclass{article}
\usepackage{amsmath}
\begin{document}
\begin{align}
 a &= b
\intertext{and\vspace{-\abovedisplayskip}}
 a &= b \nonumber\\
   &= c \label{S0::I2}
\end{align}
\end{document}
or maybe

Code: Select all

\documentclass{article}
\usepackage{amsmath}
\begin{document}
\begin{align}
 a &= b \\[-\belowdisplayskip]
\intertext{and\vspace{-\abovedisplayskip}}
 a &= b \nonumber\\
   &= c \label{S0::I2}
\end{align}
\end{document}
in which case the following could be easier:

Code: Select all

\documentclass{article}
\usepackage{amsmath}
\begin{document}
\begin{align}
 a &= b \\
\noalign{\text{and}}
 a &= b \nonumber\\
   &= c \label{S0::I2}
\end{align}
\end{document}
Regards
site moderator & package author
User avatar
svend_tveskaeg
Posts: 478
Joined: Sun Jul 12, 2009 5:31 am

problem with \nonumber using align

Post by svend_tveskaeg »

cgnieder wrote:The example actually works if you click on the writeLaTeX link ;)
I see. I just looked at the code and assumed that what I saw was all the code. :(
``In the game of chess, you can never let your adversary see your pieces.''
-- Zapp Brannigan, Futurama (season 1, episode 4)
User avatar
cgnieder
Site Moderator
Posts: 2000
Joined: Sat Apr 16, 2011 7:27 pm

problem with \nonumber using align

Post by cgnieder »

svend_tveskaeg wrote:
cgnieder wrote:The example actually works if you click on the writeLaTeX link ;)
I see. I just looked at the code and assumed that what I saw was all the code. :(
I just found out by chance: I clicked on it in order to complete it (there were only four lines missing anyway) and recognized that writeLaTeX completed the snippet. Nice feature...

Regards
site moderator & package author
User avatar
svend_tveskaeg
Posts: 478
Joined: Sun Jul 12, 2009 5:31 am

problem with \nonumber using align

Post by svend_tveskaeg »

cgnieder wrote:Nice feature...
Definitely!

P.S. Sorry for going off topic.
``In the game of chess, you can never let your adversary see your pieces.''
-- Zapp Brannigan, Futurama (season 1, episode 4)
Post Reply