diff --git a/.gitignore b/.gitignore deleted file mode 100644 index 224e7f0..0000000 --- a/.gitignore +++ /dev/null @@ -1 +0,0 @@ -.pc/ diff --git a/Changes b/Changes index 5bc331a..661b961 100644 --- a/Changes +++ b/Changes @@ -112,6 +112,65 @@ # A more detailed log history can be found within the particular files, near # the top. # +# +#--------- v2025 +# +# - generate a numeric char reference for chars not found in +# the output character encoding. +# - fix \'{\i} +# - switch --entities no longer makes accents like í +# - fix \verb&A& +# - avoid processing eqnarray* as one image, +# make layout consistent with eqnarray +# +#--------- v2024.2 +# +# - fix pstoimg operator precedence bug +# https://bugs.debian.org/1085309 +# - allow "-dir ." and "-rootdir ." +# - remove extra "showpage" from pstoimg +# https://bugs.debian.org/1078536 +# - remove svg from config for pstoimg +# https://bugs.debian.org/1078535 +# - new option -use_hilite +# - support minted package +# - new option -unicase_titles +# +#--------- v2024 +# +# - "make clean" removes manual.pdf +# https://bugs.debian.org/1046413 +# +#--------- v2023.2 +# +# - DONT_INCLUDE now affects \usepackage but not \input +# - support \usepackage[xindy]{imakeidx} for sorting accents +# - support babel main language option +# - support hyphenat package +# +#--------- v2023 +# +# - update for latest pdftocairo +# +#--------- v2022.2 +# +# - spacing of eqnarray and align +# - check for preview.sty in config.pl +# - check for failure of pdflatex run +# - newline after footnote should give space +# - fix ref to label inside float +# - add sidewaysfigure, sidewaystable +# - fix eqnarray* +# +#--------- v2022 +# +# - fix cropped figures +# - revert PreviewBorder to 0.5bp +# - support download attribute for tag +# - remove meta tags for distribution, etc +# - allow input filename with no extension +# echo hello world | latex2html -dir out -mkdir /dev/stdin +# #--------- v2021.2 # # - latex2html -long_titles fix duplicate file names diff --git a/IndicTeX-HTML/devnagri.perl b/IndicTeX-HTML/devnagri.perl index c463920..4aedace 100644 --- a/IndicTeX-HTML/devnagri.perl +++ b/IndicTeX-HTML/devnagri.perl @@ -331,6 +331,7 @@ sub do_env_pre_devnag { sub do_env_pre_tr_devnagri { local($_) = @_; open(DNTR,">dntr.tmp") || print "\n *** cannot open dntr.tmp ***" ; + binmode DNTR; print DNTR "\$\$", &revert_to_raw_tex($_), "\$\$"; close DNTR; &syswait("patc -p $PRE_FILTERS${dd}dng.pat dntr.tmp dntr.tmp1"); diff --git a/IndicTeX-HTML/itrans.perl b/IndicTeX-HTML/itrans.perl index dbb618d..3c0ca7f 100644 --- a/IndicTeX-HTML/itrans.perl +++ b/IndicTeX-HTML/itrans.perl @@ -336,10 +336,11 @@ sub itrans_html { , "\#${indic}ifm=".$itrans_info{$indic.'ifm'} , "\#$indic", $itext , "\#end$indic\n" ); open(ITRANS, ">itrans.itx"); + binmode ITRANS;; print ITRANS "$_"; close(ITRANS); &syswait("$ITRANS itrans.htm"); - open(ITRANS, ") { next if (/^(\%|$)/); $itext .= $_ diff --git a/IndicTeX-HTML/malyalam.perl b/IndicTeX-HTML/malyalam.perl index 1d9b43d..b34958d 100644 --- a/IndicTeX-HTML/malyalam.perl +++ b/IndicTeX-HTML/malyalam.perl @@ -221,6 +221,7 @@ sub mm_other_environments { sub do_env_pre_mmtr { local($_) = @_; open(MMTR,">mmtr.tmp") || print "\n *** cannot open mmtr.tmp ***" ; + binmode MMTR; print MMTR "\$\$", &revert_to_raw_tex($_), "\$\$"; close MMTR; &syswait("$PATC -p $MMDIR${dd}mm.pat mmtr.tmp mmtr.tmp1"); diff --git a/config/config.pl b/config/config.pl index 6c95740..e2ac750 100755 --- a/config/config.pl +++ b/config/config.pl @@ -156,7 +156,7 @@ # -- this version should be "thread-safe" now # --- there are no more *-globs . References are used throughout. # -- UTF8 implemented completely, as an output encoding -# -- use of full entitity names is implemented as an output encoding +# -- use of full entity names is implemented as an output encoding # -- mechanism available to choose whether to allow 8-bit chars in the # output, or UTF8 or entity names or images # -- implemented post-processing search for ,, << >> ligatures @@ -247,7 +247,7 @@ # Revision 1.6 1999/06/03 12:15:49 MRO # # -# - cleaned up the TMP / TMPDIR / TMP_ mechansim. Should work much the +# - cleaned up the TMP / TMPDIR / TMP_ mechanism. Should work much the # same now, but the code should be easier to understand. # # - cleaned up L2hos, added an INSTALLation FAQ, beautified the test @@ -441,8 +441,8 @@ package main; use vars qw(%prefs %cfg %newcfg); # This is the central place to modify the release name and date!!! -my $RELEASE = '2021.2'; -my $VERSION = 'Released July 1, 2021'; +my $RELEASE = '2025'; +my $VERSION = 'Released January 1, 2025'; # -------------------------------------------------------------------------- # Open log @@ -898,6 +898,16 @@ package main; } } +if ($kpsewhich) { + &checking('for preview.sty'); + my ($stat,$out,$err) = &get_out_err("$kpsewhich preview.sty"); + if($stat == 0) { # ok + &result("ok"); + } else { + &logit("NONE\nWarning: preview.sty not found.\n svg images will not work.\n dvipng will not work\n"); + } +} + &checking('for TeX include path'); my $texpath = $opt{TEXPATH} || $prefs{TEXPATH} || ''; if($texpath eq 'no') { @@ -1606,20 +1616,25 @@ package main; } -$newcfg{'IMAGE_TYPES'} = ''; +$newcfg{'IMAGE_TYPES'} = ''; # types for latex2html, subset of svg, png, gif +$newcfg{'PSTOIMG_TYPES'} = ''; # types for pstoimg, subset of png, gif if($newcfg{'have_pstoimg'}) { my @imgtypes = (); + my @pstoimgtypes = (); if($opt{'SVG'}) { push(@imgtypes,'svg'); } if($opt{'PNG'}) { push(@imgtypes,'png'); + push(@pstoimgtypes,'png'); } if($opt{'GIF'}) { push(@imgtypes,'gif'); + push(@pstoimgtypes,'gif'); } $newcfg{'IMAGE_TYPES'} = join(' ',@imgtypes); + $newcfg{'PSTOIMG_TYPES'} = join(' ',@pstoimgtypes); } # -------------------------------------------------------------------------- @@ -1876,6 +1891,34 @@ package main; } } +# -------------------------------------------------------------------------- +# SRCHILITE +# -------------------------------------------------------------------------- +# used in listings.perl and minted.perl for colorized listings + +$newcfg{'SRCHILITE'} = ''; + +if(1) { + my $srchilite = &find_prog(&get_name('SRCHILITE',1)); + if($srchilite) { + $newcfg{'SRCHILITE'} = $srchilite; + } +} + +# -------------------------------------------------------------------------- +# SRCHILITE +# -------------------------------------------------------------------------- +# used in listings.perl and minted.perl for colorized listings + +$newcfg{'SRCHILITE'} = ''; + +if(1) { + my $srchilite = &find_prog(&get_name('SRCHILITE',1)); + if($srchilite) { + $newcfg{'SRCHILITE'} = $srchilite; + } +} + # -------------------------------------------------------------------------- # Pipes # -------------------------------------------------------------------------- diff --git a/config/install.pl b/config/install.pl index d732176..55dee9b 100755 --- a/config/install.pl +++ b/config/install.pl @@ -295,8 +295,10 @@ split(/\s+/,$cfg{'IMAGE_TYPES'}) : qw(gif); my $iconrx = join('|', @icon_types); +my $destdir=$ENV{"DESTDIR"}; my $dest1 = "$cfg{'SHLIBDIR'}${dd}icons"; -if((-d $dest1 && !-w _) || (-d $cfg{'SHLIBDIR'} && !-w _)) { +print STDERR "((( $destdir, $dest1 )))\n"; +if((-d "$destdir$dest1" && !-w _) || (-d "$destdir$cfg{'SHLIBDIR'}" && !-w _)) { print STDERR "Error: Cannot install icons in '$dest1': No write permission.\n"; $dest1 = ''; } diff --git a/configure b/configure index b361d46..ba5cc02 100755 --- a/configure +++ b/configure @@ -106,9 +106,9 @@ ac_help="$ac_help ac_help="$ac_help --with-pnmpad=PATH path/name of the pnmpad executable" ac_help="$ac_help - --with-pnmrotate=PATH path/name of the pnmrotate executable" + --with-pnmrotate=PATH path/name of the pnmrotate executable" ac_help="$ac_help - --with-pnmscale=PATH path/name of the pnmscale executable" + --with-pnmscale=PATH path/name of the pnmscale executable" ac_help="$ac_help --with-pbmmake=PATH path/name of the pbmmake executable" ac_help="$ac_help @@ -116,7 +116,7 @@ ac_help="$ac_help ac_help="$ac_help --with-pnmtopng=PATH path/name of the pnmtopng executable" ac_help="$ac_help - --with-tifftopnm=PATH path/name of the tifftopnm executable" + --with-tifftopnm=PATH path/name of the tifftopnm executable" ac_help="$ac_help --with-anytopnm=PATH path/name of the anytopnm executable" ac_help="$ac_help @@ -130,11 +130,13 @@ ac_help="$ac_help ac_help="$ac_help --with-xwdtopnm=PATH path/name of the xwdtopnm executable" ac_help="$ac_help - --with-ppmtojpeg=PATH path/name of the ppmtojpeg executable" + --with-ppmtojpeg=PATH path/name of the ppmtojpeg executable" ac_help="$ac_help --with-giftool=PATH path/name of the giftool executable" ac_help="$ac_help --with-giftrans=PATH path/name of the giftrans executable" +ac_help="$ac_help + --with-srchilite=PATH path/name of pygmentize or source-highlight" # Initialize some variables set by options. # The variables have the same names as the options, with @@ -1134,6 +1136,14 @@ else with_giftrans=${GIFTRANS:-} fi +# Check whether --with-srchilite or --without-srchilite was given. +if test "${with_srchilite+set}" = set; then + withval="$with_srchilite" + : +else + with_srchilite=${SRCHILITE:-} +fi + if test -n "$PERL"; then @@ -1296,7 +1306,8 @@ $PERL $srcdir/config/config.pl \ XWDTOPNM=$with_xwdtopnm \ PPMTOJPEG=$with_ppmtojpeg \ GIFTOOL=$with_giftool \ - GIFTRANS=$with_giftrans + GIFTRANS=$with_giftrans \ + SRCHILITE=$with_srchilite if test "$?" != "0"; then exit 1 diff --git a/debian/README.foilhtml.Debian b/debian/README.foilhtml.Debian index 4aef571..189eedc 100644 --- a/debian/README.foilhtml.Debian +++ b/debian/README.foilhtml.Debian @@ -7,7 +7,7 @@ well-tested, and I may certainly missing some evil side-effects of my changes. Except for some obligatory cosmetic nonsense you don't want to use, -this essentially replaces all occurences of rotatedfoilhead{} in the +this essentially replaces all occurrences of rotatedfoilhead{} in the various sectioning macros by foilhead{} - foilhead{} as defined in the standard FoilTeX package already knows about landscape mode and does the right thing. diff --git a/debian/TODO b/debian/TODO index 6ea3a68..de5e02e 100644 --- a/debian/TODO +++ b/debian/TODO @@ -1,6 +1,9 @@ - * two errors while generating images +* autopkgtest for texexpand + +* tests/ contains man more sampe files, test them too? + +* two errors while generating images * split out the documentation to a separate latex2html-doc package - * enable autopkgtests with linkchecker when linkchecker is - installable again + * look into "repacksuffice" for the watch file, documented in uscan(1) \ No newline at end of file diff --git a/debian/changelog b/debian/changelog index f3db004..34b62dd 100644 --- a/debian/changelog +++ b/debian/changelog @@ -1,3 +1,82 @@ +latex2html (2025+debian1-1) unstable; urgency=medium + + * New upstream release. + + -- Carsten Leonhardt Wed, 01 Jan 2025 12:59:41 +0100 + +latex2html (2024.2-debian1-1) unstable; urgency=medium + + * New upstream release. (Closes: #1085309) + * Remove backported patches. + + -- Carsten Leonhardt Mon, 21 Oct 2024 10:53:57 +0200 + +latex2html (2024-debian1-4) unstable; urgency=medium + + * Backport fix to allow "-dir ." and "-rootdir ." + and add autopkgtest for it. + + -- Carsten Leonhardt Tue, 17 Sep 2024 12:23:55 +0200 + +latex2html (2024-debian1-3) unstable; urgency=medium + + * Backport fix to remove svg from config for pstoimg from + upstream. (Closes: #1078535) + * Backport from upstream: remove extra "showpage" from pstoimg. + (Closes: #1078536) + * Add autopkgtest for pstoimg. + * debian/control: Standards-Version: 4.7.0 + * A bug reported to Ubuntu about \color entries was already fixed in + 2018.2-debian1-1 (LP: #1798041) + + -- Carsten Leonhardt Fri, 06 Sep 2024 11:08:01 +0200 + +latex2html (2024-debian1-2) unstable; urgency=medium + + * Change the binary package dependency to ghostscript instead of + ghostscript-x too. + + -- Carsten Leonhardt Tue, 09 Jan 2024 00:29:52 +0100 + +latex2html (2024-debian1-1) unstable; urgency=medium + + * New upstream release. (Closes: #1046413) + * Depend on ghostscript instead of ghostscript-x which is now a + transitional package. (Closes: #1033772) + + -- Carsten Leonhardt Tue, 02 Jan 2024 20:18:34 +0100 + +latex2html (2023-debian1-1) unstable; urgency=medium + + * New upstream release. + * Depend on texlive-binaries instead of texlive-base-bin. Thanks to + Hilmar Preusse. (Closes: #1030065) + * debian/control: Standards-Version: 4.6.2 + + -- Carsten Leonhardt Mon, 06 Feb 2023 12:08:48 +0100 + +latex2html (2022.2-debian1-1) unstable; urgency=medium + + * New upstream release. + + -- Carsten Leonhardt Wed, 27 Jul 2022 12:00:44 +0200 + +latex2html (2022-debian1-2) unstable; urgency=medium + + [ Helmut Grohne ] + * Mark latex2html Multi-Arch: foreign. (Closes: #1010315) + + [ Carsten Leonhardt ] + * debian/control: Standards-Version: 4.6.1 + + -- Carsten Leonhardt Tue, 31 May 2022 00:37:43 +0200 + +latex2html (2022-debian1-1) unstable; urgency=medium + + * New upstream release. + + -- Carsten Leonhardt Fri, 11 Mar 2022 14:08:12 +0100 + latex2html (2021.2-debian1-1) unstable; urgency=medium [ Carsten Leonhardt ] @@ -460,7 +539,7 @@ latex2html (2000-beta1-4) unstable; urgency=low * Fix romanian language styles. Thank Ionel. (closes: #119530) * Fix typo in graphicx.perl. Thank Rainer. (closes: #115977) - * Use DVIPS_SAFE=1 for latex2html. I beleive the current version + * Use DVIPS_SAFE=1 for latex2html. I believe the current version of dvips (tetexbin 1.0.7+20001218-7) in debian sid is working fine. (closes: #118095, #114807) * Downgrade perl-doc to Suggests. (closes: #112346) @@ -476,7 +555,7 @@ latex2html (2000-beta1-3.1) unstable; urgency=low * Downgrade perl-doc from Depends to Recommends. (closes: #110518) You only need this package when calling latex2html with --help. * Remove pnmtopng from Build-Depends and Depends lists. It is provided - by netpbm which exists in boths lists. + by netpbm which exists in both lists. -- Chanop Silpa-Anan Wed, 29 Aug 2001 22:19:10 +1000 @@ -585,7 +664,7 @@ latex2html (99.1-pre2-b6-6) frozen unstable; urgency=low latex2html (99.1-pre2-b6-5) frozen unstable; urgency=low * The postinst was vulnerable to being affected by symlinks (if, for - some reason, the prerm failed). This has happended for latex2html; and + some reason, the prerm failed). This has happened for latex2html; and created a grave bug. * There was a bug in the postinst in a case statement, that caused installation to fail for certain situations. @@ -681,7 +760,7 @@ latex2html (98.1-pre2-b8-2) unstable; urgency=low latex2html (98.1-pre2-b8-1) unstable; urgency=low * More upstream bug fixes, - * Ensure that the icons are avalable, even when looking under icons.png + * Ensure that the icons are available, even when looking under icons.png -- Manoj Srivastava Wed, 27 Jan 1999 01:21:19 -0600 @@ -730,7 +809,7 @@ latex2html (98.1p1-4) frozen unstable; urgency=low * Tried to make sure that the LaTeX2HTML manual is really built correctly. * There was an old version of html.sty in the docs directory gumming up the works - * Added a symlink from Chnages.gz to changelog.gz, satisfies lintian. + * Added a symlink from Changes.gz to changelog.gz, satisfies lintian. * Added a crude hack to enable LaTeX2HTML from hanging while converting problems.tex in the manual (this is a major problem with the package that has been reported upstream). I think it is important to get this @@ -755,7 +834,7 @@ latex2html (98.1p1-2) frozen unstable; urgency=low need to be respected. * Upgraded to Standards Version 2.4.0.0 (no additional changes) * Do not generate a ps file, since the resolution of the printer is - unknown. Leave the dvi file in so that peopel may generate the ps file + unknown. Leave the dvi file in so that people may generate the ps file at will. * closes: Bug#20005 @@ -777,7 +856,7 @@ latex2html (98.1-2) unstable; urgency=low latex2html (98.1-1) unstable; urgency=low * The beta versions were never released. This is the new upstream - release, but there were enoufh source changes to restart a new CVS + release, but there were enough source changes to restart a new CVS tree. * much faster, and generates much better output. * This parses everything I could throw at it (a few glitches exist, but @@ -832,10 +911,10 @@ latex2html (96.1.h-6) unstable; urgency=low environments. * Install the LaTeX styles files in the proper location in the TDS (namely /usr/lib/texmf/tex/latex/latex2html). - * Added commads to postinst and postrm to run texhash if appropiate. + * Added commands to postinst and postrm to run texhash if appropriate. * This fixes BUG#9918. * This is the first version to be constructed with cvs-buildpackage, in - fact, we are really useing the pre-release version. + fact, we are really using the pre-release version. -- Manoj Srivastava Wed, 28 May 1997 22:26:15 -0500 @@ -855,10 +934,10 @@ latex2html (96.1.h-4) unstable; urgency=low * Changed HTML_VERSION in latex2html.config to 3.1 to support HTML tables and Font size changes by default. * Added symlinks to icons under /var/www so that the files converted by - LaTeX2HTML can be viewd directly using a HTML browser, or put in a + LaTeX2HTML can be viewed directly using a HTML browser, or put in a directory visible from the local HTTP server and viewd through the HTTP server. The solution is ugly, but it works, and should fix BUG#8536 - * Changed maintaner name in control file as well + * Changed maintainer name in control file as well -- Manoj Srivastava Thu, 1 May 1997 14:00:13 -0500 @@ -872,7 +951,7 @@ latex2html (96.1.h-3) frozen unstable; urgency=low * Expanded README to insert a table to help decide icon server values * The install test now edits the executable after asking the user, unless the force option has been used. - * The install test now edits the executable script only when necesary + * The install test now edits the executable script only when necessary * install-test now works for Debian. * New maintainer diff --git a/debian/control b/debian/control index 04dc3c8..fdd8688 100644 --- a/debian/control +++ b/debian/control @@ -2,19 +2,21 @@ Source: latex2html Section: tex Priority: optional Maintainer: Carsten Leonhardt -Build-Depends: debhelper-compat (= 13) -Build-Depends-Indep: dvipng, - poppler-utils, - ghostscript-x, - netpbm, - patch, - perl, - perl-doc, - tex-common, - texlive-base-bin, - texlive-latex-extra, - texlive-latex-recommended -Standards-Version: 4.6.0 +Build-Depends: + debhelper-compat (= 13), + tex-common, +Build-Depends-Indep: + dvipng, + ghostscript, + netpbm, + patch, + perl, + perl-doc, + poppler-utils, + texlive-binaries, + texlive-latex-extra, + texlive-latex-recommended, +Standards-Version: 4.7.0 Rules-Requires-Root: no Homepage: https://www.latex2html.org/ Vcs-Browser: https://salsa.debian.org/debian/latex2html @@ -22,17 +24,20 @@ Vcs-Git: https://salsa.debian.org/debian/latex2html.git Package: latex2html Architecture: all -Depends: ghostscript-x, - netpbm, - perl, - perl-doc, - poppler-utils, - texlive-base-bin, - texlive-fonts-recommended, - texlive-latex-extra, - texlive-latex-recommended, - ${misc:Depends} -Recommends: dvipng +Multi-Arch: foreign +Depends: + ghostscript, + netpbm, + perl, + perl-doc, + poppler-utils, + texlive-binaries, + texlive-fonts-recommended, + texlive-latex-extra, + texlive-latex-recommended, + ${misc:Depends}, +Recommends: + dvipng, Description: LaTeX to HTML translator LaTeX2HTML is a conversion tool that converts documents written in LaTeX to HTML format. In addition, it offers an easy migration diff --git a/debian/copyright b/debian/copyright index ba3f067..ca7d66f 100644 --- a/debian/copyright +++ b/debian/copyright @@ -4,7 +4,6 @@ Upstream-Contact: latex2html@tug.org Source: https://github.com/latex2html/latex2html Files-Excluded: cweb2html - docs/changebar* Files: * Copyright: 1993-1997 Nikos Drakos @@ -32,7 +31,7 @@ Copyright: 1997 Herbert Xu 2001 Chanop Silpa-Anan 2002-2003 Aurélien Beaujean 2003-2013 Roland Stigge - 2018-2020 Carsten Leonhardt + 2018-2024 Carsten Leonhardt License: GPL-2+ On Debian systems, the full text of the GNU General Public License version 2 can be found in the file diff --git a/debian/docs b/debian/docs index 4236214..b0734c8 100644 --- a/debian/docs +++ b/debian/docs @@ -1,4 +1,4 @@ debian/README.foilhtml.Debian docs/manual.dvi -docs/manual.ps docs/manual.pdf +docs/manual.ps diff --git a/debian/latex2html.patch b/debian/latex2html.patch index 645fdf7..6f4beb4 100644 --- a/debian/latex2html.patch +++ b/debian/latex2html.patch @@ -18,7 +18,7 @@ NMUed, "joey" or the like). I'll tell you all about this MUD thing at the barbeque on Friday!" Next, the attacker has to set up -Projets/debian/latex2html-2000-beta1/texexpand, which is the program +Projects/debian/latex2html-2000-beta1/texexpand, which is the program that will be executed by perl, and some of the other files referred to around line 429 of /usr/bin/latex2html. The dummy texexpand can do something like set up a suid shell for him to use later. Then it can go diff --git a/debian/lintian-overrides b/debian/lintian-overrides index a5fa4f8..731c2f4 100644 --- a/debian/lintian-overrides +++ b/debian/lintian-overrides @@ -1,8 +1,9 @@ -#not a mistake -latex2html: improbable-bug-number-in-closes 37982 #this script is not run standalone -latex2html: script-not-executable usr/share/latex2html/styles/hyperref.perl +latex2html: script-not-executable [usr/share/latex2html/styles/hyperref.perl] # these files handle national encodings -latex2html: national-encoding usr/share/latex2html/styles/TEMPLATE.perl -latex2html: national-encoding usr/share/latex2html/styles/turkish.perl -latex2html: national-encoding usr/share/latex2html/versions/koi8.pl +latex2html: national-encoding [usr/share/latex2html/styles/TEMPLATE.perl] +latex2html: national-encoding [usr/share/latex2html/styles/turkish.perl] +latex2html: national-encoding [usr/share/latex2html/versions/koi8.pl] +# not documentation +package-contains-documentation-outside-usr-share-doc [usr/share/latex2html/styles/crayola.txt] +package-contains-documentation-outside-usr-share-doc [usr/share/latex2html/styles/rgb.txt] diff --git a/debian/patches/debian/install.patch b/debian/patches/debian/install.patch index eb9b94c..3e79913 100644 --- a/debian/patches/debian/install.patch +++ b/debian/patches/debian/install.patch @@ -14,7 +14,7 @@ Forwarded: not-needed #'texlive.pm' => 'lib', 'versions' => 'lib,recurse', #'wrapper' => 'lib,recurse', -@@ -389,7 +389,7 @@ +@@ -391,7 +391,7 @@ } } closedir(DIR); diff --git a/debian/salsa-ci.yml b/debian/salsa-ci.yml index 36dfa02..894f5eb 100644 --- a/debian/salsa-ci.yml +++ b/debian/salsa-ci.yml @@ -1,11 +1,23 @@ include: - - https://salsa.debian.org/salsa-ci-team/pipeline/raw/master/salsa-ci.yml - - https://salsa.debian.org/salsa-ci-team/pipeline/raw/master/pipeline-jobs.yml + - https://salsa.debian.org/salsa-ci-team/pipeline/raw/master/recipes/debian.yml # not reproducible because of netpbm bug https://bugs.debian.org/827115 reprotest: allow_failure: true +wrap-and-sort: + allow_failure: true + variables: RELEASE: 'unstable' SALSA_CI_REPROTEST_ENABLE_DIFFOSCOPE: 1 + # enable build testing on more architectures + # SALSA_CI_DISABLE_BUILD_PACKAGE_ARM64: 0 + # SALSA_CI_DISABLE_BUILD_PACKAGE_ARMEL: 0 + # SALSA_CI_DISABLE_BUILD_PACKAGE_ARMHF: 0 + # SALSA_CI_DISABLE_BUILD_PACKAGE_RISCV64: 0 + # enable wrap-and-sort test + SALSA_CI_DISABLE_WRAP_AND_SORT: 0 + SALSA_CI_WRAP_AND_SORT_ARGS: '-stab' + # enable building twice in a row + SALSA_CI_DISABLE_BUILD_PACKAGE_TWICE: 0 diff --git a/debian/source/lintian-overrides b/debian/source/lintian-overrides index 3504725..5fecdce 100644 --- a/debian/source/lintian-overrides +++ b/debian/source/lintian-overrides @@ -3,7 +3,7 @@ #latex2html source: debian-watch-file-should-mangle-version line 2 ## upstream does not provide a gpg signature -debian-watch-does-not-check-gpg-signature +debian-watch-does-not-check-openpgp-signature # better fix the tools that don't handle hyphens well hyphen-in-upstream-part-of-debian-changelog-version diff --git a/debian/tests/control b/debian/tests/control index 5312dfe..1d381bb 100644 --- a/debian/tests/control +++ b/debian/tests/control @@ -1,10 +1,28 @@ -Tests: l2htest -Restrictions: allow-stderr -Depends: latex2html -#Depends: latex2html, linkchecker +Tests: + l2htest, +Restrictions: + allow-stderr, +Depends: + latex2html, + linkchecker, -# linkchecker is uninstallable at the moment (2020-06-16) +Tests: + linkchecker, +Restrictions: + allow-stderr, +Depends: + latex2html, + linkchecker, -#Tests: linkchecker -#Restrictions: allow-stderr -#Depends: latex2html, linkchecker +# check that pstoimg works +Test-Command: pstoimg -o "$AUTOPKGTEST_TMP/test.png" tests/pages1.eps + +# check "-dir ." works / https://tug.org/pipermail/latex2html/2024-September/004132.html +Test-Command: latex2html -dir . tests/l2htest.tex +Restrictions: + allow-stderr, + +# check "-rootdir ." works / https://tug.org/pipermail/latex2html/2024-September/004132.html +Test-Command: latex2html -rootdir . tests/l2htest.tex +Restrictions: + allow-stderr, diff --git a/debian/tests/l2htest b/debian/tests/l2htest index 9a1d286..e31ebe1 100644 --- a/debian/tests/l2htest +++ b/debian/tests/l2htest @@ -6,7 +6,7 @@ set -e echo "---- running latex2html on test data ----" echo -if latex2html -dir $AUTOPKGTEST_TMP tests/l2htest +if latex2html -dir "$AUTOPKGTEST_TMP" tests/l2htest then echo echo "---- latex2html ran successfully ----" else @@ -16,16 +16,14 @@ else fi -# linkchecker is uninstallable at the moment (2020-06-16) - -# echo "---- testing for broken links ----" -# echo +echo "---- testing for broken links ----" +echo -# if linkchecker $AUTOPKGTEST_TMP/index.html -# then echo -# echo "---- no broken links ----" -# else -# echo -# echo "---- linkchecker exited with an error state ----" -# exit 1 -# fi +if linkchecker "$AUTOPKGTEST_TMP"/index.html +then echo + echo "---- no broken links ----" +else + echo + echo "---- linkchecker exited with an error state ----" + exit 1 +fi diff --git a/debian/upstream/metadata b/debian/upstream/metadata index b634103..1efaa52 100644 --- a/debian/upstream/metadata +++ b/debian/upstream/metadata @@ -1,4 +1,3 @@ -Homepage: https://www.latex2html.org Repository: https://github.com/latex2html/latex2html.git Repository-Browse: https://github.com/latex2html/latex2html/ Bug-Database: https://github.com/latex2html/latex2html/issues diff --git a/docs/Makefile b/docs/Makefile index bd7d3ac..87b1884 100644 --- a/docs/Makefile +++ b/docs/Makefile @@ -141,7 +141,7 @@ manual.pdf: manual.ps manual.ps: manual.dvi $(DVIPS) manual.dvi -o $@ -manual.aux manual.cb: \ +manual.aux: \ manual.tex credits.tex licence.tex overview.tex \ support.tex userman.tex hypextra.tex features.tex \ problems.tex l2hfiles.dat manhtml.tex l2hman.sty @@ -154,7 +154,7 @@ manual.glo manual.idx: \ problems.tex l2hfiles.dat manhtml.tex l2hman.sty $(LATEX) manual.tex -manual.dvi: manual.aux manual.ind manual.gls manual.cb +manual.dvi: manual.aux manual.ind manual.gls $(LATEX) manual.tex manual.ind: manual.idx @@ -202,8 +202,8 @@ htmlclean: rm -f manual/.??* manual/*TMP* clean: - rm -f manual.dvi manual.ps manual.glo manual.log manual.aux \ - manual.ilg manual.lof manual.lot manual.cb manual.idx manual.ind \ + rm -f manual.pdf manual.dvi manual.ps manual.glo manual.log manual.aux \ + manual.ilg manual.lof manual.lot manual.idx manual.ind \ manual.toc manual.gls rm -f *.ptr diff --git a/docs/appendix.tex b/docs/appendix.tex index 1fe5801..7af1191 100644 --- a/docs/appendix.tex +++ b/docs/appendix.tex @@ -50,7 +50,7 @@ \section{Known Problems} \item [Cross-references\index{cross-references}] References in environments that are passed to LaTeX for processing -(e.g. a \texttt{cite}, or a \texttt{ref} command), are not processed +(e.g.\ a \texttt{cite}, or a \texttt{ref} command), are not processed correctly. \texttt{label} commands are handled correctly. @@ -58,7 +58,7 @@ \section{Known Problems} Commands which affect global parameters during the translation, and are sensitive to the order in which they are processed may not be handled correctly. In particular, counter manipulation -(e.g. \texttt{newcounter, setcounter, stepcounter}, etc) +(e.g.\ \texttt{newcounter, setcounter, stepcounter}, etc) commands may cause problems. \item [Index\index{index}] @@ -278,7 +278,7 @@ \section{Troubleshooting} \item [Cannot convert postscript images which are included in the LaTeX file] \hfill \\ It is likely that the macros you are using for including postscript -files (e.g. \texttt{epsffile}) are not understood by \latextohtml. +files (e.g.\ \texttt{epsffile}) are not understood by \latextohtml. To avoid this problem enclose them in an environment which will be passed to LaTeX anyway e.g. \begin{verbatim} @@ -346,7 +346,7 @@ \section{Troubleshooting} \item [Problems when producing the DVI version \label{htmlsty}] If you are using any of the new LaTeX commands which are defined in the \fn{html.sty} file make sure that -\fn{html.sty} file is included e.g. as one of the optional arguments to the +\fn{html.sty} file is included e.g.\ as one of the optional arguments to the \texttt{documentstyle} command. Of course you also have to make sure that LaTeX knows where the html.sty @@ -755,12 +755,12 @@ \subsection{Changes upto v96} \htmladdnormallink{Unicode}{ftp://dkuug.dk/i18n/ISO_10646} character sets by specifying \fn{-html\_version 2.1}. HTML 3.0 support is provided for textual font size changes -(like \verb||), used in conjunction wich a generated +(like \verb||), used in conjunction with a generated optional style sheet. (Marcus Hennecke) \item[More inline math generated in \texttt{HTML}] Small inline equations which can be typeset in \texttt{HTML} \textbf{are} typeset -in \texttt{HTML}. This further reduces the nuber of GIF files +in \texttt{HTML}. This further reduces the number of GIF files that need to be generated. \item[Hypertext references can now be external] The commands @@ -926,7 +926,7 @@ \subsection{Changes up to v95} included in the ``Troubleshooting'' section of the \latextohtml{} manual. -Can now use either the \fn{pbmplus} or the \fn{netpbm} libary. +Can now use either the \fn{pbmplus} or the \fn{netpbm} library. If \fn{netpbm} is used then it is no longer necessary to get and install \fn{giftrans} in order to generate transparent inlined images. @@ -1215,7 +1215,7 @@ \subsection{Changes upto v0.4} arbitrary HTML tags to be included in a LaTeX document. This is useful for taking -advantage of HTML+ features as they become available (e.g. interactive +advantage of HTML+ features as they become available (e.g.\ interactive forms). The HTML commands are ignored when producing the DVI version of the document. @@ -1282,7 +1282,7 @@ \subsection{Changes upto v0.4} the translator to be ``reused'' without going through the initial interactive session. The same behavior is obtained by setting the variable \texttt{REUSE} to 1 (the default) in the configuration file. -Note that images which may depend on contextual information (e.g. numerical +Note that images which may depend on contextual information (e.g.\ numerical labels) cannot be reused and are always re-generated. \end{htmllist} \item[\textbf{Bug Fixes and Minor Changes}] \hfill @@ -1314,7 +1314,7 @@ \subsection{Changes upto v0.3.1} \item Nested environments with the same name are now dealt with properly. \item Commands that are passed to LaTeX for processing which have -environments in their arguments (e.g. a \texttt{parbox} command which +environments in their arguments (e.g.\ a \texttt{parbox} command which an \texttt{itemize} environment as an argument) are now processed correctly. A general mechanism for users to specify the syntax of commands that should be passed to LaTeX @@ -1448,7 +1448,7 @@ \subsection{Changes upto v0.2} \item The \fn{pstoxbm} script now uses environment variables set in the initialization file. \item Fixed bug in translating sequences of special HTML characters -(e.g. \&, $<$, etc.) +(e.g.\ \&, $<$, etc.) \item Fixed bug in the handling of the \verb|$$|-form of the dislay math environment. \item Fixed bug in the handling of the *-forms of environments. @@ -1460,7 +1460,7 @@ \subsection{Changes upto v0.2} \subsection{Changes upto v0.1.1} \begin{itemize} \item Fixed bug about empty lines being inserted in environments that -cannot tolerate them (e.g. \texttt{math}). +cannot tolerate them (e.g.\ \texttt{math}). \item Changed the format of inlined images coming back from LaTeX from GIF to XBM. This looks better on grayscale and color monitors. \item Fixed problem with commands being passed on to LaTeX after diff --git a/docs/features.tex b/docs/features.tex index fd265c0..a9e087b 100644 --- a/docs/features.tex +++ b/docs/features.tex @@ -63,7 +63,7 @@ \subsection{Variation with HTML Versions\label{versions}}% There is little provision for aligning headings, paragraphs or images nor for super/sub-scripts to be generated. Images are created for tables and other environments that use \HTMLtag{TABLE} tags with \HTMLiii; -e.g. \env{eqnarray} and \env{equation} with equation numbering. +e.g.\ \env{eqnarray} and \env{equation} with equation numbering. \index{HTML@\texttt{HTML}!Version 2.1, now `i18n' extension}% \index{Unicode|see{\htmlref{character set}{IIIcharset}}}% @@ -79,7 +79,7 @@ \subsection{Variation with HTML Versions\label{versions}}% but {ISO--10646} (Unicode). This is a 16-bit character set and can thus display a much larger set of characters. There are also provisions for bidirectional languages -(e.g. in Arabic the text is written from right to left, +(e.g.\ in Arabic the text is written from right to left, but numerals from left to right), and provisions in \texttt{HTML} to determine the character set and the language used. @@ -260,7 +260,7 @@ \subsubsection{Multi-lingual documents, using Images\label{multilang}}% whose glyphs can be typeset using \TeX{} or \LaTeX. Using \TeX's \Lcs{font} command, a macro is defined to declare the special font required; -e.g. for Cyrillic characters, using the Univ. of Washington font: +e.g.\ for Cyrillic characters, using the Univ. of Washington font: %begin{latexonly} \begin{small} %end{latexonly} @@ -303,7 +303,7 @@ \subsection{Mathematics\label{maths}} sub-expressions; \item \texttt{SGML}-like representation built using abstract ``entities'';\\ -e.g. for the \texttt{HTML-Math} model, or for \texttt{MathML}. +e.g.\ for the \texttt{HTML-Math} model, or for \texttt{MathML}. % \end{itemize} Which is the most appropriate normally depends on the context, @@ -334,7 +334,7 @@ \subsection{Mathematics\label{maths}} not loaded & --- & always generates an image of the whole\newline expression/environment\\ \hline loaded & --- & -uses entities and \HTMLtag{MATH} tags; e.g. for \texttt{HTML-Math} +uses entities and \HTMLtag{MATH} tags; e.g.\ for \texttt{HTML-Math} (or \texttt{MathML} in future)\\ \hline loaded & \Cs{no\_math} & textual representation where possible, with~images~of sub-expressions \\ \hline @@ -548,7 +548,7 @@ \subsection{Mathematics\label{maths}} generated of the \emph{entire contents} of the \Lc{mbox}. It is not necessary for there to be any actual mathematics inside the \Lc{mbox}'s contents;\html{\\} -e.g. \verb|\mbox{...some text...${}$}| +e.g.\ \verb|\mbox{...some text...${}$}| will cause an image to be created of the given text. @@ -621,7 +621,7 @@ \subsection{Figures and Image Conversion\label{imgcon}% \item ``figures'' \index{images!figures}\html{\\}% applies to image-generating \LaTeX{} environments -(e.g. \env{makeimage}, \env{figure}, \env{table} (with \texttt{HTML} 2.0), +(e.g.\ \env{makeimage}, \env{figure}, \env{table} (with \texttt{HTML} 2.0), and displayed math environments when required to generate images, etc.). \end{itemize} @@ -841,7 +841,7 @@ \subsection{Figures and Image Conversion\label{imgcon}% Environments for alignment and changing the font size do not generate images of their contents. Any \Lc{htmlimage} command may affect the surrounding environment instead; -e.g. within a \env{table} or \env{figure} environment, +e.g.\ within a \env{table} or \env{figure} environment, but does not apply to a \env{minipage}. When the \Lc{htmlimage} command occurs in an inappropriate @@ -1222,7 +1222,7 @@ \subsection{Figures, Tables and Arbitrary Images\label{sec:figs}} \Lc{includegraphics} or other special macros, the background color may come out as a shade of grey, rather than white or transparent. This is due to a setting designed to enhance anti-aliasing of text -within images; e.g. for mathematics. +within images; e.g.\ for mathematics. To alleviate this possible problem, the \Cs{white} command-line option can be used, to ensure a white background for images of \env{figure} environments. @@ -1323,7 +1323,7 @@ \subsection{Packages and Style-Files\label{sec:sty}} \end{itemize} the translator looks for a corresponding \texttt{.perl} file having the same file-name prefix; -e.g. the file \fn{\$LATEX2HTMLDIR/styles/german.perl}. +e.g.\ the file \fn{\$LATEX2HTMLDIR/styles/german.perl}. If such a \texttt{.perl} file is found, then its code will be incorporated with the main script, to be used as required. @@ -1670,7 +1670,7 @@ \subsection{Indexing\label{index}\index{index|(}}% \index{index!style@\texttt{\char124}\Meta{style}}% \item [\texttt{|}\Meta{style} : ] where \Meta{style} is the name of \LaTeX{} style-changing command, -without the initial `\Lc{}'; e.g. `\texttt{emph}', `\texttt{textbf}', +without the initial `\Lc{}'; e.g.\ `\texttt{emph}', `\texttt{textbf}', `\texttt{textit}', etc. The corresponding \LaTeX{} command is applied to the text of the generated hyperlink. @@ -1678,7 +1678,7 @@ \subsection{Indexing\label{index}\index{index|(}}% \index{index!alphabetization}% \item [blank lines and alphabetization: ] Having precisely a single space-character after the \verb+|+ -(e.g. \verb+\index{A| }+) +(e.g.\ \verb+\index{A| }+) places a blank line before the index entry and omits the hyperlink. This is used mainly for visual formatting; it allows a break before the entries starting with each letter, say. Using a printable-key, as in \verb+\index{Q@Q, R| }+, @@ -1885,7 +1885,7 @@ \subsubsection{Integrated Glossary and Index\label{glossind}}% Notice how the feature of \env{makeidx}, allowing the printable portion to be separate from the sorting-key, is used to allow text-styles to be included within both index-entries and glossary-entries. Indeed the purpose of \Lc{Glossary} is -to allow deviations from a fixed style, e.g. +to allow deviations from a fixed style, e.g.\ % %begin{latexonly} \begin{small} diff --git a/docs/hypextra.tex b/docs/hypextra.tex index 670b3fa..e1bb629 100644 --- a/docs/hypextra.tex +++ b/docs/hypextra.tex @@ -251,7 +251,7 @@ \section{Hypertext Extensions to \LaTeX} % \item[\htmlref{\Lc{htmlimage}}{htmlimage} ] used for fine control over the size of individual images, -and other graphics effects (e.g. making a `thumbnail' version);\html{\\} +and other graphics effects (e.g.\ making a `thumbnail' version);\html{\\} ignored in \LaTeX. \begin{latexonly} (See page~\pageref{htmlimage} for details.) @@ -1001,7 +1001,7 @@ \subsection{Conditional Text\label{sec:latexonly}}% \medskip\index{conditional text!avoid using counters}\html{\\}\noindent \textbf{Warning: }% Be careful when using \LaTeX{} commands which alter the values of counters -(e.g. numbered figures or equations) in conditional text, because this may +(e.g.\ numbered figures or equations) in conditional text, because this may cause the counter values in the electronic version to lose synchronisation with the values of the corresponding counters in the \LaTeX{} version. @@ -1014,7 +1014,7 @@ \subsection{Conditional Text\label{sec:latexonly}}% to be used when generating images. Typically this is used to add commands to the preamble of \fn{images.tex}, such as setting the text or background color. However code can be added at any other point as well; -e.g. to change the background color of all images after a certain point in the document. +e.g.\ to change the background color of all images after a certain point in the document. \smallskip\noindent Note the \hyperref[page]{warning}{warning at the bottom of page~}{}{env:warn} @@ -1064,7 +1064,7 @@ \subsection{Symbolic References shown as Hyperized Text\label{hyperized}% \index{references!iconic}\html{\\}\noindent In printed documents cross-references are shown through a \emph{numeric or symbolic indirection} -e.g. ``see Figure 1'' (numeric indirection), +e.g.\ ``see Figure 1'' (numeric indirection), or ``see section `Changes'~'' (symbolic indirection). \latextohtml{} can mirror this mechanism using the same numeric or symbolic references, @@ -1379,7 +1379,7 @@ \subsection{Hypertext Links in Bibliographic References (Citations)}% ... as well as many other \LaTeX{} constructions, such as are described in the \LaTeX{} \hypercite{\emph{Companion}}{\emph{Companion}}{}{goossens:latex} -and \LaTeX{} \hypercite{\emph{Graphics Companion} (e.g. \Xy-pic)}% +and \LaTeX{} \hypercite{\emph{Graphics Companion} (e.g.\ \Xy-pic)}% {\emph{Graphics Companion}}{\Xy-pic}{goossens:latexGraphics}; \end{verbatim} %begin{latexonly} @@ -1391,7 +1391,7 @@ \subsection{Hypertext Links in Bibliographic References (Citations)}% \\~~...\\ as well as many other \LaTeX{} constructions, such as are described in the \LaTeX{} \hypercite{\emph{Companion}}{\emph{Companion}}{}{goossens:latex} -and \LaTeX{} \hypercite{\emph{Graphics Companion} (e.g. \Xy-pic)}% +and \LaTeX{} \hypercite{\emph{Graphics Companion} (e.g.\ \Xy-pic)}% {\emph{Graphics Companion}}{\Xy-pic}{goossens:latexGraphics}; \end{quote} \begin{latexonly} @@ -1401,7 +1401,7 @@ \subsection{Hypertext Links in Bibliographic References (Citations)}% \\~~...\\ as well as many other \LaTeX{} constructions, such as are described in the \LaTeX{} \underline{\emph{Companion}} -and \LaTeX{} \underline{\emph{Graphics Companion} (e.g. \Xy-pic)}; +and \LaTeX{} \underline{\emph{Graphics Companion} (e.g.\ \Xy-pic)}; \end{quote} \end{latexonly} % @@ -1829,7 +1829,7 @@ \subsection{Miscellaneous commands for \texttt{HTML} effects\label{misceffects}} \paragraph*{\Lc{latextohtml}\label{l2hname}} expands to the name \latextohtml, of this translator. Commands for parts of names of important \LaTeX{} packages are also -included with \latextohtml: e.g. \TeX, \LaTeX, \AmS, \Xy\,. +included with \latextohtml: e.g.\ \TeX, \LaTeX, \AmS, \Xy\,. (This is to make it easy to refer to these products, in a consistent way within the \texttt{HTML} pages; you may still need \LaTeX{} definitions for the typeset version.) @@ -2150,7 +2150,7 @@ \subsection{Document Segmentation\protect\footnote{This feature Usually this will be just the section-head, from the \Lc{htmlhead} \htmlref{command}{htmlhead} in the \texttt{.ptr} file. Numbering and color information is unaffected.\html{\\} This allows an alternative heading to be specified, or no heading at all in special -circumstances; e.g. the page contains a single large table with a caption. +circumstances; e.g.\ the page contains a single large table with a caption. \index{segmentcolor@\Lc{segmentcolor}}% \item [ \Lc{segmentcolor\char123}\Meta{model}% diff --git a/docs/l2hfiles.dat b/docs/l2hfiles.dat index eb961f4..e4feea5 100644 --- a/docs/l2hfiles.dat +++ b/docs/l2hfiles.dat @@ -190,6 +190,7 @@ \item[\gn{\$TOP\_NAVIGATION}] when set, a navigation panel is placed at the top of every \texttt{HTML} page, unless overridden by \fn{\$NO\_NAVIGATION} being set also \item[\gn{\$TRANSPARENT\_FIGURES}] when set, this specifies that the background of generated images should be made transparent \item[\gn{\$TRANSPARENT\_IMAGES}] when set, this \emph{prevents} the background of images from being made transparent (no longer used) +\item[\gn{\$UNICASE\_TITLES}] when set, duplication of generated filenames for \texttt{HTML} pages is checked in case insensitive manner \item[\gn{\$UNSEGMENT}] when set, \latextohtml{} translates a segmented document as a whole rather than a single segment; use this for testing your segmented document \item[\gn{\$UP}] when navigation panels are created, this holds a hyperlink to the parent \texttt{HTML} page \item[\gn{\$UP\_TITLE}] when navigation panels are created, this holds a title of the parent \texttt{HTML} page diff --git a/docs/manual.tex b/docs/manual.tex index b152021..edc9b2f 100644 --- a/docs/manual.tex +++ b/docs/manual.tex @@ -13,7 +13,7 @@ % to typeset email-addresses, URLs and directory paths in LaTeX ... % %begin{latexonly} - \usepackage[rightbars]{changebar} +% \usepackage[rightbars]{changebar} \usepackage{l2hman} \usepackage{url} \def\email{\begingroup \urlstyle{tt}\Url} @@ -99,7 +99,7 @@ \setlength{\textwidth}{5.5in} %\addtolength{\oddsidemargin}{-1in} %\addtolength{\evensidemargin}{-1in} -\setlength{\changebarwidth}{1pt} +%\setlength{\changebarwidth}{1pt} % % read own internals for sections/contents before any @@ -171,7 +171,7 @@ % \begin{latexonly} -This document accompanies \latextohtml{} version 2021.2. +This document accompanies \latextohtml{} version 2025. \paragraph{History} diff --git a/docs/overview.tex b/docs/overview.tex index f7f9ec0..2dec916 100644 --- a/docs/overview.tex +++ b/docs/overview.tex @@ -83,7 +83,7 @@ \section{Overview} the features that these commands allow are the subject of \hyperref{a whole section of}{Section~}{ in}{sec:hyp} this manual. Some of the new commands provide improved strategies for effects -already existing in \LaTeX; e.g. +already existing in \LaTeX; e.g.\ \htmlref{cross-references}{hyperref} and \htmlref{citations}{hypercite}. To use these effectively requires only small changes to the \LaTeX{} source. @@ -283,7 +283,7 @@ \subsection{List of Features\label{features:ovw}\index{features!listing}} \index{HTML@\texttt{HTML}!interactive forms}% \item can include raw \texttt{HTML} in a \LaTeX{} document -(e.g. in order to specify interactive forms); +(e.g.\ in order to specify interactive forms); \index{LaTeX commands@\LaTeX{} commands}\label{hypcites}% \index{Common LaTeX@Common \LaTeX{} Commands!latex blue@\LaTeX{} blue book}% @@ -298,7 +298,7 @@ \subsection{List of Features\label{features:ovw}\index{features!listing}} an \texttt{HTML} document. Also many other \LaTeX{} constructions are handled, including many described in the \LaTeX{} \hypercite{\textit{Companion}}{\textit{Companion}}{}{goossens:latex} -and \LaTeX{} \hypercite{\textit{Graphics Companion} (e.g. \Xy-pic)}% +and \LaTeX{} \hypercite{\textit{Graphics Companion} (e.g.\ \Xy-pic)}% {\textit{Graphics Companion}}{\Xy-pic}{goossens:latexGraphics}; %\index{images@images\label{IIIimages}!equations}% diff --git a/docs/problems.tex b/docs/problems.tex index 83ed6ef..1c17205 100644 --- a/docs/problems.tex +++ b/docs/problems.tex @@ -51,7 +51,7 @@ \section{Known Problems} Changes to commands using \Lc{def} or \Lc{renewcommand} should usually be made only locally, within special environments, to set a needed parameter; -e.g. a basic length in a \env{picture} environment. +e.g.\ a basic length in a \env{picture} environment. But when such environments force an image to be generated, then \LaTeX{} will make the correct redefinition. @@ -62,7 +62,7 @@ \section{Known Problems} \newline \textit{This is inherent to the way \latextohtml{} does its processing. It will not be different unless later versions change this strategy; -(e.g. if \latextohtmlNG\ ever becomes fully integrated.)} +(e.g.\ if \latextohtmlNG\ ever becomes fully integrated.)} \item [Math-mode font-size changes: ] Math-mode font changes made outside the math-mode are not honoured. Thus the two equations @@ -158,7 +158,7 @@ \subsection{Troubleshooting}% The \fn{\$VERBOSITY} \hyperref[page]{variable}{variable (see page~}{)}{cs_verbositylevel}% can be set to generate tracing messages, which may help to locate which command or environment is being processed repeatedly. -Try setting a value of `\texttt{3}'; e.g. using the commandline switch \Cs{verbosity 3}. +Try setting a value of `\texttt{3}'; e.g.\ using the commandline switch \Cs{verbosity 3}. This will print command and environment names, as thaey are processed. It should soon become apparent where any such looping occurs. @@ -273,7 +273,7 @@ \subsection{Troubleshooting}% occur in \textsc{v97.1}\,, so please advise the \latextohtml{} developers if you get error messages of this kind.)\html{\\} The message should contain the name of environment which caused the problem, -along with an identifying number; e.g. \texttt{eqnarray268}. +along with an identifying number; e.g.\ \texttt{eqnarray268}. To find which exact piece of code this represents, run \latextohtml{} again, using the \Cs{debug} switch. Then look at the files in the \texttt{TMP} subdirectory of the working directory @@ -291,7 +291,7 @@ \subsection{Troubleshooting}% \item [The \Lc{verb"ABC"} command doesn't work: ] This is an unfortunate bug which can be avoided by using -any character other than quotes; e.g. \Lc{verb+ABC+}. +any character other than quotes; e.g.\ \Lc{verb+ABC+}. \item [Cannot get the ``tilde'' (\~{}) to show: \hfill] The trick here is to use \verb|\~{}|.\html{\\} @@ -334,7 +334,7 @@ \subsection{Troubleshooting}% If~you have optional arguments for the \Lc{item} command in a \env{description} environment containing nested ``\texttt{]}'' characters then these may not show up correctly. To avoid the problem enclose them -in \verb|{}|s;\\ e.g. \ \verb+\item[{[nested [angle [brackets] are ok]]}]+ +in \verb|{}|s;\\ e.g.\ \ \verb+\item[{[nested [angle [brackets] are ok]]}]+ \item [\latextohtml{} behaves differently even when you run it on the @@ -347,7 +347,7 @@ \subsection{Troubleshooting}% \item [Cannot convert \PS\ images which are included in the \LaTeX{} file: ]~\\ It~is likely that the macros you are using for including \PS\ -files (e.g. \Lc{epsffile}) are not understood by \latextohtml. +files (e.g.\ \Lc{epsffile}) are not understood by \latextohtml. To avoid this problem enclose them in an environment which will be passed to \LaTeX{} anyway; e.g. \begin{quote} @@ -382,7 +382,7 @@ \subsection{Troubleshooting}% Perhaps one of the inlined images is more than a page (paper page) long. This is sometimes the case with very large tables or large \PS\ images. In this case you can try specifying -a larger paper size (e.g. `\texttt{a4}', `\texttt{a3}' or even `\texttt{a0}') +a larger paper size (e.g.\ `\texttt{a4}', `\texttt{a3}' or even `\texttt{a0}') instead of the default (`\texttt{a5}') using the \latextohtml{} variable \fn{\$PAPERSIZE} in the file \fn{latex2html.config}. @@ -446,7 +446,7 @@ \subsection{Troubleshooting}% \item [Problems when producing the \texttt{.dvi} version: \label{htmlsty}] If you are using any of the new \LaTeX{} commands which are defined in the \fn{html.sty} file make sure that \fn{html.sty} is included; -e.g. as one of the optional arguments to the \Lc{documentclass} command. +e.g.\ as one of the optional arguments to the \Lc{documentclass} command. Of course you also have to make sure that \LaTeX{} knows where the \fn{html.sty} file is, either by putting it in the same place as the other style-files on @@ -559,7 +559,7 @@ \subsection{Troubleshooting}% Some problems in displaying the correct inlined images, may be due to the image caching mechanisms of your browser. With some browsers a simple ``\textbf{Reload Current Document}'' will be enough -to refresh the images but with others (e.g. \appl{Mosaic}) you may need +to refresh the images but with others (e.g.\ \appl{Mosaic}) you may need to request for the cache to be refreshed. With \appl{Mosaic} try selecting ``\textbf{Flush Image Cache}'' from ``\textbf{Options}'' in the menu-bar and then reload the \texttt{HTML} file. diff --git a/docs/support.tex b/docs/support.tex index 692c0e0..7f7e74d 100644 --- a/docs/support.tex +++ b/docs/support.tex @@ -173,14 +173,14 @@ \subsection{Installation on Windows} \begin{itemize} \item install \fn{WinZip}; \item install \TeX/\LaTeXe{} and \fn{dvips}; -\item install \fn{Perl};\\ - E.g. \fn{ActivePerl} $509$ or higher from \ActiveStateURL. +\item install \Perl{};\\ + E.g.\ \fn{ActivePerl} $509$ or higher from \ActiveStateURL. Windows $95$ users will also need \fn{DCOM}, it is listed on that download page, too. -\item install \fn{GhostScript};\\ - E.g. \fn{Aladdin GhostScript} $5.50$. -\item install the \fn{NetPBM} tools library from \NetpbmWinURL. -\item unpack \latextohtml{}, e.g. under \verb|C:\TEXMF\LATEX2HTML|; +\item install \appl{Ghostscript};\\ + E.g.\ \fn{Aladdin GhostScript} $5.50$. +\item install the \fn{netpbm} tools library from \NetpbmWinURL. +\item unpack \latextohtml{}, e.g.\ under \verb|C:\TEXMF\LATEX2HTML|; \item check that the path to \fn{GSWIN32C.EXE} is added to the \texttt{PATH} variable in your \texttt{AUTOEXEC.BAT}; \item with \latextohtml{} $99.1$ or higher, edit \texttt{l2hconf.pin}, diff --git a/docs/userman.tex b/docs/userman.tex index e57463a..308013b 100644 --- a/docs/userman.tex +++ b/docs/userman.tex @@ -237,11 +237,18 @@ \subsubsection{Options controlling Titles, File-Names and Sectioning} for that page, separated by the `\texttt{\_}' character.\html{\\} Commas and common short words (\texttt{a an to by of and for the}) are omitted from both title and word-count. +When duplication of constructed filenames is detected (see also the +\htmlref{-unicase\_titles}{cs_unicasetitles} option), +an incremented number starting from 2 is appended to each duplicated filename. -\smallskip\noindent -\textbf{Warning:} Use this switch with great caution. -Currently there are no checks for uniqueness of names or overall length. -Very long names can easily result from using this feature.% +\index{filenames!long names} +\index{filenames!case insensitive} + +\item [ -unicase\_titles\label{cs_unicasetitles}] +\sameas{\fn{\$UNICASE\_TITLES}\texttt{ = 1;}}\\ +If set, and the \htmlref{-long\_titles}{cs_longtitles} option is used, +duplication of generated filenames is checked in case insensitive manner. +Useful under case insensitive filesystems such as NTFS or FAT. \index{filenames!customised}% \index{filenames!custom title hook@\texttt{custom\_title\_hook}} @@ -456,7 +463,7 @@ \subsubsection{Options controlling Titles, File-Names and Sectioning} \end{tabular} \end{center} These levels apply even when the document contains no sectioning for -the shallower levels; e.g. no \Lc{part} or \Lc{chapter} commands is most common, +the shallower levels; e.g.\ no \Lc{part} or \Lc{chapter} commands is most common, especially when using \LaTeX's \env{article} document-class. @@ -508,7 +515,7 @@ \subsubsection{Options controlling Extensions and Special Features} This feature is intended to enable sophisticated authors the ability to insert arbitrary \TeX{} commands in environments that are destined to be processed by \LaTeX{} anyway; -e.g. \env{figure}s, \strikeout{\env{theorem}s}, \env{picture}s, etc. +e.g.\ \env{figure}s, \strikeout{\env{theorem}s}, \env{picture}s, etc. However this should rarely be needed, as now there is better support for these types of environment. There are now other methods to specify which chunks of code are to be passed to \LaTeX{} for explicit image-generation; @@ -627,7 +634,7 @@ \subsubsection{Options controlling Extensions and Special Features} \item [ -iso\_language \Meta{type}\label{cs_iso_language}] This enables you to specify a different language type than \texttt{'EN'} to be used in the DTD entries of the \texttt{HTML} -document, e.g. \texttt{'EN.US'}. +document, e.g.\ \texttt{'EN.US'}. \item [ -short\_index\label{cs_shortindex}] \sameas{\fn{\$SHORT\_INDEX}\texttt{ = 1;}}\\ @@ -659,6 +666,22 @@ \subsubsection{Options controlling Extensions and Special Features} If this is set you will get every footnote applied with a subsequent number, to ease readability. +\index{use-hilite}% +\index{listings}% +\item [ -use\_hilite \label{cs_use_hilite}] +Additional support for the listings and minted packages: generate colorized +syntax highlighting of lstlisting/minted environments and lstinline/mintinline +snippets via the external \texttt{pygmentize} or \texttt{source-highlight} +tool. For this option to work, either Pygments or GNU source-highlight package +must be installed. + +\index{hilite-opts}% +\index{listings}% +\item [ -hilite\_opts \Meta{string}\label{cs_hilite_opts}] +Additional options to pygmentize or GNU source-highlight. See the appropriate +manpage for the list of possible options, and the console output for the actual +source highlighting command lines generated by \texttt{latex2html}. + \index{address!signature}% \index{address!using a subroutine}% @@ -1232,10 +1255,10 @@ \subsubsection{Other Configuration Variables, without switches} \begin{itemize} \item add a switch \texttt{-P}\Meta{printer} to load a specific configuration-file;\\ -e.g. to use a specific set of \PS\ fonts, for improved image-generation. +e.g.\ to use a specific set of \PS\ fonts, for improved image-generation. \item to prepend a path to a different version of \fn{dvips} than normally -available as the system default (e.g. the printing requirements are different). +available as the system default (e.g.\ the printing requirements are different). \item to append debugging switches, in case of poor quality images;\\ one can see which paths are being searched for fonts and other resources. @@ -1276,7 +1299,7 @@ \subsubsection{Other Configuration Variables, without switches} If \LaTeX{} is having trouble finding style-files and/or packages, then the default command can be prepended with other commands to set environment variables intended to resolve these difficulties;\\ -e.g. +e.g.\ \verb|$LATEX = 'setenv TEXINPUTS |\Meta{path to search}\verb| ; latex' |. There are several variables to help control exactly which files are @@ -1416,7 +1439,7 @@ \subsubsection{Other Configuration Variables, without switches} \item [\fn{\$BODYTEXT}\texttt{ = '';}] The value of this variable is used within the \HTMLtag{BODY ... } tag; -e.g. to set text and/or background colors.\html{\\} +e.g.\ to set text and/or background colors.\html{\\} It's value is overridden by the \verb|\bodytext| command, and can be added-to or parts changed using the \Lc{htmlbody} command or \Lc{color} and \Lc{pagecolor} from the \env{color} package. @@ -1613,7 +1636,7 @@ \subsubsection{Asking the Translator to Ignore Commands\label{ignore}} \end{quote} \verb|{}|'s mark compulsory arguments and \verb|[]|'s optional ones, while \texttt{<<\emph{pattern}>>} denotes matching everything up to the -indicated string-pattern, given literally (e.g. \verb|\\endarray|); +indicated string-pattern, given literally (e.g.\ \verb|\\endarray|); spaces are ignored. Special characters such as \verb|$|\,, \verb|&|\,, \verb|\| itself and perhaps some others, need to be ``escaped'' with a preceding \verb|\|\,. @@ -1623,7 +1646,7 @@ \subsubsection{Asking the Translator to Ignore Commands\label{ignore}} Some commands may have arguments which should be left as text even though the command should be ignored -(e.g. \Lc{hbox}, \Lc{center}, etc.). +(e.g.\ \Lc{hbox}, \Lc{center}, etc.). In these cases arguments should be left unspecified. Here is an example of how this mechanism may be used: %begin{latexonly} diff --git a/l2hconf.pin b/l2hconf.pin index 90e9ae8..8a575fd 100644 --- a/l2hconf.pin +++ b/l2hconf.pin @@ -30,6 +30,7 @@ $PDFTOCAIRO = '@PDFTOCAIRO@'; # pdf to svg converter $PS2PDF = '@PS2PDF@'; # ps to pdf converter $PDFCROP = '@PDFCROP@'; # pdfcrop $GS = '@GS@'; # GhostScript +$SRCHILITE = '@SRCHILITE@'; # pygmentize or source-highlight #if @PDFLATEX@ $USE_PDFTEX = 1; # use pdflatex unless -nouse_pdftex on command line @@ -997,6 +998,15 @@ $TITLES_LANGUAGE = "english"; # or when you specify the language through the babel package. +# When the -long_titles option is used, duplication of generated filenames +# which differ only in letter case is checked as follows: +# $UNICASE_TITLES = 0: such filenames are treated as unique +# (for case sensitive filesystems typical under Unix) +# $UNICASE_TITLES = 1: such filenames are treated as duplicated +# (for case insensitive filesystems such as NTFS or FAT) +$UNICASE_TITLES = 0; + + ### Verbosity ################################################################# # # -verbosity @@ -1108,18 +1118,16 @@ sub bot_navigation_panel { ### Meta Information ##################################################### # # This information will be inserted in the HEAD of the generated -# HTML file. It can be used by automatic indexing scripts (eg -# site-index.pl at http://www.ai.mit.edu/tools/site-index.html) -# You can change the description, keywords, etc. values. +# HTML file. +# You can set the description, keywords, etc. values. # sub meta_information { local($_) = @_; # Cannot have nested HTML tags... do { s/<[^>]*>//g; - "\n" . - "\n" . - "\n" . - "\n" + # "\n" . + # "\n" . + "" } if $_; } diff --git a/latex2html.1 b/latex2html.1 index fc0be27..1c25aad 100644 --- a/latex2html.1 +++ b/latex2html.1 @@ -76,9 +76,19 @@ page are constructed from the first words of the section heading for that page, separated by the `_' character. Commas and common short words (a an to by of and for the) are omitted from both title and word-count. -Warning: Use this switch with great caution. Currently there are no -checks for uniqueness of names or overall length. Very long names can -easily result from using this feature. +When duplication of constructed filenames is detected (see also the +.B -unicase_titles +option), an incremented number starting from 2 +is appended to each duplicated filename. +.TP +.B -unicase_titles +Same as setting: +.I $UNICASE_TITLES = 1; +If set, and the +.B -long_titles +option is used, duplication of generated filenames +is checked in case insensitive manner. +Useful under case insensitive filesystems such as NTFS or FAT. .TP .B -custom_titles Same as setting: @@ -555,6 +565,17 @@ Useful for lualatex documents which cannot be translated by latex or pdflatex. Generate intermediate images with dvilualatex instead of plain latex. Useful for dvilualatex documents which cannot be translated by latex. .TP +.B -use_hilite +Additional support for the listings and minted packages: generate colorized +syntax highlighting of lstlisting environments and lstinline +snippets via the external pygmentize or source-highlight tool. For this option +to work, either Pygments or GNU source-highlight package must be installed. +.TP +.B -hilite_opts +Additional options to pygmentize or GNU source-highlight. See the appropriate +manpage for the list of possible options, and the console output for the actual +source highlighting command lines generated by latex2html. +.TP .B -ascii_mode Same as setting: .I $ASCII_MODE = $EXTERNAL_IMAGES = 1; diff --git a/latex2html.pin b/latex2html.pin index aceecdb..313bbcd 100755 --- a/latex2html.pin +++ b/latex2html.pin @@ -66,7 +66,7 @@ use vars qw($LATEX2HTMLDIR $LATEX2HTMLPLATDIR $SCRIPT #- to C's #define statement, so please be careful when removing comments! #- #- The (texlive) wrapper sets these values -#- or it is stored in the enviroment +#- or it is stored in the environment #- #unless @wrapper@ || @texlive@ BEGIN { @@ -274,6 +274,7 @@ unless(GetOptions(\%opt, # all non-linked options go into %opt 'prefix=s', \$PREFIX, 'auto_prefix!', \$AUTO_PREFIX, 'long_titles=i', \$LONG_TITLES, + 'unicase_titles!', \$UNICASE_TITLES, 'custom_titles!', \$CUSTOM_TITLES, 'title|t=s', \$TITLE, 'rooted!', \$ROOTED, @@ -285,6 +286,8 @@ unless(GetOptions(\%opt, # all non-linked options go into %opt 'use_pdftex!', \$USE_PDFTEX, 'use_luatex!', \$USE_LUATEX, 'use_luadvi!', \$USE_LUADVI, + 'use_hilite!', \$USE_HILITE, + 'hilite_opts=s', \$HILITE_OPTS, 'address=s', \$ADDRESS, 'noaddress', 'subdir!', @@ -695,6 +698,26 @@ sub driver { print "\n *** initialise *** " if ($VERBOSITY > 1); &initialise; # Initialise some global variables + # Early reservation of filename for auto-linked index.html to avoid + # eventual duplication if some later generated page would get name 'Index'. + # This code to generate "$to" adopted from the do-block with the clause + # "L2hos->Link($from,$to);" about 200 lines later. + do { + local($EXTN) = $EXTN; + $EXTN =~ s/_\w+(\.html?)/$1/ if ($frame_main_name); + local($from,$to) = (eval($LINKPOINT),eval($LINKNAME)); + $from = &make_long_title($LONG_LINKPOINT) . $EXTN + if ($LONG_TITLES && $LONG_LINKPOINT); + if (length($from) && length($to) && ($from ne $to)) { + $to =~ s/$frame_main_name(\.html?)/$1/ if ($frame_main_name); + if ($UNICASE_TITLES) { + $nodenames{"\L$to"} = 1; + } else { + $nodenames{$to} = 1; + } + } + } unless ($NO_AUTO_LINK || !($LINKPOINT) || !($LINKNAME)); + print "\n *** check modes *** " if ($VERBOSITY > 1); &ascii_mode if $ASCII_MODE; # Must come after initialization &titles_language($TITLES_LANGUAGE); @@ -743,10 +766,13 @@ sub driver { } ## AYS: Allow extension other than .tex and make it optional - ($EXT = $FILE) =~ s/.*\.([^\.]*)$/$1/; - if ( $EXT eq $FILE ) { - $EXT = "tex"; + if ($FILE =~ /.*(\.[^\.]*)$/) { + $EXT = $1; + } elsif (-f "$FILE.tex") { + $EXT = ".tex"; $FILE =~ s/$/.tex/; + } else { + $EXT = ''; } #RRM: allow user-customisation, dependent on file-name @@ -767,7 +793,7 @@ sub driver { $texfilepath = '.' unless($texfilepath); die "Cannot read $texfilepath$dd$FILE \n" - unless (-f "$texfilepath$dd$FILE"); + unless (-r "$texfilepath$dd$FILE"); # Tell texexpand which files we *don't* want to look at. @@ -779,8 +805,11 @@ sub driver { $FILE =~ s/\.[^\.]*$//; ## AYS $DESTDIR = ''; # start at empty if ($FIXEDDIR) { - $DESTDIR = $FIXEDDIR unless ($FIXEDDIR eq '.'); - if (($ROOTED)&&!($texfilepath eq $orig_cwd)) { + # $FIXEDDIR is compared to $DESTDIR later + # so both need to be absolute paths + $FIXEDDIR = L2hos->Make_directory_absolute($FIXEDDIR); + $DESTDIR = $FIXEDDIR; + if ($ROOTED) { $DESTDIR .= $dd . $FILE unless $NO_SUBDIR; }; } elsif ($texfilepath eq $orig_cwd) { @@ -791,7 +820,7 @@ sub driver { } $PREFIX = "$FILE-" if $AUTO_PREFIX; - print "\nOPENING $texfilepath$dd$FILE.$EXT \n"; ## AYS + print "\nOPENING $texfilepath$dd$FILE$EXT \n"; ## AYS next unless (&new_dir($DESTDIR,'')); # establish absolute path to $DESTDIR @@ -842,7 +871,7 @@ sub driver { . ($TEXINPUTS ? "-texinputs \"$TEXINPUTS\" " : '' ) . (($VERBOSITY >2) ? "-verbose " : '' ) . "-out \"$DESTDIR$dd$TMP_$dd$FILE\" " - . "\"$texfilepath$dd$FILE.$EXT\"") + . "\"$texfilepath$dd$FILE$EXT\"") && die " texexpand failed: $!\n"; print STDOUT "\n *** `texexpand' done ***\n" if ($VERBOSITY > 1); @@ -949,6 +978,8 @@ sub open_dbm_database { # dbmopen(%verbatim, "$TMP_${dd}verbatim",0755); dbmopen(%verb_delim, "$TMP_${dd}verb_delim",0755); dbmopen(%verb_lstopt, "$TMP_${dd}verb_lstopt",0755); + dbmopen(%verb_mintopt, "$TMP_${dd}verb_mintopt",0755); + dbmopen(%verb_mintlang, "$TMP_${dd}verb_mintlang",0755); dbmopen(%expanded,"$TMP_${dd}expanded",0755); # Holds max_id, verb_counter, verbatim_counter, eqn_number dbmopen(%global, "$TMP_${dd}global",0755); @@ -990,6 +1021,8 @@ sub close_dbm_database { # dbmclose(%verbatim); undef %verbatim; dbmclose(%verb_delim); undef %verb_delim; dbmclose(%verb_lstopt); undef %verb_lstopt; + dbmclose(%verb_mintopt); undef %verb_mintopt; + dbmclose(%verb_mintlang); undef %verb_mintlang; dbmclose(%expanded); undef %expanded; dbmclose(%global); undef %global; dbmclose(%env_style); undef %env_style; @@ -1103,6 +1136,7 @@ sub catfile { unless($ignore); return undef; } + binmode CATFILE; local($/) = undef; # slurp in whole file my $contents = ; close(CATFILE); @@ -1314,7 +1348,8 @@ sub deal_with_texinputs { sub absolutize_path { my ($path) = @_; my $npath = ''; - foreach $dir (split /$envkey/o, $path) { + foreach $dir (split /$envkey+/o, $path) { + # split regexp is designed to skip empty fields $npath .= L2hos->Make_directory_absolute($dir) . $envkey; } $npath =~ s/$envkey$//; @@ -1365,6 +1400,7 @@ sub load_style_file_translations { $auto_styles =~ s/\|$//; if(open(STYLES, "<$TMP_${dd}styles")) { + binmode STYLES; while() { if(s/^\s*(\S+)\s*(.*)$/$style = $1; $options = $2;/eo) { &do_require_package($style); @@ -1589,13 +1625,29 @@ sub pre_process { s/\\verb()(\;SPM\w+\;|[^a-zA-Z*\s])/"$2"/e || s/\\verb(\t\t*)([^*\s])/"$2"/e || s/\\(lstinline)\s*(\[[^]]*\])?\s*(\;SPM\w+\;|[^a-zA-Z*\s])/"$3"/e || - s/\\(lstinline)\s*(\[[^]]*\])?\s*([^*\s])/"$3"/e) { + s/\\(lstinline)\s*(\[[^]]*\])?\s*([^*\s])/"$3"/e || + s/\\(mintinline)\s*(\[[^]]*\])?\s*(\{[^}]*\})\s*(\;SPM\w+\;|[^a-zA-Z*\s])/"$4"/e || + s/\\(mintinline)\s*(\[[^]]*\])?\s*(\{[^}]*\})\s*([^*\s])/"$4"/e || + s/\\(mint)\s*(\[[^]]*\])?\s*(\{[^}]*\})\s*(\;SPM\w+\;|[^a-zA-Z*\s])/"$4"/e || + s/\\(mint)\s*(\[[^]]*\])?\s*(\{[^}]*\})\s*([^*\s])/"$4"/e) { if ($1 eq 'lstinline') { #SGE: retain knowledge and options of \lstinline $del = $3; $vb_mark = $verblst_mark; $verb_lstopt{$id} = $2; + } elsif ($1 eq 'mintinline') { + #SGE: retain knowledge, options and language of \mintinline + $del = $4; + $vb_mark = $verbmint_mark; + $verb_mintopt{$id} = $2; + $verb_mintlang{$id} = $3; + } elsif ($1 eq 'mint') { + #SGE: retain knowledge, options and language of \mint + $del = $4; + $vb_mark = $verbminted_mark; + $verb_mintopt{$id} = $2; + $verb_mintlang{$id} = $3; } else { $del = $2; #RRM: retain knowledge of whether \verb* or \verb @@ -1604,10 +1656,11 @@ sub pre_process { $esc_del = &escape_rx_chars($del); $esc_del = '' if (length($del) > 2); - # try to find closing delimiter and substitute the complete - # statement with $verb_mark or $verbstar_mark or $verblst_mark -# s/(]*$id>[\Q$del\E])([^$esc_del\n]*)([\Q$del\E]|$comment_mark(\d+)\n?)/ - s/(]*$id>\Q$del\E)([^$esc_del]*?)(\Q$del\E|$comment_mark(\d+)\n?)/ + # try to find closing delimiter and substitute the complete statement + # with $verb_mark or $verbstar_mark or $verblst_mark or $verbmint_mark + # or $verbminted_mark + # use non-greedy (.*?) to end as soon as we see 2nd delimiter + s/(]*$id>\Q$del\E)(.*?)(\Q$del\E|$comment_mark(\d+)\n?)/ $contents=$2; if ($4) { $verb_rerun = 1; join('', "\\verb$del", $contents, $comments{$4}) @@ -1791,6 +1844,7 @@ sub slurp_input_and_partition_and_pre_process { unless(open(SINPUT,"<$file")) { die "\nError: Cannot read '$file': $!\n"; } + binmode SINPUT; local(@file_string); print STDOUT "$file" if ($VERBOSITY >1); while () { @@ -1875,6 +1929,7 @@ sub do_write_string_out { &wrap_shorthand_environments; print STDOUT "\n *** End-of-partition ***" if ($VERBOSITY > 1); if(open(OUT, ">$TMP_$dd$PARTITION_PREFIX$count")) { + binmode OUT; print OUT $_; close(OUT); } else { @@ -1895,6 +1950,7 @@ sub slurp_input { local($file) = @_; local(%string); if(open(INPUT,"<$file")) { + binmode INPUT; local(@file_string); while () { push(@file_string, $_ ); @@ -2222,7 +2278,7 @@ sub do_cmd_htmllanguagestyle { # # If you have, for example: # -# a) preample +# a) preamble # b) \begin{document} # c) text # d) \include{chapter} @@ -2352,6 +2408,7 @@ sub translate { open(OUTPUT, ">$CURRENT_FILE") || die "Cannot write '$CURRENT_FILE': $!\n"; + binmode OUTPUT; if ($XBIT_HACK) { # use Apache's XBit hack chmod 0744, $CURRENT_FILE; &check_htaccess; @@ -2873,7 +2930,6 @@ sub translate_environments { print STDOUT "\nOUT-A {$env $br_id}\n$contents\n" if ($VERBOSITY > 4); #JCL(jcl-env) - insert the $O$br_id$C stuff to handle environment grouping if (!($contents eq '')) { - $after =~ s/^\n//o if ($defenv); $this_env = join("", $before, $closures , $contents , ($defenv ? '': &balance_tags()) @@ -3197,7 +3253,7 @@ sub read_style_info { if ($style_names) { $envS = "$style_names" } elsif (($envS =~ /^pre$/)&& - (/^\\begin.*preform($O|$OP)\d+($C|$CP)$verbatim_mark(\w*[vV]erbatim|lstlisting)(\*?)/)) + (/^\\begin.*preform($O|$OP)\d+($C|$CP)$verbatim_mark(\w*[vV]erbatim|lstlisting|minted)(\*?)/)) { $envS = $3.($4 ? 'star' : '') }; $env_style{$envS} = " " unless (($style_names)||($env_style{$envS})); $env_id = " ID=\"$env_id\"".(($envS) ? " CLASS=\"$envS\"" : ''); @@ -3806,6 +3862,7 @@ sub preprocess_images { print "\nWriting image.pre file ...\n"; open(ENV,">.$dd${PREFIX}images.pre") || die "\nCannot write '${PREFIX}images.pre': $!\n"; + binmode ENV; print ENV &make_latex($latex_body); print ENV "\n"; close ENV; @@ -3825,6 +3882,7 @@ sub preprocess_images { # save pre-processor commands in a file: preproc open(CMDS,">.$dd${PREFIX}preproc") || die "\nCannot write '${PREFIX}preproc': $!\n"; + binmode CMDS; print CMDS $preprocessor_cmds ; close CMDS; @@ -3835,6 +3893,7 @@ sub make_image_file { print "\nWriting image file ...\n"; open(ENV,">.$dd${PREFIX}images.tex") || die "\nCannot write '${PREFIX}images.tex': $!\n"; + binmode ENV; print ENV &make_latex($latex_body); print ENV "\n"; close ENV; @@ -4154,16 +4213,17 @@ sub process_log_file { } $before = ''; } - } else { - s/^\:([^:]*)\:lthtmlCropMarkHeight\:\=([0-9.]*)pt/$cropmarkheight{$1} = $2;''/e; - s/^\:([^:]*)\:lthtmlCropMarkDepth\:\=([0-9.]*)pt\:1ex:=([0-9.]*)pt//; + } elsif (/^\:([^:]*)\:lthtmlCropMarkHeight\:\=([0-9.]*)pt/) { + $cropmarkheight{$1} = $2; + } elsif (/^\:([^:]*)\:lthtmlCropMarkDepth\:\=([0-9.]*)pt\:1ex:=([0-9.]*)pt/) { $ptdepth{$1} = $2 + .5; - # extra .5 pt in depth is border from latex 'preview' packagea + # extra .5 pt in depth is border from latex 'preview' package $pt_per_ex{$1} = $3; # $pt_per_ex contains the length of 1 ex measured in points, # and is used to scale the image to the curent html font size } - $LaTeXERROR = 1 if (/^No pages of output./); + $LaTeXERROR = 1 if (/^No pages of output./ || + /no output PDF file produced/); } if ($LaTeXERROR) { @@ -4236,15 +4296,15 @@ sub extract_image_svg { open(PDF2SVG, "$svg_cmd|") || die; open(SVG, ">${PREFIX}img$new_num.svg") || die; while () { # filter svg file - if (/^$/$env_id>/ if ($env_id); + # don't append unresolved $env_id's + $pre =~ s/>$/$env_id>/ if ($env_id =~ /^\s+(CLASS|ID)/); } local($closing_tag) = 1 if ($pre =~ /^<>$/); $pre = $post = '' if $closing_tag; @@ -7268,7 +7329,7 @@ sub make_latex { "\\def\\lthtmltypeout#1{{\\let\\protect\\string \\immediate\\write\\lthtmlwrite{#1}}}%\n" . (($USE_DVIPNG || $IMAGE_TYPE eq 'svg') ? <<'' : \usepackage[tightpage,active]{preview} -\PreviewBorder=1bp +\PreviewBorder=0.5bp \newbox\lthtmlPageBox \newdimen\lthtmlCropMarkHeight \newdimen\lthtmlCropMarkDepth @@ -7524,8 +7585,10 @@ sub style_sheet { print "\nError: Cannot write '$FILE.css': $!\n"; return; } + binmode STYLESHEET; if ( -f $EXTERNAL_STYLESHEET ) { if(open(EXT_STYLES, "<$EXTERNAL_STYLESHEET")) { + binmode EXT_STYLES; while () { print STYLESHEET $_; } close(EXT_STYLES); } else { @@ -7584,7 +7647,9 @@ H5 { } /* mathematics styles */ DIV.displaymath { text-align:center; margin-top:1em; margin-bottom:1em; } /* math displays: margins for \\abovedisplayskip \\belowdisplayskip */ -TD.eqno { width:0; } /* equation-number cells */ +TD.eqno { width:0; } /* equation-number cells */ +TD.lfill { text-align:left; width:50%; } +TD.rfill { text-align:right; width:50%; } TABLE.PAD TD { padding:3px; } TABLE.BORDER TD { border:1px solid black; } TABLE.equation { width:100%; } /* place eq nos at right/left edge */ @@ -7605,7 +7670,7 @@ EOF print STYLESHEET "SPAN.$env\t\t{ $style }\n"; } elsif ($env =~ /\./) { print STYLESHEET "$env\t\t{ $style }\n"; - } elsif ($env =~ /^(preform|lstlisting|\w*[Vv]erbatim(star)?)$/) { + } elsif ($env =~ /^(preform|lstlisting|minted|\w*[Vv]erbatim(star)?)$/) { print STYLESHEET "PRE.$env\t\t{ $style }\n"; } elsif ($env =~ /figure|table|tabular|equation|$array_env_rx/) { print STYLESHEET "TABLE.$env\t\t{ $style }\n"; @@ -7688,7 +7753,7 @@ sub encode_title { $_; } -# Encodes the contents of enviroments that are passed to latex. The code +# Encodes the contents of environments that are passed to latex. The code # is then used as key to a hash table pointing to the URL of the resulting # picture. Returns "" if contents are too long. Long keys do not work with # some DBM modules, and are unlikely to reappear verbatim in the latex files. @@ -7856,7 +7921,7 @@ sub post_process { &slurp_input($this_file); open(OUTFILE, ">$this_file") || die "\nError: Cannot write file '$this_file': $!\n"; - + binmode OUTFILE; if (($INDEX) && ($SHORT_INDEX) && ($SEGMENT eq 1)) { &make_index_segment($title,$file); } @@ -7916,7 +7981,7 @@ sub post_replace_markers { # s/(\s*\b?([^<]+|<([^>\/]+|\/[^>A]+)>\s*)*<\/A>)\s*\b?\ <\/A>/$1$5$2/gom; # clean up empty table cells - s/(]*>)\s*(<\/TD>)/$2/gom; + # s/(]*>)\s*(<\/TD>)/$1$2/gom; # clean up list items (only desirable in the bibliography ?) # s/\n

(]*>)/\n

<\/P>\n$1/gom; @@ -8121,7 +8186,7 @@ sub replace_sensitive_markers { if (defined &replace_verbatim_hook) {&replace_verbatim_hook;} else {&replace_verbatim_marks if /$verbatim_mark/;} if (defined &replace_verb_hook) {&replace_verb_hook;} - else {&replace_verb_marks if /$verb_mark|$verbstar_mark|$verblst_mark/;} + else {&replace_verb_marks if /$verb_mark|$verbstar_mark|$verblst_mark|$verbmint_mark|$verbminted_mark/;} s/;SPMdollar;/\$/g; s/;SPMtilde;/\~/g; s/;SPMpct;/\%/g; s/;SPM/\&/go; s/$percent_mark/%/go; @@ -8221,6 +8286,7 @@ sub replace_init_file_mark { return(); } if(open(INIT, "<$init_file")) { + binmode INIT; foreach $info_line () { $info_line =~ s/[<>"&]/'&'.$html_special_entities{$&}.';'/eg; $init_contents .= $info_line; @@ -8983,6 +9049,7 @@ sub make_footnotes { sub post_process_footnotes { &slurp_input($footfile); open(OUT, ">$footfile") || die "Cannot write file '$footfile': $!\n"; + binmode OUT; &replace_markers; &post_post_process if (defined &post_post_process); &adjust_encoding; @@ -9004,6 +9071,7 @@ sub make_file { print "\nError: Cannot write '$filename': $!\n"; return; } + binmode FILE; print FILE $_; close(FILE); } @@ -9030,6 +9098,8 @@ sub replace_verbatim_marks { # "\n".$tmp.(($tmp =~/\n\s*$/s)? '':"\n")!eg; s/(]*>)?$verbatim_mark(lstlisting|lstset|lststyle|lstfile)(\d+)#(<\/PRE>)?\n?/ &process_lstlisting($1, $4, $2, $verbatim{$3})/eg; + s/(]*>)?$verbatim_mark(minted|setminted|setmintedinline|usemintedstyle|mintfile)(\d+)#(<\/PRE>)?\n?/ + &process_minted($1, $4, $2, $verbatim{$3})/eg; # s/$verbatim_mark(rawhtml)(\d+)#/$verbatim{$2}/eg; # Raw HTML s/$verbatim_mark(imagesonly)(\d+)#//eg; # imagesonly is *not* replaced # Raw HTML, but replacements may have protected characters @@ -9039,6 +9109,7 @@ sub replace_verbatim_marks { } # Actual lstlisting engine, except initialization, moved to styles/listings.perl +# Actual minted engine, except initialization, moved to styles/minted.perl # TeX's special characters may have been escaped with a '\'; remove it. sub unprotect_raw_html { @@ -9061,17 +9132,22 @@ sub remove_verbatim_marks { s/$verbatim_mark(\w*[Vv]erbatim\w*\*?)(\d+)#//go; s/$verbatim_mark(rawhtml|imagesonly)(\d+)#//go; s/$verbatim_mark(lstlisting)(\d+)#//go; + s/$verbatim_mark(minted)(\d+)#//go; s/$verbatim_mark$keepcomments_rx(\d+)#//go; s/$unfinished_mark$keepcomments_rx(\d+)#//go; } sub replace_verb_marks { # Modifies $_ - s/($verb_mark|$verbstar_mark|$verblst_mark)(\d+)$verb_mark/ + s/($verb_mark|$verbstar_mark|$verblst_mark|$verbmint_mark|$verbminted_mark)(\d+)$verb_mark/ $code = $verb{$2}; $code = &replace_comments($code) if ($code =~ m:$comment_mark:); if ($1 eq $verblst_mark) {$code=&process_lstinline($verb_lstopt{$2},$code);} + elsif ($1 eq $verbmint_mark) + {$code=&process_mintinline($verb_mintopt{$2},$verb_mintlang{$2},$code);} + elsif ($1 eq $verbminted_mark) + {$code=&process_mint($verb_mintopt{$2},$verb_mintlang{$2},$code);} else {$code="$code<\/code>";} $code/eg; } @@ -9085,7 +9161,7 @@ sub replace_comments{ sub remove_verb_marks { # Modifies $_ - s/($verb_mark|$verbstar_mark|$verblst_mark)(\d+)$verb_mark//go; + s/($verb_mark|$verbstar_mark|$verblst_mark|$verbmint_mark|$verbminted_mark)(\d+)$verb_mark//go; } # This is used by revert_to_raw_tex @@ -9094,6 +9170,7 @@ sub revert_verbatim_marks { # s/$verbatim_mark(verbatim)(\d+)#/\\begin{verbatim}$verbatim{$2}\\end{verbatim}\n/go; s/$verbatim_mark(\w*[Vv]erbatim)(\d+)#/\\begin{$1}\n$verbatim{$2}\\end{$1}\n/go; s/$verbatim_mark(lstlisting)(\d+)#/\\begin{lstlisting}\n$verbatim{$2}\\end{lstlisting}\n/go; + s/$verbatim_mark(minted)(\d+)#/\\begin{minted}\n$verbatim{$2}\\end{minted}\n/go; s/$verbatim_mark(rawhtml)(\d+)#/\\begin{rawhtml}\n$verbatim{$2}\\end{rawhtml}\n/go; s/$verbatim_mark(imagesonly|tex2html_code)(\d+)#\n?/$verbatim{$2}/go; s/$verbatim_mark$image_env_rx(\d+)#/\\begin{$1}\n$verbatim{$2}\\end{$1}\n/go; @@ -9105,6 +9182,8 @@ sub revert_verb_marks { s/$verbstar_mark(\d+)$verb_mark/\\verb*$verb_delim{$1}$verb{$1}$verb_delim{$1}/go; s/$verb_mark(\d+)$verb_mark/\\verb$verb_delim{$1}$verb{$1}$verb_delim{$1}/go; s/$verblst_mark(\d+)$verb_mark/\\lstinline$verb_lstopt{$1}$verb_delim{$1}$verb{$1}$verb_delim{$1}/go; + s/$verbmint_mark(\d+)$verb_mark/\\mintinline$verb_mintopt{$1}$verb_mintlang{$1}$verb_delim{$1}$verb{$1}$verb_delim{$1}/go; + s/$verbminted_mark(\d+)$verb_mark/\\mint$verb_mintopt{$1}$verb_mintlang{$1}$verb_delim{$1}$verb{$1}$verb_delim{$1}/go; } sub replace_cross_ref_marks { @@ -9489,8 +9568,6 @@ sub extract_pure_text { sub banner { print <<"EOF"; This is LaTeX2HTML Version $TEX2HTMLVERSION -by Nikos Drakos, Computer Based Learning Unit, University of Leeds. - EOF } @@ -9510,6 +9587,7 @@ sub usage { my $script = $SCRIPT || $0; open(PIPE, "$perldoc -t $script |") || die "Fatal: can't open pipe: $!"; + binmode PIPE; while () { if (/^\s*$/) { next; @@ -9582,23 +9660,12 @@ sub set_depth_levels { # Now ignores accents which cannot be translated to ISO-LATIN-1 characters # Also replaces ?' and !' .... sub replace_strange_accents { - &real_replace_strange_accents(@_); # if ($CHARSET =~ /8859[_\-]1$/); + &real_replace_strange_accents(@_); } sub real_replace_strange_accents { # Modifies $_; s/\?`/&iso_map("iquest", "")/geo; s/!`/&iso_map("iexcl", "")/geo; - s/\\\^\\i /&iso_map("icirc", "")/geo; - my ($charset) = "${CHARSET}_character_map_inv"; - $charset =~ s/-/_/g; - # convert upper 8-bit characters - if (%$charset &&($CHARSET =~ /8859[_\-]1$/)) { - s/([\200-\377])/ - $tmp = $$charset{'&#'.ord($1).';'}; - &mark_string($tmp) if ($tmp =~ m!\{!); - &translate_commands($tmp) - /egos - } }; # Creates a new directory or reuses old, perhaps after deleting its contents @@ -9857,7 +9924,7 @@ sub fulltexpath { sub make_name { local($sec_name, $packed_curr_sec_id) = @_; local($title,$making_name,$saved) = ('',1,''); - local($filename) = ''; + local($filename,$dupname) = ('',''); if ($LONG_TITLES) { $saved = $_; &process_command($sections_rx, $_) if /^$sections_rx/; @@ -9877,12 +9944,14 @@ sub make_name { ++$OUT_NODE; $filename = join("", ${PREFIX}, $title, $EXTN); # Avoid duplication of filenames - unless ($nodenames{$filename}) { - $nodenames{$filename} = 1; + $dupname = $filename; + $dupname = "\L$filename" if $UNICASE_TITLES; + unless ($nodenames{$dupname}) { + $nodenames{$dupname} = 1; } else { # Duplication detected: add version number to generated filename $filename = - join("", ${PREFIX}, $title, ++$nodenames{$filename}, $EXTN); + join("", ${PREFIX}, $title, ++$nodenames{$dupname}, $EXTN); } $filename; } else { @@ -10216,7 +10285,7 @@ sub get_last_word { local($pre_bit); if ($lastbit =~/>([^>]*)$/) { $word = $1; $pre_bit = $`.'>'; - if ($pre_bit =~ /($verb_mark|$verbstar_mark|$verblst_mark)$/) { + if ($pre_bit =~ /($verb_mark|$verbstar_mark|$verblst_mark|$verbmint_mark|$verbminted_mark)$/) { $word = $lastbit; } elsif ($pre_bit =~ /<\w+_mark>$/) { $word = $& . $word; @@ -10636,6 +10705,7 @@ sub save_image_map { # clean print "\nError: Cannot write '$urlimg': $!\n"; return; } + binmode IMAGE_MAP; ### HWS Pass server map unchanged from user print IMAGE_MAP "\n\n\n"; print IMAGE_MAP " "; @@ -10653,6 +10723,8 @@ sub rename_html { ($to_prefix, $suffix) = split(/\./, $to); if ($EXTN =~ /$suffix$/) { if (open(FROM, "<$from") && open(HTMP, ">HTML_tmp")) { + binmode FROM; + binmode HTMP; while () { s/$from_prefix\.$IMAGE_TYPE/$to_prefix.$IMAGE_TYPE/g; print HTMP; @@ -10677,6 +10749,7 @@ sub save_captions_in_file { &replace_markers; &add_dir_to_href if ($DESTDIR); if(open(CAPTIONS, ">${PREFIX}$type.pl")) { + binmode CAPTIONS; print CAPTIONS $_; close (CAPTIONS); } else { @@ -10844,25 +10917,27 @@ sub iso_map { my($character_map,$enc); local ($this); - if (($CHARSET =~ /utf/)&&!$NO_UTF) { - # utf8 is default output - $enc = $iso_10646_character_map{"$char$kind"}; - if (!$enc && $iso_10646_combining_character_map{"$kind"}) { - # use combining accents for characters not in main table: \dot{A} - $enc = $char.$iso_10646_combining_character_map{"$kind"}; - } - } else { - # see if it is a character in the charset + if (($CHARSET !~ /utf/) || $NO_UTF) { + # for special char sets selected by \usepackage[latin1]{inputenc} + # look for the character in special char set $character_map = $CHARSET; $character_map =~ tr/-/_/; eval "\$enc = \$${character_map}_character_map\{\"$char$kind\"\}"; print "\n no support for $CHARSET: $@ " if ($@); - $enc =~ /^\&\#(\d{3});$/; # numeric character references in html refer to unicode # we need to convert this char to an 8-bit character - if ($1 && ($1<=255)) { $enc = chr($1) } + if ($enc =~ /^\&\#(\d{3});$/ && ($1<=255)) { $enc = chr($1) } + } + if (!$enc) { + # unicode is default output + # this section also generates a numeric char reference + # for any char not found in the output char set in the section above + $enc = $iso_10646_character_map{"$char$kind"}; + if (!$enc && $iso_10646_combining_character_map{"$kind"}) { + # use combining accents for characters not in main table: \dot{A} + $enc = $char.$iso_10646_combining_character_map{"$kind"}; + } } - if ($USE_ENTITY_NAMES && $enc) { return(";SPM$char$kind;") } if ($enc) { $ISOLATIN_CHARS = 1; $enc; } elsif (!$image_made{"$char$kind"}) { @@ -11481,7 +11556,7 @@ sub do_package_options { foreach $option (split (',',$options)) { $option =~ s/^[\s\t\n]*//o; $option =~ s/[\s\t\n]*$//o; - $option =~ s/\W/_/g; # replace non-alphanumerics + $option =~ s/[^\w=]/_/g; # replace non-alphanumerics next unless ($option); if (!($styles_loaded{$package."_$option"})) { &do_require_packageoption($package."_$option"); @@ -11490,6 +11565,12 @@ sub do_package_options { } } } + # A routine called _setup can be defined to do + # any processing that is necessary after all options have been loaded + my $package_setup = $package."_setup"; + if (defined &$package_setup) { + &$package_setup; + } $rest; } @@ -11500,7 +11581,7 @@ sub do_class_options { foreach $option (split (',',$options)) { $option =~ s/^[\s\t\n]*//o; $option =~ s/[\s\t\n]*$//o; - $option =~ s/\W/_/g; # replace non-alphanumerics + $option =~ s/[^\w=]/_/g; # replace non-alphanumerics next unless ($option); &do_require_package($option); if (!($styles_loaded{$class."_$option"})) { @@ -11573,16 +11654,21 @@ sub do_require_extension { } } +# argument $optionfull is _

','
'); + my ($verb_pre,$verb_post) = ('
','
'); if ($USING_STYLES) { $env_id .= ' CLASS="verbatim"' unless ($env_id =~ /(^|\s)CLASS\s*\=/i); $verb_pre =~ s/>/ $env_id>/; @@ -56,7 +58,7 @@ sub do_cmd_lstinputlisting { # %verbatim not coupled to a dbm => will not work in subprocesses, but don't mind $verbatim{++$global{'verbatim_counter'}} = $option.$file; - # Do nothing here, just wrap into a verbatim-like lstlisting environment. + # Do nothing here, just wrap into a verbatim-like lstfile environment. # File reading and decorating postponed to &process_lstlisting. join('', $closures, $verb_pre , $verbatim_mark, 'lstfile', $global{'verbatim_counter'} @@ -323,42 +325,131 @@ sub process_lstlisting { $rulecolor = $_; $rulecolor = " BORDERCOLOR=\"$rulecolor\"" unless ($rulecolor eq ''); + # Evtl use Pygments or GNU source-highlight to produce colorized output + my($lst_lang,$lst_lnum) = ('',''); + if ($USE_HILITE) { + unless ($SRCHILITE ne '' && -x $SRCHILITE) { + if ($SRCHILITE ne '') { + print "\n\n$SRCHILITE cannot be executed\n"; + &write_warnings("\n$SRCHILITE cannot be executed"); + } else { + print "\n\npygmentize or source-highlight executable not available\n"; + &write_warnings("\npygmentize or source-highlight executable not available"); + } + print "Generating listings via builtin engine\n\n"; + &write_warnings("Generating listings via builtin engine"); + $USE_HILITE = 0; + } + } + if ($USE_HILITE) { + unless (open (HILITE, ">.$dd${PREFIX}hilite.in")) { + print "\n\nCannot create pygmentize or source-highlight input file: $!\n"; + print "Generating listings via builtin engine\n\n"; + &write_warnings("\nCannot create pygmentize or source-highlight input file: $!"); + &write_warnings("Generating listings via builtin engine"); + $USE_HILITE = 0; + } + } + if ($USE_HILITE) { + $lst_pre =~ s/]*>//;# highlighting engine inserts
 by itself
+    $lst_post =~ s/<\/PRE>//;
+    $_ = $curopts{'language'};
+    s/$O\d+$C//go;		# Get rid of bracket id's
+    s/$OP\d+$CP//go;		# Get rid of processed bracket id's
+    ($option,$dum) = &get_verb_optional_argument;
+    s/\s+//;			# Remove white space and make lowercase
+    $_ = "\L$_";
+    $option =~ s/\s+//;
+    $option = "\L$option";
+    # evtl language rewriting
+    if ($_ eq 'c') {
+      if ($option eq 'sharp') {
+	$_ = 'csharp';
+      } elsif ($option eq 'objective') {
+	$_ = 'objc';
+      }
+    } elsif ($_ eq 'java') {
+      if ($option eq 'aspectj') {
+	$_ = 'aspectj';
+      }
+    } elsif ($_ eq '') {
+      if ($SRCHILITE =~ /pygmentize/) {
+	$_ = 'text';
+      } else {
+	$_ = 'txt';
+      }
+    } else {
+      if ($SRCHILITE =~ /pygmentize/) {
+	$_ = $lstset_pylangs{$_} if exists ($lstset_pylangs{$_});
+      } else {
+	$_ = $lstset_langs{$_} if exists ($lstset_langs{$_});
+      }
+    }
+    $lst_lang = $_;
+    if ($curopts{'numbers'} eq 'left')
+    {
+      if ($SRCHILITE =~ /pygmentize/) {
+	$lst_lnum = ",linenos=table";
+      } else {
+	$lst_lnum = "--line-number=' '";
+      }
+    }
+  }
+
   $lst_pre  = $bstyle_open.$lst_pre."\n";
   $lst_post = "\n".$lst_post.$bstyle_close;
   $_ = $contents;
 
-  # Evtl generate line numbers
-  if ($curopts{'numbers'} eq 'left') {
-    # Insert numbers from the left side.
-    $counter = $fcount-$incr;
-    s/^/$i++; $counter+=$incr;
-    (($counter % $step) && ($curopts{'numberfirstline'} ne 'true' || $i > 1)) ?
+  if ($USE_HILITE) {
+    # Pygments and source-highlight can generate line numbers by themselves
+    s/^\n//;				# remove leading vertical space
+    $_ = &revert_to_raw_tex ($_);
+    print HILITE $_;
+    close (HILITE);
+    if ($SRCHILITE =~ /pygmentize/) {
+      print "\n\nRunning $SRCHILITE $HILITE_OPTS -l $lst_lang -f html -O noclasses,nobackground$lst_lnum .$dd${PREFIX}hilite.in\n\n";
+      $_ = `$SRCHILITE $HILITE_OPTS -l $lst_lang -f html -O noclasses,nobackground$lst_lnum .$dd${PREFIX}hilite.in`;
+      s//
/;	# clear extra style
+    } else {
+      print "\n\nRunning $SRCHILITE $HILITE_OPTS --failsafe $lst_lnum -s $lst_lang -i .$dd${PREFIX}hilite.in\n\n";
+      $_ = `$SRCHILITE $HILITE_OPTS --failsafe $lst_lnum -s $lst_lang -i .$dd${PREFIX}hilite.in`;
+    }
+    unlink (".$dd${PREFIX}hilite.in");
+    s/\n$//;				# remove trailing vertical space
+  } else {
+    # Evtl generate line numbers by builtin engine
+    if ($curopts{'numbers'} eq 'left') {
+      # Insert numbers from the left side.
+      $counter = $fcount-$incr;
+      s/^/$i++; $counter+=$incr;
+      (($counter % $step) &&
+      ($curopts{'numberfirstline'} ne 'true' || $i > 1)) ?
       ('     ' . ' ' x $nspaces) :
       (sprintf("%5d",$counter) . ' ' x $nspaces)/mge;
-    $lst_last_counter = $counter+$incr;
-    $lst_auto_counter{$lst_name} = $lst_last_counter
-      if ($curopts{'firstnumber'} eq 'auto' && $lst_name ne '');
-  }
-  elsif ($curopts{'numbers'} eq 'right' && $HTML_VERSION > 2.1) {
-    # Inserting right padded numbers for every line is tricky.
-    # Do it as a table with two huge columns with verbatim contents.
-    # But only if HTML version is high enough...
-    s/$/$nlines++;''/mge;
-    for ($counter=$fcount; $i<$nlines; $i++) {
-      $cline .= (($counter % $step) &&
-		 ($curopts{'numberfirstline'} ne 'true' || $i > 0)) ?
-	(' ' x $nspaces . "     \n") :
-	(' ' x $nspaces . sprintf("%d\n",$counter));
-      $counter += $incr;
+      $lst_last_counter = $counter+$incr;
+      $lst_auto_counter{$lst_name} = $lst_last_counter
+	if $curopts{'firstnumber'} eq 'auto' && $lst_name ne '';
+    } elsif ($curopts{'numbers'} eq 'right' && $HTML_VERSION > 2.1) {
+      # Inserting right padded numbers for every line is tricky.
+      # Do it as a table with two huge columns with verbatim contents.
+      # But only if HTML version is high enough...
+      s/$/$nlines++;''/mge;
+      for ($counter=$fcount; $i<$nlines; $i++) {
+	$cline .= (($counter % $step) &&
+		   ($curopts{'numberfirstline'} ne 'true' || $i > 0)) ?
+	  (' ' x $nspaces . "     \n") :
+	  (' ' x $nspaces . sprintf("%d\n",$counter));
+	$counter += $incr;
+      }
+      $lst_last_counter = $counter;
+      $lst_auto_counter{$lst_name} = $lst_last_counter
+	if $curopts{'firstnumber'} eq 'auto' && $lst_name ne '';
+      $cline =~ s/\n$//;
+      $_ = "
" + .$lst_pre.$_.$lst_post."" + .$lst_pre.$cline.$lst_post."
"; + $lst_pre = $lst_post = ''; } - $lst_last_counter = $counter; - $lst_auto_counter{$lst_name} = $lst_last_counter - if ($curopts{'firstnumber'} eq 'auto' && $lst_name ne ''); - $cline =~ s/\n$//; - $_ = "
" - .$lst_pre.$_.$lst_post."" - .$lst_pre.$cline.$lst_post."
"; - $lst_pre = $lst_post = ''; } # Frames, captions and coloring are generated also as a synthetic table @@ -409,6 +500,83 @@ sub process_lstinline { $bstyle_open = $bstyle_close = '' unless (s/^\s*((<\w+[^>]*>\s*)+)[^<]*((<\/\w+>\s*)+)$/$bstyle_open=$1;$bstyle_close=$3;''/eo); + # Evtl use Pygments or GNU source-highlight to produce colorized output + my($lst_lang) = ''; + if ($USE_HILITE) { + unless ($SRCHILITE ne '' && -x $SRCHILITE) { + if ($SRCHILITE ne '') { + print "\n\n$SRCHILITE cannot be executed\n"; + &write_warnings("\n$SRCHILITE cannot be executed"); + } else { + print "\n\npygmentize or source-highlight executable not available\n"; + &write_warnings("\npygmentize or source-highlight executable not available"); + } + print "Generating listings via builtin engine\n\n"; + &write_warnings("Generating listings via builtin engine"); + $USE_HILITE = 0; + } + } + if ($USE_HILITE) { + unless (open (HILITE, ">.$dd${PREFIX}hilite.in")) { + print "\n\nCannot create pygmentize or source-highlight input file: $!\n"; + print "Generating listings via builtin engine\n\n"; + &write_warnings("\nCannot create pygmentize or source-highlight input file: $!"); + &write_warnings("Generating listings via builtin engine"); + $USE_HILITE = 0; + } + } + if ($USE_HILITE) { + $_ = $curopts{'language'}; + s/$O\d+$C//go; # Get rid of bracket id's + s/$OP\d+$CP//go; # Get rid of processed bracket id's + ($option,$dum) = &get_verb_optional_argument; + s/\s+//; # Remove white space and make lowercase + $_ = "\L$_"; + $option =~ s/\s+//; + $option = "\L$option"; + # evtl language rewriting + if ($_ eq 'c') { + if ($option eq 'sharp') { + $_ = 'csharp'; + } elsif ($option eq 'objective') { + $_ = 'objc'; + } + } elsif ($_ eq 'java') { + if ($option eq 'aspectj') { + $_ = 'aspectj'; + } + } elsif ($_ eq '') { + if ($SRCHILITE =~ /pygmentize/) { + $_ = 'text'; + } else { + $_ = 'txt'; + } + } else { + if ($SRCHILITE =~ /pygmentize/) { + $_ = $lstset_pylangs{$_} if exists ($lstset_pylangs{$_}); + } else { + $_ = $lstset_langs{$_} if exists ($lstset_langs{$_}); + } + } + $lst_lang = $_; + $contents =~ s/^\n//; # remove leading vertical space + $contents = &revert_to_raw_tex ($contents); + print HILITE $contents; + close (HILITE); + if ($SRCHILITE =~ /pygmentize/) { + print "\n\nRunning $SRCHILITE $HILITE_OPTS -l $lst_lang -f html -O noclasses,nobackground .$dd${PREFIX}hilite.in\n\n"; + $contents = `$SRCHILITE $HILITE_OPTS -l $lst_lang -f html -O noclasses,nobackground .$dd${PREFIX}hilite.in`; + $contents =~ s//
/;
+    } else {
+      print "\n\nRunning $SRCHILITE $HILITE_OPTS --failsafe -s $lst_lang -i .$dd${PREFIX}hilite.in\n\n";
+      $contents = `$SRCHILITE $HILITE_OPTS --failsafe -s $lst_lang -i .$dd${PREFIX}hilite.in`;
+    }
+    unlink (".$dd${PREFIX}hilite.in");
+    $contents =~ s/^.*?
//s;	# remove obstructive starting stuff
+    $contents =~ s/<\/pre>.*?$//s;	# remove obstructive trailing stuff
+    $contents =~ s/\n$//;		# remove trailing vertical space
+  }
+
   # Make the actual lstinline output
   $bstyle_open.''.$contents.''.$bstyle_close;
 }
diff --git a/styles/longtable.perl b/styles/longtable.perl
old mode 100755
new mode 100644
diff --git a/styles/lsorbian.perl b/styles/lsorbian.perl
index 2f75d56..cf60ec4 100644
--- a/styles/lsorbian.perl
+++ b/styles/lsorbian.perl
@@ -8,7 +8,7 @@ package lsorbian;
 
 print " [lsorbian]";
 
-sub main'lsorbian_translation { @_[0] }
+sub main::lsorbian_translation { @_[0] }
 
 
 
diff --git a/styles/magyar.perl b/styles/magyar.perl
index 40077ac..29bbf0a 100644
--- a/styles/magyar.perl
+++ b/styles/magyar.perl
@@ -8,7 +8,7 @@ package magyar;
 
 print " [magyar]";
 
-sub main'magyar_translation { @_[0] }
+sub main::magyar_translation { @_[0] }
 
 
 
diff --git a/styles/makeidx.perl b/styles/makeidx.perl
index 5144845..d95d3af 100644
--- a/styles/makeidx.perl
+++ b/styles/makeidx.perl
@@ -58,7 +58,7 @@ sub add_real_idx {
 	    $index{$key} = $index{$old_key} . $old_html."\n | ";
 	};
     }
-    @keys = sort makeidx_keysort @keys;
+    @keys = sort $makeidx_keysort @keys;
     @keys = grep(!/\001/, @keys);
     foreach $key (@keys) {
 	$index .= &add_idx_key($key);
@@ -83,7 +83,10 @@ sub makeidx_keysort {
     $y =~ s/^([a-z])/~~~\1/;
     $x cmp $y;
 }
- 
+
+# sort routine can be overridden by setting this variable
+$makeidx_keysort = \&makeidx_keysort;
+
 sub add_idx_key {
     local($key) = @_;
     local($index, $next);
diff --git a/styles/minted.perl b/styles/minted.perl
new file mode 100644
index 0000000..2dd5a90
--- /dev/null
+++ b/styles/minted.perl
@@ -0,0 +1,789 @@
+# -*- perl -*-
+#
+# $Id:  $
+#
+# minted.perl
+#   Georgy Salnikov  24/08/20
+#
+# Extension to LaTeX2HTML V2024 to partly support the "minted" package.
+#
+# Partly derived from listings.perl
+#
+# Change Log:
+# ===========
+#
+# $Log:  $
+#
+# Note:
+# This module provides translation for the \minted environment
+# and for some more commands of the minted.sty package
+#
+# Handling decisions are done together with verbatim by LaTeX2HTML main program
+#
+# Several global variables and arrays are defined in the initialization block
+# of the LaTeX2HTML main program:
+#
+# %minted_current
+# %minted_lex
+# %mintinline_current
+# %mintinline_lex
+# %mint_langs
+# $mint_last_counter
+#
+
+package main;
+
+my $MINTED_HILITE = 1;
+
+# This package very probably may be used in minted
+&do_require_package("color");
+
+# Implementation of \inputminted[]{}{}, preparation only
+sub do_cmd_inputminted {
+  local($_) = @_;
+  local($outer,$lexer,$file);
+
+  local($dum,$option) = &get_verb_optional_argument;
+  $lexer = &missing_braces unless (
+    (s/$next_pair_pr_rx/$lexer=$2;''/eo)
+    ||(s/$next_pair_rx/$lexer=$2;''/eo));
+  $lexer = "\L$lexer";
+  $file = &missing_braces unless (
+    (s/$next_pair_pr_rx/$file=$2;''/eo)
+    ||(s/$next_pair_rx/$file=$2;''/eo));
+  $outer = $_;
+
+  local($closures,$reopens) = &preserve_open_tags;
+  my ($verb_pre,$verb_post) = ('
','
'); + if ($USING_STYLES) { + $env_id .= ' CLASS="verbatim"' unless ($env_id =~ /(^|\s)CLASS\s*\=/i); + $verb_pre =~ s/>/ $env_id>/; + } + + # %verbatim not coupled to a dbm => will not work in subprocesses, but don't mind + $verbatim{++$global{'verbatim_counter'}} = $option.'{'.$lexer.'}'.$file; + + # Do nothing here, just wrap into a verbatim-like minted environment. + # File reading and decorating postponed to &process_minted. + join('', $closures, $verb_pre + , $verbatim_mark, 'mintfile', $global{'verbatim_counter'} + , '#', $verb_post, $reopens, $outer); +} + +# Implementation of \setminted[]{}, preparation only +sub do_cmd_setminted { + local($_) = @_; + local($dum,$lexer) = &get_verb_optional_argument; + $lexer = "\L$lexer"; + local($option) = &missing_braces unless ( + (s/$next_pair_pr_rx/$option=$2;''/eo) + ||(s/$next_pair_rx/$option=$2;''/eo)); + local($outer) = $_; + + # In preamble this just initializes the defaults + if ($PREAMBLE) { + $dum = "\L$dum"; + my(%opts) = &lst_parse_options($option); + if ($dum eq '') { + @minted_current{keys %opts} = (values %opts); + } else { + @{$minted_lex{$dum}}{keys %opts} = (values %opts); + } + return $outer; + } + + # Do nothing here, just wrap into a verbatim-like setminted environment. + # Processing options will be done later by &process_minted. + local($closures,$reopens) = &preserve_open_tags; + $verbatim{++$global{'verbatim_counter'}} = $lexer.$option; + join('', $closures, $verbatim_mark, 'setminted', $global{'verbatim_counter'}, + '#', $reopens, $outer); +} + +# Implementation of \setmintedinline[]{}, preparation only +sub do_cmd_setmintedinline { + local($_) = @_; + local($dum,$lexer) = &get_verb_optional_argument; + $lexer = "\L$lexer"; + local($option) = &missing_braces unless ( + (s/$next_pair_pr_rx/$option=$2;''/eo) + ||(s/$next_pair_rx/$option=$2;''/eo)); + local($outer) = $_; + + # In preamble this just initializes the defaults + if ($PREAMBLE) { + $dum = "\L$dum"; + my(%opts) = &lst_parse_options($option); + if ($dum eq '') { + @mintinline_current{keys %opts} = (values %opts); + } else { + @{$mintinline_lex{$dum}}{keys %opts} = (values %opts); + } + return $outer; + } + + # Do nothing here, just wrap into a verbatim-like setmintedinline environment. + # Processing options will be done later by &process_minted. + local($closures,$reopens) = &preserve_open_tags; + $verbatim{++$global{'verbatim_counter'}} = $lexer.$option; + join('', $closures, $verbatim_mark, 'setmintedinline', + $global{'verbatim_counter'}, '#', $reopens, $outer); +} + +# Implementation of \usemintedstyle[]{}, preparation only +sub do_cmd_usemintedstyle { + local($_) = @_; + local($dum,$lexer) = &get_verb_optional_argument; + $lexer = "\L$lexer"; + local($style) = &missing_braces unless ( + (s/$next_pair_pr_rx/$style=$2;''/eo) + ||(s/$next_pair_rx/$style=$2;''/eo)); + local($outer) = $_; + + # In preamble this just initializes the defaults + if ($PREAMBLE) { + $dum = "\L$dum"; + if ($dum eq '') { + $minted_current{'style'} = $style; + } else { + $minted_lex{$dum}{'style'} = $style; + } + return $outer; + } + + # Do nothing here, just wrap into a verbatim-like setminted environment. + # Processing options will be done later by &process_minted. + local($closures,$reopens) = &preserve_open_tags; + $verbatim{++$global{'verbatim_counter'}} = $lexer.$style; + join('', $closures, $verbatim_mark, 'usemintedstyle', + $global{'verbatim_counter'}, '#', $reopens, $outer); +} + +# This is the main driver subroutine for the minted environment +sub process_minted { + local($lst_pre, $lst_post, $lst_cmd, $_) = @_; + + # Check if it was an auxiliary command wrapped into an environment + if ($lst_cmd eq 'setminted') { return &set_setminted($_); } + if ($lst_cmd eq 'setmintedinline') { return &set_setmintedinline($_); } + if ($lst_cmd eq 'usemintedstyle') { return &set_usemintedstyle($_); } + + # Process an actual minted environment + local($option,$dum) = &get_verb_optional_argument; + local($lexer) = &missing_braces unless ( + (s/$next_pair_pr_rx/$lexer=$2;''/eo) + ||(s/$next_pair_rx/$lexer=$2;''/eo) + ||(s/$verb_braces_rx/$lexer=$1;''/eo)); + $lexer = "\L$lexer"; + local($contents) = $_; + + # Fetch current defaults and apply specified options... + my(%curopts) = %minted_current; + my(%opts) = &lst_parse_options($option); + + # First of all, apply language specific options if any + @curopts{keys %{$minted_lex{$lexer}}} = (values %{$minted_lex{$lexer}}); + + # Now apply all the other specified options + @curopts{keys %opts} = (values %opts); + + # For wrapped inputminted - replace file name with file contents + if ($lst_cmd eq 'mintfile') { + my($dir); + my($file) = $contents; + my($file2) = "$file.tex"; + if ($file !~ /\.tex$/) { + # 2nd choice is better than 1st - TeXnical quirk + ($file,$file2) = ($file2,$file); + } + my($found) = 0; + foreach $dir ("$texfilepath", split(/:/,$ENV{'TEXINPUTS'})) { + if (-f ($_ = "$dir/$file") || -f ($_ = "$dir/$file2")) { + $found = 1; + # overread $_ with file contents + &slurp_input($_); + last; + } + } + &write_warnings("No file <$file> for inputminted.") unless $found; + # pre_process file contents + if (defined &replace_all_html_special_chars) { + &replace_all_html_special_chars; + } else { + &replace_html_special_chars; + } + s/\n$//; # vertical space is contributed by
already. + $contents = $_; + } + + # Interpret the rest of options in sequence... + # Line numbering (linenos,numbers,stepnumber,numberfirstline,numbersep,firstnumber) + my($i, $counter, $cline, $nlines); + $cline = ''; + $i = $counter = $nlines = 0; + my($step) = sprintf("%.0f", $curopts{'stepnumber'}); + my($incr) = $step<=>0; + $curopts{'linenos'} = 'true' if ($curopts{'numbers'} ne 'none'); + $curopts{'numbers'} = 'none' if ($curopts{'linenos'} ne 'true' || !$incr); + $curopts{'numbers'} = 'left' if ($curopts{'linenos'} eq 'true' && + $curopts{'numbers'} eq 'none' && $incr); + my($nspaces); + ($nspaces, $dum) = &convert_length ($curopts{'numbersep'}, 1); + $nspaces = sprintf("%.0f", $nspaces/10); + my($fcount) = $curopts{'firstnumber'}; + if ($fcount eq 'auto') { + $fcount = 1; + } elsif ($fcount eq 'last') { + $fcount = $mint_last_counter; + } else { + $fcount = sprintf("%.0f", $fcount); + } + + # Framing options group (frame, framesep, framerule) + my($frame) = 'VOID'; + $frame = 'LHS' if ($curopts{'frame'} eq 'leftline'); + $frame = 'ABOVE' if ($curopts{'frame'} eq 'topline'); + $frame = 'BELOW' if ($curopts{'frame'} eq 'bottomline'); + $frame = 'HSIDES' if ($curopts{'frame'} eq 'lines'); + $frame = 'BORDER' if ($curopts{'frame'} eq 'single'); + my($framesep); + ($framesep, $dum) = &convert_length ($curopts{'framesep'}, 1); + $framesep = sprintf("%.0f", $framesep); + my($framerule); + ($framerule, $dum) = &convert_length ($curopts{'framerule'}, 1); + $framerule = sprintf("%.0f", $framerule); + if ($framerule == 1) { # Special case specifying a very thin border + $framerule = ''; + } else { + $framerule = " BORDER=\"$framerule\""; + } + + # Coloring options group (bgcolor, rulecolor) + my($bgcolor) = $curopts{'bgcolor'}; + $bgcolor = " BGCOLOR=\"$bgcolor\"" unless ($bgcolor eq ''); + my($rulecolor); + $_ = $curopts{'rulecolor'}; + if (/^\s*\\/) { + # Translate as a command and extract color value from the HTML tag + &lst_translate_option; + s/$O\d+$C//go; # Get rid of bracket id's + s/$OP\d+$CP//go; # Get rid of processed bracket id's + # Extract color value or clear the malformed contents + $_ = '' + unless (s/^\s*\s*<\/FONT>\s*$//); + } + $rulecolor = $_; + $rulecolor = " BORDERCOLOR=\"$rulecolor\"" unless ($rulecolor eq ''); + + # Evtl use Pygments or GNU source-highlight to produce colorized output + my($lst_lnum,$mint_style) = ('',''); + if ($MINTED_HILITE) { + unless ($SRCHILITE ne '' && -x $SRCHILITE) { + if ($SRCHILITE ne '') { + print "\n\n$SRCHILITE cannot be executed\n"; + &write_warnings("\n$SRCHILITE cannot be executed"); + } else { + print "\n\npygmentize or source-highlight executable not available\n"; + &write_warnings("\npygmentize or source-highlight executable not available"); + } + print "Generating listings via builtin engine\n\n"; + &write_warnings("Generating listings via builtin engine"); + $MINTED_HILITE = 0; + } + } + if ($MINTED_HILITE) { + unless (open (HILITE, ">.$dd${PREFIX}hilite.in")) { + print "\n\nCannot create pygmentize or source-highlight input file: $!\n"; + print "Generating listings via builtin engine\n\n"; + &write_warnings("\nCannot create pygmentize or source-highlight input file: $!"); + &write_warnings("Generating listings via builtin engine"); + $MINTED_HILITE = 0; + } + } + if ($MINTED_HILITE) { + $lst_pre =~ s/]*>//;# highlighting engine inserts
 by itself
+    $lst_post =~ s/<\/PRE>//;
+    # evtl language rewriting (for source-highlight only)
+    $lexer = 'text' if $lexer eq '';
+    unless ($SRCHILITE =~ /pygmentize/) {
+      $lexer = $mint_langs{$lexer} if exists ($mint_langs{$lexer});
+    }
+    if ($curopts{'numbers'} eq 'left')
+    {
+      if ($SRCHILITE =~ /pygmentize/) {
+	$lst_lnum = ",linenos=table";
+      } else {
+	$lst_lnum = "--line-number=' '";
+      }
+    }
+    $mint_style = ",style=$curopts{'style'}" if $curopts{'style'} ne '';
+  }
+
+  $_ = $contents;
+
+  if ($MINTED_HILITE) {
+    # Pygments and source-highlight can generate line numbers by themselves
+    s/^\n//;				# remove leading vertical space
+    $_ = &revert_to_raw_tex ($_);
+    print HILITE $_;
+    close (HILITE);
+    if ($SRCHILITE =~ /pygmentize/) {
+      print "\n\nRunning $SRCHILITE $HILITE_OPTS -l $lexer -f html -O noclasses,nobackground$mint_style$lst_lnum .$dd${PREFIX}hilite.in\n\n";
+      $_ = `$SRCHILITE $HILITE_OPTS -l $lexer -f html -O noclasses,nobackground$mint_style$lst_lnum .$dd${PREFIX}hilite.in`;
+      s//
/;	# clear extra style
+    } else {
+      print "\n\nRunning $SRCHILITE $HILITE_OPTS --failsafe $lst_lnum -s $lexer -i .$dd${PREFIX}hilite.in\n\n";
+      $_ = `$SRCHILITE $HILITE_OPTS --failsafe $lst_lnum -s $lexer -i .$dd${PREFIX}hilite.in`;
+    }
+    unlink (".$dd${PREFIX}hilite.in");
+    s/\n$//;				# remove trailing vertical space
+  } else {
+    # Evtl generate line numbers by builtin engine
+    if ($curopts{'numbers'} eq 'left') {
+      # Insert numbers from the left side.
+      $counter = $fcount-$incr;
+      s/^/$i++; $counter+=$incr;
+      (($counter % $step) &&
+      ($curopts{'numberfirstline'} ne 'true' || $i > 1)) ?
+      ('     ' . ' ' x $nspaces) :
+      (sprintf("%5d",$counter) . ' ' x $nspaces)/mge;
+      $mint_last_counter = $counter+$incr;
+    } elsif ($curopts{'numbers'} eq 'right' && $HTML_VERSION > 2.1) {
+      # Inserting right padded numbers for every line is tricky.
+      # Do it as a table with two huge columns with verbatim contents.
+      # But only if HTML version is high enough...
+      s/$/$nlines++;''/mge;
+      for ($counter=$fcount; $i<$nlines; $i++) {
+	$cline .= (($counter % $step) &&
+		   ($curopts{'numberfirstline'} ne 'true' || $i > 0)) ?
+	  (' ' x $nspaces . "     \n") :
+	  (' ' x $nspaces . sprintf("%d\n",$counter));
+	$counter += $incr;
+      }
+      $mint_last_counter = $counter;
+      $cline =~ s/\n$//;
+      $_ = "
" + .$lst_pre.$_.$lst_post."" + .$lst_pre.$cline.$lst_post."
"; + $lst_pre = $lst_post = ''; + } + } + + # Frames and coloring are generated also as a synthetic table + if ($HTML_VERSION > 2.1) { + $lst_pre = "" + ."
\n".$lst_pre; + $lst_post = $lst_post."\n
"; + } + + # WHEW !!! + $lst_pre.$_.$lst_post."\n"; +} + +# Driver subroutine for the real processing of \mint command +sub process_mint { + local($_, $lexer, $contents) = @_; + local($lst_pre, $lst_post) = ('
', '
'); + + # Process an actual mint command + local($option,$dum) = &get_verb_optional_argument; + $_ = $lexer; + $lexer = &missing_braces unless ( + (s/$next_pair_pr_rx/$lexer=$2;''/eo) + ||(s/$next_pair_rx/$lexer=$2;''/eo) + ||(s/$verb_braces_rx/$lexer=$1;''/eo)); + $lexer = "\L$lexer"; + + # Fetch current defaults and apply specified options... + my(%curopts) = %minted_current; + my(%opts) = &lst_parse_options($option); + + # First of all, apply language specific options if any + @curopts{keys %{$minted_lex{$lexer}}} = (values %{$minted_lex{$lexer}}); + + # Now apply all the other specified options + @curopts{keys %opts} = (values %opts); + + # Interpret the rest of options in sequence... + # Line numbering (linenos,numbers,stepnumber,numberfirstline,numbersep,firstnumber) + my($i, $counter, $cline, $nlines); + $cline = ''; + $i = $counter = $nlines = 0; + my($step) = sprintf("%.0f", $curopts{'stepnumber'}); + my($incr) = $step<=>0; + $curopts{'linenos'} = 'true' if ($curopts{'numbers'} ne 'none'); + $curopts{'numbers'} = 'none' if ($curopts{'linenos'} ne 'true' || !$incr); + $curopts{'numbers'} = 'left' if ($curopts{'linenos'} eq 'true' && + $curopts{'numbers'} eq 'none' && $incr); + my($nspaces); + ($nspaces, $dum) = &convert_length ($curopts{'numbersep'}, 1); + $nspaces = sprintf("%.0f", $nspaces/10); + my($fcount) = $curopts{'firstnumber'}; + if ($fcount eq 'auto') { + $fcount = 1; + } elsif ($fcount eq 'last') { + $fcount = $mint_last_counter; + } else { + $fcount = sprintf("%.0f", $fcount); + } + + # Framing options group (frame, framesep, framerule) + my($frame) = 'VOID'; + $frame = 'LHS' if ($curopts{'frame'} eq 'leftline'); + $frame = 'ABOVE' if ($curopts{'frame'} eq 'topline'); + $frame = 'BELOW' if ($curopts{'frame'} eq 'bottomline'); + $frame = 'HSIDES' if ($curopts{'frame'} eq 'lines'); + $frame = 'BORDER' if ($curopts{'frame'} eq 'single'); + my($framesep); + ($framesep, $dum) = &convert_length ($curopts{'framesep'}, 1); + $framesep = sprintf("%.0f", $framesep); + my($framerule); + ($framerule, $dum) = &convert_length ($curopts{'framerule'}, 1); + $framerule = sprintf("%.0f", $framerule); + if ($framerule == 1) { # Special case specifying a very thin border + $framerule = ''; + } else { + $framerule = " BORDER=\"$framerule\""; + } + + # Coloring options group (bgcolor, rulecolor) + my($bgcolor) = $curopts{'bgcolor'}; + $bgcolor = " BGCOLOR=\"$bgcolor\"" unless ($bgcolor eq ''); + my($rulecolor); + $_ = $curopts{'rulecolor'}; + if (/^\s*\\/) { + # Translate as a command and extract color value from the HTML tag + &lst_translate_option; + s/$O\d+$C//go; # Get rid of bracket id's + s/$OP\d+$CP//go; # Get rid of processed bracket id's + # Extract color value or clear the malformed contents + $_ = '' + unless (s/^\s*\s*<\/FONT>\s*$//); + } + $rulecolor = $_; + $rulecolor = " BORDERCOLOR=\"$rulecolor\"" unless ($rulecolor eq ''); + + # Evtl use Pygments or GNU source-highlight to produce colorized output + my($lst_lnum,$mint_style) = ('',''); + if ($MINTED_HILITE) { + unless ($SRCHILITE ne '' && -x $SRCHILITE) { + if ($SRCHILITE ne '') { + print "\n\n$SRCHILITE cannot be executed\n"; + &write_warnings("\n$SRCHILITE cannot be executed"); + } else { + print "\n\npygmentize or source-highlight executable not available\n"; + &write_warnings("\npygmentize or source-highlight executable not available"); + } + print "Generating listings via builtin engine\n\n"; + &write_warnings("Generating listings via builtin engine"); + $MINTED_HILITE = 0; + } + } + if ($MINTED_HILITE) { + unless (open (HILITE, ">.$dd${PREFIX}hilite.in")) { + print "\n\nCannot create pygmentize or source-highlight input file: $!\n"; + print "Generating listings via builtin engine\n\n"; + &write_warnings("\nCannot create pygmentize or source-highlight input file: $!"); + &write_warnings("Generating listings via builtin engine"); + $MINTED_HILITE = 0; + } + } + if ($MINTED_HILITE) { + $lst_pre =~ s/]*>//;# highlighting engine inserts
 by itself
+    $lst_post =~ s/<\/PRE>//;
+    # evtl language rewriting (for source-highlight only)
+    $lexer = 'text' if $lexer eq '';
+    unless ($SRCHILITE =~ /pygmentize/) {
+      $lexer = $mint_langs{$lexer} if exists ($mint_langs{$lexer});
+    }
+    if ($curopts{'numbers'} eq 'left')
+    {
+      if ($SRCHILITE =~ /pygmentize/) {
+	$lst_lnum = ",linenos=table";
+      } else {
+	$lst_lnum = "--line-number=' '";
+      }
+    }
+    $mint_style = ",style=$curopts{'style'}" if $curopts{'style'} ne '';
+  }
+
+  $_ = $contents;
+
+  if ($MINTED_HILITE) {
+    # Pygments and source-highlight can generate line numbers by themselves
+    s/^\n//;				# remove leading vertical space
+    $_ = &revert_to_raw_tex ($_);
+    print HILITE $_;
+    close (HILITE);
+    if ($SRCHILITE =~ /pygmentize/) {
+      print "\n\nRunning $SRCHILITE $HILITE_OPTS -l $lexer -f html -O noclasses,nobackground$mint_style$lst_lnum .$dd${PREFIX}hilite.in\n\n";
+      $_ = `$SRCHILITE $HILITE_OPTS -l $lexer -f html -O noclasses,nobackground$mint_style$lst_lnum .$dd${PREFIX}hilite.in`;
+      s//
/;	# clear extra style
+    } else {
+      print "\n\nRunning $SRCHILITE $HILITE_OPTS --failsafe $lst_lnum -s $lexer -i .$dd${PREFIX}hilite.in\n\n";
+      $_ = `$SRCHILITE $HILITE_OPTS --failsafe $lst_lnum -s $lexer -i .$dd${PREFIX}hilite.in`;
+    }
+    unlink (".$dd${PREFIX}hilite.in");
+    s/\n$//;				# remove trailing vertical space
+  } else {
+    # Evtl generate line numbers by builtin engine
+    if ($curopts{'numbers'} eq 'left') {
+      # Insert numbers from the left side.
+      $counter = $fcount-$incr;
+      s/^/$i++; $counter+=$incr;
+      (($counter % $step) &&
+      ($curopts{'numberfirstline'} ne 'true' || $i > 1)) ?
+      ('     ' . ' ' x $nspaces) :
+      (sprintf("%5d",$counter) . ' ' x $nspaces)/mge;
+      $mint_last_counter = $counter+$incr;
+    } elsif ($curopts{'numbers'} eq 'right' && $HTML_VERSION > 2.1) {
+      # Inserting right padded numbers for every line is tricky.
+      # Do it as a table with two huge columns with verbatim contents.
+      # But only if HTML version is high enough...
+      s/$/$nlines++;''/mge;
+      for ($counter=$fcount; $i<$nlines; $i++) {
+	$cline .= (($counter % $step) &&
+		   ($curopts{'numberfirstline'} ne 'true' || $i > 0)) ?
+	  (' ' x $nspaces . "     \n") :
+	  (' ' x $nspaces . sprintf("%d\n",$counter));
+	$counter += $incr;
+      }
+      $mint_last_counter = $counter;
+      $cline =~ s/\n$//;
+      $_ = "
" + .$lst_pre.$_.$lst_post."" + .$lst_pre.$cline.$lst_post."
"; + $lst_pre = $lst_post = ''; + } + } + + # Frames and coloring are generated also as a synthetic table + if ($HTML_VERSION > 2.1) { + $lst_pre = "" + ."
\n".$lst_pre; + $lst_post = $lst_post."\n
"; + } + + # WHEW !!! + $lst_pre.$_.$lst_post."\n"; +} + +# Driver subroutine for the real processing of \mintinline command +sub process_mintinline { + local($_, $lexer, $contents) = @_; + + # Get mintinline options + local($option,$dum) = &get_verb_optional_argument; + $_ = $lexer; + $lexer = &missing_braces unless ( + (s/$next_pair_pr_rx/$lexer=$2;''/eo) + ||(s/$next_pair_rx/$lexer=$2;''/eo) + ||(s/$verb_braces_rx/$lexer=$1;''/eo)); + $lexer = "\L$lexer"; + + # Fetch current defaults and apply specified options... + my(%curopts) = %minted_current; + my(%opts) = &lst_parse_options($option); + + # First of all, apply language specific options if any + @curopts{keys %{$minted_lex{$lexer}}} = (values %{$minted_lex{$lexer}}); + + # Now apply mintinline specific options if any + @curopts{keys %mintinline_current} = (values %mintinline_current); + @curopts{keys %{$mintinline_lex{$lexer}}} = (values %{$mintinline_lex{$lexer}}); + + # Now apply all the other specified options + @curopts{keys %opts} = (values %opts); + + # Evtl use Pygments or GNU source-highlight to produce colorized output + my($mint_style) = ''; + if ($MINTED_HILITE) { + unless ($SRCHILITE ne '' && -x $SRCHILITE) { + if ($SRCHILITE ne '') { + print "\n\n$SRCHILITE cannot be executed\n"; + &write_warnings("\n$SRCHILITE cannot be executed"); + } else { + print "\n\npygmentize or source-highlight executable not available\n"; + &write_warnings("\npygmentize or source-highlight executable not available"); + } + print "Generating listings via builtin engine\n\n"; + &write_warnings("Generating listings via builtin engine"); + $MINTED_HILITE = 0; + } + } + if ($MINTED_HILITE) { + unless (open (HILITE, ">.$dd${PREFIX}hilite.in")) { + print "\n\nCannot create pygmentize or source-highlight input file: $!\n"; + print "Generating listings via builtin engine\n\n"; + &write_warnings("\nCannot create pygmentize or source-highlight input file: $!"); + &write_warnings("Generating listings via builtin engine"); + $MINTED_HILITE = 0; + } + } + if ($MINTED_HILITE) { + # evtl language rewriting (for source-highlight only) + $lexer = 'text' if $lexer eq ''; + unless ($SRCHILITE =~ /pygmentize/) { + $lexer = $mint_langs{$lexer} if exists ($mint_langs{$lexer}); + } + # style seems the only option which can be really useful for mintinline + $mint_style = ",style=$curopts{'style'}" if $curopts{'style'} ne ''; + # Pygments and source-highlight can generate line numbers by themselves + $contents =~ s/^\n//; # remove leading vertical space + $contents = &revert_to_raw_tex ($contents); + print HILITE $contents; + close (HILITE); + if ($SRCHILITE =~ /pygmentize/) { + print "\n\nRunning $SRCHILITE $HILITE_OPTS -l $lexer -f html -O noclasses,nobackground$mint_style .$dd${PREFIX}hilite.in\n\n"; + $contents = `$SRCHILITE $HILITE_OPTS -l $lexer -f html -O noclasses,nobackground$mint_style .$dd${PREFIX}hilite.in`; + $contents =~ s//
/;
+    } else {
+      print "\n\nRunning $SRCHILITE $HILITE_OPTS --failsafe -s $lexer -i .$dd${PREFIX}hilite.in\n\n";
+      $contents = `$SRCHILITE $HILITE_OPTS --failsafe -s $lexer -i .$dd${PREFIX}hilite.in`;
+    }
+    unlink (".$dd${PREFIX}hilite.in");
+    $contents =~ s/^.*?
//s;	# remove obstructive starting stuff
+    $contents =~ s/<\/pre>.*?$//s;	# remove obstructive trailing stuff
+    $contents =~ s/\n$//;		# remove trailing vertical space
+  }
+
+  # Make the actual mintinline output
+  ''.$contents.'';
+}
+
+# Driver subroutine for \setminted processing
+# Just copy the given set of options to the default options set
+sub set_setminted {
+  local($_) = @_;
+  local($lexer,$dum) = &get_verb_optional_argument;
+  $lexer = "\L$lexer";
+  my(%opts) = &lst_parse_options($_);
+  if ($lexer eq '') {
+    @minted_current{keys %opts} = (values %opts);
+  } else {
+    @{$minted_lex{$lexer}}{keys %opts} = (values %opts);
+  }
+  '';
+}
+
+# Driver subroutine for \setmintedinline processing
+# Just copy the given set of options to the default options set
+sub set_setmintedinline {
+  local($_) = @_;
+  local($lexer,$dum) = &get_verb_optional_argument;
+  $lexer = "\L$lexer";
+  my(%opts) = &lst_parse_options($_);
+  if ($lexer eq '') {
+    @mintinline_current{keys %opts} = (values %opts);
+  } else {
+    @{$mintinline_lex{$lexer}}{keys %opts} = (values %opts);
+  }
+  '';
+}
+
+# Driver subroutine for \usemintedstyle processing
+# Just copy the given style to the default options set
+sub set_usemintedstyle {
+  local($_) = @_;
+  local($lexer,$dum) = &get_verb_optional_argument;
+  $lexer = "\L$lexer";
+  local($style) = $_;
+  if ($lexer eq '') {
+    $minted_current{'style'} = $style;
+  } else {
+    $minted_lex{$lexer}{'style'} = $style;
+  }
+  '';
+}
+
+# Option parser for minted commands/envs family, this can be tricky
+sub lst_parse_options {
+  local($_) = @_;
+
+  # First get rid of comment marks
+  s/(\\\w+)$comment_mark\d*\s*?\n[ \t]*/$1 \n/go;
+  s/($comment_mark\d*\s*)+\n[ \t]*/\n/go;
+
+  # Find any kinds of brackets to keep them intact
+  # for the case if they might have commas inside
+  my(@fields, @chunks);
+  my($before, $match, $after);
+  while (/$any_next_pair_pr_rx|$any_next_pair_rx4|$opt_arg_rx|$verb_braces_rx/)
+  {
+    ($before, $match, $after) = ($`, $&, $');
+    @chunks = split(/,/, $before);
+    $fields[$#fields] .= shift(@chunks) if @fields;
+    push(@fields, @chunks);
+    $fields[$#fields] .= $match;
+    $_ = $after;
+  }
+  @chunks = split(/,/);
+  $fields[$#fields] .= shift(@chunks) if @fields;
+  push(@fields, @chunks);
+
+  # All options are separated, now split them to option name and value
+  my(%opts);
+  my($par, $val);
+  foreach (@fields) {
+    if (($par, $val) = /^\s*(\w+?)\s*=\s*(.*)\s*$/s) {
+      $opts{$par} = $val;
+    } elsif (($par) = /^\s*(\w+?)\s*$/s) {	# boolean option
+      $opts{$par} = 'true';
+    }
+  }
+  %opts;
+}
+
+# Replace braces with marks and try to interpret this as a bracketed command
+sub lst_translate_option {
+  # Modifies $_
+  &mark_string($_);
+  my($br_id) = ++$global{'max_id'};
+  $_ = $O.$br_id.$C.$_.$O.$br_id.$C;
+  $_ = &translate_environments($_);
+  $_ = &translate_commands($_);
+}
+
+# &get_next_optional_argument is not well suited for minted
+# Here is a special version of &get_next_optional_argument
+sub get_verb_optional_argument {
+  local($next, $pat);
+  my($before, $match, $after);
+  $next = $pat = $match = '';
+  if (s/^(\[)/$pat=$1;''/eo) {
+    # Find any kinds of braces not to stuck on [] evtl nested between them
+    while (/$any_next_pair_pr_rx|$any_next_pair_rx4|$verb_braces_rx|\]/) {
+      ($before, $match, $after) = ($`, $&, $');
+      $next .= $before;
+      $pat  .= $before;
+      if ($match eq ']') {
+	$pat .= $match;
+	$_ = $after;
+	# Before returning, remove comment mark and newline after closing ]
+	s/^[ \t]*($comment_mark\d*[ \t]*)*\n//o;
+	last;
+      }
+      $next .= $match;
+      $pat  .= $match;
+      $_ = $after;
+    }
+    if ($match ne ']') {
+      # Closing ] not found, revert back $_ and clear arguments
+      $_ = $pat . $_;
+      $next = $pat = '';
+    }
+  }
+  # Imitate return of &get_next_optional_argument
+  ($next, $pat);
+}
+
+&process_commands_wrap_deferred (<<_RAW_ARG_DEFERRED_CMDS_);
+inputminted # [] # {} # {}
+setminted # [] # {}
+setmintedinline # [] # {}
+usemintedstyle # [] # {}
+_RAW_ARG_DEFERRED_CMDS_
+
+1;			# Must be last line
diff --git a/styles/more_amsmath.perl b/styles/more_amsmath.perl
index ae31a0c..84d01f3 100644
--- a/styles/more_amsmath.perl
+++ b/styles/more_amsmath.perl
@@ -148,6 +148,8 @@ sub embed_display {
 $mlalign = " style=\"text-align:left;\">";
 $mralign = " style=\"text-align:right;\">";
 $mvalign = " ";	#  class equation specifies style=\"vertical-align:baseline;\"
+$slcell = $smncell."class=\"LEFT\">";
+$srcell = $smncell."class=\"RIGHT\">";
 $smlcell = $smncell.$mlalign;
 $smccell = $smncell.$mcalign;
 $smrcell = $smncell.$mralign;
@@ -157,6 +159,8 @@ sub embed_display {
 
 $lseqno = "$eqno_class style=\"text-align:left;\">\n";
 $rseqno = "$eqno_class style=\"text-align:right\">\n";
+$lsfill = " class=\"lfill\">";
+$rsfill = " class=\"rfill\">";
 
 
 # do these indirectly, so that they only over-ride the existing
@@ -671,9 +675,9 @@ sub process_env_align{
 	$env_id = '';
 
 	local($valign, $scell, $eqno) = ($mvalign,'','');
-	local($srow, $ecell, $slcell, $srcell) = (
+	local($srow, $ecell) = (
 	    $smrow.$valign.$emtag , $emcell
-	    , $smncell.$mlalign, $smncell.$mralign );
+	    );
 
 	local($return) = &start_math_display ( $sarray );
 
@@ -681,15 +685,11 @@ sub process_env_align{
 	$_ = &revert_array_envs($_);
 	$_ = &protect_array_envs($_);
 
-	if ($EQN_TAGS =~ /L/) {
-	    # equation number on left
-	    ($srow, $scell, $ecell) = ( $smrow.$valign.$emtag.$smcell 
-		, $smncell , $emcell);
-	} else {
-	    # equation number on right
-	    ($srow, $scell, $ecell) = (
-		$smrow.$valign.$emtag , $smncell, $emcell );
-	}
+	# leftmost and rightmost columns expand to fill available space,
+	# so that the main group of columns is centered.
+	# one of the two contains the equation numbers.
+	($srow, $scell, $ecell) = ( $smrow.$valign.$emtag.$smcell
+				    , $smncell , $emcell);
 
 	local($xcols) = '0';
 
@@ -713,8 +713,8 @@ sub process_env_align{
 
 	    if ($EQN_TAGS =~ /L/) {
 #		$return .= $srow.$mcalign.$eqno.$ecell
-		$return .= $srow.$lseqno.$eqno.$ecell
-	    } else { $return .= $srow }
+		$return .= $srow.$lsfill.$eqno.$ecell
+	    } else { $return .= $srow.$lsfill.$ecell }
 
 	    local($scell) = $srcell; # so 1st cell is right-aligned...
 
@@ -748,9 +748,10 @@ sub process_env_align{
 		} else { $return .= join('', $mspace , $ecell); }
 
 #		$return .= $smncell.$mcalign.$eqno.$ecell
-		$return .= $smncell.$rseqno.$eqno.$ecell
+		$return .= $smncell.$rfill;
+		$return .= $eqno
 		    unless ($EQN_TAGS =~ /L/); # eqn-num on right
-		$return .= $erow;
+		$return .= $ecell.$erow;
 		next;
 	    }
 
@@ -778,9 +779,10 @@ sub process_env_align{
 	    }
 
 #	    $return .= $smncell.$mcalign.$eqno.$ecell
-	    $return .= $smncell.$rseqno.$eqno.$ecell
+	    $return .= $smncell.$rsfill;
+	    $return .= $eqno
 		unless ($EQN_TAGS =~ /L/); # eqn-num on right
-	    $return .= $erow;
+	    $return .= $ecell.$erow;
 	}
 	$_ = &end_math_display($return , $earray );
     } else {
diff --git a/styles/natbib.perl b/styles/natbib.perl
index 20f2a4a..a9c252c 100644
--- a/styles/natbib.perl
+++ b/styles/natbib.perl
@@ -119,7 +119,7 @@ package main;
 $CITE_OPEN_DELIM = '(' unless $CITE_OPEN_DELIM;
 $CITE_CLOSE_DELIM = ')' unless $CITE_CLOSE_DELIM;
 
-# CUSTOMIZATION: Delimiters for seperation of multiple citations
+# CUSTOMIZATION: Delimiters for separation of multiple citations
 $CITE_ENUM = '; ' unless $CITE_ENUM;
 
 # CUSTOMIZATION: whether multiple citations should be sorted. (BRM)
@@ -237,7 +237,7 @@ sub do_natbib_sort {
 sub do_cmd_cite {
     local($_) = @_;
     local($cite_key, @cite_keys);
-# Look for options of the command in a seperate subroutine
+# Look for options of the command in a separate subroutine
     local($has_optional,$optional1,$optional2)=&cite_check_options;
 # Select the correct marker 
     local ($c_mark) = ($has_optional ? $cite_par_mark : $cite_mark);
diff --git a/styles/norsk.perl b/styles/norsk.perl
index f49f0c9..1e00a97 100644
--- a/styles/norsk.perl
+++ b/styles/norsk.perl
@@ -8,7 +8,7 @@ package norsk;
 
 print " [norsk]";
 
-sub main'norsk_translation { @_[0] }
+sub main::norsk_translation { @_[0] }
 
 
 
diff --git a/styles/nynorsk.perl b/styles/nynorsk.perl
index a6f27b3..d2b0750 100644
--- a/styles/nynorsk.perl
+++ b/styles/nynorsk.perl
@@ -8,7 +8,7 @@ package nynorsk;
 
 print " [nynorsk]";
 
-sub main'nynorsk_translation { @_[0] }
+sub main::nynorsk_translation { @_[0] }
 
 
 
diff --git a/styles/polish.perl b/styles/polish.perl
index fa5700f..e571fe7 100644
--- a/styles/polish.perl
+++ b/styles/polish.perl
@@ -8,7 +8,7 @@ package polish;
 
 print " [polish]";
 
-sub main'polish_translation {
+sub main::polish_translation {
     local($_) = @_;
 #s/;SPMquot;\s*('|`|;SPMlt;|;SPMgt;|\\|-|;SPMquot;|=|\|)/&get_polish_specials($1)/geo;
 s/;SPMquot;\s*('|`|;SPMlt;|;SPMgt;|\\|-|;SPMquot;|=|\||[aelrcnoszAELRCNOSZ])/&get_polish_specials($1)/geo;
@@ -17,11 +17,11 @@ sub main'polish_translation {
 
 sub get_polish_specials {
     local($char) = @_;
-    if($char=~/[ae]/i) {&main'iso_map($char,'ogon')}
-    elsif($char=~/[lL]/) {&main'iso_map($char,'strok')}
-    elsif($char=~/r/) {&main'iso_map('z','dot')}
-    elsif($char=~/R/) {&main'iso_map('Z','dot')}
-    elsif($char=~/[cnosz]/i) {&main'iso_map($char,'acute')}
+    if($char=~/[ae]/i) {&main::iso_map($char,'ogon')}
+    elsif($char=~/[lL]/) {&main::iso_map($char,'strok')}
+    elsif($char=~/r/) {&main::iso_map('z','dot')}
+    elsif($char=~/R/) {&main::iso_map('Z','dot')}
+    elsif($char=~/[cnosz]/i) {&main::iso_map($char,'acute')}
     else{$polish_specials{$char}}
 }
 
diff --git a/styles/polski.perl b/styles/polski.perl
index ff3c74a..06e23dd 100644
--- a/styles/polski.perl
+++ b/styles/polski.perl
@@ -6,15 +6,15 @@
 
 package polski;
 
-sub main'polski_translation { @_[0] }
+sub main::polski_translation { @_[0] }
 
 sub get_polski_specials {
     local($char) = @_;
-    if($char=~/[ae]/i) {&main'iso_map($char,'ogon')}
-    elsif($char=~/[lL]/) {&main'iso_map($char,'strok')}
-    elsif($char=~/x/) {&main'iso_map('z','dot')}
-    elsif($char=~/X/) {&main'iso_map('Z','dot')}
-    elsif($char=~/[cnosz]/i) {&main'iso_map($char,'acute')}
+    if($char=~/[ae]/i) {&main::iso_map($char,'ogon')}
+    elsif($char=~/[lL]/) {&main::iso_map($char,'strok')}
+    elsif($char=~/x/) {&main::iso_map('z','dot')}
+    elsif($char=~/X/) {&main::iso_map('Z','dot')}
+    elsif($char=~/[cnosz]/i) {&main::iso_map($char,'acute')}
     else{$polski_specials{$char}}
 }
 
@@ -96,7 +96,7 @@ sub polski_today {
 sub do_cmd_PLSlash {
     local($_) = @_;
     s/^\s*('|`|;SPMlt;|;SPMgt;|\\|-|\/|=|\||[aelxcnoszAELXCNOSZ])/
-	&get_polski_specials($1)/eos;
+	&polski::get_polski_specials($1)/eos;
     $_;
 }
 
@@ -104,7 +104,7 @@ sub do_cmd_PLSlash {
 sub polski_prefix_translation {
     local($_) = @_;
     s/(^|\G|[^\\<]|[^\\](\\\\)+)\/\s*('|`|;SPMlt;|;SPMgt;|\\|-|\/|=|\||[aelxcnoszAELXCNOSZ])/
-	$1.&polski'get_polski_specials($3)/geom;
+	$1.&polski::get_polski_specials($3)/geom;
     $_;
 }
 
diff --git a/styles/portuges.perl b/styles/portuges.perl
index 5e70347..ec81cf1 100644
--- a/styles/portuges.perl
+++ b/styles/portuges.perl
@@ -8,7 +8,7 @@ package portuges;
 
 print " [portuges]";
 
-sub main'portuges_translation {
+sub main::portuges_translation {
     local($_) = @_;
 s/;SPMquot;\s*('|`|;SPMlt;|;SPMgt;|\\|-|;SPMquot;|=|\|)/&get_portuges_specials($1)/geo;
     $_;
diff --git a/styles/romanian.perl b/styles/romanian.perl
index 8256e5d..b3e0a4d 100644
--- a/styles/romanian.perl
+++ b/styles/romanian.perl
@@ -8,7 +8,7 @@ package romanian;
 
 print " [romanian]";
 
-sub main'romanian_translation { @_[0] }
+sub main::romanian_translation { @_[0] }
 
 
 
@@ -73,7 +73,7 @@ sub romanian_today {
 &romanian_titles;
 $default_language = 'romanian';
 $TITLES_LANGUAGE = 'romanian';
-$romanian_encoding = 'is-8859-16';
+$romanian_encoding = 'iso-8859-16';
 
 # $Log: romanian.perl,v $
 # Revision 1.1  1998/08/25 01:59:07  RRM
diff --git a/styles/russian.perl b/styles/russian.perl
index a15cfd7..5747b3f 100644
--- a/styles/russian.perl
+++ b/styles/russian.perl
@@ -10,7 +10,7 @@ package russian;
 
 print " [russian]";
 
-sub main'russian_translation {
+sub main::russian_translation {
     local($_) = @_;
     s/;SPMquot;\-\-\-/—/go;
     s/\-\-\-/—/go;
@@ -31,7 +31,7 @@ sub main'russian_translation {
 
 sub make_next_char_rx {
     local($chars) = @_;
-    local($OP,$CP) = &main'brackets;
+    local($OP,$CP) = &main::brackets;
     ";SPMquot;\\s*(($chars)|$OP\\d+$CP\\s*($chars)\\s*$OP\\d+$CP)";
 }
    
diff --git a/styles/scottish.perl b/styles/scottish.perl
index 71c8338..126c460 100644
--- a/styles/scottish.perl
+++ b/styles/scottish.perl
@@ -8,7 +8,7 @@ package scottish;
 
 print " [scottish]";
 
-sub main'scottish_translation { @_[0] }
+sub main::scottish_translation { @_[0] }
 
 
 
diff --git a/styles/slovak.perl b/styles/slovak.perl
index 42421d3..0a884ed 100644
--- a/styles/slovak.perl
+++ b/styles/slovak.perl
@@ -8,7 +8,7 @@ package slovak;
 
 print " [slovak]";
 
-sub main'slovak_translation { @_[0] }
+sub main::slovak_translation { @_[0] }
 
 
 
diff --git a/styles/slovene.perl b/styles/slovene.perl
index 7de823e..215a56c 100644
--- a/styles/slovene.perl
+++ b/styles/slovene.perl
@@ -8,13 +8,13 @@ package slovene;
 
 print " [slovene]";
 
-sub main'slovene_translation {
+sub main::slovene_translation {
     local($_) = @_;
     s/;SPMquot;\s*('|`|;SPMlt;|;SPMgt;|\\|-|;SPMquot;|=|\|)/&get_slovene_specials($1)/geo;
     local($next_char_rx) = &make_next_char_rx("[aAeEiIoOuU]");
-    s/$next_char_rx/&main'iso_map(($2||$3),"uml")/geo;
+    s/$next_char_rx/&main::iso_map(($2||$3),"uml")/geo;
     $next_char_rx = &make_next_char_rx("[sz]");
-    s/$next_char_rx/&main'iso_map("sz","lig")/geo;
+    s/$next_char_rx/&main::iso_map("sz","lig")/geo;
     $next_char_rx = &make_next_char_rx("[SZ]"); s/$next_char_rx/S$2/go;
     s/;SPMquot;\s*([cflmnprt])/\1/go;
     s/;SPMquot;/"/go;
@@ -23,7 +23,7 @@ sub main'slovene_translation {
 
 sub make_next_char_rx {
     local($chars) = @_;
-    local($OP,$CP) = &main'brackets;
+    local($OP,$CP) = &main::brackets;
     ";SPMquot;\\s*(($chars)|$OP\\d+$CP\\s*($chars)\\s*$OP\\d+$CP)";
 }
 
diff --git a/styles/spanish.perl b/styles/spanish.perl
index 847caba..e60bdd5 100644
--- a/styles/spanish.perl
+++ b/styles/spanish.perl
@@ -9,7 +9,7 @@ package spanish;
 # Put Spanish equivalents here for headings/dates/ etc when
 # latex2html start supporting them ...
 
-sub main'spanish_translation { @_[0] }
+sub main::spanish_translation { @_[0] }
 
 
 
diff --git a/styles/texdefs.perl b/styles/texdefs.perl
index 2fe0e8d..d29fda4 100644
--- a/styles/texdefs.perl
+++ b/styles/texdefs.perl
@@ -53,7 +53,7 @@ sub do_cmd_char {
     local($_) = @_;
 # some special characters are already turned into l2h internal
 # representation.
-# Get its represention from the table and use it like as regexp form.
+# Get its representation from the table and use it like as regexp form.
     local($spmquot) = &escape_rx_chars($html_specials{'"'});
 # Get all internal special char representations as implied during
 # preprocessing.
diff --git a/styles/turkish.perl b/styles/turkish.perl
index 1834f74..5efb56f 100644
--- a/styles/turkish.perl
+++ b/styles/turkish.perl
@@ -19,7 +19,7 @@
 
 package turkish;
 
-sub main'turkish_translation {
+sub main::turkish_translation {
     @_[0];
 }
 
diff --git a/styles/usorbian.perl b/styles/usorbian.perl
index 40b4e00..6ea7ed0 100644
--- a/styles/usorbian.perl
+++ b/styles/usorbian.perl
@@ -10,13 +10,13 @@ package usorbian;
 
 &do_require_extension ('latin2');
 
-sub main'usorbian_translation {
+sub main::usorbian_translation {
     local($_) = @_;
     s/;SPMquot;\s*('|`|;SPMlt;|;SPMgt;|\\|-|;SPMquot;|=|\|)/&get_usorbian_specials($1)/geo;
     local($next_char_rx) = &make_next_char_rx("[aAeEiIoOuU]");
-    s/$next_char_rx/&main'iso_map(($2||$3),"uml")/geo;
+    s/$next_char_rx/&main::iso_map(($2||$3),"uml")/geo;
     $next_char_rx = &make_next_char_rx("[sz]");
-    s/$next_char_rx/&main'iso_map("sz","lig")/geo;
+    s/$next_char_rx/&main::iso_map("sz","lig")/geo;
     $next_char_rx = &make_next_char_rx("[SZ]"); s/$next_char_rx/S$2/go;
     s/;SPMquot;\s*([cflmnprt])/\1/go;
     s/;SPMquot;/"/go;
@@ -25,7 +25,7 @@ sub main'usorbian_translation {
 
 sub make_next_char_rx {
     local($chars) = @_;
-    local($OP,$CP) = &main'brackets;
+    local($OP,$CP) = &main::brackets;
     ";SPMquot;\\s*(($chars)|$OP\\d+$CP\\s*($chars)\\s*$OP\\d+$CP)";
 }
 
diff --git a/styles/webtex.perl b/styles/webtex.perl
index a0c7c3a..af4d3b8 100644
--- a/styles/webtex.perl
+++ b/styles/webtex.perl
@@ -227,6 +227,7 @@ sub convert_to_webtex {
 	    &webeq_failed($out_tag); $out_tag = '';
 	} else {
 	    open(TAG, "<$out_tag");
+		binmode TAG;
 	    $app_tag = join('',);
 	    close(TAG);
 	    # replace webeq fall-back image by LaTeX2HTML's own, or none at all
diff --git a/styles/welsh.perl b/styles/welsh.perl
index e8c81d8..cbdca58 100644
--- a/styles/welsh.perl
+++ b/styles/welsh.perl
@@ -8,7 +8,7 @@ package welsh;
 
 print " [welsh]";
 
-sub main'welsh_translation { @_[0] }
+sub main::welsh_translation { @_[0] }
 
 
 
diff --git a/tests/accents_in_index.tex b/tests/accents_in_index.tex
new file mode 100644
index 0000000..a1ea0eb
--- /dev/null
+++ b/tests/accents_in_index.tex
@@ -0,0 +1,33 @@
+\documentclass{article}
+\usepackage[xindy]{imakeidx}
+\usepackage{hyperref}
+\makeindex
+\begin{document}
+
+\begin{table}
+a table
+  \caption{hello}\label{t1}
+\end{table}
+
+See Table \ref{t1}.
+\index{y formula}
+\begin{equation} 
+y(n) = \langle x\rangle. % \qquad\hbox{($x$ real)}
+\label{eq1}
+\end{equation}
+\index{\'ecole}
+\begin{equation} 
+y_2(n) = \langle x_2\rangle. % \qquad\hbox{($x$ real)}
+\label{eq2}
+\end{equation} 
+See eq.~\ref{eq1} and eq.~\ref{eq2}.
+\index{accent}
+\index{aça}
+\index{aea}
+\index{aaa}
+\index{\c{c}\`a}
+\index{\c{C}a}
+
+
+\printindex
+\end{document}
diff --git a/tests/ams_comment.tex b/tests/ams_comment.tex
index 76ad6cd..0ba0890 100644
--- a/tests/ams_comment.tex
+++ b/tests/ams_comment.tex
@@ -56,6 +56,21 @@
     t & \equiv (P_1 - P_3)^2 \\
     u & \equiv (P_1 - P_4)^2
   \end{align}
+An array inside an align environment:
+\begin{align}
+  \begin{array}{c}
+    0
+  \end{array}
+  & =
+  \begin{array}{c}
+    0
+  \end{array}
+  \\
+  \left[ \begin{array}{cc}
+           a & b \\ c & d
+         \end{array} \right] &=
+  \left[ \begin{array}{cc} 1 & 2 \\ 3 & 4 \end{array} \right]
+\end{align}
 
 ba%comment
 nana
diff --git a/tests/babel.tex b/tests/babel.tex
new file mode 100644
index 0000000..89cd3ec
--- /dev/null
+++ b/tests/babel.tex
@@ -0,0 +1,11 @@
+\documentclass{report}
+
+\usepackage[main=dutch,german]{babel}
+
+\begin{document}
+\tableofcontents
+\chapter{Purpose of this Test}
+Testing the \texttt{main} option of the babel package.
+
+\end{document}
+
diff --git a/tests/basic.tex b/tests/basic.tex
index d8c47cf..3852b78 100644
--- a/tests/basic.tex
+++ b/tests/basic.tex
@@ -61,3 +61,6 @@ \subsection{Table}
 \hline
 \end{tabular}
 
+dif\'{i}cil
+dif{\'i}cil
+dif\'{\i}cil
diff --git a/tests/epsfig.tex b/tests/epsfig.tex
index 77920db..b0ff5ca 100644
--- a/tests/epsfig.tex
+++ b/tests/epsfig.tex
@@ -6,6 +6,7 @@
 
 \begin{document}
 
+As of 2021, this figure is cropped by preview, because it is wider than \verb|\textwidth|
 \begin{figure}[hbt]
   \begin{center}
     \begin{picture}(7,1.0)
@@ -16,5 +17,16 @@
   \end{center}
   \caption{Test.}
 \end{figure}
+Test with makeimage:
+\begin{figure}[hbt]
+  \begin{makeimage}
+    \begin{picture}(7,1.0)
+      \put(0.28,0){\epsfig{file = allpasses.eps, width=6in}}
+      \put(0,0.42){$x[n]$}
+      \put(6.3,0.42){$y[n]$}
+    \end{picture}
+  \end{makeimage}
+  \caption{Test.}
+\end{figure}
 
 \end{document}
diff --git a/tests/eq_line_spacing.tex b/tests/eq_line_spacing.tex
index a6c5bc8..ce224c4 100644
--- a/tests/eq_line_spacing.tex
+++ b/tests/eq_line_spacing.tex
@@ -1,6 +1,9 @@
 \documentclass[12pt]{amsart}
 \usepackage{amssymb}
 \usepackage{latexsym}
+\usepackage{array}
+\usepackage{caption}
+
 \title{The trap for \LaTeX\ convertors}
 \author{Sergej V. Znamenskij}
 \begin {document}
@@ -23,7 +26,7 @@
 
 .$.\sum\limits^n1.$.$.\prod\limits_n2.$.$.\dfrac{\alpha\otimes\mu}{\gamma}.$.$.1.$.$.\dfrac {\rightharpoonup}{A\otimes B}.$.
 
-The simple convertion algorithm can fail due to the following reasons:
+The simple conversion algorithm can fail due to the following reasons:
 \begin {itemize} 
 \item HTML lacks opportunity to reproduce \LaTeX\ layout directly;
 \item Some kind of HTML markup has different visual representation in different browser versions;  
@@ -36,4 +39,112 @@
 \[ a = \int \exp{x} \,\mathrm{d}x \]
 \end{figure}
 
+Test using eqnarray:
+\begin{eqnarray}
+a_1 &=& -2 r \cos( 2 \pi f_c T_s ) \\
+a_2 &=& r^2,
+\end{eqnarray}
+
+Test using eqnarray*:
+\begin{eqnarray*}
+b_0 &=& (1 - r^2) / 2 \\
+b_1 &=& 0 \\
+b_2 &=& -b_0,
+\end{eqnarray*}
+
+test of lefteqn with eqnarray :
+\begin{eqnarray}
+  \lefteqn{%
+    123456789|123456789|123456789|123456789|123456789|123456789|123456789|
+  }
+  \\&=&
+  123456789|123456789|
+\end{eqnarray}
+test of lefteqn eqnarray* :
+\begin{eqnarray*}
+  \lefteqn{%
+    123456789|123456789|123456789|123456789|123456789|123456789|123456789|
+  }
+  \\&=&
+  123456789|123456789|
+\end{eqnarray*}
+
+First as an equation:
+\begin{equation}
+\tilde{y}(x,t) = C^{+} e^{j (\omega t - k x)} + C^{-} e^{j (\omega t + k x)},
+\label{eq:yxt}
+\end{equation}
+Then using displaymath:
+\begin{displaymath}
+  \tilde{y}(x,t) = C^{+} e^{j (\omega t - k x)} + C^{-} e^{j (\omega t + k x)},
+\end{displaymath}
+followed by more text.
+
+% Then compare the PDF and HTML results with the attention on:
+%
+% 1) spaces between footnote marks and the text following them
+%
+% 2) clickability of the reference from Section 1 to Table in Section 2
+%
+% 3) some illegal HTML tags generated inside Table (near DIV class="CENTER").
+
+\section{Footnote quirks}
+
+Usually there is a space between the footnote mark and the subsequent text.
+But if the text just after a footnote mark starts from the next line,
+the space can be lost.
+
+Here we should have a space after footnote
+mark.\footnote{This is note1} This text follows footnote 1.
+
+Here we intentionally should have no space between the footnote
+mark and the dot\footnote{This is note2}. This text follows footnote 2.
+
+Here we should have a space after footnote
+mark.\footnote{This is note3}
+But the stock latex2html-2022 removes it.
+
+{Here we should not have a space after the
+switch to large text with a newline.\large
+Large text.}
+
+{Here we should not have a space after the
+switch to large text with a space.\large Large text.}
+
+{Here we should have a new paragraph after the
+switch to large text with two newlines.\large
+
+Large text.}
+
+{Here we should not have a space after the
+switch to large text with a newlines and a space.\large
+ Large text.}
+
+Now see Table \ref{tablecap} in the next section. Try to press this hyperlink.
+This can fail because stock latex2html-2022 sometimes loses labels
+defined inside floating table environments.
+
+\newpage
+
+\section{Table quirks}
+
+Here the stock latex2html-2022 can put an illegal HTML tag
+into the generated table near DIV class=CENTER.
+
+\begin{table}
+\begin{centering}
+\begin{tabular}{|>{\centering}m{6em}|c|>{\centering}m{4em}|c|}
+  \hline 
+  heading 1 & heading 2 & heading 3 & heading 4\\
+  \hline 
+  cell 1 & cell 2 & cell 3 & cell 4\\
+  \hline 
+\end{tabular}
+\par\end{centering}
+\caption{\label{tablecap}This was our test table}
+\end{table}
+
+
+
+
 \end {document}
diff --git a/tests/formulas.tex b/tests/formulas.tex
index 2faccfb..8923dc5 100644
--- a/tests/formulas.tex
+++ b/tests/formulas.tex
@@ -17,3 +17,31 @@ \section{Mathematic formulas}
 \end{eqnarray}
 
 Testing single variables: $a$, $b$, $c$.
+
+Test of Figure environment:
+\begin{figure}
+\[ a = \int \exp{x} \,\mathrm{d}x \]
+\end{figure}
+
+Test using eqnarray:
+\begin{eqnarray}
+a_1 &=& -2 r \cos( 2 \pi f_c T_s ) \\
+a_2 &=& r^2,
+\end{eqnarray}
+
+Test using eqnarray*:
+\begin{eqnarray*}
+b_0 &=& (1 - r^2) / 2 \\
+b_1 &=& 0 \\
+b_2 &=& -b_0,
+\end{eqnarray*}
+First as an equation:
+\begin{equation}
+\tilde{y}(x,t) = C^{+} e^{j (\omega t - k x)} + C^{-} e^{j (\omega t + k x)},
+\label{eq:yxt}
+\end{equation}
+Then using displaymath:
+\begin{displaymath}
+  \tilde{y}(x,t) = C^{+} e^{j (\omega t - k x)} + C^{-} e^{j (\omega t + k x)},
+\end{displaymath}
+followed by more text.
diff --git a/tests/hyp.tex b/tests/hyp.tex
new file mode 100644
index 0000000..cd352c6
--- /dev/null
+++ b/tests/hyp.tex
@@ -0,0 +1,18 @@
+\documentclass{article}
+
+\usepackage{hyphenat}
+
+\begin{document}
+
+electromagnetic-endioscopy
+electromagnetic-endioscopy
+electromagnetic\hyp{}endioscopy
+electromagnetic/endioscopy
+electromagnetic\fshyp{}endioscopy
+electromagnetic\textbackslash endioscopy
+electromagnetic\bshyp{}endioscopy
+electromagnetic:endioscopy
+electromagnetic\colonhyp{}endioscopy
+
+\end{document}
+
diff --git a/tests/jcl-verb.tex b/tests/jcl-verb.tex
index c4d5ade..98da949 100644
--- a/tests/jcl-verb.tex
+++ b/tests/jcl-verb.tex
@@ -64,6 +64,7 @@
 %%	not. Hence the subclasses:
 %%	c11): $del is \w
 %%	c12): $del is \W
+%%	c13): $del is &
 %%
 %%     c2): \\verb[$del][^$del]*
 %%	not a \verb statement
@@ -155,6 +156,7 @@ \section*{Test Description}
 %%	not. Hence the subclasses:
 %%	c11): $del is \w
 %%	c12): $del is \W
+%%	c13): $del is &
 %%
 %%     c2): \\verb[$del][^$del]*
 %%	not a \verb statement
@@ -218,6 +220,8 @@ \section*{Test Description}
 
 testc12 
 
+testc13
+
 testd111 
 
 testd111 
@@ -281,6 +285,9 @@ \section*{Test Part}
 %%% c12): correct \W delimiter, should pass
 \verb/testc12/
 
+%%% c13): correct & delimiter, should pass
+\verb&testc13&
+
 %%% c2): no closing delimiter, should fail
 %\verb_testc2
 
diff --git a/tests/latin1.tex b/tests/latin1.tex
new file mode 100644
index 0000000..2ad691b
--- /dev/null
+++ b/tests/latin1.tex
@@ -0,0 +1,99 @@
+\documentclass{article}
+\usepackage[latin1]{inputenc}
+\usepackage[T1]{fontenc}
+\usepackage{longtable}
+\begin{document}
+
+Latex2html will detect the input encoding command
+in this file, and generate HTML output in the latin1
+(iso-8859-1) encoding.
+
+Latex2html can generate numeric character references for
+characters not in latin1.
+
+Latex2html cannot currently generate utf8 output from
+latin1 input.
+
+\begin{longtable}{llllll}
+273 & 187 & BB &   » &   RIGHT-POINTING DOUBLE ANGLE QUOTATION MARK\\
+274 & 188 & BC &   ¼ &   VULGAR FRACTION ONE QUARTER\\
+275 & 189 & BD &   ½ &   VULGAR FRACTION ONE HALF\\
+276 & 190 & BE &   ¾ &   VULGAR FRACTION THREE QUARTERS\\
+277 & 191 & BF &   ¿ &   INVERTED QUESTION MARK\\
+300 & 192 & C0 &   À &   LATIN CAPITAL LETTER A WITH GRAVE\\
+301 & 193 & C1 &   Á &   LATIN CAPITAL LETTER A WITH ACUTE\\
+302 & 194 & C2 &   Â &   LATIN CAPITAL LETTER A WITH CIRCUMFLEX\\
+303 & 195 & C3 &   Ã &   LATIN CAPITAL LETTER A WITH TILDE\\
+304 & 196 & C4 &   Ä &   LATIN CAPITAL LETTER A WITH DIAERESIS\\
+305 & 197 & C5 &   Å &   LATIN CAPITAL LETTER A WITH RING ABOVE\\
+306 & 198 & C6 &   Æ &   LATIN CAPITAL LETTER AE\\
+307 & 199 & C7 &   Ç &   LATIN CAPITAL LETTER C WITH CEDILLA\\
+310 & 200 & C8 &   È &   LATIN CAPITAL LETTER E WITH GRAVE\\
+311 & 201 & C9 &   É &   LATIN CAPITAL LETTER E WITH ACUTE\\
+312 & 202 & CA &   Ê &   LATIN CAPITAL LETTER E WITH CIRCUMFLEX\\
+313 & 203 & CB &   Ë &   LATIN CAPITAL LETTER E WITH DIAERESIS\\
+314 & 204 & CC &   Ì &   LATIN CAPITAL LETTER I WITH GRAVE\\
+315 & 205 & CD &   Í &   LATIN CAPITAL LETTER I WITH ACUTE\\
+316 & 206 & CE &   Î &   LATIN CAPITAL LETTER I WITH CIRCUMFLEX\\
+317 & 207 & CF &   Ï &   LATIN CAPITAL LETTER I WITH DIAERESIS\\
+320 & 208 & D0 &   Ð &   LATIN CAPITAL LETTER ETH\\
+321 & 209 & D1 &   Ñ &   LATIN CAPITAL LETTER N WITH TILDE\\
+322 & 210 & D2 &   Ò &   LATIN CAPITAL LETTER O WITH GRAVE\\
+323 & 211 & D3 &   Ó &   LATIN CAPITAL LETTER O WITH ACUTE\\
+324 & 212 & D4 &   Ô &   LATIN CAPITAL LETTER O WITH CIRCUMFLEX\\
+325 & 213 & D5 &   Õ &   LATIN CAPITAL LETTER O WITH TILDE\\
+326 & 214 & D6 &   Ö &   LATIN CAPITAL LETTER O WITH DIAERESIS\\
+327 & 215 & D7 &   $×$ &   MULTIPLICATION SIGN\\
+330 & 216 & D8 &   Ø &   LATIN CAPITAL LETTER O WITH STROKE\\
+331 & 217 & D9 &   Ù &   LATIN CAPITAL LETTER U WITH GRAVE\\
+332 & 218 & DA &   Ú &   LATIN CAPITAL LETTER U WITH ACUTE\\
+333 & 219 & DB &   Û &   LATIN CAPITAL LETTER U WITH CIRCUMFLEX\\
+334 & 220 & DC &   Ü &   LATIN CAPITAL LETTER U WITH DIAERESIS\\
+335 & 221 & DD &   Ý &   LATIN CAPITAL LETTER I WITH ACUTE\\
+336 & 222 & DE &   Þ &   LATIN CAPITAL LETTER THORN\\
+337 & 223 & DF &   ß &   LATIN SMALL LETTER SHARP S\\
+340 & 224 & E0 &   à &   LATIN SMALL LETTER A WITH GRAVE\\
+341 & 225 & E1 &   á &   LATIN SMALL LETTER A WITH ACUTE\\
+342 & 226 & E2 &   â &   LATIN SMALL LETTER A WITH CIRCUMFLEX\\
+343 & 227 & E3 &   ã &   LATIN SMALL LETTER A WITH TILDE\\
+344 & 228 & E4 &   ä &   LATIN SMALL LETTER A WITH DIAERESIS\\
+345 & 229 & E5 &   å &   LATIN SMALL LETTER A WITH RING ABOVE\\
+346 & 230 & E6 &   æ &   LATIN SMALL LETTER AE\\
+347 & 231 & E7 &   ç &   LATIN SMALL LETTER C WITH CEDILLA\\
+350 & 232 & E8 &   è &   LATIN SMALL LETTER E WITH GRAVE\\
+351 & 233 & E9 &   é &   LATIN SMALL LETTER E WITH ACUTE\\
+352 & 234 & EA &   ê &   LATIN SMALL LETTER E WITH CIRCUMFLEX\\
+353 & 235 & EB &   ë &   LATIN SMALL LETTER E WITH DIAERESIS\\
+354 & 236 & EC &   ì &   LATIN SMALL LETTER I WITH GRAVE\\
+355 & 237 & ED &   í &   LATIN SMALL LETTER I WITH ACUTE\\
+356 & 238 & EE &   î &   LATIN SMALL LETTER I WITH CIRCUMFLEX\\
+357 & 239 & EF &   ï &   LATIN SMALL LETTER I WITH DIAERESIS\\
+360 & 240 & F0 &   ð &   LATIN SMALL LETTER ETH\\
+361 & 241 & F1 &   ñ &   LATIN SMALL LETTER N WITH TILDE\\
+362 & 242 & F2 &   ò &   LATIN SMALL LETTER O WITH GRAVE\\
+363 & 243 & F3 &   ó &   LATIN SMALL LETTER O WITH ACUTE\\
+364 & 244 & F4 &   ô &   LATIN SMALL LETTER O WITH CIRCUMFLEX\\
+365 & 245 & F5 &   õ &   LATIN SMALL LETTER O WITH TILDE\\
+366 & 246 & F6 &   ö &   LATIN SMALL LETTER O WITH DIAERESIS\\
+367 & 247 & F7 &   $÷$ &   DIVISION SIGN\\
+370 & 248 & F8 &   ø &   LATIN SMALL LETTER O WITH STROKE\\
+371 & 249 & F9 &   ù &   LATIN SMALL LETTER U WITH GRAVE\\
+372 & 250 & FA &   ú &   LATIN SMALL LETTER U WITH ACUTE\\
+373 & 251 & FB &   û &   LATIN SMALL LETTER U WITH CIRCUMFLEX\\
+374 & 252 & FC &   ü &   LATIN SMALL LETTER U WITH DIAERESIS\\
+375 & 253 & FD &   ý &   LATIN SMALL LETTER Y WITH ACUTE\\
+376 & 254 & FE &   þ &   LATIN SMALL LETTER THORN\\
+377 & 255 & FF &   ÿ &   LATIN SMALL LETTER Y WITH DIAERESIS\\
+\end{longtable}
+
+Testing accents made by latex commands:
+
+J'ai re\c{c}u de bonnes notes \`a {\'e}cole.  Dix cent\^\i mes.
+
+Testing latex accents not found in latin1 character encoding:
+
+g breve: \u{g}
+
+z acute: \'z
+
+\end{document}
diff --git a/tests/minted.tex b/tests/minted.tex
new file mode 100644
index 0000000..c832f2b
--- /dev/null
+++ b/tests/minted.tex
@@ -0,0 +1,32 @@
+% Translation command example to produce listing with syntax highlighting:
+% latex2html -html_version 4.0 -use_pdftex -local_icons -use_hilite minted.tex
+\documentclass{article}
+\usepackage{minted}
+\begin{document}
+\begin{minted}[numbers=left,style=colorful,frame=single,rulecolor=red]{c}
+/************************************************************
+ * Convert 24-bit ASPECT integer into 32-bit native integer *
+ ************************************************************/
+int conv_integer (void *pntr)
+{
+  unsigned      par;
+  INTEGER       *par3000 = (INTEGER *)pntr;
+
+  par = par3000->l | (par3000->m<<8) | (par3000->h<<16);
+  if (par3000->h & 0x80) par |= 0xff000000;             /* negative ? */
+  return (int)par;
+}
+\end{minted}
+Now inline test \mintinline[style=colorful]{c}$if (par3000->h & 0x80) par |= 0xff000000;$ here.
+\setminted{style=colorful,frame=single,rulecolor=red}
+\setminted[perl]{rulecolor=green}
+\usemintedstyle{default}
+\usemintedstyle[perl]{bw}
+\begin{minted}{c}
+printf ("Hello world !\n");
+\end{minted}
+\begin{minted}{perl}
+print "Hello world !\n";
+\end{minted}
+Now test \mint[numbers=left,frame=single,rulecolor=red]{c}$if (par3000->h & 0x80) par |= 0xff000000;$ here.
+\end{document}
diff --git a/tests/polski.tex b/tests/polski.tex
index 8e327e8..6902d94 100644
--- a/tests/polski.tex
+++ b/tests/polski.tex
@@ -11,4 +11,7 @@
 
 \nonprefixing
 zestawienia /obroty
+
+\PLSlash a
+
 \end{document}
diff --git a/tests/rrm-col.tex b/tests/rrm-col.tex
index 2e04705..bc1d0a7 100644
--- a/tests/rrm-col.tex
+++ b/tests/rrm-col.tex
@@ -1,5 +1,5 @@
 \documentclass{article}
-\usepackage[dvips,dvipsnames]{color}
+\usepackage[dvipsnames]{color}
 \usepackage{colordvi}
 \usepackage{html}
 \bodytext{	 TEXT    = white
diff --git a/texexpand.1 b/texexpand.1
index 5c58960..6eb935f 100644
--- a/texexpand.1
+++ b/texexpand.1
@@ -259,9 +259,8 @@ together with their options if the file itself hasn't been merged.
 ends in `//\*(R', the whole subdirectory tree is searched.
 .PP
 15. \einput / \einclude merge the given file (if found under the given
-name or with .tex extension) if its basename is in \f(CW@do_include\fR or if it
-isn't in \f(CW@dont_include\fR or if the given filename doesn't end in 
-\&.sty/.clo/.cls when \-auto_exclude is set.
+name or with .tex extension) regardless of the values of \f(CW@do_include\fR,
+\f(CW@dont_include\fR and \-auto_exclude.
 .Sh "Notes"
 Recognizes \edocumentclass, \edocumentstyle, \eusepackage, \eRequirePackage,
 \ebegin{verbatim}...\eend{verbatim}, \f(CW%begin\fR{latexonly}...%end{latexonly},
diff --git a/texexpand.pin b/texexpand.pin
index 371e786..18f8572 100755
--- a/texexpand.pin
+++ b/texexpand.pin
@@ -14,8 +14,9 @@
 
 # Recognizes \documentclass, \documentstyle, \usepackage, \RequirePackage,
 # \begin{verbatim}...\end{verbatim}, \begin{lstlisting}...\end{lstlisting},
+# \begin{minted}...\end{minted},
 # %begin{latexonly}...%end{latexonly}, \begin{latexonly}...\end{latexonly},
-# \input, \include, \verb, \lstinline, \latex
+# \input, \include, \verb, \lstinline, \mintinline, \mint, \latex
 # \endinput, \end{document}
 # \includecomment, \excludecomment
 # \begin{"to exclude"}, \end{"to exclude"}
@@ -42,8 +43,9 @@
 #  d) %begin{any}
 #  e) \begin{verbatim}
 #  f) \begin{lstlisting}
-#  g) \begin{latexonly}
-#  h) %begin{latexonly}
+#  g) \begin{minted}
+#  h) \begin{latexonly}
+#  i) %begin{latexonly}
 # 
 # a)-d) cause texexpand to drop its contents, it will not show up in the
 # output file. You can use this to 'comment out' a bunch of files, say.
@@ -68,17 +70,17 @@
 # 3. [%\]begin{"to exclude"} and [%\]end{"to exclude"} have to be on a
 #    separate line.
 #    Anything between these tags (including the tags) is discarded.
-# 4. \begin{verbatim/verbatim*/lstlisting} and
-#    \end{verbatim/verbatim*/lstlisting} have to be on a separate line.
+# 4. \begin{verbatim/verbatim*/lstlisting/minted} and
+#    \end{verbatim/verbatim*/lstlisting/minted} have to be on a separate line.
 #    Anything between these tags (including the tags) is not expanded.
 # 5. The scope of any such tags may extend over several files.
 #    The opening tag for latexonly may occur on a different include level
 #    than the closing tag.
-#    The opening tag for verbatim/lstlisting/"to exclude" must occur
+#    The opening tag for verbatim/lstlisting/minted/"to exclude" must occur
 #    within the same file than the closing tag.
 # 6. Warnings are printed when the document has been parsed and open
 #    tags remain.
-# 7. When in a "to exclude"/verbatim/lstlisting environment, texexpand
+# 7. When in a "to exclude"/verbatim/lstlisting/minted environment, texexpand
 #    won't recognize ANY command except the corresponding closing tag.
 #    There cannot be any nested constructions.
 #    This behaviour is identical to that of LaTeX.
@@ -90,7 +92,8 @@
 # 11. Everything behind a `%' that isn't preceded by a `\' is regarded as
 #     a comment, i.e. it is printed but not interpreted.
 # 12. If any command listed in 10. is preceded by an occurrence of
-#     `\verb', `\lstinline' or `\latex' then it is NOT interpreted.
+#     `\verb', `\lstinline', `\mintinline', `\mint', `\latex'
+#     then it is NOT interpreted.
 #     This crashes on lines like this:
 #        blah blah \verb+foo foo+ \input{bar} % bar won't be loaded!
 # 13. Packages provided via \usepackage are handled the same way as
@@ -495,8 +498,8 @@ sub initialise {
 # Create generic regexp's:
 # If this matches before a command, the command is ignored.
     $ignore_cmd_rx =
-#	'(\\latex\W|\\verb|\\lstinline|\\expandafter|\\ifx|\\else\W|[\|\[\@]$)';
-  "(\\\\latex\\W|\\\\verb|\\\\lstinline|\\\\expandafter|\\\\ifx|\\\\else\\W|[\\|\\[\\@]\$)";
+#	'(\\latex\W|\\verb|\\lstinline|\\mintinline|\\mint|\\expandafter|\\ifx|\\else\W|[\|\[\@]$)';
+  "(\\\\latex\\W|\\\\verb|\\\\lstinline|\\\\mintinline|\\\\mint|\\\\expandafter|\\\\ifx|\\\\else\\W|[\\|\\[\\@]\$)";
 # This matches a square bracket pair (typically an option list).
     $options_rx = '(\[[^\]]*\]|)';
 # This matches a single argument.
@@ -537,7 +540,7 @@ sub initialise {
 
 
 sub main {
-# Note that verbatim/lstlisting/latexonly may split over different files!
+# Note that verbatim/lstlisting/minted/latexonly may split over different files!
 # $verbatim is 1 if inside a verbatim environment,
 # $latexonly is > 0 if inside latexonly environments
 # $includelevel indicates the depth of include/input
@@ -555,6 +558,7 @@ sub main {
     if($opt{save_styles}) {
 	open(STYLES,">$opt{save_styles}")
             || die "$prompt Error: Cannot open style file '$opt{save_styles}': $!\n";
+        binmode STYLES;
     }
     my $out_file = $opt{output}||$opt{out};
     if($out_file) {
@@ -564,6 +568,7 @@ sub main {
     else {
 	open(OUT,">&STDOUT");
     }
+    binmode OUT;
 
     &process_file($infile); # the workhorse...
 
@@ -600,17 +605,17 @@ sub main {
 #     also would retain its body from LaTeX.
 #     => $active false, $mute true
 #  3) interprete minimal and pass the lines to the out file
-#     This is inside a verbatim, lstlisting or latexonly environment.
+#     This is inside a verbatim, lstlisting, minted or latexonly environment.
 #     The line of course must be at least interpreted to
 #     determine the closing tag.
 #     => $active false, $mute false
 #
 # Any environment may extend over several include files.
-# Any environment except verbatim, lstlisting and latexonly may have its
+# Any environment except verbatim, lstlisting, minted and latexonly may have its
 # opening or closing tag on different input levels.
-# The comment and verbatim/lstlisting environments cannot be nested, as
+# The comment and verbatim/lstlisting/minted environments cannot be nested, as
 # is with LaTeX.
-# We must at least parse verbatim/lstlisting/comment environments in
+# We must at least parse verbatim/lstlisting/minted/comment environments in
 # latexonly environments, to catch fake latexonly tags.
 #
 # The work scheme:
@@ -682,6 +687,7 @@ sub process_file {
     $includelevel++;
 
     open(IN,"<$infile") || die "$prompt Cannot open $infile\n";
+    binmode IN;
     print STDERR "$prompt %--- Processing $infile" if ($debug > 1);
 
     # if we don't include this file marker LaTeX2HTML won't split
@@ -772,7 +778,7 @@ sub process_file {
 	    $mute=1 unless $latexonly;
 	}
 #	elsif (!$fakeenv && !$verbatim && /\\begin\s*\{\s*verbatim(\*)?\s*\}/) {
-	elsif (!$fakeenv && !$verbatim && /\\begin\s*\{\s*((\w*[Vv]erbatim\w*|lstlisting)\*?)\s*\}/) {
+	elsif (!$fakeenv && !$verbatim && /\\begin\s*\{\s*((\w*[Vv]erbatim\w*|lstlisting|minted)\*?)\s*\}/) {
 	    ($before,$verbatimname) = ($`,$1);
 	    ($active,$verbatim) = (0,1)
 		unless ($before =~ /$ignore_cmd_rx/o);
@@ -844,7 +850,7 @@ sub process_file {
 	    }
 	}
 #	elsif ( /\\end\s*\{\s*verbatim(\*)?\s*\}/) {
-	elsif ( /\\end\s*\{\s*((\w*[Vv]erbatim\w*|lstlisting)\*?)\s*\}/) {
+	elsif ( /\\end\s*\{\s*((\w*[Vv]erbatim\w*|lstlisting|minted)\*?)\s*\}/) {
 	    if ($1 eq $verbatimname) {
 		$verbatim=0;
 		$active = ($latexonly ? 0 : 1);
@@ -1059,36 +1065,23 @@ sub process_input_include_file {
 	$styles =~ s|.*\Q$dd\E||; # strip path
 	$styles =~ s/\.[^.]*$//; # strip extension
 
-	# Sorry for the next if-statement... (hmm,ok)
-	if ($styles !~ /^($do_include_rx)$/o &&
-	    $filename !~ /\.($do_include_ext_rx)$/o &&
-	    ($styles =~ /^($dont_include_rx)$/o || 
-	     ($opt{auto_exclude} && $filename =~ /\.($dont_include_ext_rx)$/o))) {
-	    print STDERR "$prompt %--- ignoring $filename" if($debug);
-	    print STYLES "$styles\n" if($opt{save_styles});
-	}
-	else {
-	    local($fname) = &find_file($filename);
+	local($fname) = &find_file($filename);
 
-	    # notify anyway that a file is found, to allow a Perl
-	    # module loaded for this specific file
+	# notify anyway that a file is found, to allow a Perl
+	# module loaded for this specific file
 #	    print STYLES "$styles\n" if($opt{save_styles});
 
-	    if($fname) {
-		print OUT "$before";
+	if ($fname) {
+	   print OUT "$before";
 
-		# recursive call
-		&process_file($fname,$cmd);
+	   # recursive call
+	   &process_file($fname,$cmd);
 
-		print OUT $after if($after =~ /\S+/);
-		print STDERR "$prompt %--- successfully included $filename"
-		    if($debug > 1);
+	   print OUT $after if($after =~ /\S+/);
+	   print STDERR "$prompt %--- successfully included $filename"
+	       if($debug > 1);
 
-		return(1); #merge
-	    }
-	    else {
-		print STDERR "$prompt include $filename failed. Reinserting $before command\n";
-	    }
+	   return(1); #merge
 	}
     }
     return(0);		#no merge
diff --git a/versions/frame.pl b/versions/frame.pl
index 4e7faaa..7009aff 100644
--- a/versions/frame.pl
+++ b/versions/frame.pl
@@ -1202,6 +1202,7 @@ sub make_frame_file {
 	);
     &text_cleanup;
     open(FILE,">$filename") || print "Cannot open $filename $!\n";
+	binmode FILE;
     print FILE $_;
     close(FILE);
 }
diff --git a/versions/html5_0.pl b/versions/html5_0.pl
index bc36553..c149930 100644
--- a/versions/html5_0.pl
+++ b/versions/html5_0.pl
@@ -199,13 +199,14 @@ sub do_cmd_rightline {
 $A_attribs = ",SHAPE,DIR,";
 $A__SHAPE = $shape_type;
 $A__DIR = $dir_type;
-$A_attribs_rx_list = join('',",HREF,NAME,REL,REV,CHARSET,TARGET,ACCESSKEY,COORDS,TABINDEX,ONFOCUS,ONBLUR",$style_attribs);
+$A_attribs_rx_list = join('',",HREF,NAME,REL,DOWNLOAD,TARGET,ACCESSKEY,COORDS,TABINDEX,ONFOCUS,ONBLUR",$style_attribs);
 $A__HREF_rx = $URL_type;
 $A__NAME_rx = $A__REL_rx = $A__REV_rx = $string_type;
 $A__CHARSET_rx = $A__TARGET_rx = $A__ACCESSKEY_rx = $CDATA_type;
 $A__COORDS_rx = $coord_type;
 $A__TABINDEX_rx = $num_type;
 $A__ONFOCUS_rx = $A__ONBLUR_rx = $script_type;
+$A__DOWNLOAD_rx = $URL_type; # does not support DOWNLOAD attr with no value
 
 $ACRONYM_attribs = ",DIR,";
 $ACRONYM__DIR = $dir_type;
@@ -1466,11 +1467,9 @@ sub do_env_eqnarray {
     local($sbig,$ebig,$falign) = ('','','CENTER');
     ($sbig,$ebig) = ('','')
 	if (($DISP_SCALE_FACTOR)&&($DISP_SCALE_FACTOR >= 1.2 ));
-    local($valign) = join('', ' VALIGN="', 
-	($NETSCAPE_HTML)? "BASELINE" : "MIDDLE", '"');
     $failed = 1; # simplifies the next call
     ($labels, $comment, $_) = &process_math_env($math_mode,$_);
-    $failed = 0 unless ($no_eqn_numbers);
+    $failed = 0;
     if ((($failed)&&($NO_SIMPLE_MATH))
 	||(/$htmlimage_rx|$htmlimage_pr_rx/)) {
 #	||((/$htmlimage_rx|$htmlimage_pr_rx/)&&($& =~/thumb/))) {
@@ -1493,23 +1492,19 @@ sub do_env_eqnarray {
 	local($sarray, $srow, $slcell, $elcell, $srcell, $ercell, $erow, $earray);
 	($sarray, $elcell, $srcell, $erow, $earray, $sempty) = ( 
 	    "\n\n"
-	    , "\n"
+	    , "\n"
+	    , "\n"
 	    , "", "\n", "\n" );
 	$env_id = '';
-	$sarray .= (($no_eqn_numbers) ? ">" :  " WIDTH=\"100%\">" );
-	local($seqno) = join('',"\n\n");
-	if ($EQN_TAGS =~ /L/) { # number on left
-	    ($srow, $slcell, $ercell) = (
-		"\n" . $seqno
-		, "\n"
-		, "" :  " >" );
+
+	# leftmost and rightmost columns expand to fill available space,
+	# so that the main group of columns is centered.
+	# one of the two contains the equation numbers.
+	($srow, $slcell, $ercell) = (
+	    "\n"
+	    , "");
 
 	$_ = &protect_array_envs($_);
 
@@ -1549,7 +1544,7 @@ sub do_env_eqnarray {
 	    $return .= $slcell;
 #	    if (s/\\lefteqn$OP(\d+)$CP(.*)$OP\1$CP/ $2 /) {
 	    if (s/\\lefteqn//) {
-		$return .= "\"LEFT\" COLSPAN=\"3\">";
+		$return .= "LEFT\" COLSPAN=\"3\">";
 		s/(^\s*|$html_specials{'&'}|\s*$)//gm;
 		if (($NO_SIMPLE_MATH)||($doimage)||($failed)) {
 		    $_ = (($_)? &process_math_in_latex(
@@ -1579,19 +1574,19 @@ sub do_env_eqnarray {
 	    if (($NO_SIMPLE_MATH)||($doimage)||($failed)) {
 		$thismath = (($thismath ne '')? &process_math_in_latex(
 		    "indisplay" , '', '', $doimage.$thismath ):'');
-		$return .= join('',"\"RIGHT\">",$thismath) if ($thismath ne '');
+		$return .= join('',"RIGHT\">",$thismath) if ($thismath ne '');
 	    } elsif ($thismath ne '') { 
 		$savemath = $thismath;
 		$thismath = &simple_math_env($thismath);
 		if ($failed) {
 		    $thismath = &process_math_in_latex(
 			"indisplay",'','',$savemath);
-		    $return .= join('',"\"RIGHT\">",$thismath)
+		    $return .= join('',"RIGHT\">",$thismath)
 		} elsif ($thismath ne '') {
-		    $return .= join('',"\"RIGHT\">$sbig",$thismath,"$ebig")
+		    $return .= join('',"RIGHT\">$sbig",$thismath,"$ebig")
 		}
 	    }
-	    $return .= "\"RIGHT\">\ " if ($thismath eq '');
+	    $return .= "RIGHT\">\ " if ($thismath eq '');
 
 	    # center column, set using \textstyle
 	    $thismath = shift(@cols); $failed = 0;
diff --git a/versions/math.pl b/versions/math.pl
index c8f28bf..57ba56f 100644
--- a/versions/math.pl
+++ b/versions/math.pl
@@ -1476,16 +1476,16 @@ sub translate_math_commands {
 		    );
 		return( $pre_pre_text . $pre_text );
 	    }
-	    # ...else put it back inside a {displaymath} for an image
+	    # ...else put it back inside a {indisplay} for an image
 	    if ($cnt) { $orig .= $_; $_ = ''; }
-	    local($math_env) = 'displaymath';
+	    local($math_env) = 'indisplay';
 	    if ($outer_math =~ /^subequations/) {
 		$math_env = $outer_math;
      # this branch is experimental, for AMS-aligned environments
-	    } elsif ($outer_math &&($outer_math !~ /^equation|eqnarray|split/)) {
-		$math_env = $outer_math;
-		$math_env .= '*' unless ($outer_math =~ /star$|\*/);
-	    }
+	    } #elsif ($outer_math &&($outer_math !~ /^equation|eqnarray|split/)) {
+	#	$math_env = $outer_math;
+	#	$math_env .= '*' unless ($outer_math =~ /star$|\*/);
+	#    }
 	    $pre_text = join('', '\begin{',$math_env,'}'
 			, $orig ,'\end{',$math_env,'}' );
 	    local($after_undef) = $_;
diff --git a/versions/techexpl.pl b/versions/techexpl.pl
index 7c447c5..201c985 100644
--- a/versions/techexpl.pl
+++ b/versions/techexpl.pl
@@ -212,6 +212,7 @@ sub TE_replace_file_marks {
 sub TE_check_file_contents {
     local ($ifile) = @_;
     open(TEINC, "<$ifile");
+	binmode TEINC;
     my($macrosOK,$macrosNUM,$numlines,$invalid) = (0,0,0,0);
     my $TE_special_macros_rx = join('|',@TE_special_macros);
     my $TE_defined_accents_rx = join('|',@TE_defined_accents);
diff --git a/versions/unicode.pl b/versions/unicode.pl
index da4755c..726ddd0 100644
--- a/versions/unicode.pl
+++ b/versions/unicode.pl
@@ -418,7 +418,7 @@ sub convert_to_unicode {
 	'qubuts', 'ֻ',
 	'dagesh', 'ּ',
 	'meteg', 'ֽ',
-	'maqaf', '־',
+	'maqaf', '־',
 	'rafe', 'ֿ',
 	'paseq', '׀',
 	'sofpasuq', '׃',