4

Consider:

\begin{align*}
&\begin{bmatrix} P_1 J&0\\0&NP_2\end{bmatrix}=\\&\begin{bmatrix}I&0\\0&N\end{bmatrix}\begin{bmatrix}P_1&0\\0& P_2\end{bmatrix}
\begin{bmatrix}J&0\\0&I\end{bmatrix}
\stackrel{2.18}{=}\begin{bmatrix}I&0\\0&N\end{bmatrix}[V,W]^{-1}[EV,AW]\begin{bmatrix}
J&0\\0&I\end{bmatrix}\\
&\stackrel{(2.10)}{=}[EV,AW]^{-1}EA[V,W]=[EV,AW]^{-1}AE[V,W]\\
&\stackrel{(2.10)}{=}\begin{bmatrix}J&0\\0&I\end{bmatrix}[V,W]^{-1}[EV,AW]\begin{bmatrix}I&0\\0&N\end{bmatrix}\\
&\stackrel{(2.18)}{=}\begin{bmatrix}J&0\\0&I\end{bmatrix}
\begin{bmatrix}P_1&0\\0&P_2\end{bmatrix}\begin{bmatrix}I&0\\0&N\end{bmatrix}
\begin{bmatrix}JP_1&0\\0&P_2N\end{bmatrix}\\
\end{align*}

The last line should produce an automatic equation numbering, say 2.15. I am using \begin{equation}\end{equation}, but while I am writing

\begin{align*}
&\begin{bmatrix} P_1 J&0\\0&NP_2\end{bmatrix}=\\&\begin{bmatrix}I&0\\0&N\end{bmatrix}\begin{bmatrix}P_1&0\\0& P_2\end{bmatrix}
\begin{bmatrix}J&0\\0&I\end{bmatrix}
\stackrel{2.18}{=}\begin{bmatrix}I&0\\0&N\end{bmatrix}[V,W]^{-1}[EV,AW]\begin{bmatrix}
J&0\\0&I\end{bmatrix}\\
&\stackrel{(2.10)}{=}[EV,AW]^{-1}EA[V,W]=[EV,AW]^{-1}AE[V,W]\\
&\stackrel{(2.10)}{=}\begin{bmatrix}J&0\\0&I\end{bmatrix}[V,W]^{-1}[EV,AW]\begin{bmatrix}I&0\\0&N\end{bmatrix}\\
\begin{equation}
&\stackrel{(2.18)}{=}\begin{bmatrix}J&0\\0&I\end{bmatrix}
\begin{bmatrix}P_1&0\\0&P_2\end{bmatrix}\begin{bmatrix}I&0\\0&N\end{bmatrix}
\begin{bmatrix}JP_1&0\\0&P_2N\end{bmatrix}\\
\end{equation}
\end{align*}

it is showing some error.

8
  • You can't nest environments that start math mode like that, use one align, and \nonumber on the lines that shouldn't be numbered. Commented Mar 11, 2017 at 9:03
  • 1
    See e.g. tex.stackexchange.com/questions/42726 Commented Mar 11, 2017 at 9:07
  • I dont understand, could anyone give a code :( :(
    – Myshkin
    Commented Mar 11, 2017 at 9:09
  • 2
    Take your first code, replace align* with align (i.e. remove the *), and then before the \\ of the first few lines, write \nonumber. Commented Mar 11, 2017 at 9:14
  • If you want automatic numbering of equations, use align, not align*.
    – Mico
    Commented Mar 11, 2017 at 9:21

2 Answers 2

8

You can use aligned inside equation, so you can choose what line the global equation number will be aligned with; in this case, with \begin{aligned}[b], we have the last line.

You shouldn't hardwire the numbers, but use \eqref together with suitable \label commands.

\documentclass{article}
\usepackage{amsmath}

\numberwithin{equation}{section}

\begin{document}

\setcounter{section}{2}\setcounter{equation}{9}
\begin{equation} \label{a}
0=0
\end{equation}
\setcounter{equation}{17}
\begin{equation} \label{b}
1=1
\end{equation}

This was just to set up numbers to be used in the main
display
\begin{equation} \label{c}
\begin{aligned}[b]
&\begin{bmatrix} P_1 J&0\\0&NP_2\end{bmatrix}=
  \begin{bmatrix}I&0\\0&N\end{bmatrix}\begin{bmatrix}P_1&0\\0& P_2\end{bmatrix}
  \begin{bmatrix}J&0\\0&I\end{bmatrix}
\\[1ex]
&\qquad\overset{\eqref{b}}{=}
  \begin{bmatrix}I&0\\0&N\end{bmatrix}[V,W]^{-1}[EV,AW]
  \begin{bmatrix}J&0\\0&I\end{bmatrix}
\\[1ex]
&\qquad\overset{\eqref{a}}{=}
  [EV,AW]^{-1}EA[V,W]=[EV,AW]^{-1}AE[V,W]
\\[1ex]
&\qquad\overset{\eqref{a}}{=}
  \begin{bmatrix}J&0\\0&I\end{bmatrix}[V,W]^{-1}[EV,AW]
  \begin{bmatrix}I&0\\0&N\end{bmatrix}
\\[1ex]
&\qquad\overset{\eqref{b}}{=}
  \begin{bmatrix}J&0\\0&I\end{bmatrix}
  \begin{bmatrix}P_1&0\\0&P_2\end{bmatrix}\begin{bmatrix}I&0\\0&N\end{bmatrix}
  \begin{bmatrix}JP_1&0\\0&P_2N\end{bmatrix}
\end{aligned}
\end{equation}

\end{document}

enter image description here

3

Just for completeness, here's a solution that uses a single align environment, rather than an aligned environment nested inside an equation environment. The cost is that the first four rows -- the ones that aren't supposed to be numbered -- need to be terminated with a \nonumber (or \notag) directive.

enter image description here

\documentclass{article}
\usepackage{amsmath} % for 'align' environment
\begin{document}

\begin{align}
&\begin{bmatrix}P_1 J&0\\0&NP_2\end{bmatrix}=
  \begin{bmatrix}I&0\\0&N\end{bmatrix}
  \begin{bmatrix}P_1&0\\0&P_2\end{bmatrix}
  \begin{bmatrix}J&0\\0&I\end{bmatrix}\nonumber\\
&\quad\stackrel{(2.18)}{=}\begin{bmatrix}I&0\\0&N\end{bmatrix} 
  [V,W]^{-1}[EV,AW]
  \begin{bmatrix}J&0\\0&I\end{bmatrix}\nonumber\\
&\quad\stackrel{(2.10)}{=}[EV,AW]^{-1}EA[V,W]
  =[EV,AW]^{-1}AE[V,W]\nonumber\\
&\quad\stackrel{(2.10)}{=}\begin{bmatrix}J&0\\0&I\end{bmatrix}
  [V,W]^{-1}[EV,AW]
  \begin{bmatrix}I&0\\0&N\end{bmatrix}\nonumber\\
&\quad\stackrel{(2.18)}{=}\begin{bmatrix}J&0\\0&I\end{bmatrix}
  \begin{bmatrix}P_1&0\\0&P_2\end{bmatrix}
  \begin{bmatrix}I&0\\0&N\end{bmatrix}
  \begin{bmatrix}JP_1&0\\0&P_2N\end{bmatrix}
\end{align}
\end{document}

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .