[l2h] Inline math cropping

Ross Moore ross at maths.mq.edu.au
Wed Feb 25 10:40:10 CET 2004


Hello Jean-Pierre,

On 25/02/2004, at 7:33 PM, Jean-Pierre.Chretien wrote:

>
>>> Date: Wed, 25 Feb 2004 11:36:07 +0900 (JST)
>>> From: Shigeharu TAKENO <shige at iee.niit.ac.jp>
>>> To: latex2html at tug.org
>>> Subject: Re: [l2h] Inline math cropping

>>> So, "inline equation is not aligned on the baseline of the text"
>>> is usual situation in that case.
>
> The math latex code is "... $3 \times 3$ matrices..." which has no
> lower part.
> While setting up a simplified example file, I tested it with Netscape 
> 4.8
> instead of my usual browser (Mozilla 1.5). Alignment is OK, but
> the grey background is visible.


> In fact one of the reasons to shift to Mozilla is that it could deal 
> correctly
> with transparent png, but it clearly does not understand
> the align=MIDDLE alignment directive in the tag.

Yes. That is a known, and now acknowledged, bug in Mozilla, according to
what I've been told.

> Is this a known problem ? Did I miss something in the preferences ?
> Is it Solaris-Sparc specific ?

No. Some time ago the Mozilla developers mistakenly thought that
it would be good to copy the buggy way that M$ IE aligns images inline.
That method makes it impossible to reliably align using "middle"
when the text is allowed to flow with changing window-size.

> So this seems also an issue for the browser point of view:
>  - with Netscape 4.8, the alignment is correct, but the grey background
> of the png is visible (I would like to stick to png);
>  - with Mozilla 1.5, the aligment is uncorrect, but the transparency of
>  the png is correct.

It has taking some convincing to get them to acknowledge the error.
Hopefully a newer version will have both correct alignment,
and full support for PNG images.


> As the original code and the two snaphots are quite small,
> I think I may attach them, I've added a second inline with a lower 
> part.
>
>>>
>>> [snip: patch to control use of .t02 file with a Perl variable]
>
> Thanks a lot for this patch, I will check if it is OK for the
> whole document in question, which has a lot of inline math.
> If I understand correctly how the code works, it is normal to
> have extra space below because it allows to get a correct alignment

Yes; that is correct.

Sometimes a small amount can safely be shaved off;
e.g. at the bottom of  {\cal S} which drops a little
below the baseline, but doesn't warrant  align=middle
because of this.

It is because of things like {\cal S}, and other script letters,
that a small gap is always inserted below the baseline.
If no more than 3 rows of white can be shaved, then this is deemed
to be OK, and simply removes that extra bit --- a good thing.
Then the shaved image is used, with  align=bottom.

However, if the 'shaving' removes too much, as in your example,
then the image is correct already and needs  align=middle .


> of the formulas with align=MIDDLE. Thus I guess that forcing cropping
> may solve the particular problem I mentioned, but may make worse
> other formulas (with integrals e.g.).

Yes, indeed that will happen.
The current mechanism is as good as can be done; assuming:
   a.  the browser aligns correctly
   b.  you don't want to go to the trouble of specifically
locating every paragraph, line and image on the HTML page,
and specifying all the font sizes and line-heights.


> I'll keep the list posted on this.
>
> Regards, and thanks agian for investigating the code.

I'm glad you found it readable and/or understandable.
It's good to have people out there who can hack at the
coding. But please don't distribute this particular hack,
because it will actually create some more problems that
are very hard to solve.


Hope this helps,

	Ross Moore


>
> -- 
> Jean-Pierre

------------------------------------------------------------------------
Ross Moore                                         ross at maths.mq.edu.au
Mathematics Department                             office: E7A-419
Macquarie University                               tel: +61 +2 9850 8955
Sydney, Australia                                  fax: +61 +2 9850 8114
------------------------------------------------------------------------



More information about the latex2html mailing list