I'm having some spacing troubles before an equal sign, inside a combined gather and aligned environment, as shown with this MWE :

\documentclass[11pt,letterpaper,twoside]{book}
\usepackage[nodisplayskipstretch]{setspace}
\usepackage{amsmath}
\usepackage{amsfonts}
\usepackage{mathtools}

\begin{document}

%\setlength{\abovedisplayskip}{1em}
\setlength{\abovedisplayshortskip}{0pt}
\setlength{\belowdisplayskip}{\abovedisplayskip}
\setlength{\belowdisplayshortskip}{\belowdisplayskip}
\setlength{\jot}{3ex}

TEST:
\begin{align}
A &= B + C + D + E \nonumber \\
&= F + G + H
\begin{aligned}[t]
&+ X + Y + Z \\[-1ex]
&+ P + Q + R + S.
\end{aligned} \label{some label}
\end{align}

RETEST:

\begin{align}
A &= B + C + D + E \nonumber \\
&
\begin{aligned}
= F + G + H &+ X + Y + Z \\[-1ex]
&+ P + Q + R + S.
\end{aligned} \label{some label}
\end{align}

\end{document}

Preview of the RETEST code:

The red line shows that the equal signs aren't exactly aligned, and I need to manualy hack the code by adding some extra spacing by eye. The TEST part of that MWE code solves the issue with the equal sign, but then the equation number isn't placed in the middle (it's in the "top" position, because of the option [t]). How can I fix that spacing glitch, with the RETEST code? Or with the TEST code, how can I place the equation number in the midle position of the aligned environment, without changing the [t] option (so the equal signs are still aligned)?

To be more precise: I need the X + Y + Z + P + Q + R to be broken into two parts (displayed on two lines), with their labeled number in the middle poistion, as what the RETEST code is doing.

I wouldn't use that form, but to get \mathrel relation spacing at the start of a math list you need

{}= F

not

=F

\documentclass[11pt,letterpaper,twoside]{book}
\usepackage[nodisplayskipstretch]{setspace}
\usepackage{amsmath}
\usepackage{amsfonts}
\usepackage{mathtools}

\begin{document}

%\setlength{\abovedisplayskip}{1em}
\setlength{\abovedisplayshortskip}{0pt}
\setlength{\belowdisplayskip}{\abovedisplayskip}
\setlength{\belowdisplayshortskip}{\belowdisplayskip}
\setlength{\jot}{3ex}

TEST:
\begin{align}
A &= B + C + D + E \nonumber \\
&= F + G + H
\begin{aligned}[t]
&+ X + Y + Z \\[-1ex]
&+ P + Q + R + S.
\end{aligned} \label{some label}
\end{align}

RETEST:

\begin{align}
A &= B + C + D + E \nonumber \\
&
\begin{aligned}
{}= F + G + H &+ X + Y + Z \\[-1ex]
&+ P + Q + R + S.
\end{aligned} \label{some label}
\end{align}

\end{document}
• The spacing is worst, if I add {} before the equal sign.
– Cham
Jun 9, 2020 at 15:35
• @Cham I posted the output, they look lined up to me. Jun 9, 2020 at 15:36
• Using your code, I get a misaligned equal sign for the RETEST code.
– Cham
Jun 9, 2020 at 15:39
• If you have a very old version of amsmath (older than 2016) then you need \! in front of \begin{aligned} Jun 9, 2020 at 15:40
• @Cham if you are using texlive then it is easy to run texlive 2015 and texlive 2020 side by side (if you have the space) but otherwise no I'd wait until you have finished your document. latex compatibility is better than most software so updates are in general safe to do but if it was my docuemnt I probably wouldn't update unless absolutely essential to gain some bug fix that you can not do without. Jun 9, 2020 at 15:56