5

How do I modify the penalty given to a pagebreak between paragraphs? I looked everywhere and could not figure out. If I really need to I can redefine \par but I'm unsatisfied with such a hack.

user21820
  • 868
  • 7
  • 19
  • @Werner: Yes I read that many times already, thanks. – user21820 Jun 18 '15 at 07:40
  • @user21820 So you culd start editing your question for add a MWE. – Aradnix Jun 18 '15 at 08:29
  • @Aradnix: I don't have a particular situation with a specific layout problem. Rather, I would like to modify the penalty I asked about. It seems there is no direct way unlike say \interlinepenalty. – user21820 Jun 18 '15 at 08:42
  • There is no (vertical) penalty inserted after a paragraph. – egreg Jun 18 '15 at 09:00
  • @egreg: So how do I automatically insert a vertical penalty after a paragraph? – user21820 Jun 18 '15 at 09:01
  • By redefining \par. ;-) – egreg Jun 18 '15 at 09:02
  • @egreg: Lol alright so that's the only way? Is there anything I need to beware of while doing so? – user21820 Jun 18 '15 at 09:04
  • Are you using Plain TeX or LaTeX? And what's the reason for such a strange request? – egreg Jun 18 '15 at 09:05
  • @egreg: Because I was trying to design an environment but neither list items nor paragraphs allow me proper control over the page-breaking behaviour. If you really want to know, I want an environment that can be nested and produces an outline-style list that discourages page-break within inner lists more than outer lists, and also prevents page-break between an inner list and its heading. – user21820 Jun 18 '15 at 09:12
  • @egreg: I don't mind either, but I would prefer if it is simple like redefining \par. I hesitate to redefine \par just like that as I don't know what might break. – user21820 Jun 18 '15 at 09:15
  • iiuc, if you plan to use the code within an environment, your redefinition of \par will be kept local to the group, so you shouldn't worry to break things elsewhere. – jarnosc Oct 31 '15 at 22:05
  • @erreka: Thanks for telling me, though actually I want to redefine \par because I want to encourage page-break between paragraphs rather than in the middle, if the paragraph is not too long. – user21820 Nov 01 '15 at 14:10

1 Answers1

6

The penalty for breaking before the \parskip glue inserted between paragraphs is 0, so one possibility is to redefine \par to add a \penalty node before that skip. One problem doing that in latex is that latex redefines \par all the time (after headings and list items, to control breaking and indentation, in parboxes and minipages (to restore the default definition) etc, so you need to coordinate your redefinition with any other macros that are resetting \par.

An alternative way to view the same requirement is that you want to make it more likely that page break happens between paragraphs than mid-paragraph. Given that the inter-paragraph penalty is essentially fixed at 0, rather than change that you can increase the \interlinepenalty to discourage breaking between lines. \interlinepenalty is normally 0 (except after section headings, or in the scope of samepage) So you can increase it to make breaks between paragraphs more likely.

You also need to add some stretchable glue to the page, either by using \raggedbottom or making \parskip or some other glue flexible. If there is no stretchable glue then TeX has no choice in the page breaking, it has to break after the last line that fits on the page, or if the penalty is 10000 so that is not possible it will make an over-full box and over-print the page boundary.

David Carlisle
  • 757,742
  • The problem I had with changing only \interlinepenalty (which I already did) is that it is only one of the many penalties, and I had wanted to be able to encourage page-breaking between paragraphs relative to all other places. In the end I did redefine \par and so far had no issues. – user21820 Nov 24 '15 at 13:34