I use \widowpenalty
and \clubpenalty
to avoid widow and orphan lines. However, latex automatically increases the line spacing of my document. How do I prevent the increment of line spacing while using these two variables?
1 Answer
Changing \widowpenalty
and \clubpenalty
does not alter the line spacing as the following example shows:
\documentclass{article}
\usepackage{kantlipsum}
\begin{document}
\noindent
\begin{minipage}{.5\textwidth}
\widowpenalty0
\clubpenalty0
\kant[1]
\end{minipage}%
\begin{minipage}{.5\textwidth}
\widowpenalty10000
\clubpenalty10000
\kant[1]
\end{minipage}
\end{document}
However, because increasing these penalties makes it harder for LaTeX to find good page breaks, additional spacing must appear somewhere to fill out the pages. Depending on your settings, this might be at the bottom of pages, between sections or paragraphs etc. Basically, the space has to go somewhere in order to ensure that, for example, an additional line or so gets pushed past a page break when needed.
Without an example, it isn't possible to say precisely what is going on in your case or how you might alter it.
But note that the more restrictions you place on LaTeX, the worse the results will be in general so constraining typesetting to exclude widows and orphans will force LaTeX to make worse choices than it otherwise would regarding other aspects of the document, probably including uneven and excessive spacing in some cases.
-
I think it was because I set geometry to 1 in on each side. When I use \newpage to the place where I want to separate the paragraph, everything works fine. When I don't set the bottom margin in geometry, the paragraph go pass the bottom line Commented May 14, 2016 at 1:03
-
1That has nothing to do with line spacing. But it does show that you are almost certainly misusing
geometry
by keeping secrets from it and then being surprised it doesn't know them. If you use geometry, you should not change any page layout dimensions manually. You should change them exclusively withgeometry
.– cfrCommented May 14, 2016 at 1:14 -
geometry
has aheightrounded
option that can help with added vertical spaces (sort of). It makes the text area an integral multiple of\baselineskip
.– TH.Commented May 14, 2016 at 15:26
setspace
to set one-half or double spacing or a custom increase of your choice.\raggedbottom
to the preamble?