# Long multiline equations adding white space beforehand when placed on a page break

I have a little problem getting long multiline equations to work over a page break in the memoir class. If the equation is by any chance at a page break, the equations will get placed on the next page but in the text before that equation, a lot of white spaces are added. Also, I get an underful vbox error.

Here is a picture to illustrate my problem:

And here the tex example code:

\documentclass[
11pt, a4paper,
fleqn,
twoside, openright,
final
]{memoir}

\usepackage[utf8]{inputenc}   % Input-Encoding
\usepackage[TS1,T1]{fontenc}  % Output-Encoding
\usepackage[english]{babel}   % English language package

%Geometry
\geometry{a4paper,left=3cm,right=3cm,top=3cm,bottom=3cm}
\usepackage{amssymb,amsmath}

\usepackage{blindtext}

\begin{document}
\newpage

\mainmatter
\OnehalfSpacing

\chapter{Testchapter}
\blindtext[6]

\blindtext[1]

{\setlength{\mathindent}{0cm} \small
\begin{gather}
\label{eq:S1f}
\begin{aligned}
y1 &= a+b+c\\ &{} d+e+f \\ &{} g+h+j
\end{aligned}\\
\begin{aligned}
y2 &= a+b+c\\ &{} d+e+f \\ &{} g+h+j
\end{aligned}\\
\begin{aligned}
y3 &= a+b+c\\ &{} d+e+f \\ &{} g+h+j
\end{aligned}\\
\begin{aligned}
y4 &= a+b+c\\ &{} d+e+f \\ &{} g+h+j
\end{aligned}
\end{gather}
}

\blindtext

\end{document}


I am using a gather environment because that was the best way to get my relatively long equations nicely shown in LaTex. I also tried some other variants here already (without improvement).

Any idea why this is happening and how I can fix it? Would be really bad if I had to worry about where to place my equation as this should be the job of Latex :D

• What exactly do you want to achieve? a) Eq. 1.1 to 1.4. behave as a float or b) pagebreak between eq. 1.3 and 1.4? – leandriis Oct 16 '17 at 21:01
• you should never have a blank line before a displayed equation also you probably want \allowdisplaybreaks to allow the display to split over a page. – David Carlisle Oct 16 '17 at 21:07
• @leandriis Actually I could live with both, only the white spaces were annoying me, but \allowdisplaybreaks and \raggedbottom seems to solve the problem @ David Any particular reason why a blank line before equations should be avoided? I think I have it in most of my text without blank lines, but never really looked for this... – Jens Oct 16 '17 at 21:23
• a blank line before a display will always leave more space above than below the display. this will be more noticeable before multi-line displays, but is always there. it will also allow a page break before a display, which is bad style in traditional math publishing. – barbara beeton Oct 17 '17 at 1:03

\allowdisplaybreaks