Some samples of documents I have produced:
The most time-consuming part of the conversion is generating the .gif
images. I've tried to speed this up a bit by reusing images generated from
prior runs. The script below will work on most Unix systems as well as Win32 systems with the
CygWin32 system.
The basic idea: when tex4ht generates a .gif image from a .ps
file, a checksum is computed for the .ps file and saved in a separate file.
Just before tex4ht generates a .gif image from a .ps
file, a check is made to see if such a checksum file is left over from
a prior run. If a checksum file exists, and if the saved checksum
matches the checksum of the current .ps file, then no .ps-to-.gif
translation is done. Instead, the old .gif file is reused.
This scheme isn't perfect.
sh"-like shell (although this script is simple enough to be easily re-written in almost any scripting language, including perl, if you have it).
grep (used to remove lines where dvips inserts the
date on which the .ps file was created)
cksum, the Unix utility for computing file
checksums. If you don't have this, other programs could be used. If
desperate, use wc or even just extract the file length
from a directory listing.
Place the script below somewhere within your executable path. Call it
"convertif".
Then look at your tex4ht.env file. Find the line that
contains the conversion command for generating gifs. It's the one
that begins with the "G" and should look
something like:
Gconvert -crop 0x0 -density 110x110 -transparency '#FFFFFF' tmp.ps %%3The details will vary among different installations.
Edit this line by adding "convertif %%1 tmp.ps %%3 " in
front of the rest of the command. For example,
Gconvertif %%1 tmp.ps %%3 convert -crop 0x0 -density 110x110 -transparency '#FFFFFF' tmp.ps %%3
#!/bin/sh
#
# Usage:
# convertif idvFile psfile giffile convert-command ...
# Processes psfile to convert to gif format. First checks to see if
# directory already contains an acceptable file.
#
#
# Compute the checksum for the .ps file
COUNT1=`grep -v CreationDate $2 | grep -v DVIPSSource | cksum`
echo "$2 checksum is /" $COUNT1 "/"
#
# Do we have a saved checksum?
#
if test -r $3.cksum
then
echo "found $3.cksum"
COUNT2=`cat $3.cksum`
echo "Old checksum is /" $COUNT2 "/"
#
# Are the checksums equal?
#
if test "$COUNT1" = "$COUNT2"
then
#
# Yes. We don't need to regenerate the .gif
#
echo "Reusing $3"
cp $3 .
else
#
# No. Save the checksum and generate the .gif
# (Throw out the 1st three command arguments and treat
# the remaining command arguments as a command to execute).
#
echo $COUNT1 > $3.cksum
shift 3
$*
fi
else
#
# No. Save the checksum and generate the .gif
# (Throw out the 1st three command arguments and treat
# the remaining command arguments as a command to execute).
#
echo $COUNT1 > $3.cksum
shift 3
$*
fi