[Tex/LaTex] Align environment creates extra vertical space

alignspacing

I'm typing a very large document (a thesis) and at some point align environment produces abnormally large vertical space before and after equation. I double-checked that it is neither in the beginning nor in the end of a paragraph. And the weird thing is that, when I copy the problematic piece of code and create a new document containing it alone, spacing is perfectly normal (hence, presenting it here is pointless). Also this abnormal spacing thing happens only once in the whole original document, although similar codes are used frequently.

My question is, what do you recommend me to check?

Best Answer

there is stretchable space inserted before and after any multi-line display structure when amsmath is used. (stretchable space is similarly inserted around single-line displays, but they aren't as susceptible to the surrounding context.)

take a look at what appears on the following page. if there is another large multi-line display near the top (preceded by only one or two lines of text), it isn't by default allowed to break the display if it doesn't fit on the previous page. instead, the stretchable gaps (around displays, before section headings, between paragraphs -- all to a different degree) are stretched to produce a bottom-aligned page.

this isn't really what you usually want, as you have observed.

if you are willing to allow the long display on the second page to break, you can approach this in the following ways:

  • if you are willing to allow breaks in displays throughout the whole document, place the command \allowdisplaybreaks in the preamble;
  • if you want to be selective about where a long display breaks, insert \displaybreak immediately before the \\ in the display where it is to take effect.

additional possibilities are described in the amsmath documentation (texdoc amsmath).

another possibility is that a box of some sort (e.g. a minipage) or other large unbreakable element appears near the top of the "second" page. the tactics for dealing with such a situation depend on what kind of element it is.