Tell me more ×
TeX - LaTeX Stack Exchange is a question and answer site for users of TeX, LaTeX, ConTeXt, and related typesetting systems. It's 100% free, no registration required.

If a displayed equation is close to the bottom of the page, TeX likes to insert a page break even if the current paragraph contains only one more line after the equation, as e.g. in

... it follows that
\[
  a_n = ...
\]
for all $n\in\N$.

(And this happens although there is enough space in the current page.) The problem appears to be that TeX doesn't regard a widow line following a displayed equation as a widow.

Since I don't like this behaviour, I came up with the following workaround: I write \avoidbreak before the closing \], where \avoidbreak is defined by

\newcommand{\avoidbreak}{\postdisplaypenalty=100}

Of course it's a nuisance that now I have to write \avoidbreak at every instance of a possibly "bad" page break. I don't want to globally define \postdisplaypenalty=100 since this would discourage page breaks after displayed equations even at the end of a paragraph: For a new paragraph right after the display it is quite alright if it starts on the next page (even if it consists of only one line, see also the MWE below).

Now my question: Is there a clean solution that works without having to manually add something like \avoidbreak? I'd appreciate some code that I can just add to my preamble.

\documentclass{article}
%Remove the following % to get "one line of text" onto the first page:
%\postdisplaypenalty=100
\setlength\textheight{3.65cm}
\setlength\textwidth{4cm}
\begin{document}
Two lines of text followed by a formula
\[a=b\]
Two lines of text followed by a formula
\[a=b\]
%It doesn't matter if you have a new line at this place or not!
%I only want to avoid the page break if no new paragraph is started here.
one line of text

New paragraph
\end{document}

(Let me mention that TeX has a \displaywidowpenalty parameter, but this one is about widows before displayed equations.)

share|improve this question

1 Answer

I can't see any problems with setting \postdisplaypenalty globally—if you encounter any problems, they are probably signs of a package bug. The default values are probably fine for Knuth; but these settings are implemented as parameters because you should customize them.

share|improve this answer
Setting \postdisplaypenalty globally should certainly not cause any errors. I meant side effects that are not obvious when looking at the output. (After all, the behaviour I complain about is also not that obvious.) I do agree with the point you make in the second sentence: Accordingly, I'll extend my comment about Knuth. – Hendrik Vogt Sep 19 '10 at 17:00
Please note that I reformulated my question, among other things to explain why changing \postdisplaypenalty globally is not so good. – Hendrik Vogt Mar 9 at 20:15

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.