Continuing
prevent page break inside a sentence
I would like to penalize page breaks within a sentence but allow the pagebreaks otherwise as usual. As opposed to the above, I am happy to edit the paragraphs involving sentences that are likely to be broken but should be prevented from being broken. Yes, I understood that LaTeX has no idea about what a sentence is. Here is what I tried:
\documentclass[a4paper]{article}
\usepackage[latin]{babel}
\begin{document}
\vspace*{123ex}
{\interlinepenalty=10000 Lorem ipsum dolor sit amet, consetetur sadipscing elitr, sed diam nonumy eirmod tempor invidunt ut labore et dolore magna aliquyam erat, sed diam voluptua.{\interlinepenalty=0\penalty0\ }%
At vero eos et accusam et justo duo dolores et ea rebum.{\interlinepenalty=0\penalty0\ }%
Stet clita kasd gubergren, no sea takimata sanctus est Lorem ipsum dolor sit amet.{\interlinepenalty=0\penalty0\ }%
Lorem ipsum dolor sit amet, consetetur sadipscing elitr, sed diam nonumy eirmod tempor invidunt ut labore et dolore magna aliquyam erat, sed diam voluptua.{\interlinepenalty=0\penalty0\ }%
At vero eos et accusam et justo duo dolores et ea rebum.{\interlinepenalty=0\penalty0\ }%
Stet clita kasd gubergren, no sea takimata sanctus est Lorem ipsum dolor sit amet.}
\end{document}
However, the result was not very promising:
I would expect LaTeX to find a page break after "amet." and before the middle "Lorem" in the above example automatically. (I tried \pagebreak[i] for various i, and it led nowhere.)
Any idea on how to penalize page breaking inside a sentence?


\parfillskip=0so that you get no space afteramet.in the code in your question it isn't just the outer setting of\interlinepenaltythat does nothing, none of the{\interlinepenalty=0\penalty0\ }do anything either as they are all within a group,\interlinepenaltyis only consulted at end of paragraph so any settings in a group that does not include an end of para do nothing. – David Carlisle Mar 19 '19 at 12:55.addlast sentence.{\parfillskip=0pt\par}\clearpage\noindent Start of new sentence...– David Carlisle Mar 19 '19 at 13:45\pdfsaveposto save the current vertical position after the\parand if that changes give an error message to force you to reconsider this page break, or ... – David Carlisle Mar 19 '19 at 13:56\enlargethispageto squeeze in an extra line, or you can force a break as above. – David Carlisle Mar 19 '19 at 13:59