LATEX-L Archives

Mailing list for the LaTeX3 project


Options: Use Classic View

Use Monospaced Font
Show Text Part by Default
Show All Mail Headers

Topic: [<< First] [< Prev] [Next >] [Last >>]

Print Reply
Frank Mittelbach <[log in to unmask]>
Thu, 22 Sep 2011 19:16:11 +0200
text/plain (150 lines)
Am 21.09.2011 21:55, schrieb Joseph Wright:
> On 21/09/2011 19:36, Frank Mittelbach wrote:
>> Am 21.09.2011 18:48, schrieb Joseph Wright:
>>> On 21/09/2011 17:34, Bruno Le Floch wrote:
>>>> Context uses it in \keeplinestogether, but I don't see why they
>>>> couldn't have used \clubpenalties instead. I don't understand the
>>>> difference between \interlinepenalties and \clubpenalties as described
>>>> in etex_man:
>>>> - the ith interline penalty value is used after line i of the paragraph;
>>>> - the ith club penalty value is used after line i of a partial
>>>> paragraph;
>>> My reading of this was that the variation comes down to whether there is
>>> any display math about, but in such a case I'm doubtful you'd want to
>>> 'keep together' in any case. As you say, in most realistic circumstances
>>> \clubpenalties seems to be quite usable, as you have to start from line
>>> 1 with \interlinepenalties too.
>> I beg to disagree. The two arrays serve different purposes and in fact
>> \insertpenalties is the one that is more useful (and was the original
>> reason for providing the this additional functionality (the others are
>> more an afterthought to make thing orthogonal).
>> Main use case:
>>    Ensure that after a section x lines are kept together with the section
>> for this use have to use \insertpenalties as you do *not* want to
>> restart counting after a displayed equation, but you just want x-lines
>> once. (in that case you need a mechanism to restore the default status
>> after the first paragraph, as LaTeX today does (or rather attempts as it
>> not always works in TeX) with \clubpenalty for ensuring 2 lines after a
>> heading)
>> Minor use case:
>>    At the beginning of a paragraph (or after a displayed equation as that
>> is visually simiar) you want at least 2 lines but preferably 3) then
>> something like
>>   \clubpenalties = 2 10000 8000
>> That would be a setting you could use for a whole range of paragraphs or
>> even for a whole document.
>> you can think of others also in combination with \insertpenalties
> (I'm assuming you mean '\interlinepenalties' throughout.)

I'm sorry, yes of course I meant the latter

> I guess this partly depends on your view on display stuff.

don't think so, the display stuff is a bit ugly, granted, but it doesn't 
change the fact that \interlinepenalties refers within a single 
paragraph only to a fixed number of lines counted from the beginning 
while \clubpenalties get restarted after each interrupting display and 
that is (depending on the use case) not necessarily what you are looking 

> 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). That is just the way it is. It 
makes sense for single line displayed equations but if you have a set of 
equations then that counter clearly ends up being off

> Do we go with a
> grid-typesetting approach and measure its eight, divide by the text lien
> height and use the result? Do we ignore it?

real grid typesetting needs to do something like the above (which is 
what I have done in xor for example). But that is not directly related 
to the \interlinepenalties \clubpenalties question which is about 
holding certain lines together or allowing breakpoints with a certain 
> I guess the other problem I have is that the generalisation
> \interlinepenalty =>  \interlinepenalties seems a bit odd.

it is odd in the sense that \interlinepenalty applies to all lines and 
\interlinepenalties only to the first n lines. While in contrast 
\clubpenalty and \widowpenalty refer only to single lines

> 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.

So on the whole the generalization is odd in all cases, but that doesn't 
mean it isn't useful.

  On the other hand,
> \interlinepenalty is a 'floating' idea with no link to the position in a
> paragraph, whereas \interlinepenalties does have to start at the beginning.
> 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