[l2h] Re: LaTeX2html \fbox problem
Ross Moore
ross@ics.mq.edu.au
Fri, 23 Mar 2001 17:19:03 +1100 (EST)
> > Dear Ross Moore
> >
> > I have a problem with L2H 2k1 version and \fbox -ed text. It will convert
> > only some of them into images and others it doesnt, like
> >
> > \centerline{\fbox{foobar}}
> >
> The problem is with the LaTeX coding for \fbox .
>
> The width of the frame is not included as part of the typeset size
> of an \fbox'd word or phrase.
> This upsets the delicate mechanism that LaTeX2HTML uses to crop
> images to the correct size for accurate positioning.
I may be wrong in attributing this to LaTeX coding;
it may actually be the dvips model for rendering a \vrule which is
causing a problem, by placing the rule slightly too far to the right.
Anyway, whatever the cause, there is a reasonably easy fix,
which amounts to using $\fbox{...}$ instead of just \fbox{...}.
To make this happen automatically within LaTeX2HTML, the following
patch should help.
Within the subroutine block: sub process_commands_inline_in_tex
(of the main latex2html script)
# Generate a new subroutine
my $itype = ($cmd =~ /^f.*box$/ ? 'inline' : 'nomath'); ###<-- add this line
$code = "sub wrap_cmd_$cmd {" . "\n"
.'local($cmd, $_) = @_; local ($args) = "";' . "\n"
. $body . "\n"
. (($thisone)? ";print \"\\ndo $cmd:\".\$args.\"\\n\";\n" : '')
.'(&make_'.$itype.'_wrapper(1).$cmd.$padding.$args.' ### these 2 lines replace
. '&make_'.$itype.'_wrapper(0),$_)}' ### the one that was here
."\n";
print "\nWRAP_CMD:$raw_arg_cmds{$cmd}: $code "
if ($thisone); # for debugging
This patch will affect also the commands \framebox and \fcolorbox .
Here is the change as a diff
(beware that the line-numbers may not be correct for your installation):
12760a12766
> my $itype = ($cmd =~ /^f.*box$/ ? 'inline' : 'nomath');
12765c12771,12772
< .'(&make_nomath_wrapper(1).$cmd.$padding.$args.&make_nomath_wrapper(0),$_)}'
---
> .'(&make_'.$itype.'_wrapper(1).$cmd.$padding.$args.'
> . '&make_'.$itype.'_wrapper(0),$_)}'
Thanks again for bringing forward this issue.
Ross Moore
>
>