Very often you can find solutions by changing the penalty. One is
widowpenalty. However what are penalties and is there a small list of every defined penalty.
There is a German site which does exactly this.
Penalties are the main value that TeX tries to minimise when line or page breaking, They may be inserted explicitly (
the penalty for breaking a page after a line within a paragraph
the penalty for line breaking at an automatically inserted hyphen
the penalty for line breaking at an explicit hyphen
the penalty for breaking a line at a binary operator
the penalty for breaking a line at a relation
extra penalty for breaking after first line of a paragraph
extra penalty for breaking before last line of a paragraph
extra penalty for breaking before last line before a display math
extra penalty for page breaking after a hyphenated line
penalty for breaking before a display
penalty for breaking after a display
penalty for splitting an insertion (can only be split footnote in standard LaTeX)
e-tex adds some additional penalties (that are not set by default in LaTeX) but are supported by all three of the major engines
An extension to
An extension of
An extension of
An extension of
XeTeX supports one additional primitive penalty:
The full documentation of which is Inter-character linebreak penalty I believe it is the penalty inserted between characters for Asian typesetting which typically doesn't use inter-word spaces.
Other penalties are inserted by the format for example LaTeX defines a count
but locally arranges that
which are the values used by
Note penalties are not just numeric values they are actual nodes that are inserted into the horizontal or vertical list. they can be inspected with
For example this bit of LaTeX which tries to insert italic corrections without disturbing the penalties in the horizontal list
This is part of all the commands such as
The statement above that TeX tries to minimise penalties is in fact a simplification. For line breaking, the actual quantity that is minimised is demerits which is (more or less) the sum of the squares of the penalties associated with the linebreaks in a paragraph and the badness of each line (which is a measure of how much white space has been stretched beyond its specified limits) plus three additional demerit parameters as described below. The exact formula is in the TeXBook, but isn't usually relevant.
The three demerit parameters and the default values given to them by LaTeX are:
Additional demerit added to the paragraph for each pair of consecutive lines ending in a discretionary (typically a hyphen).
Additional demerit added if the penultimate line ends with a discretionary.
Additional demerit added for pairs of "incompatible" lines (ie a tight line in which white space is squeezed next to a loose line in which white space is stretched.)
Note, the values of demerit parameters are typically large (they combine with the square of penalty and badness units) also demerits are just a value used in the line breaking calculation. Unlike penalties they do not correspond to nodes that may be manipulated in TeX lists.
Penalties are used by TeX for controlling the line and page break routines. Some of them are inserted implicitly, others can be added by the user (usually via macros). A penalty issued in horizontal or math mode will influence line breaking, one issued in vertical mode will influence page breaking decisions.
The list of "implicit penalties" can be found in the TeXbook (page 272):
(I've added "h", "m" and "v" to show which ones are added in horizontal, math and vertical mode).
Their default values can be looked at by the usual
The LaTeX kernel adds to this list several other penalty parameters:
They are used either to insert penalties in appropriate spots (
It's the case, for instance, of
Of course one can directly insert a penalty manually; for example
which inhibits a page or line break if found respectively in vertical or horizontal mode.
However one should keep in mind that penalties are discardable items, so they disappear at page or line breaks (if not used for triggering the break), but discussing this would bring too far. TeX also inserts automatically
Thank you for your interest in this question. Because it has attracted low-quality answers, posting an answer now requires 10 reputation on this site.
Would you like to answer one of these unanswered questions instead?