[l2h] Some problems and patches for Windows
Shigeharu TAKENO
shige at iee.niit.ac.jp
Sun Dec 29 13:57:01 CET 2019
shige 12/29 2019
----------------
I found some problems of current latex2html (github version) for
Windows.
1) On windows, 2 or more commands cannot connect ';' in
L2hos->syswait().
----- from here -----
--- latex2html.pin.ORG 2019-12-29 21:03:41.052544000 +0900
+++ latex2html.pin 2019-12-29 21:28:53.738308000 +0900
@@ -3870,7 +3870,9 @@
# calls either dvips, dvipng, gs, or nothing as specified
# by command line options
sub call_dvips {
- local($dvips_call);
+ # local($dvips_call);
+ # 2019-12-27 shige: 2-44)
+ local($dvips_call, $dvips_call2);
if ($USE_PDFTEX || $USE_LUATEX) {
# svg images are produced directly from images.pdf,
# don't need to do anything here
@@ -3881,11 +3883,16 @@
$dvips_call .= "-sDEVICE=png16m -r$DVIPNG_DPI -dTextAlphaBits=4 -dGraphicsAlphaBits=4 -sOutputFile=$TMPDIR$dd$IMAGE_PREFIX%d.png .${dd}${PREFIX}images.pdf";
} else {
# did not usepackage{preview}, need to crop
- $dvips_call = "$PDFCROP --hires " . ($DEBUG ? '--debug ' : '')
- . ".${dd}${PREFIX}images.pdf"
- . ";" . $dvips_call;
+ # $dvips_call = "$PDFCROP --hires " . ($DEBUG ? '--debug ' : '')
+ # . ".${dd}${PREFIX}images.pdf"
+ # . ";" . $dvips_call;
+ # 2019-12-27 shige: 2-44)
print "\nTransforming PDF images to postscript using gs/ps2write ...\n";
- $dvips_call .= "-sDEVICE=ps2write -sOutputFile=$TMPDIR$dd$IMAGE_PREFIX%.3d.ps .${dd}${PREFIX}images-crop.pdf\n";
+ # $dvips_call .= "-sDEVICE=ps2write -sOutputFile=$TMPDIR$dd$IMAGE_PREFIX%.3d.ps .${dd}${PREFIX}images-crop.pdf\n";
+ # 2019-12-27 shige: 2-44)
+ $dvips_call = "$PDFCROP --hires " . ($DEBUG ? '--debug ' : '')
+ . ".${dd}${PREFIX}images.pdf";
+ $dvips_call2 = $dvips_call . "-sDEVICE=ps2write -sOutputFile=$TMPDIR$dd$IMAGE_PREFIX%.3d.ps .${dd}${PREFIX}images-crop.pdf";
}
}
} else {
@@ -3899,7 +3906,10 @@
$dvips_call = "$DVIPS -S1 -i $DVIPSOPT -o$TMPDIR$dd${IMAGE_PREFIX} .${dd}${PREFIX}images.dvi";
}
} else {
- $dvips_call = "$DVIPS .${dd}${PREFIX}images.dvi && $PS2PDF .${dd}${PREFIX}images.ps";
+ # $dvips_call = "$DVIPS .${dd}${PREFIX}images.dvi && $PS2PDF .${dd}${PREFIX}images.ps";
+ # 2019-10-29, 2019-12-27 shige: 2-41)
+ $dvips_call = "$DVIPS .${dd}${PREFIX}images.dvi";
+ $dvips_call2 = "$PS2PDF .${dd}${PREFIX}images.ps";
print $dvips_call, "\n";
}
}
@@ -3907,6 +3917,9 @@
print $dvips_call if (($DEBUG)||($VERBOSITY > 1));
&close_dbm_database if $DJGPP;
L2hos->syswait($dvips_call) && print "Error: $!\n";
+ if ($dvips_call2) {
+ L2hos->syswait($dvips_call2) && print "Error: $!\n";
+ }
&open_dbm_database if $DJGPP;
}
}
----- to here -----
2) In Windows, there are no tee command and alternatives.
----- from here -----
--- latex2html.pin.ORG 2019-12-29 21:03:41.052544000 +0900
+++ latex2html.pin 2019-12-29 21:33:45.524136000 +0900
@@ -4264,10 +4264,16 @@
my $PPMTO=$IMAGE_TYPE=~m/gif/i? $PPMTOGIF : $PNMTOPNG;
#L2hos->syswait("$PNGTOPNM $p.png|$PNMCROP -sides|tee $p.ppm|$PNMCUT -top $millimeter |$PNMCROP -sides|tee $p-.ppm|$PPMTO{$IMAGE_TYPE} --quiet $transparent >img$new_num.$IMAGE_TYPE;");
if ($name =~ /figure|table/) {
- L2hos->syswait("$PNGTOPNM $p.png|tee $p.ppm|$PPMTO --quiet $transparent >${PREFIX}img$new_num.$IMAGE_TYPE;");
+ #L2hos->syswait("$PNGTOPNM $p.png|tee $p.ppm|$PPMTO --quiet $transparent >${PREFIX}img$new_num.$IMAGE_TYPE;");
+ # 2019-12-12: 2-44)
+ L2hos->syswait("$PNGTOPNM $p.png >$p.ppm");
+ L2hos->syswait("$PPMTO --quiet $transparent $p.ppm >${PREFIX}img$new_num.$IMAGE_TYPE;");
} else {
# L2hos->syswait("$PNGTOPNM $p.png|$PNMCROP -sides|tee $p.ppm|$PNMCUT -top $millimeter |$PNMCROP -left -right|tee $p-.ppm|$PPMTO --quiet $transparent >img$new_num.$IMAGE_TYPE;");
- L2hos->syswait("$PNGTOPNM $p.png|$PNMCROP -sides|tee $p.ppm|$PPMTO --quiet $transparent >${PREFIX}img$new_num.$IMAGE_TYPE;");
+ # L2hos->syswait("$PNGTOPNM $p.png|$PNMCROP -sides|tee $p.ppm|$PPMTO --quiet $transparent >${PREFIX}img$new_num.$IMAGE_TYPE;");
+ # 2019-12-12: 2-44)
+ L2hos->syswait("$PNGTOPNM $p.png|$PNMCROP -sides >$p.ppm");
+ L2hos->syswait("$PPMTO --quiet $transparent $p.ppm >${PREFIX}img$new_num.$IMAGE_TYPE;");
}
$edepth{$name}=$ptdepth{$name}/$pt_per_ex{$name};
----- to here -----
3) In Windows, open file is text mode in default.
----- from here -----
--- latex2html.pin.ORG 2019-12-29 21:03:41.052544000 +0900
+++ latex2html.pin 2019-12-29 21:34:33.697865000 +0900
@@ -4273,7 +4273,9 @@
$edepth{$name}=$ptdepth{$name}/$pt_per_ex{$name};
# extra .5pt in depth is border from latex "preview" package
print "edepth{$name}=$edepth{$name}\n" if ($VERBOSITY > 2);
- open PPM,"<$p.ppm"; read(PPM,$_,30);close PPM;
+ # open PPM,"<$p.ppm"; read(PPM,$_,30);close PPM;
+ # 2019-12-12 shige: 2-44)
+ open PPM,"<$p.ppm"; binmode(PPM); read(PPM,$_,30);close PPM;
m/^(\d+) (\d+)$/m;
$eheight{$name}=$2*$imgpixeloverex; # image height in ex
print "eheight{$name}=$ehieight{$name}\n" if ($VERBOSITY > 2);
----- to here -----
4) For some gs, GS_LIB setting may override the gs's default
search path, and the gs may fail to find library file.
----- from here -----
--- config/config.pl.ORG 2019-12-29 21:03:30.834019000 +0900
+++ config/config.pl 2019-12-29 21:12:03.932733000 +0900
@@ -1296,7 +1296,8 @@
EOF
}
else {
- push(@right_paths,'.');
+ #push(@right_paths,'.');
+ # 2019-12-16 shige: 2-24)
my $item;
foreach $item (@right_paths) {
$item = &simplify_path($item);
----- to here -----
5) TeXLive may have Ghostscript in /texlive/YYYY/tlpkg/tlgs, but
search target file "gs_init.ps" may not be in it.
----- from here -----
--- config/config.pl.ORG 2019-12-29 21:03:30.834019000 +0900
+++ config/config.pl 2019-12-29 21:09:43.430880000 +0900
@@ -1266,10 +1266,16 @@
my @right_paths = ();
my $gs_lib = 0;
my $gs_fonts = 0;
+ # 2017-04-11 shige: 2-24)
+ my $gs_stand_ps;
Gslibpaths: foreach $path (@try_path) {
foreach('',"$dd$gs_version","${dd}gs$gs_version") {
my $testpath = $path . $_;
- if(!$gs_lib && -d $testpath && -s "$testpath${dd}gs_init.ps") {
+ # if(!$gs_lib && -d $testpath && -s "$testpath${dd}gs_init.ps") {
+ # 2017-04-11, 2019-12-03 shige: 2-24)
+ if ($testpath =~ /tlgs/) { $gs_stand_ps = "landscape.ps"; }
+ else { $gs_stand_ps = "gs_init_ps"; }
+ if(!$gs_lib && -d $testpath && -s "$testpath${dd}$gs_stand_ps") {
push(@right_paths,L2hos->path2os($testpath));
$gs_lib = 1;
}
----- to here -----
6) For some TeX system, we can not gswin32c directly, we should
use rungs instead.
----- from here -----
--- prefs.pm.ORG 2019-12-29 21:03:46.497975000 +0900
+++ prefs.pm 2019-12-29 21:20:20.042378000 +0900
@@ -275,7 +275,9 @@
$prefs{'GS'} = 'gsos2';
}
elsif($::newcfg{'plat'} eq 'win32') {
- $prefs{'GS'} = 'gswin32c';
+ #$prefs{'GS'} = 'gswin32c';
+ # 2019-12-12 shige: 2-24)
+ $prefs{'GS'} = 'rungs,gswin32c';
}
else {
$prefs{'GS'} = 'gs';
----- to here -----
7) On Windows, absolute path name may not start by "$dd". So, by
the default code, l2h may add ".\" to absolute init file path
"C:\Users\...".
----- from here -----
--- latex2html.pin.ORG 2019-12-29 21:03:41.052544000 +0900
+++ latex2html.pin 2019-12-29 21:22:33.775227000 +0900
@@ -421,7 +421,9 @@
}
&set_if_false($NO_ISOLATIN, $opt{latin});
if ($INIT_FILE) {
- if ($INIT_FILE !~ /^[.$dd$dd]/) { # should start with / or .
+ # if ($INIT_FILE !~ /^[.$dd$dd]/) { # should start with / or .
+ # 2019-12-18 shige: 2-43)
+ if ($INIT_FILE !~ /^\./ && !L2hos->is_absolute_path($INIT_FILE)) {
$INIT_FILE = ".$dd$INIT_FILE"; # so that value of @INC has no effect
}
if (-f $INIT_FILE && -r _) {
----- to here -----
+========================================================+
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