TeX has a well–deserved good reputation for its line breaking algorithm and it has found its way into other software over the years. When it comes to interparagraph material such as penalties, skips and whatsits, things start getting murky as TeX provides little help in this area, especially on the main vertical list where most of the action is.
This article describes the galley module which seeks to control line breaking as well as taking care of inter-paragraph material being added at the right time. In other words, galley can assist packages such as breqn which has to construct paragraph shapes on the fly while taking current ones into account as well as ensuring the output routine doesn’t get tricked by penalties, skips and whatsits appearing in places where they could allow breakpoints where none are intended.