groff
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

RE: [Groff] Short Orphan Lines


From: Ted Harding
Subject: RE: [Groff] Short Orphan Lines
Date: Thu, 25 Mar 2004 21:48:02 -0000 (GMT)

On 25-Mar-04 Andrew Piziali wrote:
> Ted, you wrote:
>>   [...]
>>   Tricky!  There is no built-in "widow" control, and making this
>>   automatic would require re-writing the paragraph macros.  "Orphan"
>>   control (preventing the last line on the page being the first line
>>   of a new paragraph) is quite easy: all you need to do is to follow
>>   the new paragraph request (e.g. .PP) with something like
> 
>>   .PP
>>   .ne 2
>>   Text of paragraph ...
> 
>>   which would trigger a page break unless there was space for at least
>>   two lines remaining (allowing for additional space taken by
>>   footnotes etc.).
> 
> Is there any reason I shouldn't just wrap .PP with my own paragraph
> macro and use it instead?
> 
>         .de Para
>         .  PP
>         .  ne 2
>         ..

This would work fine -- but of course only for the above purpose
(preventing the first line of a paragraph being the last line on
a page).
> 
>>   One way to handle your problem, which requires "manual intervention"
>>   and is therefore far from ideal, is to again use something like ".ne
>>   2", where you place this in the input text somewhere in the text
>>   which gets printed out as the last line but one (or last but two,
>>   with ".ne 3", if you prefer) of the paragraph.
> 
> As you point out later, this is not really a good solution because
> final formatting responsibility is shifted from groff to the author. 
> As soon as the text is changed, is may no longer work.
> 
> Given the size of the document (200+ pages), I really need an automated
> solution.  Hence, the .Para macro above is appealing.

But unfortunately not for preventing the last line of a paragraph
being the first line on a page ... As Robert Goulding just reminded
us, there was code for "widow control" (which is this problem) in
James Clark's original groff code; but I think it was "draft code"
and was never compiled into releases.

I agree with you that "final formatting responsibility is shifted
from groff to the author". However, this is not altogether to be
ruled out; quite often, a nasty bit of formatting is mended by
slightly editing the text. For instance, I don't myself like the
last line of a paragraph (even when it is all on one page) being
just one short word; so I will re-word something somewhere so that
it gets pulled back to the previous line. Or, I don't like "Dr
Zhivago" being split across two lines, so I will mend that too.
But all this is for the final version: as you observe, if you do
this sort of thing, and then make substantial changes later, it
will probably all get thrown out of alignment anyway!

However, if you do use the solution

  .PP
  Text of paragraph ....
  Text which lies within
  .ne 2
  the last line but one when printed,
  and the last line.

then the ".ne 2" will be OK so long as you don't add anything
to the paragraph after "the last line." -- if the paragraph
gets shifted by text changes elsewhere so that ".ne 2" is not
triggered, then either the whole paragraph is on one page, or
two or more lines go over to the next page in the natural course
of formatting without ".ne 2" being activated, either of which
is fine. So possibly the issue of subsequent text changes may not
often be a problem.

Comments from others will be welcome!

Best wishes to all,
Ted.


--------------------------------------------------------------------
E-Mail: (Ted Harding) <address@hidden>
Fax-to-email: +44 (0)870 167 1972
Date: 25-Mar-04                                       Time: 21:48:02
------------------------------ XFMail ------------------------------


reply via email to

[Prev in Thread] Current Thread [Next in Thread]