Advantages of using package "nowidow" over \clubpenalty or \widowpenalty

by Dave   Last Updated September 11, 2019 17:23 PM

Consider the following Minimum Working Example (MWE):

\documentclass{book}
\usepackage{blindtext}
\usepackage[all]{nowidow}

\begin{document}
    \blindtext
    \blindtext
    \blindtext
    \blindtext

    This is a sample text to visualize the behavior of useful package nowidow. It clearly shows that only one line visible on the previous page is prevented (what is called the effect of Hurenkind). If there is only one line on the next page, this effect is called Schusterjunge. I hope one can understand the undesired behavior of both typesetting effects. Blabla blub test bla blub bla bla bla and some more blabla to cause LaTeX to produce some Hurenkind.

    \blindtext
\end{document}

Screenshot of the result:

Screenshot of the result

As you can see, the package nowidow prevents the appearance of an ugly single line on the second page. Also it does prevent appearance of one single line on the first page before pagebreak.


The question:

Some similar protective behavior could be caused by setting

\clubpenalty = 10000
\widowpenalty = 10000
\displaywidowpenalty = 10000

in the preamble. What are the advantages of using package nowidow over using these single commands (or vice versa)?



Answers 1


There is a difference.

With the package option defaultlines=<number>, you can set the number of lines that should be kept together; so, with

\usepackage[defaultlines=3,all]{nowidow}

at least three lines will be moved to the next page.

You can get the same effect by loading the package without options and issuing

\setnowidow[3]

By default the package doesn't act on club lines. You can use

\setnoclub[3]

if you prefer to keep at least three lines before a page break.

The package also provides for \nowidow[<number>] to be used at the end of a paragraph in order to locally force <number> lines after the page break. Similarly for \noclub.

egreg
egreg
September 11, 2019 16:45 PM

Related Questions