bug-texinfo
[Top][All Lists]
Advanced

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

Re: bad page breaks and ugly formatting


From: Werner LEMBERG
Subject: Re: bad page breaks and ugly formatting
Date: Fri, 31 Jan 2003 19:19:33 +0100 (CET)

>     If @unnumberedsubsubsec is immediately followed by @deffn,
>     texinfo.tex allows a break right after the title.
> 
> I'll see if it can be fixed, but no promises :).
> If you just write a line of regular text after the section command,
> it should do better.

Well, this is a workaround, not a solution...

>     For example, address@hidden@end deffn' immediately followed by
>     @unnumberedsubsubsec provides more vertical space after the
>     header line than before it.
> 
> Can you send me the source?  Can't debug these things in a vacuum.

As usaual, get groff.texinfo from the groff tarball. :-)

>     Or the other way, wouldn't it be better to limit vertical
>     stretching to avoid such artefacts?
> 
> I don't know any way to do that in TeX -- if there's any stretch at
> all, it will stretch as needed (possibly generating an underfull box
> message).
> 
> I assume there's a huge unbreakable block on the next page, hence
> the large stretching.

Right.

> Might be time to resort to @tex \vfill @end tex before that :).

Hmmm, what about doing this automatically?

  . Compute the height and depth of the @group's vbox.

  . If it doesn't fit on the current page, and if the distance from
    the current position (before the vbox) to the bottom of the page
    is larger than \vfilllimit times the page length, insert \vfill
    before emitting @group's vbox.

A reasonable default value for \vfilllimit is 0.6 or 0.7.  With 0.7,
two pages are adjusted in groff.texinfo; with 0.6, about 10.

Here a patch.


    Werner

======================================================================

--- texinfo.tex.old     Fri Jan 31 16:04:26 2003
+++ texinfo.tex Fri Jan 31 19:14:47 2003
@@ -550,6 +550,15 @@
 % produce a whole line of output instead of starting the paragraph.
 \def\w#1{\leavevmode\hbox{#1}}
 
+\def\vfilllimit{0.7}
+
+\def\setvfilllimit{\parsearg\dosetvfilllimit}
+\def\dosetvfilllimit#1{%
+  \def\vfilllimit{#1}%
+}
+
+\newbox\groupbox
+
 % @group ... @end group forces ... to be all on one page, by enclosing
 % it in a TeX vbox.  We use \vtop instead of \vbox to construct the box
 % to keep its height that of a normal line.  According to the rules for
@@ -571,10 +580,20 @@
   % above.  But it's pretty close.
   \def\Egroup{%
     \egroup           % End the \vtop.
+    \dimen0 = \ht\groupbox
+    \advance\dimen0 by \dp\groupbox
+    \dimen2 = \pageheight
+    \advance\dimen2 by -\pagetotal
+    \ifdim \dimen0 > \dimen2
+      \ifdim \pagetotal < \vfilllimit\pageheight
+        \page
+      \fi
+    \fi
+    \copy\groupbox
     \endgroup         % End the \group.
   }%
   %
-  \vtop\bgroup
+  \setbox\groupbox = \vtop\bgroup
     % We have to put a strut on the last line in case the @group is in
     % the midst of an example, rather than completely enclosing it.
     % Otherwise, the interline space between the last line of the group




reply via email to

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