## LATEX-L@LISTSERV.UNI-HEIDELBERG.DE

 Options: Use Forum View Use Monospaced Font Show Text Part by Default Show All Mail Headers Message: [<< First] [< Prev] [Next >] [Last >>] Topic: [<< First] [< Prev] [Next >] [Last >>] Author: [<< First] [< Prev] [Next >] [Last >>]

On 9/22/11, Joseph Wright <[log in to unmask]> wrote:
> On 22/09/2011 18:16, Frank Mittelbach wrote:
>>> For me, I'm
>>> not sure how it fits into the concept of a 'line'. If I have a paragraph
>>>
>>>     text text text text text
>>>     text text text text text
>>>          display
>>>          display
>>>     text text text text text
>>>     text text text text text
>>>
>>> then how many lines does the display part count?
>>
>> In TeX the display counts as 3 lines (regardless of the number of real
>> lines it would occupy in a grid system).
>
> We should document that as part of the galley: I didn't know that :-)
>
>>> The
>>> \clubpenalty =>  \clubpenalties is easy to understand, as both are
>>> related to the start of a paragraph.
>>
>> not quite \clubpenalties refer to the beginning of every partial
>> paragraph. However \clubpenalty only refers to the penalty after the
>> first line of a paragraph.
>
> The interesting thing is that this is not the case. While I can't find
> it in The TeXbook or TeX by Topic, using \tracingall shows that, as the
> e-TeX manual says, \clubpenalty applies to each _partial_ paragraph. For
> example, try
>
> \documentclass{article}
> \usepackage{lipsum}
> \begin{document}
>
> Hello world Hello world Hello world Hello world Hello world Hello world
> Hello world Hello world Hello world Hello world Hello world Hello world
> Hello world Hello world Hello world Hello world Hello world Hello world
> $> y = mx + c >$
> some more text some more text some more text some more text some more
> some more text some more text some more text some more text some more
> some more text some more text some more text some more text some more
>
> \tracingall
>
> \end{document}
>
> and look through the shipped-out box.
>
> So e-TeX\d generalisation is correct, its more that it's somewhat
> different to the one I expected :-)
>
>>> I guess my overall concern is that I've not seen \interlinepenalties
>>> used 'in the wild', whereas \clubpenalties and \widowpenalties do seem
>>> to be in use. Perhaps that's because I'm not really involved in
>>> typesetting maths (and so the effects of display environments pass me
>>> by).
>>
>> the fact that people use it incorrectly doesn't mean we should continue
>> to do so.
>>
>> Point is when I want to have at least 3 lines after a heading I should set
>>
>> \interlinepenalties = 3 10000 10000 1000
>> <first para>
>> \interlinepenalties = 0
>>
>> now if that para contains a display I still get only 3 lines fixed to
>> the heading. However if i would have used \clubpenalties instead above
>> it would have gotten the following situation:
>>
>> \clubpenalties = 3 10000 10000 1000
>> <1 line>  %no break
>> <2 line>  %no break
>> <3 line>
>> <4 line>
>> <display formula (counts as three lines>
>> <8 line>  %no break                       <--- not desired
>> <9 line>  %no break                       <--- not desired
>> <10 line>
>> <11 line>
>> <12 line>
>> \clubpenalties = 0
>>
>>
>> you may of course want one or 2 lines after each display, but that is a
>> different use case above you get this only after a heading
>
> What it seems is needed is an interface that makes sense, i.e. which
> separates out:
>
>   1) The general interline penalty
>   2) The penalty for lines(s) at the start of the paragraph as a whole
>   3) The penalty for lines(s) at the end of the paragraph as a whole
>   4) The penalty for line(s) before display math
>   5) The penalty for line(s) after display math
>   6) Additional penalties between arbitrary lines
>
> or some such structure. This will require a bit of thought, as it means
> synchronising the various primitives in an ordered way.

I'm afraid (3) doesn't exist (not sure). It would be
\the\interlinepenalties <length>-k, where <length> is the number of
lines in the paragraph.

Since we have full control on all of the paragraph-breaking
primitives, would it make sense to start a new TeX paragraph after
each display (with no indentation, nor \everypar hook: the user should
think that it is still the same paragraph), and thus be able to use
\widowpenalties for the true end of the paragraph (checking whether
the partial paragraph ends in \par or )?

> One additional note from my experiments is that \interlinepenalties is
> reset by \par, in the same way \parshape is. I can't see this mentioned
> anywhere. In contrast, neither \interlinepenalty nor \clubpenalties are!
> Quite surprising.

Surprising, indeed.

Bruno