How to force widow lines using \widowpenalty?

Suppose I want the last line of a paragraph to be printed on a new page to have a widow line.
Which command is suitable for this?
Neither \widowpenalty nor \clubpenalty works for this.
I do not want use \newpage.

EDIT I've given this to LaTeX but only 0 is on the first page. I thought it should be 0,9 and 1, and only after 1 should be newpage?

\documentclass{article}

\begin{document}
0\\
9\\
1\\
2\\
{\clubpenalty-10000 \par }
2\\
3333333333333333333333333333333333333333333333333333333333
{\widowpenalty-10000 \par}
4444444444444444444444444444444444444444444444444444444444\\
5\\
5\\
7\\
{\widowpenalty-10000 \par}
\end{document}

• If you want that 0, 9, and 1 on the first page, and 2 alone atop the second (that is, if you want the last line of a paragraph to be detached from the others), you want a widow line (one that “has its past behind”), not an orphan line (one that “has its future ahead”). But note that you should remove \\ from what you mean to be the last line, otherwise an additional, empty line will follow. – GuM Nov 15 at 18:09
• @GuM Your intention seems right to me (what you say about "2 alone atop") but it'll be nice if you could specify the code which achieves this.I cannot deduce the code from your English description. – user2925716 Nov 15 at 18:26
• (Untested): 0\\9\\1\\2 {\widowpenalty = -10000 \par}. – GuM Nov 15 at 18:36
• Out of pure curiosity: what’s the purpose of this? Why do you want to have the last line of a paragraph on a new page? – GuM Nov 15 at 22:17

What you want is not an orphan line, but a widow line. An orphan line is when the first line of a paragraph is separated from the rest of the paragraph by a page break.

Just set \widowpenalty to –infinity (which is -10000). This will tell TeX that that is the best place to break the page.

If you want this to affect the entire document, then just write \widowpenalty-10000:

Otherwise, if you want to limit the scope of this assignment to a single paragraph, you need to do it inside a group and make sure that the paragraph ends (with a \par or a blank line) before the group ends, or \widowpenalty will have no effect:

MWE for the first picture:

\documentclass{article}
\usepackage[a6paper]{geometry}
\begin{document}
\widowpenalty-10000
Lorem ipsum dolor sit amet, consectetur adipisicing elit, sed do eiusmod
tempor incididunt ut labore et dolore magna aliqua. Ut enim ad minim veniam,
quis nostrud exercitation ullamco laboris nisi ut aliquip ex ea commodo
consequat. Duis aute irure dolor in reprehenderit in voluptate velit esse
cillum dolore eu fugiat nulla pariatur. Excepteur sint occaecat cupidatat non
proident, sunt in culpa qui officia deserunt mollit anim id est laborum.

Lorem ipsum dolor sit amet, consectetur adipisicing elit, sed do eiusmod
tempor incididunt ut labore et dolore magna aliqua. Ut enim ad minim veniam,
quis nostrud exercitation ullamco laboris nisi ut aliquip ex ea commodo
consequat. Duis aute irure dolor in reprehenderit in voluptate velit esse
cillum dolore eu fugiat nulla pariatur. Excepteur sint occaecat cupidatat non
proident, sunt in culpa qui officia deserunt mollit anim id est laborum.
\end{document}


MWE for the second picture:

\documentclass{article}
\usepackage[a6paper]{geometry}
\begin{document}
Lorem ipsum dolor sit amet, consectetur adipisicing elit, sed do eiusmod
tempor incididunt ut labore et dolore magna aliqua. Ut enim ad minim veniam,
quis nostrud exercitation ullamco laboris nisi ut aliquip ex ea commodo
consequat. Duis aute irure dolor in reprehenderit in voluptate velit esse
cillum dolore eu fugiat nulla pariatur. Excepteur sint occaecat cupidatat non
proident, sunt in culpa qui officia deserunt mollit anim id est laborum.
{\widowpenalty-10000 \par}

Lorem ipsum dolor sit amet, consectetur adipisicing elit, sed do eiusmod
tempor incididunt ut labore et dolore magna aliqua. Ut enim ad minim veniam,
quis nostrud exercitation ullamco laboris nisi ut aliquip ex ea commodo
consequat. Duis aute irure dolor in reprehenderit in voluptate velit esse
cillum dolore eu fugiat nulla pariatur. Excepteur sint occaecat cupidatat non
proident, sunt in culpa qui officia deserunt mollit anim id est laborum.
\end{document}


You need the \par inside the same group as \widowpenalty-10000 because otherwise TeX would restore the value of \widowpenalty to its original value before it breaks the paragraph into lines, and the value of \widowpenalty TeX uses for the current paragraph is the one in force at the time the paragraph is broken into lines.

• Dear Phelype, this is what I did. But please note that I want to have after your anim id est laborum another text and another continuing paragraph so that this very line becomes a real orphan with some text after it! – user2925716 Nov 15 at 13:57
• @user2925716 Sorry, but I'm not sure I understand what you mean... You mean you want the effect of \widowpenalty-10000 to end after the first paragraph? – Phelype Oleinik Nov 15 at 14:00
• I want to have a real orphan. That is a last line of some paragraph from the first page on the second page on the top followed by another paragraph on the second page. And this should be done for every existing page. If you need more explanation please ask me. – user2925716 Nov 15 at 14:03
• I'd do {\widowpenalty-10000 \par} instead of bracing the whole paragraph. – egreg Nov 15 at 14:27
• @user2925716 Yes, it is the same. Both \clubpenalty and \widowpenalty are taken into account when TeX breaks the paragraph into lines. You need the \par with both. – Phelype Oleinik Nov 15 at 16:49