2

In this answer, the author is using the command \widowpenalties=3 10000 10000 150.

While I can understand what \widowpenalty is doing, I found no documentation for \widowpenalties3 nor for \widowpenalties4. I looked in the TeXBook, in the Companion book, in source2e.pdf, but they don't explain anywhere what those commands are doing, and how they work exactly, with precise details.

Could you please shed some light on this notion?

Watson
  • 890
  • 1
    It's a penalty to avoid having widow lines. – Bernard Feb 15 '21 at 20:10
  • @Bernard : yes, I definitely can guess this, but have no idea how they precisely work. – Watson Feb 15 '21 at 20:13
  • There are some explanations in TeX by Topic, p.238. Maybe it will help? – Bernard Feb 15 '21 at 20:20
  • OK, it seems to be a duplicate. Then the search function of this website does not work properly. I typed "widowpenalties" with quotes, and found only 1 result, which is not even the relevant question linked here! – Watson Feb 15 '21 at 20:55
  • It can be found on CTAN, or you can install it with your distribution package manager. – Bernard Feb 15 '21 at 21:05
  • 1
    @Watson Search not working properly is a common problem on stack exchange sites in general. I usually have better luck with google, sometimes prepending "site:https://tex.stackexchange.com" (with the https on the url). Although in this case, I'm getting 61 results for that search on this site, and the 7th is the one we want. (And the first is now this question.) – Teepeemm Feb 15 '21 at 22:08
  • This is 1599 in e-TeX documentation here: https://v1.overleaf.com/latex/examples/typeset-the-source-code-documentation-for-tex-e-tex-or-pdftex/qkgfgyspnhcv.pdf, but no detail is given! – Watson Feb 23 '21 at 17:49

1 Answers1

3

widowpenalties is an e-tex extension so not mentioned in the texbook. Classic tex has \widowpenalty which is a penalty for breaking a page at the last line of a paragraph

e-tex has a simple extension to a list

\widowpenalties 3 1001  1002 1003

would declare a list of 3 penalties with 1001 being used on the last line, 1002 on the last but one and 1003 being used ones before that. as for \parshape the last value is repeated)

You can similarly use the list \clubpenalties to control page breaking in the initial lines of a paragraph not just after the first line.

This list all the penalty valued parameters available in classic tex and its extensions.

What are penalties and which ones are defined?


so taking this example

\documentclass{article}

\begin{document}

\showoutput \showboxdepth3

\clubpenalties 3 1001 1002 0 \widowpenalties 3 2001 2002 0 \interlinepenalty=5

some text some text some text some text some text some text some text some text some text some text some text some text some text some text some text some text some text some text some text some text some text some text some text some text some text some text some text some text some text some text some text some text some text some text some text some text some text some text some text some text some text some text some text some text some text some text some text some text some text some text some text some text some text some text some text some text some text some text some text some text some text some text some text some text some text some text some text some text some text some text some text some text some text some text some text some text some text some text some text some text some text some text some text some text some text some text some text some text some text some text some text some text some text some text some text some text some text some text some text some text some text some text some text some text some text some text some text some text some text some text some text some text some text some text

the log shows the lines as follows

...\hbox(6.15079+0.0)x345.0, glue set 0.55896 [] line 1
...\penalty 1006 interline + first club
...\glue(\baselineskip) 5.84921
...\hbox(6.15079+0.0)x345.0, glue set 0.08807 [] line 2
...\penalty 1007 interline + 2nd club
...\glue(\baselineskip) 5.84921
...\hbox(6.15079+0.0)x345.0, glue set 0.26903 [] line 3
...\penalty 5 interline
...\glue(\baselineskip) 5.84921
...\hbox(6.15079+0.0)x345.0, glue set 0.08807 [] line 4
...\penalty 5 interline
...\glue(\baselineskip) 5.84921
...\hbox(6.15079+0.0)x345.0, glue set 0.26903 []
...\penalty 5 interline
...\glue(\baselineskip) 5.84921
...\hbox(6.15079+0.0)x345.0, glue set 0.08807 []
...\penalty 5 interline
...\glue(\baselineskip) 5.84921
...\hbox(6.15079+0.0)x345.0, glue set 0.26903 []
...\penalty 5 interline
...\glue(\baselineskip) 5.84921
...\hbox(6.15079+0.0)x345.0, glue set 0.08807 []
...\penalty 5 interline
...\glue(\baselineskip) 5.84921
...\hbox(6.15079+0.0)x345.0, glue set 0.26903 []
...\penalty 5 interline
...\glue(\baselineskip) 5.84921
...\hbox(6.15079+0.0)x345.0, glue set 0.08807 []
...\penalty 5 interline
...\glue(\baselineskip) 5.84921
...\hbox(6.15079+0.0)x345.0, glue set 0.26903 []
...\penalty 5 interline
...\glue(\baselineskip) 5.84921
...\hbox(6.15079+0.0)x345.0, glue set 0.08807 []
...\penalty 5 interline
...\glue(\baselineskip) 5.84921
...\hbox(6.15079+0.0)x345.0, glue set 0.26903 []
...\penalty 5 interline
...\glue(\baselineskip) 5.84921
...\hbox(6.15079+0.0)x345.0, glue set 0.08807 []
...\penalty 2007 interline + 2nd widow ...\glue(\baselineskip) 5.84921
...\hbox(6.15079+0.0)x345.0, glue set 0.26903 []
...\penalty 2006 interline + 1st widow ...\glue(\baselineskip) 5.84921
...\hbox(6.15079+0.0)x345.0, glue set 256.5554fil [] last line of text

David Carlisle
  • 757,742