[Tex/LaTex] Block of equations with only some being subequations

equationsnumberingsubequations

I'm trying to make a block of equations where the first two are standalone equations, and the second two are subequations, ie

X=XXXX (1)

X=XXXX (2)

X=XXXX (3a)

=XXXX (3b)

I'm using the amsmath package, with align and subequation, but I can't figure out how to do this without making a separate block for Eqs 1-2 and one for Eqs 3a-3b. That solution is unsatisfactory, because then there is a big vertical gap between the two blocks, and I want them to appear all as one.

Here's the code I have so far, in case it's unclear.

\begin{align}
T(x) &= \frac{m}{2{k_{B}}} \left\langle \mathbf{\tilde{v}}{(\mathbf{x}_{i},t)}^{2} \right\rangle\\ 
\mathbf{u}(x) &= \left\langle \mathbf{v}_{i}(\mathbf{x}_{i},t) \right\rangle
\end{align}
\begin{subequations} 
\begin{align}
P_{xy}(x) &= \frac{1}{A} \left\langle \sum\limits_{i} {m \tilde{v}_{i,x} \tilde{v}_{i,y}} + \frac{1}{2} \sum\limits_{i} {\sum\limits_{j\ne i} {r_{ij,y} F_{ij,x}}} \right\rangle \\
\begin{split}
 &=\frac{m}{A} \Bigg\langle \sum\limits_{i}{{{{\tilde{v}}}_{i,x}}{{{\tilde{v}}}_{i,y}}} + \frac{a^3\omega _{pd}^2}{4} \\
 &\quad \times \sum\limits_{i}{\sum\limits_{j\ne i}{r_{ij,y}{\left\{ \frac{e^{(-{{r}_{ij}}/\lambda )}}{{{r}_{ij}}}\left( \frac{1}{r_{ij}}+\frac{1}{\lambda} \right) \right\}_{x}}}} \Bigg\rangle
\end{split}
\end{align}
\end{subequations}

Any suggestions would be greatly appreciated!

Best Answer

It's possible with a little manual work. With \startsubequation you fix the equation number and each \tagsubequation command will step the subcounter. Until you use \tagsubequation, the main equation number will not increase.

\documentclass{article}

\usepackage{amsmath}

\makeatletter
\newcounter{manualsubequation}
\renewcommand{\themanualsubequation}{\alph{manualsubequation}}
\newcommand{\startsubequation}{%
  \setcounter{manualsubequation}{0}%
  \refstepcounter{equation}\ltx@label{manualsubeq\theequation}%
  \xdef\labelfor@subeq{manualsubeq\theequation}%
}
\newcommand{\tagsubequation}{%
  \stepcounter{manualsubequation}%
  \tag{\ref{\labelfor@subeq}\themanualsubequation}%
}
\let\subequationlabel\ltx@label
\makeatother


\begin{document}

\begin{align}
T(x) &=
  \frac{m}{2k_{B}} \biggl\langle \mathbf{\tilde{v}}(\mathbf{x}_{i},t)^{2} \biggl\rangle
\\ 
\mathbf{u}(x) &=
  \langle \mathbf{v}_{i}(\mathbf{x}_{i},t) \rangle
\\
\startsubequation\subequationlabel{eq:3}\tagsubequation\label{eq:3a}
P_{xy}(x) &=
   \frac{1}{A} \biggl\langle \sum_{i} m \tilde{v}_{i,x} \tilde{v}_{i,y} 
  +\frac{1}{2} \sum_{i} \sum_{j\ne i} r_{ij,y} F_{ij,x} \biggr\rangle
\\
\tagsubequation\label{eq:3b}
\begin{split}
&=
   \frac{m}{A} \biggl\langle \sum_{i}\tilde{v}_{i,x}\tilde{v}_{i,y}+\frac{a^3\omega_{pd}^2}{4}
 \\
&\quad \times \sum_{i}\sum_{j\ne i}r_{ij,y}\left\{ \frac{e^{(-r_{ij}/\lambda)}}{r_{ij}}
  \left( \frac{1}{r_{ij}}+\frac{1}{\lambda} \right) \right\}_{x} \biggr\rangle
\end{split}
\end{align}

Let's see the next number
\begin{equation}
a=b
\end{equation}

Also references: \eqref{eq:3}, \eqref{eq:3a} and \eqref{eq:3b}

\end{document}

enter image description here

You're using too many braces, in my opinion.

Related Question