[l2h] Some patches for latex2html

Shigeharu TAKENO shige at iee.niit.ac.jp
Wed Sep 13 12:17:04 CEST 2017


shige 09/13 2017
----------------

I will show some patches for current latex2html-2017.2. 

1) image file name for -ps_image 

When using -ps_image, image files become ps file, but they are
displayed "[IMAGE png]". This problem may be fixed by the 
following patch.

----- From here -----
diff -u latex2html-2017.2/latex2html.pin.ORG latex2html-2017.2/latex2html.pin
--- latex2html-2017.2/latex2html.pin.ORG	2017-01-24 02:14:25.000000000 +0900
+++ latex2html-2017.2/latex2html.pin	2017-09-13 11:59:41.245673000 +0900
@@ -9958,7 +9958,10 @@
             unless ($exstr =~ /BORDER/i);
     } else { 
         # MRO: dubious (&extern_image_mark takes only one arg)
-        $extern_image_mark = &extern_image_mark($IMAGE_TYPE,$altst);
+        #$extern_image_mark = &extern_image_mark($IMAGE_TYPE,$altst);
+        # shige 07/20 2017 for $PS_IMAGES
+        my ($typename) = ($PS_IMAGES) ? "ps" : $IMAGE_TYPE;
+        $extern_image_mark = &extern_image_mark($typename, $altst);
     }
 
     my ($anch1,$anch2) = ('','');
----- To here -----

2) checking file name at configure

config/config.pl shows "checking for [name] ... [full path name]" by
using &find_prog. But, it shows
  checking for /usr/local/bin/perl... /usr/local/bin/perl
for perl program since "&find_prog($^X)" is used for perl. In 
find_prog, the variable base is used for saving basename of the 
specified name, but it is not referenced. I think the following
patch may be correct.

----- From here -----
diff -u latex2html-2017.2/config/config.pl.ORG latex2html-2017.2/config/config.pl
--- latex2html-2017.2/config/config.pl.ORG	2017-01-24 02:14:25.000000000 +0900
+++ latex2html-2017.2/config/config.pl	2017-09-13 11:06:59.660852000 +0900
@@ -2228,7 +2228,9 @@
   Search: foreach $name (@names) {
     my $base = $name;
     $base =~ s:^.*[/$dd$dd]::; # strip path
-    &checking("for $name");
+    #&checking("for $name");
+    # shige: $base is for the following ?
+    &checking("for $base");
     if($name =~ /\Q$dd/) { # contains dir delimiter?
       unless($name =~ /^$drive_rx\Q$dd/oi) { # absolute dir?
         $name = &simplify_path("$cwd$dd$name");
----- To here -----

3) \label command in equation environment

In equation environment, position of the label command affects 
the image file of the equation. For example, 

  \begin{equation}
    \label{test1}
    \int_0^1\sin x dx
  \end{equation}
  \begin{equation}
    \int_0^2\sin x dx
    \label{test2}
  \end{equation}

makes the same two equation in the LaTeX level. But latex2html
makes one small equation image and one large equation image. 
This is the problem by translating \label command to a null line
in images.tex. The following patch may fix the problem.

----- From here -----
diff -u latex2html-2017.2/latex2html.pin.ORG latex2html-2017.2/latex2html.pin
--- latex2html-2017.2/latex2html.pin.ORG	2017-01-24 02:14:25.000000000 +0900
+++ latex2html-2017.2/latex2html.pin	2017-09-13 11:10:35.668177000 +0900
@@ -3491,7 +3491,9 @@
     }
     $fullcontents =  $contents; # save for later \label search.
     # MRO: replaced $* with /m
-    $contents =~ s/\n?$labels_rx(\%([^\n]+$|$EOL))?/\n/gm;
+    # $contents =~ s/\n?$labels_rx(\%([^\n]+$|$EOL))?/\n/gm;
+    # shige (2004-06-16): for [space]\label{}
+    $contents =~ s/\n?\s*$labels_rx(\%([^\n]+$|$EOL))?/\n/gm;
 
     local($tmp) = $contents;
     $tmp =~ s/^((\\par|\%)?\s*\n)+$//g;
----- To here -----

4) comment line in the equation environment

The comment line In the equation environment may be remain 
"<tex2html_comment_mark>" in the image. It is occured when
amsmath package and a bug of styles/more_amsmath.perl.
The following patch may fix the problem.

----- From here -----
diff -u latex2html-2017.2/styles/more_amsmath.perl.ORG latex2html-2017.2/styles/more_amsmath.perl
--- latex2html-2017.2/styles/more_amsmath.perl.ORG	2017-01-24 02:14:25.000000000 +0900
+++ latex2html-2017.2/styles/more_amsmath.perl	2017-09-13 11:33:49.245329000 +0900
@@ -94,6 +94,8 @@
 		, $EQNO_END);
 	}
     } else { $tag = ';SPMnbsp;;SPMnbsp;;SPMnbsp;' }
+    # shige (2004-10-01): for comment in equation env
+    $scan =~ s/($comment_mark\d+) /$1\n/g;
     if ($labels) {
 	$labels =~ s/$anchor_mark/$tag/o;
 	($labels , $scan);
----- To here -----

5) psfrag optional argument

Current latex2html is not accepted psfrag optional argument. The
following patch should be introduced to styles/psfrag.perl.

  http://tug.org/pipermail/latex2html/2000-April/000631.html

6) path separator '/' used directly

In latex2html, path separator is written by "$dd" for several OS.
But some command lines include "/" as path separator directoly.
I think they should be "$dd", but I don't know the necessary to 
change them.

----- From here -----
diff -u latex2html-2017.2/latex2html.pin.ORG latex2html-2017.2/latex2html.pin
--- latex2html-2017.2/latex2html.pin.ORG	2017-01-24 02:14:25.000000000 +0900
+++ latex2html-2017.2/latex2html.pin	2017-07-20 16:47:12.568363000 +0900
@@ -3871,34 +3871,43 @@
 	if ($LATEX_DUMP) {
 	    # dump a pre-compiled format
 	    if (!(-f "${PREFIX}images.fmt")) {
-	        print "$INILATEX ./${PREFIX}images.tex\n" 
+		# shige 07/20 2017
+	        print "$INILATEX .$dd${PREFIX}images.tex\n" 
 		    if (($DEBUG)||($VERBOSITY > 1));
+		# shige 07/20 2017
 	        print "dumping ${PREFIX}images.fmt\n"
-		    unless ( L2hos->syswait("$INILATEX ./${PREFIX}images.tex"));
+		    unless ( L2hos->syswait("$INILATEX .$dd${PREFIX}images.tex"));
 	    }
 	    local ($img_fmt) = (-f "${PREFIX}images.fmt");
 	    if ($img_fmt) {
                 # use the pre-compiled format
-	        print "$TEX \"&./${PREFIX}images\" ./${PREFIX}images.tex\n"
+		# shige 07/20 2017
+	        print "$TEX \"&.$dd${PREFIX}images\" .$dd${PREFIX}images.tex\n"
 		    if (($DEBUG)||($VERBOSITY > 1));
-	        L2hos->syswait("$TEX \"&./${PREFIX}images\" ./${PREFIX}images.tex");
+		# shige 07/20 2017
+	        L2hos->syswait("$TEX \"&.$dd${PREFIX}images\" .$dd${PREFIX}images.tex");
 	    } elsif (-f "${PREFIX}images.dvi") {
 	        print "${PREFIX}images.fmt failed, proceeding anyway\n";
 	    } else {
 	        print "${PREFIX}images.fmt failed, trying without it\n";
-		print "$LATEX ./${PREFIX}images.tex\n"
+		# shige 07/20 2017
+		print "$LATEX .$dd${PREFIX}images.tex\n"
 		    if (($DEBUG)||($VERBOSITY > 1));
-		L2hos->syswait("$LATEX ./${PREFIX}images.tex");
+		# shige 07/20 2017
+		L2hos->syswait("$LATEX .$dd${PREFIX}images.tex");
 	    }
 	} else { &make_latex_images() }
 #	    local($latex_call) = "$LATEX .$dd${PREFIX}images.tex";
 #	    print "$latex_call\n" if (($DEBUG)||($VERBOSITY > 1));
 #	    L2hos->syswait("$latex_call");
-##	    print "$LATEX ./${PREFIX}images.tex\n" if (($DEBUG)||($VERBOSITY > 1));
-##	    L2hos->syswait("$LATEX ./${PREFIX}images.tex");
+#           # shige 07/20 2017
+##	    print "$LATEX .$dd${PREFIX}images.tex\n" if (($DEBUG)||($VERBOSITY > 1));
+#           # shige 07/20 2017
+##	    L2hos->syswait("$LATEX .$dd${PREFIX}images.tex");
 ##        }
 	$LaTeXERROR = 0;
-	&process_log_file("./${PREFIX}images.log"); # Get image size info
+        # shige 07/20 2017
+	&process_log_file(".$dd${PREFIX}images.log"); # Get image size info
     }
     if ($NO_IMAGES) {
         my $img = "image.$IMAGE_TYPE";
@@ -14053,7 +14062,8 @@
 sub default_textohtmlinfopage {
     local($_) = @_;
     local($argv) = $argv;
-    if (-f "../$argv") { $argv = &make_href ("../$argv", $argv, ); }
+    # shige 07/20 2017
+    if (-f "..$dd$argv") { $argv = &make_href ("..$dd$argv", $argv, ); }
     $_ = ($INFO && $INFO =~ /^\d+$/
       ? join('', $close_all
 	, "<STRONG>$t_title</STRONG><P>\nThis document was generated using the\n"
----- 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