Different spacing between section and content

I have a strange problem with spacing between section and content header. Take a look at the picture below.

You can see that spacing between headers are different. I couldn't reproduce this error for simple documents, so I uploded my whole chapter here.

What is even stranger, everything looks normal if I only delete a couple of last lines from the chapter. The source code is a little big that is why I decided to upload it on a server. What should I do to restore good spacing between sections presented in the picture? In the other chapters everything looks OK.

-

The problem here is that LaTeX is trying to do a decent job of making the text look presentable by not allowing orphaned words before an equation environment. Taken from the Wikipedia entry on widows and orphans:

In typesetting, widows and orphans are words or short lines at the beginning or end of a paragraph, which are left dangling at the top or bottom of a column, separated from the rest of the paragraph.

The happens at the bottom of page 4 in your document:

If your document is not at a final stage of production, then I would suggest not worrying about this until later. That is because small changing in your document might end up getting rid of this problem without you having to do it manually. However, if you want to make a change to accommodate for this, you have a couple of options.

Option 1: You modify the text in the chapter before this point (by adding or removing text) so the spacing changes. This is what happens when you " delete a couple of last lines from the chapter". This is not optimal, since you may have to change the entire chapter/section flow. However, it remains an option.

Option 2: You increase the text block size just for this page, with

...
$$\sum_{j=1}^{n}u_{ij} > 0, \forall i \in {1,...,c} \label{eqn:nonempty}$$
oraz
$$\sum_{i=1}^{c}u_{ij} = 1, \forall j \in {1,...,n} \label{eqn:one}$$
...


Note: Be sure to remove this requirement if there is a change in your document that would make this enlargement unnecessary.

Option 3: Your margin specification via geometry is:

\usepackage[left=3.0cm,right=3cm,top=3.0cm,bottom=3.0cm]{geometry}


You could simply this to

\usepackage[margin=29.5mm]{geometry}% Margins of 29.5mm


to reduce the margins on all sides of your document from 30mm to 29.5mm - effectively increasing the text block horizontally by only 1mm. This causes the document to be typeset with a marginal difference, allowing for a bit more to fit on the page and a better break at the bottom of page 4:

-
+1. I think option 1 is the most useful. Option 2 is simply too odd and option 3, like any other methods involving changing the layouts should not be recommended. God knows what will happen elsewhere when someone change the layout just to a problem in one place. Instead, changing a few words can be most “local” in my experience –  Yan Zhou Aug 6 '11 at 7:57
@Werner Works like a charm :) Thanks a lot –  geronimo Aug 6 '11 at 10:39

perhaps the answer is too late. I faced the same problem but using \raggedbottom in the preface solved everything.

-
Welcome to TeX.sx! –  Peter Jansson Mar 3 '13 at 14:47