In LaTeX, you have the choice whether the page break should be done with vertical justification or without vertical justification. You can manually switch between the two options with the commands \flushbottem
(vertical justification) and \raggedbottom
(no vertical justification). With double-sided typesetting (option twoside
or default for scrbook
) vertical justification is used automatically. With vertical justification, the material of a page is distributed so that the last line is always at the same vertical position. For this purpose, variable vertical spacing—for example at \vspace{2ex plus 1ex minus 1ex}
—is first adjusted proportionally according to the requirements. If this is still not sufficient, the spacing may be overstretched and TeX will then report a "underfull \vbox
". The purpose of the vertical justification is to make the bottom of a double page spread look smoother and not bounce when you turn the page.
The visually conspicuous spreading is only done in connection with \flushbottom
exactly when TeX is not able to find a satisfactory solution to the pagination problem. This often happens, for example, when the user uses \pagebreak
too early on a page, because \pagebreak
does not turn off the requirement for the vertical position of the last line of text, unlike \newpage
and \clearpage
. But this problem can also occur with automatic pagination. For example, if a page break occurs immediately in the area of a heading, TeX may also encounter an unsolvable problem. On the one hand, at least two subsequent lines of text must be placed on the same page together with the heading. On the other hand, the heading and two lines of text may not fit on the current page. Now TeX first tries whether vertical spacing may then be compressed on the page. The spacing before and after a heading is usually defined variably to allow this. But sometimes this is not enough. In that case, the heading is placed on the next page and the page before the heading is overstretched. Quite similar problems can occur in the area of vertical boxes, for example \parbox
or minipage
, or when other large objects, such as non-floating figures or tables, are present.
Both when manual page breaks are the cause and when automatic page breaks fail to find a solution, the resulting overstretch is reported as "underfull \vbox
". TeX wants to say: "Something is going wrong here. The user needs to help me find a solution." Such help can be, for example, packing figures or tables into floating environments, explicitly inserting \newpage
or \clearpage
, or extending the page using \enlargethispage{...}
. Sometimes it is also useful to wrap individual paragraphs one line shorter using \looseness=-1
or one line longer using \looseness=1
. Whereby \looseness
is always just an offer to TeX. If TeX does not find a way to break the paragraph longer or shorter, it will not do so. By the way, since the whole paragraph breaking algorithm changes slightly by using \looseness
, it can sometimes have the opposite effect, so instead of breaking one line shorter (value -1) it actually breaks one line longer or vice versa.
By the way, this problem and its solution is not KOMA-Script specific, but applies to LaTeX in general. Only the question whether the twoside
option automatically implies \flushbottom
may be different for individual classes. However, the standard classes behave exactly like the KOMA-Script classes in this respect—or, strictly speaking, the KOMA-Script classes behave like the standard classes in this respect.