[l2h] Inline math cropping
Shigeharu TAKENO
shige at iee.niit.ac.jp
Wed Feb 25 03:36:07 CET 2004
shige 02/25 2004
----------------
In article <200402190837.i1J8bUl28313 at cressida.cert.fr>
Jean-Pierre.Chretien at cert.fr (Jean-Pierre.Chretien) wrote:
> Image "/tmp/l2h12894/p12922.pnm" is PPM, 37x30
> Running "/usr/local/netpbm/bin/pnmcrop -verbose -sides -bot <
> /tmp/l2h12894/p12922.pnm > /tmp/l2h12894/p12922.t02"
> pnmcrop: Background color is gray70
> pnmcrop: cropping 16 rows off the bottom
> Image "/tmp/l2h12894/p12922.t02" is PPM, 37x14
> Image "/tmp/l2h12894/p12922.pnm" is PPM, 37x30
> Running "/usr/local/netpbm/bin/ppmquant -floyd 256 < /tmp/l2h12894/p12922.pnm |
> /usr/local/netpbm/bin/pnmtopng -interlace -trans 'gray85' > s-img1.png"
> [snip]
> pstoimg: Written s-img1.png
>
>
> %->identify p12803*
> p12803.pnm PNM 37x30+0+0 DirectClass 8-bit 3.3k 0.000u 0:01
> p12803.t00[1] PNM 42x36+0+0 DirectClass 8-bit 9.0k 0.000u 0:01
> p12803.t00[1] PNM 42x36+0+0 DirectClass 8-bit 9.0k 0.000u 0:01
> p12803.t01[2] PNM 37x30+0+0 DirectClass 8-bit 3.3k 0.000u 0:01
> p12803.t02[3] PNM 37x14+0+0 DirectClass 8-bit 1.5k 0.000u 0:01
>
> The image remains 37x30 instead of 37x14, and the inline equation
> is not aligned on the baseline of the text.
>
>
> Any clue ?
I think the image may have lower part of usual baseline (Ex 'j',
'g'). In the case, the image will be made with a little extension
toward to bottom in order to include the equation in the image.
So, "inline equation is not aligned on the baseline of the text"
is usual situation in that case.
Well, *.02 file is made by the following code of pstoimg (near the
Line 1135):
if(&do_cmd_norename("$PNMCROP $PNMCROPOPT -bot < $in",$tmp)) {
my ($type,$width,$height2) = get_image_geometry($tmp);
if($type && ($height - $height2) < 3 ) {
# command succeeded and shaved less than 3 rows
if($opt{debug}&&(-f $tmp)) {
L2hos->Copy($tmp,$in);
&increment_name($tmp);
} elsif (-f $tmp) {
L2hos->Rename($tmp,$in);
}
next;
}
}
&do_cmd_norename() make *.t02 file, and it is used when the
height difference of images *.t01 and *.t02 is less than 3.
(I don't know the mean of this code and the limit '3'.)
If you want to use *.t02 file instead of *.t01 file, you will be
able to do by modification of that code. But it may be duty hack,
I don't know it is good or not. For example, apply the following
patch to your pstoimg:
----- (From here) -----
*** pstoimg.orig Fri Nov 14 15:31:59 2003
--- pstoimg Wed Feb 25 11:27:55 2004
***************
*** 809,814 ****
--- 809,816 ----
# This rx matches float values in Bounding Box expressions
my $Brx = '-?\d+(?:\.\d*|)';
+ my $FORCEMINIMAGE = $ENV{FORCEMINIMAGE} || 0;
+
##############################################################################
# Main program
***************
*** 1131,1137 ****
next unless($type); # skip if no geometry
if(&do_cmd_norename("$PNMCROP $PNMCROPOPT -bot < $in",$tmp)) {
my ($type,$width,$height2) = get_image_geometry($tmp);
! if($type && ($height - $height2) < 3 ) {
# command succeeded and shaved less than 3 rows
if($opt{debug}&&(-f $tmp)) {
L2hos->Copy($tmp,$in);
--- 1133,1139 ----
next unless($type); # skip if no geometry
if(&do_cmd_norename("$PNMCROP $PNMCROPOPT -bot < $in",$tmp)) {
my ($type,$width,$height2) = get_image_geometry($tmp);
! if($type && (($height - $height2) < 3 || $FORCEMINIMAGE)) {
# command succeeded and shaved less than 3 rows
if($opt{debug}&&(-f $tmp)) {
L2hos->Copy($tmp,$in);
----- (To here) -----
and set environment variable FORCEMINIMAGE to 1.
+========================================================+
Shigeharu TAKENO NIigata Institute of Technology
kashiwazaki,Niigata 945-1195 JAPAN
shige at iee.niit.ac.jp TEL(&FAX): +81-257-22-8161
+========================================================+
More information about the latex2html
mailing list