You asked,
Do \clubpenalty
or \widowpenalty
extend beyond the paragraph in which they are issued?
In general, the scope of any TeX macro is (the rest of) the group it is set in (or reset in), where "group" is used in the TeX sense of the word. A paragraph break doesn't (usually) trigger "end of group" criterion.
Consider the following example:
\documentclass{article}
\clubpenalty10000
\begin{document}
bla bla bla \the\clubpenalty
\begingroup % start a group
\clubpenalty1000
bla bla bla \the\clubpenalty
\endgroup
$ % start a math group
\clubpenalty100
\mbox{bla bla bla }
\the\clubpenalty
$ % paragraph ends after end of math group
bla bla bla \the\clubpenalty % 10000? 1000? 100?
\end{document}
What do you think the final value of \clubpenalty
is: 100? 1000? 10000?
Two clarifications. First, as David Carlisle has pointed out in a comment, there are some macros -- e.g., \looseness
-- that are reset automatically for each paragraph. For such macros, a paragraph break does (implicitly) act similarly to an end-of-group marker.
Second, if a macro comes into play only while TeX is exercising its paragraph-building algorithm -- \clubpenalty
is an example of such a macro -- it's the value of the macro in force at the very end of the paragraph that is used for that paragraph. In the middle paragraph of the example code shown aove, the math group ends before the paragraph ends. Hence, the value of \clubpenalty
which gets used for that paragraph is 10000, not 100.
\linebreak
where you want a line to break. or \nopagebreak or whatever (but often its better to alter the line breaking than keep the linebreaking and break the page at a different place)