[l2h] Making latex2html behave on my Red Hat 7.2 system

Peter N. Yianilos pny@pnylab.com
Sat, 22 Jun 2002 12:01:22 -0400


Here's a report of what I had to do to make latex2html do
what I want on Red Hat 7.2.

Please note that the moderators of this forum may suggest better
solutions -- these are simply my workarounds to get the program
working in my environment.

It was a bit of an odyssey, but I really want to use this utility, and
its output is quite good:

	1) First, note that just downloading and installing latex2html
	works (the program executes and produces output), but there
	is a major problem, that renders the output unacceptable:
	
		"The images generated have black borders along two
		 edges"

	This is due to a problem with earlier versions of pnmcrop, part
	of the netpbm package.

		"The images did not blend with the background"

	This is due to transparency issues discussed further below.

	2) To deal with this, I first tried moving to netpbm-9.25.tgz, 
	but when I finally got it working, there were strange image
	artifacts relating (my guess) to either level quantization or
	antialiasing.  So I rejected this path.

	3) I then installed the following two rpms:

		netpbm-9.14-2.i386.rpm
		netpbm-progs-9.14-2.i386.rpm

	4) latex2html now reported an error every time an image conversion
	was attempted.  I traced the problem to an apparent issue with
	the arguments expected by the netpbm script pnmcrop.  The 
	newer version (just installed above) seems to require an argument
	after "-verbose".  So I modified perl script pstoimg as follows:

		Old: my $PNMCROP = '/usr/bin/pnmcrop -verbose';
		New: my $PNMCROP = '/usr/bin/pnmcrop -verbose 0';

	After this change, latex2html ran and produced output without
	the black borders above.

	5) But still, the images were not transparent and stood out
	on the page, despite the fact that latex2html default operation
	generates transparent images.  The problem was traced (by
	responses from this forum) to a lack of transparent PPM
	support in many current browsers.

	6) So I switched to gif by using the "-image_type gif" argument
	to latex2html.  But again, image conversion failed!

	There was another problem.  It appears that netpbm
	program pstogif also has a argument incompatibility.  The
	"-trans" argument now expects no argument?, and doesn't
	even work.  So I made the following change to pstoimg:

		Old: $pnmtoimg .= ' -trans ' . L2hos->quote($trans_color);
		New: $pnmtoimg .= ' -trans ';

	I played with the
	new netpbm version of pnm2gif for a while, trying to make
	it deal with transparency -- but I could not make it work.

	But at least, with the change above, latex2html ran, and
	produced output, albeit not transparent.

	7) So I "punted" and wrote a small shell script to make all
	gifs in the output directory transparent:

		#!/bin/bash

		for file in *.gif ; do {

		    giftrans -t '#b2b2b2' $file > xxx
		    mv xxx $file

		} ; done

	Now, after running latex2html, I enter the output directory
	and run this script.
	
	It worked!  The output was transparent and free of black
	borders.