I recently came across the \goodbreak
command, which seems to indicate to TeX that this is a good place to put a page break. How does it differ from, say \pagebreak[3]
?
1 Answer
The most important difference is that \goodbreak
ends a paragraph, whereas \pagebreak
doesn't. The latter command can be used inside a paragraph and, in this case it instructs TeX to place the vertical penalty (that is, the invitation to break a page) after the line where the command eventually ends up (more precisely, the place is controlled by the end of the word preceding the \pagebreak
command).
Another big difference is that \pagebreak
can be controlled with the optional argument, so it can be adjusted during revisions of the manuscript. Note that the correct way to type it in is either between paragraphs (with a blank line before it) or between words with a space at either end:
... a paragraph ends.
\pagebreak[3]
A paragraph starts ...
... some words \pagebreak[3] and bla bla ...
In the second case, the pagebreak (if taken), will be after the line where “words” ends up.
The \goodbreak
command is one of the relics of plain TeX in LaTeX. It must be included for back compatibility, but it's not really documented. Use it if you know what it does.
Note also that the penalties issued are different:
\pagebreak[0]
issues 0 penalty\pagebreak[1]
issues -51 penalty (\@lowpenalty
)\pagebreak[2]
issues -151 penalty (\@medpenalty
)\pagebreak[3]
issues -301 penalty (\@highpenalty
)\pagebreak[4]
issues -10000 penalty (it's the same for\pagebreak
without optional argument).
The values can be changed by acting on the specified counter.
The penalty issued by \goodbreak
is -500.
-
said, "The values can be changed by acting on the specified counter." What is the specified counter and how do you act on it? Also, it seems like you thought that was obvious; where do I go to learn how to find obvious counter information like that. Sep 5, 2018 at 18:21
-
\goodbreak
a bit strange. One time my document was breaking a new section into a new page for no apparent reason. Giving a\goodbreak
in between actually stopped this page break!