[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: improve vertical positioning of `@image`
From: |
Gavin Smith |
Subject: |
Re: improve vertical positioning of `@image` |
Date: |
Tue, 20 Sep 2022 21:53:34 +0100 |
On Tue, Sep 20, 2022 at 05:13:00AM +0000, Werner LEMBERG wrote:
>
> Right now, at the top of a page, the height of an `@image` box is
> aligned with the base line of the top line. I ask to shift the image
> box up so that it aligns with the top of the top (default text) line,
> since the current behaviour is not optimal for two reasons.
>
> * If there are many images mixed with text, the top of the text block
> is vertically jumping a lot.
>
> * It is a waste of space. For example, LilyPond's notation reference
> has more than 900 pages including almost 1700 images; a raised box
> would save a few pages.
Can you try the following change and report how it looks?
I expect this will also affect spacing for images that are not at the top of
the page.
The attempt is to move the reference point of the \vtop further down the
image, by about the height of a line. I've tested it but don't feel I
fully understand it.
diff --git a/doc/texinfo.tex b/doc/texinfo.tex
index 3c887c9d3c..809e93ebf5 100644
--- a/doc/texinfo.tex
+++ b/doc/texinfo.tex
@@ -9318,6 +9318,11 @@ might help (with 'rm \jobname.?? \jobname.??s')%
\imagexxx #1,,,,,\finish
\fi
}
+
+\newdimen\capheight
+\setbox0=\vbox{\tenrm H}
+\capheight=\ht0
+
%
% Arguments to @image:
% #1 is (mandatory) image filename; we tack on .eps extension.
@@ -9347,7 +9352,7 @@ might help (with 'rm \jobname.?? \jobname.??s')%
%
% Place image in a \vtop for a top page margin that is (close to) correct,
% as \topskip glue is relative to the first baseline.
- \vtop\bgroup\hrule height 0pt\vskip-\parskip
+ \vtop\bgroup \kern -\capheight \vskip-\parskip
\fi
%
% Enter horizontal mode so that indentation from an enclosing