# \flushbottom vs \raggedbottom

I use \documentclass{book}.

• If I use \flushbottom, I get messages of the sort Underfull \vbox (badness 10000) has occurred while \output is active []. See question.
• These messages disappear when I use \raggedbottom but then of course the height of page content varies form page to page.

So there seems to be no optimal solution but a trade off between to "evils" ... What is the point of view of LaTeX pros on this matter? Which option should be chosen in this situation?

• Please, try showing a minimal example: are you using the setspace package or the \linespread command? Jul 31 '12 at 14:57
• Yes I use \usepackage[onehalfspacing]{setspace}\setstretch{1,15}. No I don't think I ever used \linespread. Difficult to produce a minimal example, since with \blindtext LaTeX will have no problems with either option, I suppose. And actually I do not really know from the log file to which pages of my text these badness messages refer (and it's a long document, the PDF having >250 pages). So it's not easy to reproduce the problems. Sorry. Jul 31 '12 at 15:25
• Look in the log file: tex puts out a number in brackets for each page [1][2][3].... underfull box.... [4]... means the warning is about the stuff that appears on page 4. Jul 31 '12 at 16:02

There isn't a universal right answer.

\raggedbottom is of course an easier format to achieve as you lose the constraint on equalising page content.

If however you want \flushbottom then you have to ensure that the page content fits in the specified size. For example if your content consists entirely of lines of text on a 15 pt baseline with no stretchy white space between lines or paragraphs, and your text body height is not a multiple of that \baselineskip, then every page will be underfull as TeX cannot achieve the specified size so has to break a line short. The solution there is to adjust the \baselineskip and/or the \textheight to be compatible, or, if typesetting on a grid is not an absolute requirement, add some vertical stretch glue between lines (by giving \baselinestretch a plus component) or between paragraphs (by giving \parskip a plus component).

In the final editing stages using either you may want to adjust page size on a per-page (or per-spread) basis using \enlargethispage.

• I am afraid, my LaTeX as well as editing capabilities are not such that interfering manually with LaTeX would make things look any better ... Therefore I rather tend to trust in LaTeX and only make rough global adjustments (such as switching between \raggedbotoom and \flushbottom). Jul 31 '12 at 15:32
• Is there a trick of enabling \raggedbottom only on pages with extremely bad underfull vboxes (with a given threshold for badness)? I generally want flush bottoms but I’d prefer having a ragged bottom on pages where I’d otherwise have three short paragraphs with huge, ugly spaces between them. Nov 1 '15 at 19:39
• just add \newpage at the point you want it to break it is the vertical analogue of \\  or \newline which breaks a line leaving it short in an otherwise justified paragraph @KonradRudolph Nov 1 '15 at 21:16
• @DavidCarlisle Hmm, I’d have preferred a solution which does that automatically without me having to manually insert non-semantic control code into my document. Nov 1 '15 at 21:39
• @KonradRudolph if you want it to be automatic then you need to say when it should do something, and what that thing is. \flushbottom says to stretch any glue on the page to make the bottom line come to the bottom. Now you can't just tell TeX don't always do that, do something else, sometimes, if it looks nicer... You can of course adjust the amount of stretch between paragraphs and at the bottom of the page to achieve various effects, it may be that some of those effects are desirable... Nov 1 '15 at 21:45

With this trick you'll get a \textheight so that each page contains an integer number of lines (equal to what you'd get without the trick)

\documentclass[12pt]{book} % or 10pt or 11 pt
\usepackage{setspace}
\setstretch{1.15}

\setlength{\dimen0}{\textheight}
\divide\dimen0\baselineskip
\setlength{\textheight}{\number\dimen0 \baselineskip}

\usepackage{lipsum}

\begin{document}
\lipsum
\end{document}


Alternatively, you can load the geometry package and use its option heightrounded (but this would change also other page parameters).

• What do youn mean with "equal to what you'd get without the trick"? Jul 31 '12 at 16:48
• @lpdbw The same number of lines. Jul 31 '12 at 19:32
• @lpdbw This confused me, too. I made it clear after I realized this trick actually cuts some text height but keeps the same number of lines. For example, if text height is 502 pt while each line height is 10 pt, using this trick would cut text height to 500 pt, but keep the same number of lines (50). Jul 30 '20 at 19:44
• @Cyker We say (in Italian) “you cannot have your wine barrel full and your wife drunk”: you have to yield somewhere. A 2pt cut in the text height goes unnoticed (it's less than 1mm), and TeX will not complain that many pages are underfull. Jul 30 '20 at 19:51
• @egreg Guess what? I should say text height is 512 pt and line height is 100 pt. In that case (assuming top skip is 10 pt), TeX does give underfull warnings, and the trick would cut text height from 512 pt to 510 pt. That is a 2pt cut. Jul 30 '20 at 20:25