[l2h] BUG!!!

Ross Moore Ross Moore <ross@ics.mq.edu.au>
Thu, 16 Sep 1999 12:48:31 +1000 (EST)

> Hi folks,
> the attached code works fine with latex. It put a frame around the text,
> the created HTML code is wrong.

Not just wrong, but missing!

> Any idea?
Yes. I discovered 3 places where the latex2html script needs improving.
Firstly, the coding for:  sub do_env_tex2html_nomath_inline
is just plain wrong. Here is what it should be:

sub do_env_tex2html_nomath_inline {
    local($_) = @_;
    my($cmd) = $_;
    if ($cmd=~s/^\\([a-zA-Z]+)//s) { $cmd = $1 };
    return (&translate_commands($_)) if ($raw_arg_cmds{$cmd}<1);
    &process_undefined_environment($env, $id, $_);

Secondly, there is a minor problem with storing the replacement text
for new commands and environments. Trailing white space is being removed.
Normally this does not matter, but occasionally it does;
e.g. when there is a comment-marker at the end of the replacement.

One simple way to fix this is to change the penultimate line of  sub get_next
as follows: 

#    $next =~ s/(^\s*)|(\s*$)//g unless ($what == 4); #don't lose white space on body
    $next =~ s/(^\s*)|(\s*$)//g unless ($what =~ /[14]/); #retain white space in body

I'm going to implement a better solution that removes the comment-marker
sooner, as would happen in TeX.

Finally, a small adjustment to the code that goes into images.tex :

  "\\def\\lthtmlsetinline{\\hbox{\\vrule width.1em\\kerm-.05em\\vtop{\\vbox{%\n" .
	remove this ------------------------------||||||||||||
to get:

  "\\def\\lthtmlsetinline{\\hbox{\\vrule width.1em\\vtop{\\vbox{%\n" .

That negative kern doesn't seem to be doing anything good.
At most it would affect just 1 column of pixels at the left edge of an image.
In the case of an \fbox the left edge of the box is being lost, while removing
the cropping bar that governs the height of the image.

With these changes the example code works correctly, to create an image
of the \fbox and its contents; viz.

Of course it may be that you don't want an image in the HTML,
but have ordinary text with the browser drawing a frame around it.
OK, maybe I'll implement something like this using CSS,
but only for  $HTML_VERSION = 4.0;

This already happens with \framebox and \usepackage{color} with \fcolorbox .
(At least it is supposed to, but Jock McNaughton reported problems,
 which I'll try to fix today.)

Hope this helps,

	Ross Moore

> Best regards
> Andre

[Attachment, skipping...]