# Uneven vertical spacing between paragraphs

Here's a MWE:

\documentclass{book}
\usepackage{geometry}
\geometry{paperwidth=127mm,paperheight=203mm,totalwidth=92mm,totalheight=165mm}
\usepackage{lipsum}
\begin{document}
\vspace*{5cm}
\lipsum[1][1-8]

\lipsum[1][1-8]

\lipsum[1][1-12]

\lipsum[1][1-9]

\lipsum[1][1-10]

\lipsum[1][1-10]

\lipsum[1][1-12]

\lipsum[1][1-12]

\lipsum[1][1-4]
\end{document}


My point is that there's a lot more vertical space between the paragraphs on page 2 than on page 1 or 3. If I look at pages 2 and 3 side by side, I think that the difference is annoying.

However, it seems pretty obvious that this could be fixed by moving the first line of page 3 to the end of page 2 without creating orphans or widows and without exceeding the available height for page 2. Why doesn't TeX do that?

• Typically \parskip uses (expandable) glue. Use \the\parskip for details. Try using \raggedbottom to make vertical expansion unnecessary. Oct 2 '20 at 16:13
• This is for a book. I can't use \raggedbottom. Oct 2 '20 at 16:42
• Is tex.stackexchange.com/questions/401778/… sort of where you are headed? Note: a better solution might be possible using \pagetotal and \pagegoal. Oct 2 '20 at 17:10
• Not really. I think the solution I describe below is fine with me, though. Thanks. Oct 2 '20 at 17:32

I found something in the Mittelbach/Goossens book (which I admit is on my bookshelf but rarely looked at). I'm not sure if this is the "best" way to do it but it seems to fix my problem. Use this at the beginning of the document:

\newcounter{tempc} \newcounter{tempcc}
\setlength\textheight{165mm-\topskip}
\setcounter{tempc}{\textheight}
\setcounter{tempcc}{\baselineskip}
\setcounter{tempc}{\value{tempc}/\value{tempcc}}
\setlength\textheight{\baselineskip*\value{tempc}+\topskip}


You also need to use the calc package for this to work.

EDIT: As David Carlisle suggested, the heightrounded option of the geometry package provides a similar solution.

• the geometry package will do that for you Oct 2 '20 at 16:58
• @DavidCarlisle Are you referring to the heightrounded option (that I just found in the documentation)? It seems the Mittelbach/Goossens solution produces a more pleasing result. It is also my understanding that heightrounded might enlarge textheight which is not what I want. Oct 2 '20 at 17:17
• Probably. I couldn't remember the name was going to check:-) either way the intention is to ensure that textheight-topskip is a multiple of \baselineskip Oct 2 '20 at 17:23