bug-texinfo
[Top][All Lists]
Advanced

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

Re: `@image` doesn't respect top margin of text block


From: Gavin Smith
Subject: Re: `@image` doesn't respect top margin of text block
Date: Tue, 15 Feb 2022 21:26:13 +0000

On Thu, Feb 10, 2022 at 11:12:52AM +0000, Werner LEMBERG wrote:
> 
> As the example shows, an image located at the top of the page doesn't
> correctly respect the top margin of the text block.  If this
> intentional it should be documented.
> 
> 
>     Werner

It's not intentional.  The top margin of the page is set with \topskip
glue.  This is the distance to the baseline of the first line of text,
at the top of the page.  If the first item on the page is an image,
the baseline of that image is used too.  The problem is, I expect,
that the baseline is considered to be at the bottom of the image, not
at the top.

Here's my current work on \image, for this and your other issue (spaces
between images):

diff --git a/doc/texinfo.tex b/doc/texinfo.tex
index e66b7daa73..e2f4660011 100644
--- a/doc/texinfo.tex
+++ b/doc/texinfo.tex
@@ -9393,15 +9393,17 @@ might help (with 'rm \jobname.?? \jobname.??s')%
   \fi\fi
   %
   \ifimagevmode
-    \medskip
+    %\medskip
     % Usually we'll have text after the image which will insert
     % \parskip glue, so insert it here too to equalize the space
     % above and below.
-    \nobreak\vskip\parskip
-    \nobreak
+    %\nobreak
+    \vskip\parskip
+    \vtop\bgroup \hbox to 0pt{}%
+    %\nobreak
   \fi
   %
-  % Leave vertical mode so that indentation from an enclosing
+  % Enter horizontal mode so that indentation from an enclosing
   %  environment such as @quotation is respected.
   % However, if we're at the top level, we don't want the
   %  normal paragraph indentation.
@@ -9430,7 +9432,9 @@ might help (with 'rm \jobname.?? \jobname.??s')%
   \fi
   %
   \ifimagevmode
-    \medskip  % space after a standalone image
+    \par % leave horizontal mode
+    \egroup
+    %\medskip  % space after a standalone image
   \fi  
   \ifx\centersub\centerV \egroup \fi
 \endgroup}


As you can see, here I wrap the image with a vbox, using \vtop, and
insert a zero-height hbox as the first entry as the vbox.  This is intended
to align the top of the image with the baseline of text on the other pages.
This doesn't quite line up the top of the image as there is still the height
of the first line, but this is preferrable to the image reaching up into
the top margin.

You can also see that I've taken out the two \medskip's.  This makes the
images closer together (reported in your other message), but also makes the
images closer to surrounding text.  These may provide acceptable results -
I haven't checked on a Texinfo manual containing many images.

As I haven't spent enough time on it this evening, this change may be
incorrect for @center @image, but perhaps your manual doesn't contain such
a construct and you will be able to test my changes here.  When I have more
time again, I will try to finish this patch.



reply via email to

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