bug-texinfo
[Top][All Lists]
Advanced

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

Re: `@center @image` removes leading vertical space


From: Gavin Smith
Subject: Re: `@center @image` removes leading vertical space
Date: Sat, 1 Oct 2022 11:53:19 +0100

On Fri, Sep 30, 2022 at 02:41:42PM +0000, Werner LEMBERG wrote:
> As can be seen, the `@center` macro swallows the vertical space before
> the image, which is a bug, I guess.

I have committed the fix similar to the following, although I expect it
is not perfect:

diff --git a/doc/texinfo.tex b/doc/texinfo.tex
index e4b8f379f6..b13195e660 100644
--- a/doc/texinfo.tex
+++ b/doc/texinfo.tex
@@ -9351,11 +9351,7 @@ might help (with 'rm \jobname.?? \jobname.??s')%
   \makevalueexpandable
   \ifvmode
     \imagevmodetrue
-  \else \ifx\centersub\centerV
-    % for @center @image, we need a vbox so we can have our vertical space
-    \imagevmodetrue
-    \vbox\bgroup % vbox has better behavior than vtop here
-  \fi\fi
+  \fi
   %
   \ifimagevmode
     \medskip
@@ -9369,6 +9365,11 @@ might help (with 'rm \jobname.?? \jobname.??s')%
     \vtop\bgroup \kern -\capheight \vskip-\parskip
   \fi
   %
+  \ifx\centersub\centerV
+    % Enter vertical mode so we can add vertical space
+    \vbox\bgroup\medskip\vskip\parskip
+  \fi
+  %
   % 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


(I separated out the code for @center @image as I found it hard to
understand all the possibilities otherwise.)

I checked with this change that

@center aaa @image{image,4cm}

had the text lined up with the bottom of the image, as is the case
an @image in a paragraph (outside of @center).  \vbox has to be used
instead of \vtop for this to happen.

The top margin of @center @image at the top of a page may be slightly
wrong with this change.  I couldn't think how to make this correct without
breaking the '@center aaa @image{image,4cm}' use case.  Please report
if it still looks wrong.

You may notice that @center @image is still slightly closer than @image after
this change, but it looks acceptable to my eyes.

This tighter spacing  may be to do with @center itself, and not with @image.
You can check with the input below that the @center'd "text" is closer
to the text above it, as if it was part of the first paragraph with
the same baselineskip, while the second "text" has a paragraph skip
before it.

I do not think we should change @center itself to avoid changing the
spacing for @center on a title page when used with text.

\input texinfo

blablabla blablabla blablabla blablabla
blablabla blablabla blablabla blablabla
blablabla blablabla blablabla blablabla
blablabla blablabla blablabla blablabla
blablabla blablabla blablabla blablabla
blablabla blablabla blablabla blablabla
blablabla blablabla blablabla blablabla
blablabla blablabla blablabla blablabla
blablabla blablabla blablabla blablabla
blablabla blablabla blablabla blablabla
blablabla blablabla blablabla blablabla
blablabla blablabla blablabla blablabla
blablabla blablabla blablabla blablabla
blablabla blablabla

@center text

blablabla blablabla blablabla blablabla
blablabla blablabla blablabla blablabla
blablabla blablabla blablabla blablabla
blablabla blablabla blablabla blablabla
blablabla blablabla blablabla blablabla
blablabla blablabla blablabla blablabla
blablabla blablabla blablabla blablabla
blablabla blablabla blablabla blablabla
blablabla blablabla blablabla blablabla
blablabla blablabla blablabla blablabla
blablabla blablabla blablabla blablabla
blablabla blablabla blablabla blablabla
blablabla blablabla blablabla blablabla
blablabla blablabla

text

@bye




reply via email to

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