# Incorrect equation numbering between align and case environment

I am facing problem in equation referencing. I am using two equation environments,One is align and second is cases. Below is the code given:

Cost Function of Dual Dispersion MCMA is:\\
\begin{align}
J_{DD-MCMA}=&E\left[(|y_R(n )|^2 - R_{VR})^2\right]+\\
&E\left[(|y_I(n )|^2 - R_{VI})^2\right] \nonumber
\label{cf:ddmcma}
\end{align}

The dispersion constants RVR and RVI is chosen based on following criteria as given automatically during the execution of algorithm :

\begin{align}
R_{VR}&=
\begin{cases}
RR1     &\text{if $y_{R}(n)^2\:\leq\: RR1$ } \\
RR2     &\text{if $y_{R}(n)^2\:\leq\: RR2$ } \\
RR2     &\text{otherwise}
\end{cases} \\
R_{VI}&=
\begin{cases}
RI1     &\text{if $y_{I}(n)^2\:\leq\: RI1$ } \\
RI2     &\text{if $y_{I}(n)^2\:\leq\: RI2$ } \\
RI2     &\text{otherwise}
\end{cases}
\label{dc:ddmcma}
\end{align}


when i tried to refer it just like

\par In order to obtain the stochastic gradient adaptive algorithm tap update equation, we differentiate the cost function in equation \eqref{cf:ddmcma} with respect to equalizer tap weight vector w and approximating the expectation with
the instantaneous values gives


the output of LATEX print the equation number of equation in case environment as I have refer the equation number to be displayed from align tormentor equation. e.g if align environment equation number is 11 and case environment equation number is 12 and 13 then the equation referencing displays 12 instead of 11. Please help.

• the first equation i would write: $$\label{cf:ddmcma} \begin{split} J_{DD-MCMA} & = E\left[(|y_R(n )|^2 - R_{VR})^2\right]+\\ &\quad E\left[(|y_I(n )|^2 - R_{VI})^2\right]\end{split}$$. with this you will obtain nicer align of equation number and working referencing. welcome to tex.se! Commented Jul 3, 2018 at 11:15

Your problem is the \nonumber command that is placed before the \label command in your first eqiuation.

Try like this:

\documentclass{article}
\usepackage{amsmath}
\begin{document}
Cost Function of Dual Dispersion MCMA is:
\begin{align}
J_{DD-MCMA}=&E\left[(|y_R(n )|^2 - R_{VR})^2\right]+\label{cf:ddmcma}\\
&E\left[(|y_I(n )|^2 - R_{VI})^2\right] \nonumber
\end{align}

The dispersion constants RVR and RVI is chosen based on following criteria as given automatically during the execution of algorithm :
\begin{align}
R_{VR}=&
\begin{cases}
RR1     &\text{if $y_{R}(n)^2\:\leq\: RR1$ } \\
RR2     &\text{if $y_{R}(n)^2\:\leq\: RR2$ } \\
RR2     &\text{otherwise}
\end{cases} \\
R_{VI}=&
\begin{cases}
RI1     &\text{if $y_{I}(n)^2\:\leq\: RI1$ } \\
RI2     &\text{if $y_{I}(n)^2\:\leq\: RI2$ } \\
RI2     &\text{otherwise}
\end{cases}
\label{dc:ddmcmb}
\end{align}

Eq \ref{cf:ddmcma} and \ref{dc:ddmcmb}
\end{document}


Now the first reference is about the number (1) and not the unnumbered (so next) equation...

• Please replace =& with &=. Doing so will improve the spacing around the = symbol noticeably. And please eliminate the paragraph break before the second instance of \begin{align}. Finally, do eliminate the doube-backslash after Cost Function of Dual Dispersion MCMA is:.
– Mico
Commented Jul 3, 2018 at 10:58
• The first align should be equation with split. Commented Jul 3, 2018 at 11:42

You are using \label after a \nonumber line (that you, hence the name, cannot reference by number). Just put it into (or before) the line that is numbered:

\documentclass{article}
\usepackage{amsmath}
\begin{document}
Cost Function of Dual Dispersion MCMA is:\\
\begin{align}
J_{DD-MCMA}={}&E\left[(|y_R(n )|^2 - R_{VR})^2\right]+\label{cf:ddmcma}\\
&E\left[(|y_I(n )|^2 - R_{VI})^2\right] \nonumber
\end{align}

The dispersion constants RVR and RVI is chosen based on following criteria as given automatically during the execution of algorithm :

\begin{align}
R_{VR}&=
\begin{cases}
RR1     &\text{if $y_{R}(n)^2\:\leq\: RR1$ } \\
RR2     &\text{if $y_{R}(n)^2\:\leq\: RR2$ } \\
RR2     &\text{otherwise}
\end{cases} \\
R_{VI}&=
\begin{cases}
RI1     &\text{if $y_{I}(n)^2\:\leq\: RI1$ } \\
RI2     &\text{if $y_{I}(n)^2\:\leq\: RI2$ } \\
RI2     &\text{otherwise}
\end{cases}
\label{dc:ddmcma}
\end{align}

\par In order to obtain the stochastic gradient adaptive algorithm tap update equation, we differentiate the cost function in equation \eqref{cf:ddmcma} with respect to equalizer tap weight vector w and approximating the expectation with
the instantaneous values gives

\end{document}


• Please replace =& with &=. Doing so will improve the spacing around the = symbol noticeably.
– Mico
Commented Jul 3, 2018 at 10:57
• @Mico Thanks for the hint, didn't see it, just c&p'd it. This will lead to the probably undesired effect of a shifted second line. I instead used ={}& now. Hope this suffices your demand :)
– nox
Commented Jul 3, 2018 at 11:06

As the other answers have already pointed out, the \nonumber directive inside teh first align environment is the immediate cause of the problem.

In addition to omitting the undesirable \nonumber directive, you may want to think of replacing the entire first align environment, as line-breaking is neiter necessary nor required. On the other hand, do spend some type to typeset various constants and acronyms (e.g., DD-MCMA) more attratively.

\documentclass{article}
\usepackage{amsmath}
\DeclareMathOperator{\E}{E} % expectation operator (?)
\newcommand\vn[1]{\textit{#1}} % "variable name"
\begin{document}

Cost function of Dual Dispersion MCMA is:
$$\label{cf:ddmcma} J_{\vn{DD-MCMA}}= \E\bigl[(|y^{}_{R}(n)|^2 - R_{\vn{VR}})^2\bigr]+ \E\bigl[(|y^{}_{I}(n)|^2 - R_{\vn{VI}})^2\bigr]$$
The dispersion constants $R_{\vn{VR}}$ and
$R_{\vn{VI}}$ are chosen based on following
criteria as given automatically during the
execution of algorithm:
\begin{align}
R_{\vn{VR}} &=
\begin{cases}
RR1     &\text{if $y^{}_{R}(n)^2\leq RR1$} \\
RR2     &\text{if $y^{}_{R}(n)^2\leq RR2$} \\
RR2     &\text{otherwise}
\end{cases} \label{dc:ddmcmb} \\
R_{\vn{VI}} &=
\begin{cases}
RI1     &\text{if $y^{}_{I}(n)^2\leq RI1$} \\
RI2     &\text{if $y^{}_{I}(n)^2\leq RI2$} \\
RI2     &\text{otherwise}
\end{cases} \label{dc:ddmcmc}
\end{align}

Equations \eqref{cf:ddmcma} and \eqref{dc:ddmcmc} \dots
\end{document}

• +1, even better than my complication suggested in my comment above :-) Commented Jul 3, 2018 at 11:44