[Tex/LaTex] Different spacing between section and content

sectioningspacing

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

Section spacing problems

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.

Best Answer

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:

Orphaned word

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

...
\enlargethispage{\baselineskip}% Enlarge this page by \baselineskip
\begin{equation}
  \sum_{j=1}^{n}u_{ij} > 0, \forall i \in {1,...,c} \label{eqn:nonempty}
\end{equation}
oraz
\begin{equation}
  \sum_{i=1}^{c}u_{ij} = 1, \forall j \in {1,...,n} \label{eqn:one}
\end{equation}
... 

Orphaned word removed via \enlargethispage{\baselineskip}

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:

Orphaned word remove with a change in margin specification

Related Question