2

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!

1
  • welcome to tex.sx. that's a thorny one. even worse would be "full" equations 1 and 3, and subequations 2a and 2b. no ready solution though. Commented Jun 6, 2016 at 17:44

1 Answer 1

3

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.

2
  • Wow, ok great! Thank you! Does there happen to be a way to label things so that I can reference Eq. 3, 3a, and 3b all separately, or is that something that I would have to just work around?
    – Zach
    Commented Jun 7, 2016 at 14:31
  • @Zach I added the relevant tricks. The label for the global number must go just after \startsubequation and use the specific command as shown.
    – egreg
    Commented Jun 7, 2016 at 14:43

You must log in to answer this question.

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