4

One technique for achieving an even text height, besides LaTeX's default method of allowing extra space between paragraphs, is to adjust the leading by a small amount (on the order of 0.5pt).

I've attempted to achieve this using the following,

\setlength{\baselineskip}{12pt plus 0.6pt minus 0.3pt}

but I haven't been able to achieve an even text height.

I have tried using this strategy in conjunction with three methods of setting the leading, independently of each other: with the setspace and leading packages, and by using \renewcommand{\baselinestretch}{1.2}.

Below is a minimal example (using LuaLaTeX).

\documentclass[openany,12pt]{book}

\usepackage{lipsum}
\usepackage{fontspec}

\clubpenalty=0
\brokenpenalty=0
\interlinepenalty=0
\widowpenalty=3000

\setlength{\parskip}{0pt}
\setlength{\baselineskip}{12pt plus 1pt minus 0.5pt}
\renewcommand{\baselinestretch}{1.2}

\flushbottom

\setmainfont{Times New Roman}

\begin{document}
\section{One}
\lipsum

% More text to get the section starting in the middle of a page
Sed commodo posuere pede. Mauris ut est. Ut quis purus. Sed ac odio. Sed vehicula hendrerit sem. Duis non odio. Morbi ut dui. Sed accumsan risus eget odio. In hac habitasse platea dictumst. Pellentesque non elit. Fusce sed justo eu urna porta tincidunt. Mauris felis odio, sollicitudin sed, volutpat a, ornare ac, erat. Morbi quis dolor. Donec pellentesque, erat ac sagittis semper, nunc dui lobortis purus, quis congue purus metus ultricies tellus. Proin et quam. Class aptent taciti sociosqu ad litora torquent per conubia nostra, per inceptos hymenaeos. Praesent sapien turpis, fermentum vel, eleifend faucibus, vehicula eu, lacus.

\section{Two}
\lipsum
\end{document}
lockstep
  • 250,273
Micah Walter
  • 452
  • 4
  • 15
  • 1
    This can't work, because when doing \set@fontsize, the macro \size@update does \baselineskip=\baselineskip\f@linespread\baselineskip (where \baselineskip has already been computed based on the stated font size), which kill stretchability and shrinkability. – egreg Sep 19 '14 at 19:47

1 Answers1

6

A flexible baseline skip is generally not considered a good choice. On the other hand, you're already spoiling the typesetting with \linespread{1.2}, so this can't do too much damage anyway.

On the other hand, the setting you're trying can't work, let's see why. One has to know that the font parameters are set up, partly, by the macro

\size@update

that is defined by

2346 \def\set@fontsize#1#2#3{%
2347     \@defaultunits\@tempdimb#2pt\relax\@nnil
2348     \edef\f@size{\strip@pt\@tempdimb}%
2349     \@defaultunits\@tempskipa#3pt\relax\@nnil
2350     \edef\f@baselineskip{\the\@tempskipa}%
2351     \edef\f@linespread{#1}%
2352     \let\baselinestretch\f@linespread
2353       \def\size@update{%
2354         \baselineskip\f@baselineskip\relax
2355         \baselineskip\f@linespread\baselineskip
2356         \normalbaselineskip\baselineskip
2357         \setbox\strutbox\hbox{%
2358           \vrule\@height.7\baselineskip
2359                 \@depth.3\baselineskip
2360                 \@width\z@}%
2361         \let\size@update\relax}%
2362   }

and line 2355 is responsible for the disparition of the stretchability and shrinkability of the glue you defined, because any assignment such as

<skip register>=<factor><skip register>

coerces the <skip register> to a <dimen>. See Scaling a glue in TeX for more information.

Scaling the glue is not really necessary for your case; one can simply add a fixed amount of stretchability and shrinkability:

\usepackage{etoolbox}
\makeatletter
\patchcmd\set@fontsize
  {\f@linespread\baselineskip}
  {\f@linespread\baselineskip plus 0.6\p@ minus 0.3\p@}
  {}{}
\makeatother

would solve the problem.

\documentclass[openany,12pt]{book}

\usepackage{fontspec}
\usepackage{etoolbox}
\usepackage{lipsum}

\setlength{\parskip}{0pt}
\renewcommand{\baselinestretch}{1.2}

\makeatletter
\patchcmd\set@fontsize
  {\f@linespread\baselineskip}
  {\f@linespread\baselineskip plus 0.6\p@ minus 0.3\p@}
  {}{}
\makeatother

\flushbottom

\setmainfont{Times New Roman}

\begin{document}

\section{Look: \texttt{\the\baselineskip}}

\texttt{\the\baselineskip}

\lipsum

% More text to get the section starting in the middle of a page
Sed commodo posuere pede. Mauris ut est. Ut quis purus. Sed ac odio. Sed vehicula hendrerit 
sem. Duis non odio. Morbi ut dui. Sed accumsan risus eget odio. In hac habitasse platea 
dictumst. Pellentesque non elit. Fusce sed justo eu urna porta tincidunt. Mauris felis odio, 
sollicitudin sed, volutpat a, ornare ac, erat. Morbi quis dolor. Donec pellentesque, erat ac 
sagittis semper, nunc dui lobortis purus, quis congue purus metus ultricies tellus. Proin et 
quam. Class aptent taciti sociosqu ad litora torquent per conubia nostra, per inceptos 
hymenaeos. Praesent sapien turpis, fermentum vel, eleifend faucibus, vehicula eu, lacus.

\section{Two}
\lipsum

\end{document}

enter image description here

As you see the plus and minus components are added to each font size.

egreg
  • 1,121,712
  • 1
    Believe me, I'm using glue between lines as a last resort—and also, the particular font I'm using (at the size I'm using) does need a nominal 1.2 spacing to avoid a black mess! If I can't get a grid to work out, I think slight amounts of variation between lines is much better than TeX's default of extra space between paragraphs, which is quite noticeable. – Micah Walter Sep 19 '14 at 20:21
  • 1
    @JohnPeyton With this enormous leading, the stretching and shrinking will go unnoticed. It would be quite evident with tight typesetting. Believe me: \linespread{1.2} is enormous. ;-) – egreg Sep 19 '14 at 20:23