[l2h] problem with vertical alignment of inlined math images

Bruce Miller bruce.miller at nist.gov
Wed Dec 10 15:24:50 CET 2003

Peter Morling wrote:
> Hi,
> there is a problem with the vertical alignment of inlined math images. In
> 'internet explorer' the images is aligned correct according to the middle of
> the text, but when using netscape, mozilla etc. images will be aligned a
> little over the middle of the text alignment.

Yes; surprisingly (to me) gecko (mozilla & newer netscapes) is getting
this wrong.

HTML's align='middle' should mean that the center of the image aligns with 
the baseline of the surrounding text.  l2h generates the image with enough 
padding on the bottom (or top) so that the middle of the image corresponds
to the baseline of the math in it.

However, this attribute has been deprecated in HTML 4: the new prefered way 
is to use CSS. CSS's vertical-align:middle is slightly different: it says 
that the middle of the image should align with the middle of the x-height 
of the surrounding text.  

[Gecko is treating HTML's align='middle' the same as CSS vertical-align:middle.
There's a bug report at http://bugzilla.mozilla.org/show_bug.cgi?id=192077 
On top of that, apparently, some versions of IE are doing right and some wrong! ]

> How do i solve this problem?

That's the catch :>  

The CSS approach is preferable, I think: it generally requires less
padding of the image (although it embeds an assumption about x-height!
but then images don't really work with variable text sizes anyway); 
I believe both IE & Gecko based browsers get CSS vertical-align right;
and CSS is too useful not to use, anyway.

This would require adjusting latex2html's algorithm for boxing up inline 
math images ---  I'm not too anxious to jump into that code myself, at 
the moment ---  The rest is easy: replace " align='middle' " with 
" class='inlinemath' " and add a line to the CSS:
  .inlinemath { vertical-align:middle }

Or, wait for the mozilla folks to fix it.  From the bugzilla log, it 
looks like after some initial resistance, they've accepted that it is a bug.

> Best,
> Peter
> Programmer Peter Morling, University of Southern Denmark
> Department of Statistics, Sdr. Boulevard 23A, DK-5000 Odense C
> Phone (+45) 6550 3399
> _______________________________________________
> latex2html mailing list
> latex2html at tug.org
> http://tug.org/mailman/listinfo/latex2html

bruce.miller at nist.gov

More information about the latex2html mailing list