[l2h] Unwanted black line segments under tall mathematicalexpressions in the OpenSuSE-11.1 Linux environment.

Pat Somerville l_pat_s at hotmail.com
Wed Aug 26 23:15:32 CEST 2009

Hi, again. I noticed that a few short, Portable-Network-Graphics (PNG) images also had the unwanted black line segments under them. So, sorry, what I wrote earlier about the problem related to tall images seems to be not entirely true.--Some tall images and a few short images had the black line segments under them. Another point is that the mention of both pdfTeX and LaTeX2e in the output was in the running of both latex and latex2html commands.

On the Internet I read of a couple of "workaround" solutions to convert images with black lines segments or borders under or around them to images without such unwanted black line segments: 1) from http://www.vyvy.org/main/en/node/102 to run the script eqnfix.sh on the PNG files and 2) from http://www.sladecek.org/macro.htm to run the script file with LOOP in its name.

I tried to make eqnfix.sh work on my computer, but encountered some extremely subtle things I don't recall being mentioned within http://www.vyvy.org/main/en/node/102. The author of that script is not given there, but based on the writing there probably worked with it in an Ubuntu-6.1, Linux operating system. I admit to being quite ignorant of many detailed commands used in scripting languages at the start of my recent use of the contents of eqnfix.sh. I found http://www.grymoire.com/Unix/sh.html#uh-2 on the Internet a very good place to learn about the Bourne shell called sh. The first line of eqnfix.sh reading #!/bin/sh indicates that eqnfix.sh is a Bourne-shell script file. It can be run by bash, the Bourne-Again SHell. There are couple of lines in eqnfix.sh containing $1. Unfortunately the letter "l" at the beginning of "lake" and "1," as in "12345" look identical on http://www.vyvy.org/main/en/node/102. But with the help of http://www.grymoire.com/Unix/sh.html#uh-2 I realized that this has to be $1 (dollar sign, one) instead of $l (dollar sign, letter "l" at the beginning of "lake") in eqnfix.sh. The "1" corresponds to the 1st parameter following eqnfix.fix when running this script. In my OpenSuSE-11.1, Linux installation in a command line I could only run .sh script files by commands of the form "./scriptfile.sh". So to run eqnfix.sh on a directory named "Directory" containing the .png image files, the Linux command for me would be "./eqnfix.sh Directory" in the directory just above "Directory." Then afterwards within eqnfix.sh the variable $1 would have the value of "Directory."

Since I didn't know much about the details in script files, a useful diagnostic and learning command for me was of the form "sh -x eqnfix.sh Directory," or in a greatly "stripped-down" version of eqnfix.sh which does not make use of the directory name input from the command line, just "sh -x eqnfix.sh". With this helpful command I could experiment with changes inside eqnfix.sh and see what corresponding output was produced. I found that I could not successfully run eqnfix.sh until I got rid of all of the backslashes in "\$1" and "\$file"; not essential to the image conversion, but still an improvement, would be to remove the backslash in "\$0". In addition, I also changed double quotes to pairs of single quotes; I don't know if that makes any difference or not. I think I also used my computer keyboard's tab key for the indentations. The file eqnfix.tex should be a file made in a Unix file format.--The line-return character in a Windows operating system may not be recognizable in a Linux operating system, based on what I read on the Internet. So it is best to open a text editor in the Linux operating system in which one wants to use eqnfix.sh to type the lines of eqnfix.sh. Netpbm packages need to be installed on the Linux-loaded computer. My resulting, modified eqnfix.sh looked like this:


# Get the directory path.

if [ -z ''$1'' ]; then

    cat <<EOF

Fix the latex2html black line and PNG transparency bugs.

Usage: \$0 <directory_with_problematic_PNG_images>



# Fix each PNG image.

for file in $1/*png


    echo Fixing $file...

    pngtopnm $file | \

        pnmcrop -black | \

        pnmtopng -transparent ''B3B3B3'' > img_fixed.png

mv -f img_fixed.png $file


 It is not shown in this e-mail letter; but I used a pair of single quotation marks instead of one, double-quotation mark in each instance in the above code.  I should have removed the backslash before $0 in the above code. The following comment lines could be added to the above code:

# Essential code originally posted on January 11, 2007 at http://www.vyvy.org/main/en/node/102 on the Internet,

# apparently for Ubuntu-6.1 Linux; author's name unknown

# Modified by Pat Somerville during August 25-26, 2009 to work

# in an OpenSuSE-11.1, Linux operating system

Next to make this file eqnfix.sh executable, the command "chmod +x eqnfix.sh" was needed. In my computer's terminal program in superuser mode the prompt is #. After typing sh, the prompt changes to >. Either of these prompts is different from the $ prompt shown on http://www.vyvy.org/main/en/node/102, which might have been the prompt in an Ubuntu-6.1, Linux operating system. The commands in my OpenSuSE-11.1, Linux environment were of the form:

..#latex2html -nonavigation -no_math -html_version 3.2,math -split 0 Myfile.tex (produces Myfile.html and PNG images in the new directory called Myfile)

..#sh (This command for the Bourne shell [sh] may or may not be necessary.)

..>./eqnfix.sh Myfile (The subtle period ["."] before /eqnfix.sh is very important. Here "Myfile" is the name of a directory or folder corresponding to 

the name of the file Myfile.tex and produced by latex2html.)

If the Myfile folder is open in the File Manager at the time of the execution of "./eqnfix.sh Myfile," at the end of that execution it might be necessary to refresh the contents of that folder by pressing the F5 key in order to view the newly produced .png files; but in my case it seems that the .png files were visibly replaced in the Myfile folder as they were produced. I found that the .png images for some tall parentheses had thin, vertical, line segments on the right sides of them. But fortunately they were not visible in the output file of the form Myfile.html, which uses those .png images, when Myfile.html was viewed in the following web browsers:



Internet Explorer 8.0.6001.18702

Flock 2.5.

In the Internet-Explorer-8.0.6001.18702 and Flock-2.5 web browsers some portions of some equations were somewhat blurred and weak, looking like being slightly "out of focus." Actually I saw that some of the .png images looked weak within their containing folder, even before they are displayed in the .html file making use of them. If the command "sh" was typed once, once the processing is complete, typing "exit" in the terminal program in superuse mode I suppose resulted in leaving the Bourne-shell mode with the ">" prompt; the new prompt would have been "#"; typing "exit" again would terminate the terminal program.

Previously I used LaTeX2HTML in the Fedora-Core-3, Linux operating system without the need for eqnfix.sh. Such postprocessing of the .png images using the Bourne-shell script file eqnfix.sh to remove the unwanted black line segments below them allowed LaTeX2HTML to again be a useful software tool to produce technical documents in HyperText-Markup-Language (HTML) format, this time in an OpenSuSE-11.1, Linux operating system.

Of less utility for many PNG files, but to show the "heart" of the matter, the following set of commands could be used just in the terminal program in superuser mode to convert a single PNG image to one without the unwanted black line segment under it: 

.#pngtopnm img93.png | \

>pnmcrop -black | \

>pnmtopng -transparent ''#B3B3B3'' > img_fixed.png

.#mv -f img_fixed.png img93.png

After giving the above commands, it might be necessary to press the F5 key to refresh the displayed contents of a folder in order to see the updated image file of the form img93.png. The purposes of the line "pnmtopng -transparent ''#B3B3B3'' > img_fixed.png" seemed to be to i) convert .png images containing grey backgrounds to ones with transparent backgrounds and ii) to write the results of removing both the unwanted black line segment and grey background in the .png image produced by "latex2html......Myfile.tex" in the temporary file img_fixed.png. However, as was pointed out by Dr. Ross Moore in Peter Cholak's thread, which at least in late 2005 began at http://www.tug.org/pipermail/latex2html/2002-January/001574.html on the Internet, the grey backgrounds can be eliminated by using the following command in the preamble or opening section of a .tex file of the form Myfile.tex:


 This command will make the background white-colored around the rest of the contents of a .png image. Netpbm and/or netpbm libraries should also be installed. Using the above \usepackage{color}\pagecolor{white} command, the elimination of the unwanted black line segment under a .png image produced via "latex2html.....Myfile.tex" could be accomplished in two commands of the following forms in a terminal program in superuser mode in OpenSuSE-11.1 Linux, this time within the directory containing those images instead of in the directory just above the directory containing the images:

.#pngtopnm img154.png | pnmcrop -black | pnmtopng > img_fixed.png

.#mv -f img_fixed.png img154.png

 Using version 1.70 of LaTeX2HTML the command of the form "latex2html -nonavigation -no_math -html_version 3.2,math -split 0 Myfile.tex" was used in Fedora-Core-3- and OpenSuSE-11.l, Linux operating systems with different results. Given that in Fedora-Core-3 Linux it was not necessary to postprocess the .png images produced by version 1.70 of latex2html in order to remove unwanted black line segments below .png images, I guess that in OpenSuSE-11.1 Linux there may be some sort of software mismatch and/or deficiency between it and version 1.70 of LaTeX2HTML. Removing that mismatch and/or deficiency should make the use of eqnfix.sh unnecessary. Perhaps it might be that LaTeX2HTML, last modified in the year 2002, "calls" for or requires for good operation the use of a lower version of a software package or program than is installed in my OpenSuSE-11.1, Linux installation, which I guess may have been produced much more recently than in 2002. Or perhaps I am missing in my OpenSuSE-11.1, Linux installation a software package or program which LaTeX2HTML 1.70 requires. Earlier in this thread or chain of e-mail letters I listed the versions of some software packages I have installed in OpenSuSE-11.1 Linux and which are relevant to LaTeX2HTML. Among them are libpng12-0-1.2.31-4.38-1 and libpng-devel-1.2.31-4.38.1. I noticed that I did not have libpng3, the Library for Portable Network Graphics (PNG)-compatibility version, installed. After installing it in OpenSuSE-11.1 Linux, unfortunately the unwanted black line segments were still seen underneath some .png images. Therefore postprocessing of the png images using the script eqnfix.sh was still needed to eliminate those unwanted line segments.


  ----- Original Message ----- 
  From: Pat Somerville 
  To: Pat Somerville 
  Sent: Tuesday, August 25, 2009 3:27 AM
  Subject: Re: [l2h] Unwanted black line segments under tall mathematicalexpressions in the OpenSuSE-11.1 Linux environment.

  In Fedora-Core-3 Linux I used a latex2html command of the form "latex2html -nonavigation -no_math -html_version 3.2,math -split 0 file.tex" without the unwanted black line segments under some tall fractions and one or more parentheses and braces in the resulting html file.  About 1.5 years later in OpenSuSE-11.1 Linux on the same tex file I used the latex2html command of the form "latex2html -nonavigation -no_math -html_version 4.01,math -split 0 file.tex" with the unwanted black line segments under some tall fractions and one or more parentheses and braces.  Switching 4.01 to 3.2 in the previous latex2html command unfortunately did not eliminate the unwanted black line segments in the resulting .html file in my OpenSuSE-11.1 Linux installation.

    ----- Original Message ----- 
    From: Pat Somerville 
    To: latex2html at tug.org 
    Sent: Tuesday, August 25, 2009 1:17 AM
    Subject: [l2h] Unwanted black line segments under tall mathematicalexpressions in the OpenSuSE-11.1 Linux environment.

    Hi. I have a .tex file of the form file.tex on which the issuing of commands of the form "latex file.tex" and "latex2html -nonavigation -no_math -html_version 4.01,math -split 0 file.tex" produced black line segments under some tall mathematical symbols and fractions, such as a parenthesis, a brace, or fractions, especially when there was a capital letter in the numerator. For example, in one equation R/q had an unwanted line segment under it; but r/q and 1/q did not. So it is pretty clear that this a height-related problem occurring with the tall, Portable Network Graphics (PNG) images I am producing. The unwanted line segments appeared when viewing the .html file produced as a result of the latex2hmtl command in both the Konqueror and Mozilla-Firefox-3.5.2 Web browsers. Executing a latex2html command on this .tex file in Fedora-Core-3 Linux, this problem did not occur. But using the same .tex file 1.5 years later in OpenSuSE-11.1 Linux I had the unwanted line segments under some images of mathematical symbols and fractions. I can't write with certainty that the latex2html commands were identical in the two cases about 1.5 years apart. But the above latex2html command was similar to what I often used. Is the command "latex2html -nonavigation -no_math -html_version 4.01,math -split 0 file.tex" antiquated for the modern, OpenSuSE-11.1, Linux environment, for example in the version number 4.01? Or am I using a version of some software package incompatible with what latex2html "expects" to find? Or am I missing a required software package?

    Also some pstoimg errors are reported during the running of latex2html, for example:

    'pstoimg: Error: "/usr/bin/pnmcrop -verbose -sides -bot < /tmp/l2h6353/p9481.pnm> /tmp/l2h6353/p9481.t00" failed: Bad file descriptor'

    Here are some software packages I was using in OpenSuSE-11.1 Linux when the errors occurred:

    In response to the command "latex2html --version": $* is no longer supported at /usr/bin/latex2html line 10599". "This is LaTeX2HTML version 2002-2-1 (1.70)..."

    In response to the command "LaTeX --version": pdfTeX using libpoppler 3.141592-1.40.3-2.2 (Web2C 7.5.6) Copyright 2007 Peter Breitenlohner (eTeX)/Han The Thanh (pdfTeX)

    kpathsea version 3.5.6

    Probably pdfTeX was compiled with libpng 1.2.31, zlib 1.2.3, and xpdf 3.0.1.

    In addition, after running a command of the form "latex file.tex", I think "latex2e" also appeared! What is going on here? Is this "latex" a combination of pdfTeX and LaTeX version 2e?

    Perl 5.10

    dvips 5.96

    In response to the command "rpm -qa | grep ghostscript": ghostscript-library-8.62-31.43.1, ghostscript-fonts-other-8.62-31.43.1, ghostscript-omni-8.62-31.43.1, ghostscript-fonts-std-8.62-31.43.1, ghostscript-x11-8.62-31.43.1

    In response to the command "rpm -qa | grep netpbm": netpbm-10.26.44-98.12, libnetpbm-10.26.44-98.12

    In response to the command "rpm -qa | grep libpng": libpng12-0-1.2.31-4.38.1, libpng-devel-1.2.31-4.38.1

    The package libpng3 exists. But I do not have it installed in my OpenSuSE-11.1 Linux installation.

    I did not find libz installed in my OpenSuSE-11.1 Linux installation, but in a search for libz in YaST2 did find libzio-0.9-4.19 and libzypp-5.30.3-0.1.1 reported as installed.

    Via the software I am building PNG images.

    In response to the commands "pnmcrop --version" and "pnmtopng" I saw libnetpbm from Netpbm version: Netpbm 10.26.44, compiled Dec. 3, 2008.

    pnmcrop: BSD defined

    pnmcrop: RGB_ENV='RGBDEF'

    pnmcrop:RGBENV='RGBDEF' (env vbl unset) .

    In response to the command "libpng --version": -bash: libpng: command not found (But from the above data clearly some libpng packages are installed on my computer.)

    In response to the command "libz --versioin": -bash: libz: command not found 

    I am aware of Dr. Ross Moore's year-2003 solution to avoid the black line segments under some images from http://www.xray.mpe.mpg.de/mailing-lists/latex2html/2003-02/msg00001.html on the Internet of inserting \strut or an invisible \vrule to fix such a problem in individual cases, as in $......\strut$ and "\vrule height 15 pt depth 0pt width 0pt." Also I was aware that one could have the unwanted black line segments around and/or below images when using too early a version of latex2html, which I don't think is the problem now in my case. Is there a global solution for me to avoid the problem of black line segments that I have encountered in this modern, OpenSuSE-11.1 environment?

    In addition, at http://www.latex2html.org/node2.html on the Internet the following hyperlinks to the following Uniform Resource Locators (URLs) did not work on August 24-25, 2009: http://www-texdev.ics.mq.edu.au/l2h/docs/manual/ and http://www.erdw.ethz.ch/~bonk/l2h/l2h-note.html. Thanks to anyone taking the time to provide useful help to me.



    latex2html mailing list
    latex2html at tug.org
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://tug.org/pipermail/latex2html/attachments/20090826/2016ce7f/attachment-0001.html>

More information about the latex2html mailing list