diff -ruN latex2html-2017.2/Makefile.in l2h-2017-jp2.1b1.18/Makefile.in
--- latex2html-2017.2/Makefile.in	2017-01-24 02:14:25.000000000 +0900
+++ l2h-2017-jp2.1b1.18/Makefile.in	2018-02-22 17:45:22.772666000 +0900
@@ -58,7 +58,12 @@
 installcmd = config/install.pl
 cfgfile = cfgcache.pm
 
-all: ${SCRIPTS} ${MODULES}
+# 03/25 2010 shige: 1-8)
+#euc2utf8 = nkf -w
+euc2utf8 = config/eucconv.pl
+KANJI = @KANJI@
+
+all: ${SCRIPTS} ${MODULES} styles/japanese.perl styles/ascmac.perl
 
 devel:
 	${MAKE} all BUILDOPT=-devel
@@ -77,6 +82,15 @@
 	${PERL} ${srcdir}/${buildcmd} -x ${BUILDOPT} $@
 	touch texexpand
 
+# 03/25 2010 shige: 1-8)
+styles/japanese.perl: ${cfgfile} ${srcdir}/${euc2utf8} styles/japanese.pin
+	${PERL} ${srcdir}/${euc2utf8} ${KANJI} < styles/japanese.pin > $@
+	touch $@
+
+styles/ascmac.perl: ${cfgfile} ${srcdir}/${euc2utf8} styles/ascmac.pin
+	${PERL} ${srcdir}/${euc2utf8} ${KANJI} < styles/ascmac.pin > $@
+	touch $@
+
 ${cfgfile}: config.status
 
 l2hconf.pm: ${cfgfile} ${srcdir}/${buildcmd} l2hconf.pin
diff -ruN latex2html-2017.2/config/config.pl l2h-2017-jp2.1b1.18/config/config.pl
--- latex2html-2017.2/config/config.pl	2017-01-24 02:14:25.000000000 +0900
+++ l2h-2017-jp2.1b1.18/config/config.pl	2018-02-22 18:13:42.230352000 +0900
@@ -741,10 +741,12 @@
 set arg=
 set prog=%0
 :one
-if "%1"=="" goto two
-set arg=%arg% %1
-shift
-goto one
+rem 11/08 2017 shige: 2-23)
+rem if "%1"=="" goto two
+rem set arg=%arg% %1
+rem shift
+rem goto one
+set arg=%*
 :two
 if exist %prog%.bat goto indot
 $newcfg{'PERL'} -x -S %prog% %arg%
@@ -828,6 +830,10 @@
   if($initex) {
     $newcfg{'INITEX'} = $initex;
   }
+  # shige: 1-2)
+  elsif ( $newcfg{'TEX'} ) {
+    $newcfg{'INITEX'} = "$newcfg{'TEX'} -ini";
+  }
 }
 
 $newcfg{'KPSEWHICH'} = '';
@@ -1171,10 +1177,15 @@
         my @right_paths = ();
         my $gs_lib = 0;
         my $gs_fonts = 0;
+        # 04/11 2017 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") {
+	    # 04/11 2017 shige: 2-24)
+	    if ($testpath =~ /tlgs/) { $gs_stand_ps = "showpage.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;
             }
@@ -1349,10 +1360,22 @@
 # --------------------------------------------------------------------------
 
 $newcfg{'PPMQUANT'} = '';
+# shige: 2-8)
+$newcfg{'PPMQUANTOPT'} = '';
 
 if(1) {
   my $ppmquant = &find_prog(&get_name('PPMQUANT',1));
   if($ppmquant) {
+    # shige: 2-8)
+    my ($stat,$msg,$err) = ('','','');
+    ($stat,$msg,$err) = &get_out_err("$ppmquant -version");
+    my $vers = '';
+    $msg = $msg || $err;
+    if ($msg =~ /Version/) { 
+	$newcfg{'PPMQUANTOPT'} = ' -floyd';
+    } else {
+	$newcfg{'PPMQUANTOPT'} = ''; # script version
+    }
     $newcfg{'PPMQUANT'} = $ppmquant;
   }
 }
@@ -2228,7 +2251,9 @@
   Search: foreach $name (@names) {
     my $base = $name;
     $base =~ s:^.*[/$dd$dd]::; # strip path
-    &checking("for $name");
+    # 01/28 2011 shige: 2-17)
+    #&checking("for $name");
+    &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");
@@ -2287,6 +2312,10 @@
           return "$path$ext";
         }
       }
+      # 04/11 2017 shige: 2-25)
+      if (-s $path && !-d _ && is_perl_script($path)) {
+	  return "$newcfg{'PERL'} -w $path";
+      }
     }
   }
   else { # do the regular check
@@ -2297,6 +2326,17 @@
   ''; # failure
 }
 
+# 04/11 2017 shige: 2-25)
+sub is_perl_script {
+    my ($file) = @_;
+
+    return 0 unless(open(IN, "<$file"));
+    $_ = <IN>;
+    close(IN);
+    return 1 if /^\#\s*\!.*perl/;
+    return 0;
+}
+
 #------------------------------------------------------------------------------
 # Capture output to STDOUT and STDERR. Must work on all platforms, therefore
 # an external script is used that provides for the filehandle redirection.
diff -ruN latex2html-2017.2/config/eucconv.pl l2h-2017-jp2.1b1.18/config/eucconv.pl
--- latex2html-2017.2/config/eucconv.pl	1970-01-01 09:00:00.000000000 +0900
+++ l2h-2017-jp2.1b1.18/config/eucconv.pl	2018-02-22 18:14:14.768735000 +0900
@@ -0,0 +1,29 @@
+#! /usr/local/bin/perl
+# $Id: eucconv.pl,v 1.3 2011-01-28 12:52:25+09 shige Exp $
+# euc2utf8.pl => eucconv.pl
+# Kanji translator from EUC-JP to {UTF-8/SJIS} for styles/japanese.perl
+# or others.
+# 1-8)
+#
+use Encode;
+
+binmode STDIN,":encoding(euc-jp)";
+
+if ( $#ARGV >= 0 && $ARGV[0] =~ /utf/i ) {
+    binmode STDOUT,":utf8";
+    $tocode = "UTF-8";
+} elsif ( $#ARGV >= 0 && $ARGV[0] =~ /sjis/i ) {
+    binmode STDOUT,":encoding(shiftjis)";
+    $tocode = "Shift_JIS";
+} elsif ( $#ARGV >= 0 && $ARGV[0] =~ /^jis/i ) {
+    binmode STDOUT,":encoding(iso-2022-jp)";
+    $tocode = "ISO-2022-JP";
+} else {
+    binmode STDOUT,":encoding(euc-jp)";
+    $tocode = "EUC-JP";
+}
+
+while ( <STDIN> ) {
+    s/\@CHARSET\@/$tocode/g;
+    print;
+} 
diff -ruN latex2html-2017.2/configure l2h-2017-jp2.1b1.18/configure
--- latex2html-2017.2/configure	2017-01-24 02:14:25.000000000 +0900
+++ l2h-2017-jp2.1b1.18/configure	2018-02-22 18:17:39.427670000 +0900
@@ -121,6 +121,9 @@
   --with-giftool=PATH     path/name of the giftool executable"
 ac_help="$ac_help
   --with-giftrans=PATH    path/name of the giftrans executable"
+# shige: 1-8)
+ac_help="$ac_help
+  --with-kanji=CODE       kanji code of LaTeX and HTML file (euc|utf8)"
 
 # Initialize some variables set by options.
 # The variables have the same names as the options, with
@@ -1064,6 +1067,15 @@
   with_giftrans=${GIFTRANS:-}
 fi
 
+# shige: 1-8)
+# Check whether --with-kanji or --without-kanji was given.
+if test "${with_kanji+set}" = set; then
+  withval="$with_kanji"
+  KANJI=$withval
+  :
+else
+  KANJI=${KANJI:-}
+fi
 
 
 if test -n "$PERL"; then
@@ -1378,6 +1390,7 @@
 s%@PERL@%$PERL%g
 s%@plat@%$plat%g
 s%@distver@%$distver%g
+s%@KANJI@%$KANJI%g
 
 CEOF
 EOF
diff -ruN latex2html-2017.2/docs/manual.tex l2h-2017-jp2.1b1.18/docs/manual.tex
--- latex2html-2017.2/docs/manual.tex	2017-01-24 02:14:25.000000000 +0900
+++ l2h-2017-jp2.1b1.18/docs/manual.tex	2018-02-22 18:18:41.174773000 +0900
@@ -4,6 +4,8 @@
 \usepackage[dvips]{graphicx,color}
 % \usepackage{times}
 
+% 08/20 2014 shige: for pdflatex: 2-22)
+\let\pdfoutput\undefined
 \usepackage{html,htmllist,makeidx,enumerate}
 %\usepackage{frames}
 
diff -ruN latex2html-2017.2/l2hconf.pin l2h-2017-jp2.1b1.18/l2hconf.pin
--- latex2html-2017.2/l2hconf.pin	2017-01-24 02:14:25.000000000 +0900
+++ l2h-2017-jp2.1b1.18/l2hconf.pin	2018-02-23 17:26:15.289340000 +0900
@@ -373,6 +373,14 @@
 $ANTI_ALIAS_TEXT = 1;
 
 
+# 02/16 2018 shige: 3-4)
+# -dresolution
+# [n] = DPI value for the display images. Default value is 72 (cf. 
+#       -density option of pstoimg). The value 0 means the default.
+#
+$DRESOLUTION = 0;
+
+
 # -font_size
 # To set the point size of LaTeX-generated GIF files, uncomment the following
 # variable, and set it to its desired value (i.e, 10pt, 11pt, 12pt, etc.)
@@ -841,6 +849,8 @@
 $PNMPAD = '@PNMPAD@';
 $PNMROTATE = '@PNMROTATE@';
 $PNMSCALE = '@PNMSCALE@';
+# 09/09 2010 shige: 2-14)
+$PPMQUANT = '@PPMQUANT@';
 
 $GIFTOPNM = '@GIFTOPNM@';
 $JPEGTOPNM = '@JPEGTOPNM@';
diff -ruN latex2html-2017.2/latex2html.pin l2h-2017-jp2.1b1.18/latex2html.pin
--- latex2html-2017.2/latex2html.pin	2017-01-24 02:14:25.000000000 +0900
+++ l2h-2017-jp2.1b1.18/latex2html.pin	2018-03-08 14:37:58.115880000 +0900
@@ -1,6 +1,8 @@
 #- -*- perl -*-
 #
 # $Id: latex2html.pin,v 1.71 2004/01/06 23:49:54 RRM Exp $
+# jLaTeX2HTML version 1.99+3.0 1999/9/15
+# jLaTeX2HTML version 2.1b1.18 2018/03/08 shige
 #
 # Comprises patches and revisions by various authors:
 #   See Changes, the log file of LaTeX2HTML.
@@ -9,6 +11,13 @@
 #
 # LaTeX2HTML by Nikos Drakos <nikos@cbl.leeds.ac.uk>
 
+# Japanese Patched:
+# jLaTeX2HTML by Kenshi Muto <kmuto@debian.org>
+#  jLaTeX2HTML copyright follows LaTeX2HTML copyright.
+
+# modified for latex2html-{2K.1beta,2002,2008,2015,2016,2017} by shige
+# Shigeharu TAKENO <shige@iee.niit.ac.jp>
+
 # ****************************************************************
 # LaTeX To HTML Translation **************************************
 # ****************************************************************
@@ -137,13 +146,21 @@
 #$TPATCHLEVEL = " release";
 #$RELDATE = "(March 30, 1999)";
 #$TEX2HTMLV_SHORT = $TVERSION . $TPATCHLEVEL;
+# shige: 1-6)
+$JVERSION = "JA patch-2.1beta1.18";
 
 $TEX2HTMLV_SHORT = $RELEASE;
+$JTEX2HTMLV_SHORT = "$RELEASE $JVERSION";
 $TEX2HTMLVERSION = "$TEX2HTMLV_SHORT ($REVISION)";
+$JTEX2HTMLVERSION = "$TEX2HTMLV_SHORT ($REVISION) $JVERSION";
 $TEX2HTMLADDRESS = "http://www.latex2html.org/";
+#$JTEX2HTMLADDRESS = "http://www.topstudio.co.jp/&#126;kmuto/software/latex2html/";
+$JTEX2HTMLADDRESS = "http://takeno.iee.niit.ac.jp/&#126;shige/TeX/latex2html/";
 $AUTHORADDRESS = "http://cbl.leeds.ac.uk/nikos/personal.html";
 #$AUTHORADDRESS2 = "http://www-math.mpce.mq.edu.au/%7Eross/";
 $AUTHORADDRESS2 = "http://www.maths.mq.edu.au/&#126;ross/";
+$JAUTHORADDRESS = "http://www.topstudio.co.jp/&#126;kmuto/";
+$JAUTHORADDRESS2 = "http://takeno.iee.niit.ac.jp/&#126;shige/";
 
 # Set $HOME to what the system considers the home directory
 $HOME = L2hos->home();
@@ -334,6 +351,8 @@
         'xbit!',                \$XBIT_HACK,
         'ssi!',                 \$ALLOW_SSI,
         'php!',                 \$ALLOW_PHP,
+	# 08/08 2017 shige: 3-4)
+        'dresolution=i',	\$DRESOLUTION,
         'test_mode!' # undocumented switch
        )) {
     &usage();
@@ -421,9 +440,14 @@
     $NO_MATH_PARSING = !$opt{math_parsing};
     $NO_SIMPLE_MATH = !$opt{math_parsing} unless(defined $opt{math});
 }
+# 08/08 2017 shige: 3-4)
+if ($DRESOLUTION && ($DRESOLUTION < 36 || $DRESOLUTION > 2000)) {
+    die "Error: dresolution value $DRESOLUTION are out of range [36,2000]\n";
+}
 &set_if_false($NO_ISOLATIN, $opt{latin});
 if ($INIT_FILE) {
-    if ($INIT_FILE !~ /^[.$dd]/) {	# should start with / or .
+    # 11/08 2017 shige: 2-26)
+    if ($INIT_FILE !~ /^[.$dd$dd]/) {	# should start with / or .
 	$INIT_FILE = ".$dd$INIT_FILE";	# so that value of @INC has no effect
     }
     if (-f $INIT_FILE && -r _) {
@@ -3491,7 +3515,9 @@
     }
     $fullcontents =  $contents; # save for later \label search.
     # MRO: replaced $* with /m
-    $contents =~ s/\n?$labels_rx(\%([^\n]+$|$EOL))?/\n/gm;
+    # 06/16 2004 shige: 2-10)
+    # $contents =~ s/\n?$labels_rx(\%([^\n]+$|$EOL))?/\n/gm;
+    $contents =~ s/\n?\s*$labels_rx(\%([^\n]+$|$EOL))?/\n/gm;
 
     local($tmp) = $contents;
     $tmp =~ s/^((\\par|\%)?\s*\n)+$//g;
@@ -3501,7 +3527,9 @@
     if ($tmp =~ /\$\\(display|text|(script)+)style\s*$comment_mark\d+\s*\$$/)
 	{ return ( &do_labels($fullcontents, "\&nbsp;") ) };
 
-    $contents = "\n% latex2html id marker $id\n$contents" if
+    # 10/27 2010 shige: 2-16)
+    #$contents = "\n% latex2html id marker $id\n$contents" if
+    $contents = "\n% latex2html id marker $id $contents" if
 	(!$PREAMBLE &&($contents =~ /$order_sensitive_rx/)
 		&&(!($env =~ /makeimage/)));
 
@@ -3871,34 +3899,39 @@
 	if ($LATEX_DUMP) {
 	    # dump a pre-compiled format
 	    if (!(-f "${PREFIX}images.fmt")) {
-	        print "$INILATEX ./${PREFIX}images.tex\n" 
+		# 07/20 2017 shige: 2-26)
+	        print "$INILATEX .$dd${PREFIX}images.tex\n" 
 		    if (($DEBUG)||($VERBOSITY > 1));
 	        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"
+		# 07/20 2017 shige: 2-26)
+	        print "$TEX \"&.$dd${PREFIX}images\" .$dd${PREFIX}images.tex\n"
 		    if (($DEBUG)||($VERBOSITY > 1));
-	        L2hos->syswait("$TEX \"&./${PREFIX}images\" ./${PREFIX}images.tex");
+	        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"
+		# 07/20 2017 shige: 2-26)
+		print "$LATEX .$dd${PREFIX}images.tex\n"
 		    if (($DEBUG)||($VERBOSITY > 1));
-		L2hos->syswait("$LATEX ./${PREFIX}images.tex");
+		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");
+#	    # 07/20 2017 shige: 2-26)
+##	    print "$LATEX .$dd${PREFIX}images.tex\n" if (($DEBUG)||($VERBOSITY > 1));
+##	    L2hos->syswait("$LATEX .$dd${PREFIX}images.tex");
 ##        }
 	$LaTeXERROR = 0;
-	&process_log_file("./${PREFIX}images.log"); # Get image size info
+	# 07/20 2017 shige: 2-26)
+	&process_log_file(".$dd${PREFIX}images.log"); # Get image size info
     }
     if ($NO_IMAGES) {
         my $img = "image.$IMAGE_TYPE";
@@ -4153,6 +4186,8 @@
 		. ($TMPDIR ? "-tmp $TMPDIR " : '' )
 		. (($DISCARD_PS && !$thumbnail && !$psimage)? "-discard " :'')
 		. (($INTERLACE) ? "-interlace " : '' )
+		# 08/08 2017 shige: 3-4)
+		. (($DRESOLUTION)? "-density $DRESOLUTION " : '' )
 		. (((($ANTI_ALIAS)||($aalias))&&($aalias !~ /no|text/))? "-antialias ":'')
 		. (($ANTI_ALIAS_TEXT||(($aalias =~/text/)&&($aalias !~/no/)))?
 			"-aaliastext ":'') 
@@ -4176,6 +4211,8 @@
 		    . ($TMPDIR ? "-tmp $TMPDIR " : '' )
 		    . (($DISCARD_PS && !$psimage) ? "-discard " : '' )
 		    . (($INTERLACE) ? "-interlace " : '' )
+		    # 08/08 2017 shige: 3-4)
+		    . (($DRESOLUTION)? "-density $DRESOLUTION " : '' )
 		    . ((($ANTI_ALIAS||($aalias))&&(!($aalias =~/no/)))? "-antialias " :'')
 		    . (($ANTI_ALIAS_TEXT||(($aalias =~/text/)&&($aalias !~/no/)))?
 			"-aaliastext ":'') 
@@ -4208,6 +4245,8 @@
 		. ($TMPDIR ? "-tmp $TMPDIR " : '' )
 		. (($DISCARD_PS)? "-discard " : '' )
 		. (($INTERLACE)? "-interlace " : '' )
+		# 08/08 2017 shige: 3-4)
+		. (($DRESOLUTION)? "-density $DRESOLUTION " : '' )
 		. ((($ANTI_ALIAS_TEXT||($aalias))&&($aalias !=~/no/))? 
 		    "-antialias -depth 1 " :'')
 		. (($custom_size)? "-geometry $custom_size " : '' )
@@ -4242,6 +4281,8 @@
 		. ($TMPDIR ? "-tmp $TMPDIR " : '' )
 		. (($DISCARD_PS) ? "-discard " : '' )
 		. (($INTERLACE) ? "-interlace " : '' )
+		# 08/08 2017 shige: 3-4)
+		. (($DRESOLUTION)? "-density $DRESOLUTION " : '' )
 		. ((($ANTI_ALIAS_TEXT||($aalias))&&(!($aalias =~ /no/)))?
 		    "-antialias -depth 1 " :'')
 		. ((($exscale)&&($exscale != 1)&&
@@ -4853,8 +4894,9 @@
 		} else {
 		    $cmd_trans =~ m|</.*$|;
 		    $pc_after = $` . $pc_after unless ($` =~ /^<>/);
+		    # 07/04 2017 shige: 2-21)
 		    push(@$open_tags_R, $cmd)
-			if ($cmd =~ /$fontchange_rx|$fontweight_rx|$sizechange_rx/o);
+			if ($cmd =~ /$sizechange_rx|$fontchange_rx|$fontweight_rx/o);
 		}
 	    } elsif ($mathentity) {
 #print "\nM-ENT:$mathentity :  ";
@@ -6765,7 +6807,9 @@
 	||(s/$next_pair_rx/$which = $2;''/eo));
     if ($hash) {
 	local($tmp) = "\%$hash";
-	if (eval "defined \%{$hash}") { $! = '';
+	# 01/27 2011 shige: 2-19)
+	# if (eval "defined \%{$hash}") { $! = '';
+	if (eval "\%{$hash}") { $! = '';
 	    $value = ${$hash}{'$which'};
 	} else { print "\nhash: \%$hash not defined" }
     } elsif ($which) {
@@ -6786,7 +6830,9 @@
 	||(s/$next_pair_rx/$value = $2;''/eo));
     if ($hash) {
 	local($tmp) = "\%$hash";
-	if (eval "defined \%{$hash}") { $! = '';
+	# 01/27 2011 shige: 2-19)
+	# if (eval "defined \%{$hash}") { $! = '';
+	if (eval "\%{$hash}") { $! = '';
 #	    eval "\$$hash{'$which'} = \"$value\";";
 	    ${$hash}{'$which'} = $value;
 	    print "\nHTMLset failed: $! " if ($!);
@@ -7126,17 +7172,21 @@
     }
 
     join("\n", (($DOCTYPE)? $DTDcomment : '' )
-	,"<!--Converted with LaTeX2HTML $TEX2HTMLVERSION"
-	    . " -->\n<HTML>\n<HEAD>\n<TITLE>".$title."</TITLE>"
-	, &meta_information($title)
+        # shige: 1-6)
+	,"<!--Converted with jLaTeX2HTML $JTEX2HTMLVERSION"
+	    . " -->\n<HTML>\n<HEAD>\n"
 	,  ($CHARSET && $HTML_VERSION ge "2.1" ? 
 	      "<META HTTP-EQUIV=\"Content-Type\" CONTENT=\"text/html; charset=$this_charset\">" 
 	      : "" )
 	, $LATEX2HTML_META
+        # shige: 2-13)
+	, &meta_information($title)
 	, ($BASE ? "<BASE HREF=\"$BASE\">" : "" )
 	, $STYLESHEET_CASCADE
 	, ($STYLESHEET ? "<LINK REL=\"STYLESHEET\" HREF=\"$STYLESHEET\">" : '' )
 	, $more_links_mark
+        # shige: 2-13)
+	, "<TITLE>".$title."</TITLE>\n"
 	, "</HEAD>" , ($before_body? $before_body : '')
 	, "<BODY $body>", '');
 }
@@ -7299,6 +7349,8 @@
     s/\\protect//g;		# remove redundant \protect macros
     #$_ = pack("u*", $_);	# uuencode
     s/\\\$/dollar/g;		# replace funnies, may cause problems in a hash key
+    # 12/14 2004 shige: 2-1)
+    s/\\([ij])([^a-zA-Z_])/$1nodot$2/g;
     s/\//slash/g;		# replace funnies, may cause problems in a hash key
     s/\$|\/|\\//g;		# remove funnies, may cause problems in a hash key
     s/\s*|\n//g;		# Remove spaces  and newlines
@@ -7462,8 +7514,12 @@
 	    if (/$childlinks_on_mark\#(\d)\#/) { $child_star = $1 }
 	    $child_links = &add_child_links('',$file, $depth, $child_star,$key, @keys)
 		unless (/$childlinks_null_mark\#(\d)\#/);
-	    if (($child_links)&&(!/$childlinks_mark/)&&($MAX_SPLIT_DEPTH > 1)) {
-		if ($depth < $MAX_SPLIT_DEPTH -1) {
+	    # 07/13 2017 shige: 2-27)
+	    # if (($child_links)&&(!/$childlinks_mark/)&&($MAX_SPLIT_DEPTH > 1)) {
+	    #	if ($depth < $MAX_SPLIT_DEPTH -1) {
+	    if (($child_links)&&(!/$childlinks_mark/)) {
+		if ($MAX_SPLIT_DEPTH <= 1 || $depth < $MAX_SPLIT_DEPTH -1) {
+
 		    $_ = join('', $header, $_, &child_line(), $childlinks_mark, "\#0\#" );
 		} else {
 		    $_ = join('', $header, "\n$childlinks_mark\#0\#", &upper_child_line(), $_ );
@@ -9019,8 +9075,12 @@
 
 # MRO: Print standardized header
 sub banner {
+# shige: 1-6)
     print <<"EOF";
-This is LaTeX2HTML Version $TEX2HTMLVERSION
+This is jLaTeX2HTML Version $JTEX2HTMLVERSION
+by Kenshi Muto, Debian Project.
+
+Original LaTeX2HTML Version $TEX2HTMLVERSION
 by Nikos Drakos, Computer Based Learning Unit, University of Leeds.
 
 EOF
@@ -9958,7 +10018,10 @@
             unless ($exstr =~ /BORDER/i);
     } else { 
         # MRO: dubious (&extern_image_mark takes only one arg)
-        $extern_image_mark = &extern_image_mark($IMAGE_TYPE,$altst);
+	# 07/20 2017 shige: 2-28)
+        #$extern_image_mark = &extern_image_mark($IMAGE_TYPE,$altst);
+	my ($typename) = ($PS_IMAGES) ? "ps" : $IMAGE_TYPE;
+	$extern_image_mark = &extern_image_mark($typename, $altst);
     }
 
     my ($anch1,$anch2) = ('','');
@@ -10055,6 +10118,11 @@
             $img_w = int($width / $scale + .5);
             $img_h = int($height / $scale + .5);
 	}
+	# 08/08 2017 shige: 3-4)
+	if ($DRESOLUTION && $DRESOLUTION != 72) {
+	    $img_w = int($img_w*72 / $DRESOLUTION + .5);
+	    $img_h = int($img_h*72 / $DRESOLUTION + .5);
+	}
 	$size = qq{WIDTH="$img_w" HEIGHT="$img_h"};
 
 	# allow height/width to be stored in the stylesheet
@@ -10072,6 +10140,11 @@
 		# How high is an ex in the most likely browser font ?
 		    $width = $width/$scale; $height = $height/$scale;
 		}
+		# 08/08 2017 shige: 3-4)
+		if ($DRESOLUTION && $DRESOLUTION != 72) {
+		    $width = $width*72 / $DRESOLUTION;
+		    $height = $height*72 / $DRESOLUTION;
+		}
 		$width = int(100*$width + .5)/100;
 		$height = int(100*$height + .5)/100;
 		$img_style{$imgID} = qq(width:${width}em ; height:${height}ex );
@@ -11021,6 +11094,8 @@
 sub do_require_package {
     local($file)= @_;
     local($dir);
+    # 08/23 2016 shige: 2-29)
+    local($rfile) = $file;
     #RRM: make common ps/eps-packages use  epsfig.perl
     $file = 'epsfig' if ($file =~ /^(psfig|epsf)$/);
 
@@ -11031,12 +11106,16 @@
 	    print STDOUT "\nPackage: loading $texfilepath$dd${file}.perl";
 	    require("$texfilepath$dd${file}.perl");
 	    $styles_loaded{$file} = 1;
+	    # 08/23 2016 shige: 2-29)
+	    $styles_loaded{$rfile} = 1 if $rfile ne $file;
 	} else {
 	    foreach $dir (split(/$envkey/,$LATEX2HTMLSTYLES)) {
 		if ((-f "$dir$dd${file}.perl") && ! $styles_loaded{$file}){
 		    print STDOUT "\nPackage: loading $dir$dd${file}.perl";
 		    require("$dir$dd${file}.perl");
 	    	    $styles_loaded{$file} = 1;
+		    # 08/23 2016 shige: 2-29)
+		    $styles_loaded{$rfile} = 1 if $rfile ne $file;
 		    last;
 		}
 	    }
@@ -11085,6 +11164,8 @@
     &do_require_package($option) unless ($styles_loaded{$option});
     # next look for a subroutine named  do_$option
     $do_option = "do_$option";
+    # 11/01 2001 shige: 2-2)
+    $do_option =~ s/-/_/g;
     if (!($styles_loaded{$option}) && defined(&$do_option)) {
 	&$do_option();
 	$styles_loaded{$option} = 1;
@@ -12302,12 +12383,13 @@
 	$closures .= $post unless ($pre =~ /^<>/);
 	print STDOUT "\n</$next>" if $VERBOSITY > 2;
 
-	if ($next =~ /$fontchange_rx/) {
+	# 07/04 2017 shige: 2-21)
+	if ($next =~ /$sizechange_rx/) {
+	    # discard it
+	} elsif ($next =~ /$fontchange_rx/) {
 	    $font = $next unless ($font);
 	} elsif ($next =~ /$fontweight_rx/) {
 	    $fontwt = $next unless ($fontwt);
-	} elsif ($next =~ /$sizechange_rx/) {
-	    # discard it
 	} else {
 	    unshift (@tags, $next);
 	    print STDOUT "\n<<$next>" if $VERBOSITY > 2;
@@ -12370,7 +12452,9 @@
 	    $t_author = &translate_environments($_);
 	    $t_author =~ s/\s+/ /g;
 	    $t_author = &simplify(&translate_commands($t_author));
-	    ($t_author,$t_affil,$t_address) = split (/\s*<BR>s*/, $t_author);
+	    # 04/27 2010 shige: 2-20)
+	    # ($t_author,$t_affil,$t_address) = split (/\s*<BR>s*/, $t_author);
+	    ($t_author,$t_affil,$t_address) = split (/\s*<BR>s*/, $t_author, 3);
 	    push @authors, $t_author;
 	    push @affils, $t_affil;
 	    push @addresses, $t_address;
@@ -12379,7 +12463,9 @@
 	$_ = &translate_environments($next);
 	$next = &translate_commands($_);
 	($t_author) = &simplify($next);
-	($t_author,$t_affil,$t_address) = split (/\s*<BR>s*/, $t_author);
+	# 04/27 2010 shige: 2-20)
+	# ($t_author,$t_affil,$t_address) = split (/\s*<BR>s*/, $t_author);
+	($t_author,$t_affil,$t_address) = split (/\s*<BR>s*/, $t_author, 3);
 	push @authors, $t_author;
 	push @affils, $t_affil if $t_affil;
 	push @addresses, $t_address if $t_address;
@@ -12542,10 +12628,14 @@
     if ($t_date&&!($t_date=~/^\s*(($O|$OP)\d+($C|$CP))\s*\1\s*$/)) {
 	$t_title .= "\n<P$alignc><STRONG>$t_date</STRONG></P>";}
     if ($t_address&&!($t_address=~/^\s*(($O|$OP)\d+($C|$CP))\s*\1\s*$/)) {
-	$t_title .= "\n<P$alignl><SMALL>$t_address</SMALL></P>";
+	# 04/27 2010 shige: 2-20)
+	# $t_title .= "\n<P$alignl><SMALL>$t_address</SMALL></P>";
+	$t_title .= "\n<P$alignc><SMALL>$t_address</SMALL></P>";
     }  # else { $t_title .= "\n<P$alignl>"}
     if ($t_email&&!($t_email=~/^\s*(($O|$OP)\d+($C|$CP))\s*\1\s*$/)) {
-	$t_title .= "\n<P$alignl><SMALL>$t_email</SMALL></P>";
+	# 04/27 2010 shige: 2-20)
+	# $t_title .= "\n<P$alignl><SMALL>$t_email</SMALL></P>";
+	$t_title .= "\n<P$alignc><SMALL>$t_email</SMALL></P>";
     }  # else { $t_title .= "</P>" }
     join("\n", $s_author_info, $t_title, $e_author_info);
 }
@@ -13730,6 +13820,8 @@
 sub do_cmd_footnotename { $foot_title . $_[0] }
 sub do_cmd_childlinksname { '<STRONG>'.$child_name.'</STRONG>'. $_[0] }
 sub do_cmd_infopagename { $info_title . $_[0] }
+# shige: 2-9)
+sub do_cmd_prefacename { $pre_title . $_[0] }
 
 
 sub do_cmd_ref {
@@ -14053,7 +14145,8 @@
 sub default_textohtmlinfopage {
     local($_) = @_;
     local($argv) = $argv;
-    if (-f "../$argv") { $argv = &make_href ("../$argv", $argv, ); }
+    # 07/20 2017 shige: 2-26)
+    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"
@@ -14709,18 +14802,20 @@
 sub do_cmd_LaTeX {
     local($_) = @_;
     if ($USING_STYLES) {
-	$env_style{'LaTeX'} = ' ' unless ($env_style{'LaTeX'});
-	$env_style{'logo-LaTeX'} = ' ' unless ($env_style{'logo-LaTeX'});
-	join('',"<SPAN CLASS=\"logo,LaTeX\">",$Laname, $TeXname,"</SPAN>",$_);
+	# shige: 2-12)
+	$txt_style{'LaTeX'} = ' ' unless ($txt_style{'LaTeX'});
+	$txt_style{'logo-LaTeX'} = ' ' unless ($txt_style{'logo-LaTeX'});
+	join('',"<SPAN CLASS=\"logo-LaTeX LaTeX\">",$Laname, $TeXname,"</SPAN>",$_);
     } else { join('',$Laname, $TeXname, $_); }
 }
 
 sub do_cmd_LaTeXe {
     local($_) = @_;
     if ($USING_STYLES) {
-	$env_style{'LaTeX2e'} = ' ' unless ($env_style{'LaTeX2e'});
-	$env_style{'logo-LaTeX2e'} = ' ' unless ($env_style{'logo-LaTeX2e'});
-	join('',"<SPAN CLASS=\"logo,LaTeX2e\">"
+	# shige: 2-12)
+	$txt_style{'LaTeX2e'} = ' ' unless ($txt_style{'LaTeX2e'});
+	$txt_style{'logo-LaTeX2e'} = ' ' unless ($txt_style{'logo-LaTeX2e'});
+	join('',"<SPAN CLASS=\"logo-LaTeX2e LaTeX2e\">"
 		,$Laname, $TeXname,'2<SUB>e</SUB>',"</SPAN>",$_);
     } else { join('',$Laname,$TeXname
 		,(($HTML_VERSION >= 3.0)? '2<SUB>e</SUB>':'2e'),$_);
@@ -14730,9 +14825,10 @@
 sub do_cmd_latextohtml {
     local($_) = @_;
     if ($USING_STYLES) {
-	$env_style{'LaTeX2HTML'} = ' ' unless ($env_style{'LaTeX2HTML'});
-	$env_style{'logo-LaTeX2HTML'} = ' ' unless ($env_style{'logo-LaTeX2HTML'});
-	join('',"<SPAN CLASS=\"logo,LaTeX2HTML\">"
+	# shige: 2-12)
+	$txt_style{'LaTeX2HTML'} = ' ' unless ($txt_style{'LaTeX2HTML'});
+	$txt_style{'logo-LaTeX2HTML'} = ' ' unless ($txt_style{'logo-LaTeX2HTML'});
+	join('',"<SPAN CLASS=\"logo-LaTeX2HTML LaTeX2HTML\">"
 		,$Laname, $TeXname,"2<TT>HTML</TT>","</SPAN>",$_);
     } else { join('',$Laname,$TeXname,"2<TT>HTML</TT>",$_);}
 }
@@ -14740,7 +14836,8 @@
 sub do_cmd_TeX {
     local($_) = @_;
     if ($USING_STYLES) {
-	$env_style{'logo-TeX'} = ' ' unless ($env_style{'logo-TeX'});
+	# shige: 2-12)
+	$txt_style{'logo-TeX'} = ' ' unless ($txt_style{'logo-TeX'});
 	join('',"<SPAN CLASS=\"logo-TeX\">",$TeXname,"</SPAN>",$_);
     } else { join('',$TeXname, $_);}
 }
@@ -14748,7 +14845,8 @@
 sub do_cmd_MF {
     local($_) = @_;
     if ($USING_STYLES) {
-	$env_style{'logo-Metafont'} = ' ' unless ($env_style{'logo-Metafont'});
+	# shige: 2-12)
+	$txt_style{'logo-Metafont'} = ' ' unless ($txt_style{'logo-Metafont'});
 	join('',"<SPAN CLASS=\"logo-Metafont\">",$MFname,"</SPAN>",$_);
     } else { join('', $MFname, $_);}
 }
@@ -14756,7 +14854,8 @@
 sub do_cmd_Xy {
     local($_) = @_;
     if ($USING_STYLES) {
-	$env_style{'logo-Xy-pic'} = ' ' unless ($env_style{'logo-Xy-pic'});
+	# shige: 2-12)
+	$txt_style{'logo-Xy-pic'} = ' ' unless ($txt_style{'logo-Xy-pic'});
 	join('',"<SPAN CLASS=\"logo-Xy-pic\">",$Xyname,"</SPAN>",$_);
     } else { join('',$Xyname, $_);}
 }
@@ -14764,7 +14863,8 @@
 sub do_cmd_AmS {
     local($_) = @_;
     if ($USING_STYLES) {
-	$env_style{'logo-AMS'} = ' ' unless ($env_style{'logo-AMS'});
+	# shige: 2-12)
+	$txt_style{'logo-AMS'} = ' ' unless ($txt_style{'logo-AMS'});
 	join('',"<SPAN CLASS=\"logo-AMS\">",$AmSname,"</SPAN>",$_);
     } else { join('',$AmSname, $_);}
 }
@@ -14772,7 +14872,8 @@
 sub do_cmd_AmSTeX {
     local($_) = @_;
     if ($USING_STYLES) {
-	$env_style{'logo-AMS'} = ' ' unless ($env_style{'logo-AMS'});
+	# shige: 2-12)
+	$txt_style{'logo-AMS'} = ' ' unless ($txt_style{'logo-AMS'});
 	join('',"<SPAN CLASS=\"logo-AMS\">",$AmSname,"-$TeXname","</SPAN>",$_);
     } else { join('',$AmSname, "-", $TeXname, $_);}
 }
@@ -14791,17 +14892,25 @@
     $spmrx =~ s/\000/|/g;
     $spmrx = "(.)" unless $spmrx =~ s/(.+)/($1|.)/;
 
-    s/^[ \t]*(\d{1,3})[ \t]*/&#$1;/ &&
+    # 09/13 2010 shige: 2-15)
+    #s/^[ \t]*(\d{1,3})[ \t]*/&#$1;/ &&
+    s/^[ \t]*(\d+)[ \t]*/&#$1;/ &&
 	return($_);
 
-    s/^[ \t]*\'(\d{1,3})[ \t]*/"&#".oct($1).";"/e &&
+    # 09/13 2010 shige: 2-15)
+    #s/^[ \t]*\'(\d{1,3})[ \t]*/"&#".oct($1).";"/e &&
+    s/^[ \t]*\'([0-7]+)[ \t]*/"&#".oct($1).";"/e &&
 	return($_);
 
-    s/^[ \t]*$spmquot(\d{1,2})[ \t]*/"&#".hex($1).";"/e &&
+    # 09/13 2010 shige: 2-15)
+    #s/^[ \t]*$spmquot(\d{1,2})[ \t]*/"&#".hex($1).";"/e &&
+    s/^[ \t]*$spmquot([0-9a-fA-F]+)[ \t]*/"&#".hex($1).";"/e &&
 	return($_);
 
 # This is a kludge to work together with german.perl. Brrr.
-    s/^[ \t]*\'\'(\d{1,2})[ \t]*/"&#".hex($1).";"/e &&
+    # 09/13 2010 shige: 2-15)
+    #s/^[ \t]*\'\'(\d{1,2})[ \t]*/"&#".hex($1).";"/e &&
+    s/^[ \t]*\'\'([0-9a-fA-F]+)[ \t]*/"&#".hex($1).";"/e &&
 	return($_);
 # If l2h's special char marker represents more than one character,
 # it's already in the &#xxx; form. Else convert the single character
@@ -14883,7 +14992,10 @@
 	# Accent of this form: "\^{\i}rest" or not an accent on i nor j
 	($arg) =  &get_next_pair_or_char_pr;
     }
-    $arg =~ s/([^\s\\<])/$first_char = $1; ''/eo;
+    # 12/13 2004 shige: 2-3)
+    #$arg =~ s/([^\s\\<])/$first_char = $1; ''/eo;
+    if ($type eq "t" ) { $first_char = $arg; $arg = ""; }
+    else { $arg =~ s/([^\s\\<])/$first_char = $1; ''/eo; }
 #   print STDOUT "\nACCENT1 type:$type arg:|${arg}| first_char: |$first_char| $ij_cmd 
 #	, $ACCENT_IMAGES\n";
 
@@ -14940,8 +15052,16 @@
     # ...or the accent is wider than the letter, so pad it out a bit
     $afterkern = "\\kern.15em" if ($char =~ /i|l/); #||($type=~/v/));
 
-    &process_undefined_environment("tex2html_accent_inline"
-        , ++$global{'max_id'}, "${bstyle}\\${type}\{$char\\/\}$estyle$afterkern");
+    # 01/18 2002 shige: 2-4)
+    #&process_undefined_environment("tex2html_accent_inline"
+    #    , ++$global{'max_id'}, "${bstyle}\\${type}\{$char\\/\}$estyle$afterkern");
+    if ( $type =~ /^accent/ ) {
+	&process_undefined_environment("tex2html_accent_inline" 
+          , ++$global{'max_id'}, "${bstyle}\\${type}$char\\/$estyle$afterkern");
+    } else {
+	&process_undefined_environment("tex2html_accent_inline"
+          , ++$global{'max_id'}, "${bstyle}\\${type}\{$char\\/\}$estyle$afterkern");
+    }
 }
 
 # MEH: Actually tries to find a dotless i or j
@@ -14961,7 +15081,9 @@
 	&write_warnings("Accent number $number is unknown.\n");
 	return $_;
     }
-    &accent_safe_for_ij($type , 'accent$number' );
+    # 01/18 2002 shige: 2-4)
+    #&accent_safe_for_ij($type , 'accent$number' );
+    &accent_safe_for_ij($type , "accent$number" );
     $_;
 }
 
@@ -15269,7 +15391,9 @@
     # MRO: replaced $* with /m
     while ($text =~ /(\\[a-zA-Z]+|[&;]SPM\w+;|<[^>]+>)+/m ) {
 	$scbef = $`; $special = $&; $text = $';
-	while ( $scbef =~ /(&#\d+;|[a-z$sclower])+[a-z\W\d$sclower]*/m) {
+	# 04/27 2010 shige: 2-20)
+	# while ( $scbef =~ /(&#\d+;|[a-z$sclower])+[a-z\W\d$sclower]*/m) {
+	while ( $scbef =~ /(&#\d+;|[a-z$sclower])+[a-z\s\d$sclower]*/m) {
 	    $scstr .= $`; $scbef = $';
 	    $next = $&; 
 	    $next =~ s/&#(\d+);/&lowercase_entity($1)/egm;
@@ -15280,7 +15404,9 @@
 	$scstr .= $scbef . $special;
     }
     if ($text) {
-	while ( $text =~ /(&#\d+;|[a-z$sclower])+[a-z\W\d$sclower]*/m) {
+	# 04/27 2010 shige: 2-20)
+	# while ( $text =~ /(&#\d+;|[a-z$sclower])+[a-z\W\d$sclower]*/m) {
+	while ( $text =~ /(&#\d+;|[a-z$sclower])+[a-z\s\d$sclower]*/m) {
 	    $scstr .= $`; $text = $';
 	    $next = $&;
 	    $next =~ s/&#(\d+);/&lowercase_entity($1)/egm;
@@ -15523,7 +15649,8 @@
     $delim = '%:%';		# Delimits items of sectioning information
 				# stored in a string
 
-    $LATEX2HTML_META = '<META NAME="Generator" CONTENT="LaTeX2HTML v'.$TEX2HTMLV_SHORT.'">'
+    # shige: 1-6)
+    $LATEX2HTML_META = '<META NAME="Generator" CONTENT="jLaTeX2HTML v'.$JTEX2HTMLV_SHORT.'">'
 	. "\n<META HTTP-EQUIV=\"Content-Style-Type\" CONTENT=\"text/css\">"
 	      unless ($LATEX2HTML_META);
 
@@ -15536,6 +15663,8 @@
     $EQN_TAGS = "R" unless ($EQN_TAGS);
     $EQNO_START = "(";
     $EQNO_END   = ")";
+    # 09/09 2010 shige: 3-3)
+    $EQNO_WIDTH = "10";
 
     $AtBeginDocument_hook  = "\$AtBeginDocument_hook\=\'\'; "
 	unless $AtBeginDocument_hook;
@@ -15593,6 +15722,9 @@
     &banner();
     print "Revised and extended by:"
 	. "\n Marcus Hennecke, Ross Moore, Herb Swan and others\n";
+    # shige: 1-6)
+    print "Modified of Japanese version by:"
+	. "\n Shige TAKENO\n";
 
     # Collect HTML options and figure out HTML version
     $HTML_OPTIONS = '' unless ($HTML_OPTIONS);
@@ -15615,16 +15747,39 @@
     print ($HTML_OPTIONS ? "with $HTML_OPTIONS extensions\n\n\n" : "\n\n\n");
 
     # load the character defs for latin-1, but don't set the charset yet
-    &do_require_extension('latin1');
-    $charset = $CHARSET = $PREV_CHARSET = '';
+    # 08/24 2002, 01/26 2003, 12/09 2004, 03/25 2010 shige: 1-5)
+    {
+	local($save_charset) = '';
+	$save_charset=$CHARSET if $CHARSET =~ /(EUC[-_]JP|UTF[-_]8)/;
+	&do_require_extension('latin1');
+	$charset = $CHARSET = $PREV_CHARSET = $save_charset;
+	undef $save_charset;
+    }
 
-    if ($HTML_VERSION =~ /(2.0|3.0|3.2|4.0|4.1)/) {
+    # 03/26 2011 shige: 2-18)
+    # if ($HTML_VERSION =~ /(2.0|3.0|3.2|4.0|4.1)/) {
+    if ($HTML_VERSION =~ /(2.[012]|3.[012]|4.[01])/) {
 	# Require the version specific file 
-	do { $_ = "$LATEX2HTMLVERSIONS${dd}html$1.pl";
-	     if (!(-f $_)) {  s/(\d).(\d.pl)$/$1_$2/ };
-	     if (!(-f $_)) {  s/(\d)_(\d.pl)$/$1-$2/ };
-	     require $_ || die "\n*** Could not load $_ ***\n";
-	     print "\nHTML version: loading $_\n";
+	#do { $_ = "$LATEX2HTMLVERSIONS${dd}html$1.pl";
+	#     if (!(-f $_)) {  s/(\d).(\d.pl)$/$1_$2/ };
+	#     if (!(-f $_)) {  s/(\d)_(\d.pl)$/$1-$2/ };
+	#     require $_ || die "\n*** Could not load $_ ***\n";
+	#     print "\nHTML version: loading $_\n";
+	#} unless ($HTML_VERSION =~ /2.0/);
+	local($dir,$found) = ('',0);
+	do {
+	    foreach $dir (split(/$envkey/,$LATEX2HTMLVERSIONS)) {
+		$_ = "${dir}${dd}html$1.pl";
+		if (!(-f $_)) {  s/(\d).(\d.pl)$/$1_$2/ };
+		if (!(-f $_)) {  s/(\d)_(\d.pl)$/$1-$2/ };
+		if (-f $_) { $found = 1; last; }
+	    }
+	    if ( $found ) {
+		require $_ || die "\n*** Could not load $_ ***\n";
+		print "\nHTML version: loading $_\n";
+	    } else {
+		die "\n*** Could not found html$1.pl in $LATEX2HTMLVERSIONS ***\n";
+	    }
 	} unless ($HTML_VERSION =~ /2.0/);
 	$DOCTYPE = "-//".(($HTML_VERSION eq "2.0")? "IETF" : "W3C")
 	    . "//DTD HTML $HTML_VERSION"
@@ -15651,12 +15806,26 @@
 	    . "  i18n  table  math  frame  latin1  unicode  etc.\n";
 
     # Require all necessary version specific files
-	foreach ( sort <$LATEX2HTMLVERSIONS${dd}html[1-9].[0-9].pl> ) {
-	    last if ( $_ gt "$LATEX2HTMLVERSIONS${dd}html$HTML_VERSION.pl" );
-	    do { print "\nloading $_" if ($DEBUG);
-		 require $_; } unless (
-		($NO_SIMPLE_MATH)&&($_ eq "$LATEX2HTMLVERSIONS${dd}html3.1.pl"));
-	};
+	# 03/26 2011 shige: 2-18)
+	#foreach ( sort <$LATEX2HTMLVERSIONS${dd}html[1-9].[0-9].pl> ) {
+	#    last if ( $_ gt "$LATEX2HTMLVERSIONS${dd}html$HTML_VERSION.pl" );
+	#    do { print "\nloading $_" if ($DEBUG);
+	#	 require $_; } unless (
+	#	($NO_SIMPLE_MATH)&&($_ eq "$LATEX2HTMLVERSIONS${dd}html3.1.pl"));
+	#};
+	local($dir,$found) = ('',0);
+	foreach $dir (split(/$envkey/,$LATEX2HTMLVERSIONS)) {
+	    foreach ( sort <${dir}${dd}html[1-9].[0-9].pl> ) {
+		if ( $_ gt "${dir}${dd}html$HTML_VERSION.pl" ) {
+		    $found = 1; last;
+		}
+	    }
+    	    last if $found;
+	}
+	if ( $found && (! $NO_SIMPLE_MATH || $_ ne "${dir}${dd}html3.1.pl" )) {
+	    print "\nloading $_" if ($DEBUG);
+	    require $_;
+	}
 	$STRICT_HTML = 0;
     }
 
@@ -15868,6 +16037,8 @@
 	 , 'spanish',	'spanish_translation'
 	 , 'swedish',	'swedish_translation'
 	 , 'turkish',	'turkish_translation'
+	 # shige: 1-5)
+	 , 'japanese',	'japanese_translation'
 	);
 
 # Reiner: 
diff -ruN latex2html-2017.2/prefs.pm l2h-2017-jp2.1b1.18/prefs.pm
--- latex2html-2017.2/prefs.pm	2017-01-24 02:14:25.000000000 +0900
+++ l2h-2017-jp2.1b1.18/prefs.pm	2018-02-23 16:06:42.143718000 +0900
@@ -180,14 +180,20 @@
 # but with reduced capabilities.
 
 # the TeX executable
-$prefs{'TEX'} = 'tex';
+# shige: 1-2)
+#$prefs{'TEX'} = 'tex';
+$prefs{'TEX'} = 'ptex,tex';
 
 # the LaTeX executable
 # needed for image generation
-$prefs{'LATEX'} = 'latex';
+# shige: 1-2)
+#$prefs{'LATEX'} = 'latex';
+$prefs{'LATEX'} = 'platex,latex';
 
 # the initex executable
-$prefs{'INITEX'} = 'initex';
+# shige: 1-2)
+#$prefs{'INITEX'} = 'initex';
+$prefs{'INITEX'} = 'iniptex,initex';
 
 # the kpsewhich (part of Web2C) executable. If it is found, we have
 # Web2C
@@ -210,14 +216,17 @@
 $prefs{'MKTEXLSR'} = 'mktexlsr,texhash,MakeTeXlsR';
 
 # The dvips executable and its features. dvips32 added for OS/2
-$prefs{'DVIPS'} = 'dvips,dvi2ps,dvips32';
+# shige: 1-2)
+$prefs{'DVIPS'} = 'pdvips,dvips,dvi2ps,dvips32';
 
 # Many options can be used with dvips to produce better quality images
 # or speed-up other aspects of image-generation.
 # $prefs{'DVIPSOPT'} = ' -E';  # create encapsulated (EPS) images
 # $prefs{'DVIPSOPT'} = ' -Ppdf'; # use Type 1 fonts, as for PDF
 # $prefs{'DVIPSOPT'} = ' -Pcmz -Pamz'; # use CM and AMS Type 1 fonts
-$prefs{'DVIPSOPT'} = ' -Ppdf';
+# 09/01 2005 shige: 2-30)
+#$prefs{'DVIPSOPT'} = ' -Ppdf';
+$prefs{'DVIPSOPT'} = ' -E';
 
 # set this to 1 if you want dvips to create special fonts for better
 # image generation. You need to set the following two items to correct
diff -ruN latex2html-2017.2/pstoimg.pin l2h-2017-jp2.1b1.18/pstoimg.pin
--- latex2html-2017.2/pstoimg.pin	2017-01-24 02:14:25.000000000 +0900
+++ l2h-2017-jp2.1b1.18/pstoimg.pin	2018-02-23 16:10:29.338388000 +0900
@@ -321,6 +321,8 @@
 #fi
 #if @PPMQUANT@
 my $PPMQUANT = '@PPMQUANT@';
+# shige: 2-8)
+my $PPMQUANTOPT = '@PPMQUANTOPT@';
 #fi
 #-
 #if @PNMFLIP@
@@ -885,7 +887,8 @@
   if($opt{depth} == 1) { 
     $gs_aalias = '-dTextAlphaBits=4 ';
 #if @PPMQUANT@
-    $reduce_color = "$PPMQUANT -floyd 256";
+    # shige: 2-8)
+    $reduce_color = "$PPMQUANT $PPMQUANTOPT 256";
 #fi
     }
   else {
@@ -896,7 +899,8 @@
   $GSDEVICE = $GSALIASDEVICE;
     $gs_aalias = '-dTextAlphaBits=4 ';
 #if @PPMQUANT@
-    $reduce_color = "$PPMQUANT -floyd 256";
+    # shige: 2-8)
+    $reduce_color = "$PPMQUANT $PPMQUANTOPT 256";
 #fi
   }
 #fi
diff -ruN latex2html-2017.2/styles/ascmac.pin l2h-2017-jp2.1b1.18/styles/ascmac.pin
--- latex2html-2017.2/styles/ascmac.pin	1970-01-01 09:00:00.000000000 +0900
+++ l2h-2017-jp2.1b1.18/styles/ascmac.pin	2017-05-29 17:36:54.000000000 +0900
@@ -0,0 +1,74 @@
+# ascmac.perl by Kouji KODAMA <kdm@kobe-kosen.ac.jp>
+# copied from:
+# ascmac.perl, version 3.0 1999/9/15
+#
+# ascmac.perl by Kenshi Muto <kmuto@debian.org>
+
+# Implemented features:
+#   Commands: \yen, \keytop{}, \return, \Return
+#   Environments: screen, itembox, shadebox, boxnote
+
+### shadebox と boxnote はscreen のコピ−で手抜き. (kdm)
+
+# Not implemented for the followings:
+# \ascii, \Ascii, \ASCII, \mask,
+# \Maskbox{width}{height}{mask_char}{pos}{rule_wid}{body},
+# \maskbox{width}{height}{mask_char}{pos}{body}
+
+sub do_cmd_yen { local($_) = @_; "￥$_"; }
+sub do_cmd_keytop{
+	local($_)=@_;
+	s/$next_pair_pr_rx//o; local($key)=&translate_commands($2);
+	"[".$key."]".$_;
+}
+sub do_cmd_return {
+  local($_) = @_;
+  if ($HTML_VERSION < 4.0) {
+    "[Enter]$_";
+  } else {
+    "<SPAN STYLE=\"border-width: thin; border-style: solid\">Enter</SPAN>$_";
+  }
+}
+sub do_cmd_Return {
+  local($_) = @_;
+  if ($HTML_VERSION < 4.0) {
+    "[Enter]$_";
+  } else {
+    "<SPAN STYLE=\"border-width: thin; border-style: solid\">Enter</SPAN>$_";
+  }
+}
+sub do_env_screen {
+  if ($HTML_VERSION < 4.0) {
+    join('',"<TABLE BORDER=\"1\"><TR><TD>","@_","</TD></TR></TABLE>");
+  } else {
+    join('',"<DIV STYLE=\"border: inset blue; background-color: white\">","@_","</DIV>")
+  }
+}
+sub do_env_shadebox{
+  if ($HTML_VERSION < 4.0) {
+    join('',"<TABLE BORDER=\"1\"><TR><TD>","@_","</TD></TR></TABLE>");
+  } else {
+    join('',"<DIV STYLE=\"border: inset blue; background-color: white\">","@_","</DIV>")
+  }
+}
+sub do_env_boxnote{
+  if ($HTML_VERSION < 4.0) {
+    join('',"<TABLE BORDER=\"1\"><TR><TD>","@_","</TD></TR></TABLE>");
+  } else {
+    join('',"<DIV STYLE=\"border: inset blue; background-color: white\">","@_","</DIV>")
+  }
+}
+sub do_env_itembox {
+   local($_) = @_; local($title) = '';
+   $title = &missing_braces unless
+     ((s/$next_pair_rx/$title=$2;''/e) ||
+      (s/$next_pair_pr_rx/$title=$2;''/e));
+   $_ = &translate_environments($_);
+   if ($HTML_VERSION < 4.0) {
+     join('',"<TABLE BORDER=\"1\"><TR><TD>$title</TD></TR>","<TR><TD>$_\n</TD></TR></TABLE>\n");
+   } else {
+     join('',"<TABLE STYLE=\"border: sold; background-color: lime\"><TR><TH STYLE=\"background-color: green\">$title</TH></TR>","<TR><TD>$_\n</TD></TR></TABLE>\n");
+   }
+ }
+
+1; # end
diff -ruN latex2html-2017.2/styles/frames.perl l2h-2017-jp2.1b1.18/styles/frames.perl
--- latex2html-2017.2/styles/frames.perl	2017-01-24 02:14:25.000000000 +0900
+++ l2h-2017-jp2.1b1.18/styles/frames.perl	2018-02-23 16:13:49.899824000 +0900
@@ -295,7 +295,8 @@
     elsif ($reverse == 1) {$colorset="${which}_colorset_star"}
     elsif ($reverse == 2) {$colorset="${which}_colorset_star_star"}
     else {$colorset="${which}_colorset"}
-    if (!(defined  @$colorset))
+    # shige: 2-19)
+    if (!(@$colorset))
 	{ print STDERR "\nframes for $which are not supported\n"; return($rest);}	
     local($frame_tmp)=$frame_data;
     local($key, @values);
diff -ruN latex2html-2017.2/styles/getimagesize.perl l2h-2017-jp2.1b1.18/styles/getimagesize.perl
--- latex2html-2017.2/styles/getimagesize.perl	2017-01-24 02:14:25.000000000 +0900
+++ l2h-2017-jp2.1b1.18/styles/getimagesize.perl	2018-02-23 16:33:32.556284000 +0900
@@ -44,6 +44,11 @@
             $img_w = int($width / $scale + .5);
             $img_h = int($height / $scale + .5);
 	}
+	# 08/08 2017 shige: 3-4)
+	if ($DRESOLUTION && $DRESOLUTION != 72) {
+	    $img_w = int($img_w*72 / $DRESOLUTION + .5);
+	    $img_h = int($img_h*72 / $DRESOLUTION + .5);
+	}
 	$size = qq{WIDTH="$img_w" HEIGHT="$img_h"};
 
 	# allow height/width to be stored in the stylesheet
@@ -61,6 +66,11 @@
 		# How high is an ex in the most likely browser font ?
 		    $width = $width/$scale; $height = $height/$scale;
 		}
+		# 08/08 2017 shige: 3-4)
+		if ($DRESOLUTION && $DRESOLUTION != 72) {
+		    $width = $width*72 / $DRESOLUTION;
+		    $height =$height*72 / $DRESOLUTION;
+		}
 		$width = int(100*$width + .5)/100;
 		$height = int(100*$height + .5)/100;
 		$img_style{$imgID} = qq(width:${width}em ; height:${height}ex );
diff -ruN latex2html-2017.2/styles/html.perl l2h-2017-jp2.1b1.18/styles/html.perl
--- latex2html-2017.2/styles/html.perl	2017-01-24 02:14:25.000000000 +0900
+++ l2h-2017-jp2.1b1.18/styles/html.perl	2018-02-23 16:15:52.541169000 +0900
@@ -704,7 +704,9 @@
 	||(s/$next_pair_rx/$value = $2;''/eo));
     if ($hash) {
 	local($tmp) = "\%$hash";
-	if (eval "defined \%{$hash}") { $! = '';
+	# 01/27 2011 shige: 2-19)
+	#if (eval "defined \%{$hash}") { $! = '';
+	if (eval "\%{$hash}") { $! = '';
 #	    eval "\$$hash{'$which'} = \"$value\";";
 	    ${$hash}{'$which'} = $value;
 	    print "\nHTMLset failed: $! " if ($!);
diff -ruN latex2html-2017.2/styles/japanese.pin l2h-2017-jp2.1b1.18/styles/japanese.pin
--- latex2html-2017.2/styles/japanese.pin	1970-01-01 09:00:00.000000000 +0900
+++ l2h-2017-jp2.1b1.18/styles/japanese.pin	2018-02-21 13:27:34.303088000 +0900
@@ -0,0 +1,151 @@
+# japanese.perl, version 3.0 1999/9/15
+# japanese.pin,  l2h-2K8-jp2.1b1.12 2010/05/14
+#
+# japanese.perl by Kenshi Muto <kmuto@debian.org>
+# modified by Shigeharu TAKENO <shige@iee.niit.ac.jp>
+# 
+
+package japanese;
+
+print " [japanese]";
+
+sub main'japanese_translation { #'
+    @_[0];
+}
+
+package main;
+
+sub japanese_titles {
+    $toc_title = "目次";
+    $lof_title = "図目次";
+    $lot_title = "表目次";
+    $idx_title = "索引";
+    $bib_title = "参考文献";
+    #$ref_title = "参考文献";
+    #$bib_title = "関連図書";
+    $abs_title = "概要";
+    $app_title = "付録";
+    $pre_title = "序文";
+    $foot_title = "脚注";
+    $thm_title = "定理";
+    $fig_name  = "図";
+    $tab_name  = "表";
+    $prf_name = "証明";
+  #  Sectioning-level titles
+    $info_title = "この文書について..."; 
+  #  names in navigation panels
+    #$next_name = "次へ";
+    #$up_name = "上へ";
+    #$prev_name = "前へ";
+
+    @japanese_Month1 = ('', '1月', '2月', '3月', '4月', '5月',
+		       '6月', '7月', '8月', '9月', '10月',
+		       '11月', '12月');
+    @japanese_Month2 = ('', '睦月', '如月', '弥生', '卯月', '皐月',
+			'水無月', '文月', '葉月', '長月', '神無月',
+			'霜月', '師走');
+    @japanese_Month3 = ('', '孟春', '仲春', '季春', '孟夏', '仲夏',
+			'季夏', '孟秋', '仲秋', '季秋', '孟冬',
+			'仲冬', '季冬');
+    @Month = @japanese_Month1;
+    if ( defined $JAPANESEMONTHNAME ){
+	if ( $JAPANESEMONTHNAME == 1 ) { 
+	    @Month = @japanese_Month1;
+	} elsif ( $JAPANESEMONTHNAME == 2 ) {
+	    @Month = @japanese_Month2;
+	} elsif ( $JAPANESEMONTHNAME == 3 ) {
+	    @Month = @japanese_Month3;
+	}
+    }
+}
+
+sub japanese_infopage {
+    local($_) = @_;
+    local($argv) = $argv;
+    if (-f "../$argv") { $argv = &make_href ("../$argv", $argv, ); }
+    $_ = (($INFO == 1)
+      ? join('', "<STRONG>$t_title</STRONG><P>\nこの文書は"
+        , "<A HREF=\"$TEX2HTMLADDRESS\"><STRONG>LaTeX</STRONG>2<tt>HTML</tt></A>"
+        , " 翻訳プログラム Version $TEX2HTMLVERSION\n"
+        , "<P>Copyright &#169; 1993, 1994, 1995, 1996,\n"
+        , "<A HREF=\"$AUTHORADDRESS\">Nikos Drakos</A>, \n"
+        , "Computer Based Learning Unit, University of Leeds,\n"
+        , "<BR>Copyright &#169; 1997, 1998, 1999,\n"
+        , "<A HREF=\"$AUTHORADDRESS2\">Ross Moore</A>, \n"
+        , "Mathematics Department, Macquarie University, Sydney.\n"
+        , "<P>を<A HREF=\"$JTEX2HTMLADDRESS\">日本語化したもの</A>"
+        , " ($JTEX2HTMLVERSION 版)\n"
+        , "<P>Copyright &#169; 1998, 1999,\n"
+        , "<A HREF=\"$JAUTHORADDRESS\">Kenshi Muto</A>, \n"
+        , "Debian Project.\n"
+	, "<BR>Copyright &#169; 2001--2011,\n"
+	, "<A HREF=\"$JAUTHORADDRESS2\">Shige TAKENO</A>, \n"
+	, "Niigata Inst.Tech.\n"
+        , "<P>を用いて生成されました。\n"
+        , "<P>コマンド行は以下の通りでした。: <BR>\n "
+        , "<STRONG>latex2html</STRONG> <tt>$argv</tt>.\n"
+        , (($SHOW_INIT_FILE && ($INIT_FILE ne ''))?
+	   "\n<P>初期化ファイル: <TT>$INIT_FILE</TT>\n$init_file_mark\n" :'')
+# shige for latex2html-2017.2
+	, "<P>翻訳は"
+	, (($USESIGNEDINFOPAGE)? " $address_data[0] によって" : "")
+        , " $address_data[1] に実行されました。"
+	, $open_all, $_)
+   : join('', $close_all, $INFO,"\n", $open_all, $_));
+   &infopagehook if defined &infopagehook;
+   $_;
+}
+
+sub japanese_today {
+    local($today); 
+    if ( 1 ) { # オリジナルの get_date() を使うなら
+	local($m,$d,$y) = split(/\//,&get_date());
+	if ( $y < 1989 || $USEJAPANESESEIREKI ) { # 西暦
+	    $y = "$y年"; 
+	} else { # 平成のみ元号対応
+	    $y -= 1988; 
+	    $y = "元" if $y == 1; 
+	    $y = "平成$y年"; 
+	} 
+	$today = "$y$Month[$m]$d日";
+    } else { # 武藤さんの get_date() を使うなら
+	$today = &get_date();
+    }
+    join('',$today,$_[0]);
+}
+
+#sub get_date {
+#        #平成のみ対応
+#    local($format,$order) = @_;
+#    local(@lt) = localtime;
+#    local($d,$m,$y) = @lt[3,4,5];
+#        $y += 1900;
+#        $y -= 1988;
+#        if ($y == 1) {
+#                $y = "元";
+#        } else {
+#                $y .= "";
+#        }
+#        sprintf("平成%s年%s%d日", $y, @Month[$m+1], $d);
+#}
+#if (defined &address_data) {
+#  @address_data = &address_data('ISO');
+#  $ADDRESS = "$address_data[0]\n$address_data[1]";
+#}
+
+if ( defined &english_titles ) { &english_titles; }
+&japanese_titles;
+$default_language = 'japanese';
+$TITLES_LANGUAGE = 'japanese';
+# $ISO_LANGUAGE = 'JA';
+
+$charset = $CHARSET = '@CHARSET@';
+$japanese_encoding = '@CHARSET@';
+
+if ( $USEBOTTOMLOCALDATE ) {
+    # @address_data = &address_data('ISO');
+    $address_data[1]=&japanese_today();
+    $ADDRESS = "$address_data[0]\n$address_data[1]";
+}
+
+1;
diff -ruN latex2html-2017.2/styles/more_amsmath.perl l2h-2017-jp2.1b1.18/styles/more_amsmath.perl
--- latex2html-2017.2/styles/more_amsmath.perl	2017-01-24 02:14:25.000000000 +0900
+++ l2h-2017-jp2.1b1.18/styles/more_amsmath.perl	2018-02-23 16:19:53.963782000 +0900
@@ -94,6 +94,8 @@
 		, $EQNO_END);
 	}
     } else { $tag = ';SPMnbsp;;SPMnbsp;;SPMnbsp;' }
+    # 10/01 2004 shige: 2-5)
+    $scan =~ s/($comment_mark\d+) /$1\n/g;
     if ($labels) {
 	$labels =~ s/$anchor_mark/$tag/o;
 	($labels , $scan);
@@ -163,8 +165,11 @@
 $mspace = "\&nbsp;";
 $mdlim = $html_specials{'&'};
 
-$lseqno = "$eqno_class WIDTH=\"10\" ALIGN=\"LEFT\">\n";
-$rseqno = "$eqno_class WIDTH=\"10\" ALIGN=\"RIGHT\">\n";
+# 09/09 2010 shige: 3-3)
+#$lseqno = "$eqno_class WIDTH=\"10\" ALIGN=\"LEFT\">\n";
+#$rseqno = "$eqno_class WIDTH=\"10\" ALIGN=\"RIGHT\">\n";
+$lseqno = "$eqno_class WIDTH=\"$EQNO_WIDTH\" ALIGN=\"LEFT\">\n";
+$rseqno = "$eqno_class WIDTH=\"$EQNO_WIDTH\" ALIGN=\"RIGHT\">\n";
 
 
 # do these indirectly, so that they only over-ride the existing
diff -ruN latex2html-2017.2/styles/natbib.perl l2h-2017-jp2.1b1.18/styles/natbib.perl
--- latex2html-2017.2/styles/natbib.perl	2017-01-24 02:14:25.000000000 +0900
+++ l2h-2017-jp2.1b1.18/styles/natbib.perl	2018-02-23 16:21:27.768487000 +0900
@@ -1451,7 +1451,8 @@
     local($_) = @_;
     s/$next_pair_pr_rx//o;
     local($style)="citestyle_$2";
-    if (defined @$style) {
+    # shige: 2-19)
+    if (@$style) {
 	($CITE_OPEN_DELIM,
 	 $CITE_CLOSE_DELIM,
 	 $CITE_ENUM,
diff -ruN latex2html-2017.2/styles/psfrag.perl l2h-2017-jp2.1b1.18/styles/psfrag.perl
--- latex2html-2017.2/styles/psfrag.perl	2017-01-24 02:14:25.000000000 +0900
+++ l2h-2017-jp2.1b1.18/styles/psfrag.perl	2018-02-23 16:23:34.371456000 +0900
@@ -23,9 +23,10 @@
 epsfbox # {}
 _RAW_ARG_CMDS_
 
+# shige: 2-6)
 &process_commands_nowrap_in_tex (<<_RAW_ARG_CMDS_);
-psfragstar # {} # {}
-psfrag # {} # {}
+psfragstar # {} # [] # [] # [] # [] # {}
+psfrag # {} # [] # [] # [] # [] # {}
 _RAW_ARG_CMDS_
 
 
diff -ruN latex2html-2017.2/styles/romanian.perl l2h-2017-jp2.1b1.18/styles/romanian.perl
--- latex2html-2017.2/styles/romanian.perl	2017-01-24 02:14:25.000000000 +0900
+++ l2h-2017-jp2.1b1.18/styles/romanian.perl	2018-02-23 16:26:38.271300000 +0900
@@ -75,7 +75,8 @@
 &romanian_titles;
 $default_language = 'romanian';
 $TITLES_LANGUAGE = 'romanian';
-$romanian_encoding = 'is-8859-16';
+# 09/28 2015 shige: 2-31)
+$romanian_encoding = 'iso-8859-16';
 
 # $Log: romanian.perl,v $
 # Revision 1.1  1998/08/25 01:59:07  RRM
diff -ruN latex2html-2017.2/styles/texdefs.perl l2h-2017-jp2.1b1.18/styles/texdefs.perl
--- latex2html-2017.2/styles/texdefs.perl	2017-01-24 02:14:25.000000000 +0900
+++ l2h-2017-jp2.1b1.18/styles/texdefs.perl	2018-02-23 16:28:59.556142000 +0900
@@ -63,17 +63,25 @@
     $spmrx =~ s/\000/|/g;
     $spmrx = "(.)" unless $spmrx =~ s/(.+)/($1|.)/;
 
-    s/^[ \t]*(\d{1,3})[ \t]*/&#$1;/ &&
+    # 09/13 2010 shige: 2-15)
+    #s/^[ \t]*(\d{1,3})[ \t]*/&#$1;/ &&
+    s/^[ \t]*(\d+)[ \t]*/&#$1;/ &&
 	return($_);
 
-    s/^[ \t]*\'(\d{1,3})[ \t]*/"&#".oct($1).";"/e &&
+    # 09/13 2010 shige: 2-15)
+    #s/^[ \t]*\'(\d{1,3})[ \t]*/"&#".oct($1).";"/e &&
+    s/^[ \t]*\'([0-7]+)[ \t]*/"&#".oct($1).";"/e &&
 	return($_);
 
-    s/^[ \t]*$spmquot(\d{1,2})[ \t]*/"&#".hex($1).";"/e &&
+    # 09/13 2010 shige: 2-15)
+    #s/^[ \t]*$spmquot(\d{1,2})[ \t]*/"&#".hex($1).";"/e &&
+    s/^[ \t]*$spmquot([0-9a-fA-F]+)[ \t]*/"&#".hex($1).";"/e &&
 	return($_);
 
 # This is a kludge to work together with german.perl. Brrr.
-    s/^[ \t]*\'\'(\d{1,2})[ \t]*/"&#".hex($1).";"/e &&
+    # 09/13 2010 shige: 2-15)
+    #s/^[ \t]*\'\'(\d{1,2})[ \t]*/"&#".hex($1).";"/e &&
+    s/^[ \t]*\'\'([0-9a-fA-F]+)[ \t]*/"&#".hex($1).";"/e &&
 	return($_);
 
 # If l2h's special char marker represents more than one character,
diff -ruN latex2html-2017.2/versions/html2_2.pl l2h-2017-jp2.1b1.18/versions/html2_2.pl
--- latex2html-2017.2/versions/html2_2.pl	2017-01-24 02:14:25.000000000 +0900
+++ l2h-2017-jp2.1b1.18/versions/html2_2.pl	2018-02-23 16:36:00.992922000 +0900
@@ -91,7 +91,8 @@
     ($pxs,$len);
 }
 # should no longer be needed, as this is defined in latex2html.pin
-if (undefined &convert_length) { sub convert_length {&convert_length_table(@_)} }
+# shige: 2-7)
+if (!defined(&convert_length)) { sub convert_length {&convert_length_table(@_)} }
 
 # Translates LaTeX column specifications to HTML. Again, Netscape
 # needs some extra work with its width attributes in the <td> tags.
diff -ruN latex2html-2017.2/versions/html3_1.pl l2h-2017-jp2.1b1.18/versions/html3_1.pl
--- latex2html-2017.2/versions/html3_1.pl	2017-01-24 02:14:25.000000000 +0900
+++ l2h-2017-jp2.1b1.18/versions/html3_1.pl	2018-02-23 16:38:55.611153000 +0900
@@ -158,7 +158,9 @@
     local($math_start,$math_end)= ($sbig,$ebig);
 
     local($eqno) = '&nbsp;'; # spacer, when no numbering
-    local($seqno) = join('',"\n<TD$eqno_class WIDTH=10 ALIGN=\""
+    # 09/09 2010 shige: 3-3)
+    #local($seqno) = join('',"\n<TD$eqno_class WIDTH=10 ALIGN=\""
+    local($seqno) = join('',"\n<TD$eqno_class WIDTH=\"$EQNO_WIDTH\" ALIGN=\""
                          , (($EQN_TAGS =~ /L/)? 'LEFT': 'RIGHT')
 		         , "\">\n");
     do { # include the equation number, using a <TABLE>
@@ -929,7 +931,9 @@
 	$sarray .= "ALIGN=\"CENTER\" WIDTH=\"100%\">";
 	$env_id = '';
 
-	local($seqno) = join('',"\n<TD$eqno_class WIDTH=10 ALIGN=\""
+	# 09/09 2010 shige: 3-3)
+	#local($seqno) = join('',"\n<TD$eqno_class WIDTH=10 ALIGN=\""
+	local($seqno) = join('',"\n<TD$eqno_class WIDTH=\"$EQNO_WIDTH\" ALIGN=\""
 		, (($EQN_TAGS =~ /L/)? 'LEFT': 'RIGHT')
 		, "\">\n");
 	if ($EQN_TAGS =~ /L/) { # number on left
diff -ruN latex2html-2017.2/versions/html3_2.pl l2h-2017-jp2.1b1.18/versions/html3_2.pl
--- latex2html-2017.2/versions/html3_2.pl	2017-01-24 02:14:25.000000000 +0900
+++ l2h-2017-jp2.1b1.18/versions/html3_2.pl	2018-02-23 16:47:35.665019000 +0900
@@ -270,7 +270,8 @@
 $TD_attribs_rx_list = $TH_attribs_rx_list = ",COLSPAN,ROWSPAN,WIDTH,HEIGHT,";
 $TD__COLSPAN_rx = $TD__ROWSPAN_rx = $TD__WIDTH_rx = $TD__HEIGHT_rx = $num_type;
 $TH__COLSPAN_rx = $TH__ROWSPAN_rx = $TH__WIDTH_rx = $TH__HEIGHT_rx = $num_type;
-
+# 03/26 2011 shige: 3-2)
+$TDADDOPT = $THADDOPT = '';
 
 $TEXTAREA_attribs_rx_list = ",COLS,ROWS,NAME,";
 $TEXTAREA__COLS = $TEXTAREA__ROWS = $num_type;  # required
@@ -607,7 +608,8 @@
 
     if ($color_env) {
 	local($color_test) = join(',',@$open_tags_R);
-	if ($color_test =~ /(color{[^}]*})/g ) {
+	# 02/19 2018 shige: 2-35)
+	if ($color_test =~ /(color\{[^}]*\})/g ) {
 	    $color_env = $1;
 	}
     }
@@ -860,6 +862,10 @@
 		$colspec =~ s/<TD/<$headcell/g;
 		$colspec =~ s/<\/TD/<\/$headcell/g;
 	    }
+	    # 03/26 2011 shige: 3-2)
+	    $colspec =~ s/<TD/<TD $TDADDOPT/g if $TDADDOPT;
+	    $colspec =~ s/<TH/<TH $THADDOPT/g if $THADDOPT;
+
 	    $return .= $colspec;
 	    undef $cell_done;
 	};
@@ -1046,7 +1052,9 @@
     local($math_start,$math_end)= ($sbig,$ebig);
 
     local($eqno);
-    local($seqno) = join('',"\n<TD$eqno_class WIDTH=10 ALIGN=\""
+    #local($seqno) = join('',"\n<TD$eqno_class WIDTH=10 ALIGN=\""
+    # 09/09 2010 shige: 3-3)
+    local($seqno) = join('',"\n<TD$eqno_class WIDTH=\"$EQNO_WIDTH\" ALIGN=\""
                          , (($EQN_TAGS =~ /L/)? 'LEFT': 'RIGHT')
 		         , "\">\n");
     do { # get the equation number
@@ -1106,7 +1114,7 @@
     if ($border||($attribs)) { 
 	join('',"<BR>\n<DIV$math_class>\n"
 	    , &make_table( $border, $attribs, '', '', '', $_ )
-	    , "\n<BR CLEAR=\"ALL\">");
+	    , "\n<BR CLEAR=\"ALL\">"); # </DIV> ? shige: 2-32)
     } elsif ($failed) {
 	$falign = (($EQN_TAGS =~ /L/)? 'LEFT' : 'RIGHT') if ($eqno);
 	local($fclass) = $math_class;
@@ -1193,7 +1201,9 @@
 	    , "</TD>\n<TD ALIGN=\"LEFT\" NOWRAP>"
 	    , "</TD></TR>", "\n</TABLE>", "</TD>\n<TD>" );
 	$sarray .= (($no_eqn_numbers) ? ">" :  " WIDTH=\"100%\">" );
-	local($seqno) = join('',"\n<TD$eqno_class WIDTH=10 ALIGN=\""
+	#local($seqno) = join('',"\n<TD$eqno_class WIDTH=10 ALIGN=\""
+	# 09/09 2010 shige: 3-3)
+	local($seqno) = join('',"\n<TD$eqno_class WIDTH=\"$EQNO_WIDTH\" ALIGN=\""
 		, (($EQN_TAGS =~ /L/)? 'LEFT': 'RIGHT')
 		, "\">\n");
 	if ($EQN_TAGS =~ /L/) { # number on left
diff -ruN latex2html-2017.2/versions/html4_0.pl l2h-2017-jp2.1b1.18/versions/html4_0.pl
--- latex2html-2017.2/versions/html4_0.pl	2017-01-24 02:14:25.000000000 +0900
+++ l2h-2017-jp2.1b1.18/versions/html4_0.pl	2018-02-23 16:57:16.269812000 +0900
@@ -590,6 +590,8 @@
 $TD__BGCOLOR_rx = $TH__BGCOLOR_rx = $color_type;
 $TD__ABBR_rx = $TH__ABBR_rx  = $TD__AXIS_rx = $TH__AXIS_rx = $cdata_type;
 $TD__AXES_rx = $TH__AXES_rx = $id_list_type;
+# 03/26 2011 shige: 3-2)
+$TDADDOPT = $THADDOPT = '';
 
 
 $TEXTAREA_attribs = ",DISABLED,READONLY,DIR,";
@@ -1208,6 +1210,10 @@
 		$colspec =~ s/<TD/<$headcell/g;
 		$colspec =~ s/<\/TD/<\/$headcell/g;
 	    }
+	    # 03/26 2011 shige: 3-2)
+	    $colspec =~ s/<TD/<TD $TDADDOPT/g if $TDADDOPT;
+	    $colspec =~ s/<TH/<TH $THADDOPT/g if $THADDOPT;
+
 	    $return .= $colspec;
 	    undef $cell_done;
 	};
@@ -1408,7 +1414,9 @@
     local($math_start,$math_end)= ($sbig,$ebig);
 
     local($eqno);
-    local($seqno) = join('',"\n<TD$eqno_class WIDTH=10 ALIGN=\""
+    # 09/09 2010 shige: 3-3)
+    #local($seqno) = join('',"\n<TD$eqno_class WIDTH=10 ALIGN=\""
+    local($seqno) = join('',"\n<TD$eqno_class WIDTH=\"$EQNO_WIDTH\" ALIGN=\""
                          , (($EQN_TAGS =~ /L/)? 'LEFT': 'RIGHT')
 		         , "\">\n");
     do { # get the equation number
@@ -1469,7 +1477,7 @@
     if ($border||($attribs)) { 
 	join('',"<BR>\n<DIV$math_class>\n"
 	    , &make_table( $border, $attribs, '', '', '', $_ )
-	    , "\n<BR CLEAR=\"ALL\">");
+	    , "\n<BR CLEAR=\"ALL\">"); # </DIV> ? shige: 2-32)
     } elsif ($failed) {
 	$falign = (($EQN_TAGS =~ /L/)? 'LEFT' : 'RIGHT') if ($eqno);
 	local($fclass) = $math_class;
@@ -1558,7 +1566,9 @@
 	    , "</TD></TR>", "\n</TABLE>", "</TD>\n<TD>" );
 	$env_id = '';
 	$sarray .= (($no_eqn_numbers) ? ">" :  " WIDTH=\"100%\">" );
-	local($seqno) = join('',"\n<TD$eqno_class WIDTH=10 ALIGN=\""
+	# 09/09 2010 shige: 3-3)
+	#local($seqno) = join('',"\n<TD$eqno_class WIDTH=10 ALIGN=\""
+	local($seqno) = join('',"\n<TD$eqno_class WIDTH=\"$EQNO_WIDTH\" ALIGN=\""
 		, (($EQN_TAGS =~ /L/)? 'LEFT': 'RIGHT')
 		, "\">\n");
 	if ($EQN_TAGS =~ /L/) { # number on left
@@ -1703,6 +1713,9 @@
 	join('' #,"<BR>\n<DIV$math_class>"
 	    , &make_table( $border, $attribs, '', '', '', $_ )
 	    , "\n</DIV><P></P><BR CLEAR=\"ALL\">");
+    # 02/16 2018 shige: 2-34)
+    } elsif ($no_eqn_numbers) {
+	$_;
     } else {
 	join('', $_ ,"<BR CLEAR=\"ALL\"><P></P>");
     }
diff -ruN latex2html-2017.2/versions/html4_01.pl l2h-2017-jp2.1b1.18/versions/html4_01.pl
--- latex2html-2017.2/versions/html4_01.pl	2017-01-24 02:14:25.000000000 +0900
+++ l2h-2017-jp2.1b1.18/versions/html4_01.pl	2018-02-23 17:07:08.302760000 +0900
@@ -611,6 +611,8 @@
 $TD__ABBR_rx = $TH__ABBR_rx  = $TD__AXIS_rx = $TH__AXIS_rx = $cdata_type;
 $TD__SCOPE_rx = $TH__SCOPE_rx = $scope_type;
 $TD__HEADERS_rx = $TH__HEADERS_rx = $id_list_type;
+# 03/26 2011 shige: 3-2)
+$TDADDOPT = $THADDOPT = '';
 
 
 $TEXTAREA_attribs = ",DISABLED,READONLY,DIR,";
@@ -976,7 +978,8 @@
 
     if ($color_env) {
 	local($color_test) = join(',',@$open_tags_R);
-	if ($color_test =~ /(color{[^}]*})/g ) {
+	# 02/19 2018 shige: 2-35)
+	if ($color_test =~ /(color\{[^}]*\})/g ) {
 	    $color_env = $1;
 	}
     }
@@ -1229,6 +1232,10 @@
 		$colspec =~ s/<TD/<$headcell/g;
 		$colspec =~ s/<\/TD/<\/$headcell/g;
 	    }
+	    # 03/26 2011 shige: 3-2)
+	    $colspec =~ s/<TD/<TD $TDADDOPT/g if $TDADDOPT;
+	    $colspec =~ s/<TH/<TH $THADDOPT/g if $THADDOPT;
+
 	    $return .= $colspec;
 	    undef $cell_done;
 	};
@@ -1429,7 +1436,9 @@
     local($math_start,$math_end)= ($sbig,$ebig);
 
     local($eqno);
-    local($seqno) = join('',"\n<TD$eqno_class WIDTH=10 ALIGN=\""
+    # 09/09 2010 shige: 3-3)
+    #local($seqno) = join('',"\n<TD$eqno_class WIDTH=10 ALIGN=\""
+    local($seqno) = join('',"\n<TD$eqno_class WIDTH=\"$EQNO_WIDTH\" ALIGN=\""
                          , (($EQN_TAGS =~ /L/)? 'LEFT': 'RIGHT')
 		         , "\">\n");
     do { # get the equation number
@@ -1490,7 +1499,7 @@
     if ($border||($attribs)) { 
 	join('',"<BR>\n<DIV$math_class>\n"
 	    , &make_table( $border, $attribs, '', '', '', $_ )
-	    , "\n<BR CLEAR=\"ALL\">");
+	    , "\n<BR CLEAR=\"ALL\">"); # </DIV> ? shige: 2-32)
     } elsif ($failed) {
 	$falign = (($EQN_TAGS =~ /L/)? 'LEFT' : 'RIGHT') if ($eqno);
 	local($fclass) = $math_class;
@@ -1579,7 +1588,9 @@
 	    , "</TD></TR>", "\n</TABLE>", "</TD>\n<TD>" );
 	$env_id = '';
 	$sarray .= (($no_eqn_numbers) ? ">" :  " WIDTH=\"100%\">" );
-	local($seqno) = join('',"\n<TD$eqno_class WIDTH=10 ALIGN=\""
+	# 09/09 2010 shige: 3-3)
+	#local($seqno) = join('',"\n<TD$eqno_class WIDTH=10 ALIGN=\""
+	local($seqno) = join('',"\n<TD$eqno_class WIDTH=\"$EQNO_WIDTH\" ALIGN=\""
 		, (($EQN_TAGS =~ /L/)? 'LEFT': 'RIGHT')
 		, "\">\n");
 	if ($EQN_TAGS =~ /L/) { # number on left
@@ -1724,6 +1735,9 @@
 	join('' #,"<BR>\n<DIV$math_class>"
 	    , &make_table( $border, $attribs, '', '', '', $_ )
 	    , "\n</DIV><P></P><BR CLEAR=\"ALL\">");
+    # 02/16 2018 shige: 2-34)
+    } elsif ($no_eqn_numbers) {
+	$_;
     } else {
 	join('', $_ ,"<BR CLEAR=\"ALL\"><P></P>");
     }
diff -ruN latex2html-2017.2/versions/html4_1.pl l2h-2017-jp2.1b1.18/versions/html4_1.pl
--- latex2html-2017.2/versions/html4_1.pl	2017-01-24 02:14:25.000000000 +0900
+++ l2h-2017-jp2.1b1.18/versions/html4_1.pl	2018-02-23 17:10:10.478664000 +0900
@@ -611,6 +611,8 @@
 $TD__ABBR_rx = $TH__ABBR_rx  = $TD__AXIS_rx = $TH__AXIS_rx = $cdata_type;
 $TD__SCOPE_rx = $TH__SCOPE_rx = $scope_type;
 $TD__HEADERS_rx = $TH__HEADERS_rx = $id_list_type;
+# 03/26 2011 shige: 3-2)
+$TDADDOPT = $THADDOPT = '';
 
 
 $TEXTAREA_attribs = ",DISABLED,READONLY,DIR,";
@@ -976,7 +978,8 @@
 
     if ($color_env) {
 	local($color_test) = join(',',@$open_tags_R);
-	if ($color_test =~ /(color{[^}]*})/g ) {
+	# 02/19 2018 shige: 2-35)
+	if ($color_test =~ /(color\{[^}]*\})/g ) {
 	    $color_env = $1;
 	}
     }
@@ -1229,6 +1232,10 @@
 		$colspec =~ s/<TD/<$headcell/g;
 		$colspec =~ s/<\/TD/<\/$headcell/g;
 	    }
+	    # 03/26 2011 shige: 3-2)
+	    $colspec =~ s/<TD/<TD $TDADDOPT/g if $TDADDOPT;
+	    $colspec =~ s/<TH/<TH $THADDOPT/g if $THADDOPT;
+
 	    $return .= $colspec;
 	    undef $cell_done;
 	};
@@ -1429,7 +1436,9 @@
     local($math_start,$math_end)= ($sbig,$ebig);
 
     local($eqno);
-    local($seqno) = join('',"\n<TD$eqno_class WIDTH=10 ALIGN=\""
+    # 09/09 2010 shige: 3-3)
+    #local($seqno) = join('',"\n<TD$eqno_class WIDTH=10 ALIGN=\""
+    local($seqno) = join('',"\n<TD$eqno_class WIDTH=\"$EQNO_WIDTH\" ALIGN=\""
                          , (($EQN_TAGS =~ /L/)? 'LEFT': 'RIGHT')
 		         , "\">\n");
     do { # get the equation number
@@ -1490,7 +1499,7 @@
     if ($border||($attribs)) { 
 	join('',"<BR>\n<DIV$math_class>\n"
 	    , &make_table( $border, $attribs, '', '', '', $_ )
-	    , "\n<BR CLEAR=\"ALL\">");
+	    , "\n<BR CLEAR=\"ALL\">"); # </DIV> ? shige: 2-32)
     } elsif ($failed) {
 	$falign = (($EQN_TAGS =~ /L/)? 'LEFT' : 'RIGHT') if ($eqno);
 	local($fclass) = $math_class;
@@ -1579,7 +1588,9 @@
 	    , "</TD></TR>", "\n</TABLE>", "</TD>\n<TD>" );
 	$env_id = '';
 	$sarray .= (($no_eqn_numbers) ? ">" :  " WIDTH=\"100%\">" );
-	local($seqno) = join('',"\n<TD$eqno_class WIDTH=10 ALIGN=\""
+	# 09/09 2010 shige: 3-3)
+	#local($seqno) = join('',"\n<TD$eqno_class WIDTH=10 ALIGN=\""
+	local($seqno) = join('',"\n<TD$eqno_class WIDTH=\"$EQNO_WIDTH\" ALIGN=\""
 		, (($EQN_TAGS =~ /L/)? 'LEFT': 'RIGHT')
 		, "\">\n");
 	if ($EQN_TAGS =~ /L/) { # number on left
@@ -1724,6 +1735,9 @@
 	join('' #,"<BR>\n<DIV$math_class>"
 	    , &make_table( $border, $attribs, '', '', '', $_ )
 	    , "\n</DIV><P></P><BR CLEAR=\"ALL\">");
+    # 02/16 2018 shige: 2-34)
+    } elsif ($no_eqn_numbers) {
+	$_;
     } else {
 	join('', $_ ,"<BR CLEAR=\"ALL\"><P></P>");
     }
diff -ruN latex2html-2017.2/versions/math.pl l2h-2017-jp2.1b1.18/versions/math.pl
--- latex2html-2017.2/versions/math.pl	2017-01-24 02:14:25.000000000 +0900
+++ l2h-2017-jp2.1b1.18/versions/math.pl	2018-02-23 17:16:42.454604000 +0900
@@ -171,7 +171,9 @@
     local($math_start,$math_end)= ($sbig,$ebig);
 
     local($eqno) = '&nbsp;'; # spacer, when no numbering
-    local($seqno) = join('',"\n<TD$eqno_class WIDTH=10 ALIGN=\""
+    # 09/09 2010 shige: 3-3)
+    #local($seqno) = join('',"\n<TD$eqno_class WIDTH=10 ALIGN=\""
+    local($seqno) = join('',"\n<TD$eqno_class WIDTH=\"$EQNO_WIDTH\" ALIGN=\""
                          , (($EQN_TAGS =~ /L/)? 'LEFT': 'RIGHT')
 		         , "\">\n");
     do { # include the equation number, using a <TABLE>
@@ -985,7 +987,9 @@
 	$sarray .= "ALIGN=\"CENTER\" WIDTH=\"100%\">";
 	$env_id = '';
 
-	local($seqno) = join('',"\n<TD$eqno_class WIDTH=10 ALIGN=\""
+	# 09/09 2010 shige: 3-3)
+	#local($seqno) = join('',"\n<TD$eqno_class WIDTH=10 ALIGN=\""
+	local($seqno) = join('',"\n<TD$eqno_class WIDTH=\"$EQNO_WIDTH\" ALIGN=\""
 		, (($EQN_TAGS =~ /L/)? 'LEFT': 'RIGHT')
 		, "\">\n");
 	if ($EQN_TAGS =~ /L/) { # number on left
@@ -1430,6 +1434,8 @@
 	    while ($pre_test =~ s/(($O|$OP)\d+($C|$CP))(.*)\1/$4/) {};
 	    $use_all = 1 if ($pre_test=~s/($O|$OP)\d+($C|$CP)//);
 	    if (!$use_all) {
+		# 08/20 2014 shige: 2-33)
+		$pre_test = $pre_text;
 	        while ($pre_test =~ s/\\begin(($O|$OP)\d+($C|$CP))(.*)\\end\1/$4/){};
 		$use_all = 1 if ($pre_test=~s/\\(begin|end)($O|$OP)\d+($C|$CP)//);
 	    };
diff -ruN latex2html-2017.2/versions/table.pl l2h-2017-jp2.1b1.18/versions/table.pl
--- latex2html-2017.2/versions/table.pl	2017-01-24 02:14:25.000000000 +0900
+++ l2h-2017-jp2.1b1.18/versions/table.pl	2018-02-23 17:18:43.719023000 +0900
@@ -91,7 +91,8 @@
     ($pxs,$len);
 }
 # should no longer be needed, as this is defined in latex2html.pin
-if (undefined &convert_length) { sub convert_length {&convert_length_table(@_)} }
+# shige: 2-7)
+if (!defined(&convert_length)) { sub convert_length {&convert_length_table(@_)} }
 
 # Translates LaTeX column specifications to HTML. Again, Netscape
 # needs some extra work with its width attributes in the <td> tags.
