1

I'm using the equation environment in my latex document. All went ok until half a chapter when I find the two equation have the same equation number (3.44). Why could this happens? Moreover, from that point to the end of the document, all the equations that are within the same subsection/section have the same numbering.

This is the crucial point of the document: At first

\begin{equation}
\mathbf { L } \hat { \mathbf { U } } _ { \mathcal { K } } = \hat { \mathbf { U } } _ { \mathcal { K } } \mathbf { C } _ { \mathcal { K } }
\end{equation}

that currently follow the equation numbering order and it is (3.44). Then I insert two equation that must not to be numbered, thus I used the tag environment:

\begin{equation}
\quad &\min _ { \mathbf { L } \in \mathbb { R } ^ { N \times N } , \mathrm { C } _ { \mathcal { K } } \in \mathbb { R } ^ { K \times K } } f ( \mathbf { L } , \mathbf { Y } , \hat { \mathbf { S } } )
\tag{$\mathcal{P}_{L}$}
\end{equation}
\begin{equation}
\notag
\quad \quad & & & & \left. \begin{array} { c l } { \text { s.t. } } & { \mathbf { L } \in \mathcal { L } , \operatorname { tr } ( \mathbf { L } ) = p } \\ { } & { \mathbf { L } \hat { \mathbf { U } } _ { \mathcal { K } } = \hat { \mathbf { U } } _ { \mathcal { K } } \mathbf { C } _ { \mathcal { K } } , \mathbf { C } _ { \mathcal { K } \succeq } \mathbf { 0 } } \end{array} \right\} \triangleq \mathcal { X } \left( \hat { \mathbf { U } } _ { \mathcal { K } } \right)
\end{equation}

\begin{equation}
\quad &\min _ { \mathbf { L } \in \mathbb { R } ^ { N \times N } \atop \mathrm { C } _ { \mathcal { K } } \in \mathbb { R } ^ { K \times K } } f _ { 1 } ( \mathbf { L } , \mathbf { Y } , \mu ) \triangleq \mathrm { TV } ( \mathbf { L } , \mathbf { Y } ) + \mu \| \mathbf { L } \| _ { F } ^ { 2 }
\tag{$\mathcal{P}_{L_{1}}$}
\end{equation}
\begin{equation}
\notag
 \left. \begin{array} { c l } { \text { s.t. } } & \quad \left( \mathbf { L } , \mathbf { C } _ { \mathcal { K } } \right) \in \mathcal { X } \left( \hat { \mathbf { U } } _ { \mathcal { K } } \right)
\end{equation}

that has no equation number but the tag filled. Then when writing

\begin{equation}
\operatorname { tr } \left( \mathbf { Y } ^ { T } \mathbf { L Y } \right) = \operatorname { tr } \left( \mathbf { S } _ { \mathcal { K } } ^ { T } \mathbf { \Lambda } _ { \mathcal { K } } \mathbf { S } _ { \mathcal { K } } \right) = \operatorname { tr } \left( \hat { \mathbf { S } } _ { \mathcal { K } } ^ { T } \mathbf { C } _ { \mathcal { K } } \hat { \mathbf { S } } _ { \mathcal { K } } \right)
\end{equation}

it has still equation number 3.44. Why?

EDIT: I wrote the two consecutive equation environemt to obtain the following effect

enter image description here

  • It is strange unless you have some special changes. Please show us a compilable code so that we can have some tests. – user156344 Mar 27 at 15:16
  • Why isn't it compilable? – Alberto Mar 27 at 15:18
  • Of course all the above codes are not compilable, because they don't have \documentclass{}, \begin{document}, etc. – user156344 Mar 27 at 15:18
  • 2
    You get a huge number of errors from that input. Whatever happens next is not reliable until you fix the errors. – egreg Mar 27 at 15:22
  • 2
    If you want a totally unnumbered equation, use the starred form of the environment. Al;so, rather than putting two equation environments directly after one another, consider using one of the multi0-line display environments provided by amsmath. (To see the documentation, at a command line prompt, type `texdoc amsmath'.) – barbara beeton Mar 27 at 15:24
0

You get a huge number of errors from that input. Whatever happens next is not reliable until you fix the errors.

Here's a fixed version:

\documentclass{article}
\usepackage{amsmath,amssymb}

\DeclareMathOperator{\tr}{tr}

\begin{document}

\begin{align}
&\min_{\substack{
  \mathbf{L}\in\mathbb{R}^{N\times N} \\
  \mathbf{C}_{\mathcal{K}}\in\mathbb{R}^{K\times K}
}} f(\mathbf{L},\mathbf{Y},\hat{\mathbf{S}})
\tag{$\mathcal{P}_{L}$}
\\
\notag
&\quad
\left.\begin{array}{@{}ll@{}}
\text{s.t.} & \mathbf{L}\in\mathcal{L},\tr(\mathbf{L})=p\\
            & \mathbf{L}\hat{\mathbf{U}}_{\mathcal{K}}=
              \hat{\mathbf{U}}_{\mathcal{K}}\mathbf{C}_{\mathcal{K}},
              \mathbf{C}_{\mathcal{K}\succeq\mathbf{0}}
\end{array}\right\}
\triangleq\mathcal{X}(\hat{\mathbf{U}}_{\mathcal{K}})
\\[2ex]
&\min_{\substack{
  \mathbf{L}\in\mathbb{R}^{N\times N} \\
  \mathbf{C}_{\mathcal{K}}\in\mathbb{R}^{K\times K}
}} f_{1}(\mathbf{L},\mathbf{Y},\mu)\triangleq
  \mathrm{TV}(\mathbf{L},\mathbf{Y})+\mu\|\mathbf{L}\|_{F}^{2}
\tag{$\mathcal{P}_{L_{1}}$}
\\
\notag
&\quad
\,\begin{array}{@{}ll@{}}
\text{s.t.} & (\mathbf{L},\mathbf{C}_{\mathcal{K}})\in\mathcal{X}
              (\hat{\mathbf{U}}_{\mathcal{K}})
\end{array}
\end{align}

\begin{equation}
\tr(\mathbf{Y}^{T}\mathbf{LY})=
\tr(\mathbf{S}_{\mathcal{K}}^{T}
    \mathbf{\Lambda}_{\mathcal{K}}
    \mathbf{S}_{\mathcal{K}})=
\tr(\hat{\mathbf{S}}_{\mathcal{K}}^{T}
    \mathbf{C}_{\mathcal{K}}
    \hat{\mathbf{S}}_{\mathcal{K}})
\end{equation}

\end{document}

enter image description here

With different alignment. A couple of tricks are needed to move s.t to the left with the brace on the right hand side.

\documentclass{article}
\usepackage{amsmath,amssymb}

\DeclareMathOperator{\tr}{tr}

\begin{document}

\begin{align}
\hphantom{\text{s.t.}\quad}
&\min_{\substack{
  \mathbf{L}\in\mathbb{R}^{N\times N} \\
  \mathbf{C}_{\mathcal{K}}\in\mathbb{R}^{K\times K}
}} f(\mathbf{L},\mathbf{Y},\hat{\mathbf{S}})
\tag{$\mathcal{P}_{L}$}
\\
\notag
&\left.\kern-\nulldelimiterspace
\begin{array}{@{}l@{}}
 \makebox[0pt][r]{s.t.\quad}
 \mathbf{L}\in\mathcal{L},\tr(\mathbf{L})=p\\
 \mathbf{L}\hat{\mathbf{U}}_{\mathcal{K}}=
   \hat{\mathbf{U}}_{\mathcal{K}}\mathbf{C}_{\mathcal{K}},
   \mathbf{C}_{\mathcal{K}\succeq\mathbf{0}}
\end{array}\right\}
\triangleq\mathcal{X}(\hat{\mathbf{U}}_{\mathcal{K}})
\\[2ex]
&\min_{\substack{
  \mathbf{L}\in\mathbb{R}^{N\times N} \\
  \mathbf{C}_{\mathcal{K}}\in\mathbb{R}^{K\times K}
}} f_{1}(\mathbf{L},\mathbf{Y},\mu)\triangleq
  \mathrm{TV}(\mathbf{L},\mathbf{Y})+\mu\|\mathbf{L}\|_{F}^{2}
\tag{$\mathcal{P}_{L_{1}}$}
\\
\notag
&\makebox[0pt][r]{s.t.\quad}
 (\mathbf{L},\mathbf{C}_{\mathcal{K}})\in\mathcal{X}
 (\hat{\mathbf{U}}_{\mathcal{K}})
\end{align}

\begin{equation}
\tr(\mathbf{Y}^{T}\mathbf{LY})=
\tr(\mathbf{S}_{\mathcal{K}}^{T}
    \mathbf{\Lambda}_{\mathcal{K}}
    \mathbf{S}_{\mathcal{K}})=
\tr(\hat{\mathbf{S}}_{\mathcal{K}}^{T}
    \mathbf{C}_{\mathcal{K}}
    \hat{\mathbf{S}}_{\mathcal{K}})
\end{equation}

\end{document}

enter image description here

  • The question has been edited to show the desired alignment. You may want to modify your examples. (I'd do it, but I don't yet have a working tex system.) – barbara beeton Mar 27 at 15:48
  • @egreg After these changes, the equation numbering order is correct. Thank you so much. Which could be the reason anyway? – Alberto Mar 27 at 15:58
  • @Alberto I added a different alignment. The errors you got put LaTeX out of synch and it wasn't able to step correctly the equation number. – egreg Mar 27 at 16:08

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.