0

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[total={6in,10in},left=1.5in,top=0.5in,includehead,includefoot]{geometry}
\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:

enter image description here

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.

3

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

  {}= F

not

=F

enter image description here

\documentclass[11pt,letterpaper,twoside]{book}
\usepackage[total={6in,10in},left=1.5in,top=0.5in,includehead,includefoot]{geometry}
\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}
9
  • The spacing is worst, if I add {} before the equal sign. – Cham Jun 9 '20 at 15:35
  • 1
    @Cham I posted the output, they look lined up to me. – David Carlisle Jun 9 '20 at 15:36
  • Using your code, I get a misaligned equal sign for the RETEST code. – Cham Jun 9 '20 at 15:39
  • 1
    If you have a very old version of amsmath (older than 2016) then you need \! in front of \begin{aligned} – David Carlisle Jun 9 '20 at 15:40
  • 1
    @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. – David Carlisle Jun 9 '20 at 15:56

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.