I need to bind single line paragraph and math display with \nobreak
. \clubpenalty
, \widowpenalty
, \displaywidowpenalty
has no effect because it's a single line and there is \par
between math display. Uncommenting \nobreak
the result is fine. Single line goes to the next page.
Manual intervention to tex file is not an option.
MWE:
\documentclass{article}
\usepackage[paperwidth=5cm,paperheight=3cm]{geometry}
\geometry{verbose,tmargin=.5cm,bmargin=.5cm,lmargin=.5cm,rmargin=.5cm}
\clubpenalty=10000
\widowpenalty=10000
\displaywidowpenalty=10000
\begin{document}
Long long long long long long long long long text.
Single line paragraph:
%\nobreak
\begin{equation}
a+b
\end{equation}
\end{document}
Bad output:
Perfect:
I am using Luatex and with post_linebreak_filter
callback I could recognise single line paragraphs, but I don't see math in here.
I want to create penalty node and add it before display.
mlist_to_hlist
could find math but I don't see any correlation with other callbacks. It seems this callback works later.
Any ideas would be wery helpfull