# How to set different alignment rules for different subequations?

I need to group three lengthy equations with {subequations}, here is my code:

\begin{subequations}
\begin{align}
\begin{split}\label{4a}
x ={}& 11111111111111111111111111111
\end{split}\\
\begin{split}\label{4b}
y ={}& 2222222222222222222222222222222
\end{split}
\end{align}
\begin{align}
\begin{split}\label{4d}
xxxxxxxxxxxxxxxxxxx={}& aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa\\
&-bbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbb
\end{split}
\end{align}
\end{subequations}


This is the output: There are two issues:

1, Equations 1a, 1b, 1c are not aligned, I need to align them to the left(like the image below).

2, There is a line break between 1b and 1c, I need to remove it.

Can anyone help me out? Thanks!

EDIT: This is what I mean by "align them to the left":

• Welcome to TeX.SX! Why are you nesting split? And what kind of alignment are you thinking to? At the = signs? – egreg Jan 25 '19 at 21:12
• @egreg, Oh, I need to align different equations to the left, and break those lengthy equations into several lines. Those lines from the same equation should be aligned like (1c). Nesting split seems unnecessary in my case. – Jieyu You Jan 25 '19 at 21:29

You can solve this issue with setting lengths \abovedisplayskip (space above \begin{align}), \belowdisplayskip (space below end{align}) and \jot (space between equations in align). Your aim is to have \belowdisplayskip+\abovedisplayskip=\jot, so the space between equations 1(b) and 1(c) is equal to space between 1(a) and 1(b). It can be done in the following way:

\documentclass{article}
\usepackage{amsmath}

\begin{document}
\begin{subequations}
some text some text
\newlength{\someskip}
\setlength{\someskip}{\belowdisplayskip}%<- to save current \belowdisplayskip
\setlength{\belowdisplayskip}{0pt}
\begin{align}
\begin{split}\label{4a}
x ={}& 11111111111111111111111111111
\end{split}\\
\begin{split}\label{4b}
y ={}& 2222222222222222222222222222222
\end{split}
\end{align}%*
\setlength{\abovedisplayskip}{\jot}% *
\begin{align}
\begin{split}\label{4d}
xxxxxxxxxxxxxxxxxxx={}& aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa\\
&-bbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbb
\end{split}
\end{align}
\end{subequations}
some text some text

\end{document}


% at the end of lines with * is crucial. Otherwise will give here extra line and you want to have no characters between \end{align} and \begin{align}.

I added some text to visualise skips before and after align.

like this?

\documentclass[fleqn]{article}
\usepackage{geometry}
\usepackage{mathtools}

%---------------- show page layout. don't use in a real document!
\usepackage{showframe}
\renewcommand\ShowFrameLinethickness{0.15pt}
\renewcommand*\ShowFrameColor{\color{red}}
%---------------------------------------------------------------%

\begin{document}
\begin{subequations}
\begin{gather}
x = 11111111111111111111111111111    \label{4a}   \\
y = 2222222222222222222222222222222  \label{4b}   \\
\begin{multlined}[t][0.75\linewidth]\label{4d}
xxxxxxxxxxxxxxxxxxx
= aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa\\
-bbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbb
\end{multlined}
\end{gather}
\end{subequations}
\end{document}


Not sure what you mean by “align them to the left”. Here's how you can align at the = signs.

Note that ={}& is very rarely needed.

\documentclass{article}
\usepackage{amsmath}

\begin{document}

\begin{subequations}
\begin{align}
\label{4a}
x &= 11111111111111111111111111111
\\
\label{4b}
y &= 2222222222222222222222222222222
\\
\begin{split}\label{4d}
xxxxxxxxxxxxxxxxxxx &= aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa\\
\end{split}
\end{align}
\end{subequations}

\end{document}


I would do it this way:

\documentclass{article}
\usepackage{amsmath}

\begin{document}

\begin{subequations}
\begin{align}
\label{4a}
& x = 11111111111111111111111111111
\\
\label{4b}
& y = 2222222222222222222222222222222
\\
& \begin{aligned}[b]
xxxxxxxxxxxxxxxxxxx= aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa\\
{}-bbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbb
\end{aligned}\label{4d}
\end{align}
\end{subequations}

\end{document}