This page is written to help members of our community (current users of the math machines) create web pages containing gifs duplicating the contents of previously generated postscript pages. This need is especially acute in math because html does not display math well now, and extensions to html to help this situation won't appear soon.
Postscript output is usually easy to get. TeX (via dvips) and programs such as gnuplot, xfig, Maple, etc. can produce Postscript files. But many browsers used by our students can't create an image from a Postscript file. All the usual web browsers do display gifs, however. What follows describes how to construct a sequence of web pages with gifs for each page of a Postscript file.
I've tried to document the use of the program carefully. I've made hundreds of web pages using this process without substantial difficulty.
gifs | This directory contains gifs which will be used to help viewers navigate between the web pages to be created. I list here the gifs I use. If you don't use these gifs and this directory structure, htmlize-ps should be changed. |
gifstuff | This is the directory where I put html pages and gifs made by the procedure described below. |
psstuff | I use this directory to store the original Postscript files to be copied during the procedure to be described below. You may wish to have these files accessible from the index page frog_index.html named above if you wish, for those who can access Postscript through their browsers. Postscript images and printouts seem superior to their gif companions. |
I assume that the directory frog/gifstuff contains a copy of the program htmlize-ps and a copy of the file toad.ps, a Postscript file which when printed or previewed is four pages long.
Your system must be notified that htmlize-ps is a program --
that it is "executable". So be sure to write (in the directory holding
the copy):
chmod u+x htmlize-ps
The program htmlize-ps needs three parameters or arguments. Here is how it is used on a command line:
htmlize-ps toad.ps ../frog_index.html "An essay about toads"
The first phrase is the program name. It must be followed by a space and then the name of the Postscript file to be converted. Follow this in turn by another space and write the backlink, the web page to which you wish viewers to be returned when they are done with reading your page. Then follow this by another space and the title of the web page(s) to be created. Any title with spaces must be enclosed by quotation marks.
The copy of htmlize-ps
which is provided contains the line
$blname = "Back to S. Greenfield's teaching page";
A title for your backlink should be substituted in this file
between the quotation marks. For example, a line which might be
suitable here is
$blname = "Back to the frog homepage";
fermat>ls ./ ../ htmlize-ps* toad.texA list of the files present before we begin working.
fermat>tex toad.tex This is TeX, C Version 3.141 (toad.tex [1] [2] [3] [4] ) Output written on toad.dvi (4 pages, 17616 bytes). Transcript written on toad.log.I TeXed the toad file, and TeX reported that the output was 4 pages long.
fermat>dvips toad.dvi -o toad.ps This is dvips 5.528 Copyright 1986, 1994 Radical Eye Software ' TeX output 1998.01.27:1749' -> toad.psThe program dvips takes the dvi output and changes it into Postscript. If pictures had been included in the TeX file, dvips would report additional information.. [1] [2] [3] [4]
fermat>htmlize-ps toad.ps ../frog_index.html "An essay about toads"This is the command line for the actual transformation.
Generating ppm files... Changing ppm to gif & removing ppm ...page 1...ppmtogif: computing colormap... ppmtogif: 2 colors found page 2...ppmtogif: computing colormap... ppmtogif: 2 colors found page 3...ppmtogif: computing colormap... ppmtogif: 2 colors found page 4...ppmtogif: computing colormap... ppmtogif: 2 colors found done. Making HTML: page 1...page 2...page 3...page 4...done.The program may take a while to run. The ppm files described are an intermediate stage -- yet another graphical format for files!
fermat>ls ./ toad-1.gif toad-2.html toad-4.gif toad.log ../ toad-1.html toad-3.gif toad-4.html toad.ps htmlize-ps* toad-2.gif toad-3.html toad.dvi toad.texThis is a list of the files present when we've finished. I clean up by removing the files I don't need. Again, I usually keep a copy of toad.ps in the directory psstuff. If toad.ps generated one page of output instead of four, the resulting files would be named toad-1.html and toad-1.gif.
fermat>rm toad.log toad.ps toad.tex toad.dvi fermat>ls ./ toad-1.gif toad-2.html toad-4.gif ../ toad-1.html toad-3.gif toad-4.html htmlize-ps* toad-2.gif toad-3.htmlWe're left with lots of files!
If the file frog_index.html has the proper link to the web page toad-1.html (as <a href="gifstuff/toad-1.html">...</a>) then readers will be led along from the first page through the fourth. I've just tested this whole process several times with Postscript files of varying sizes. It failed once: one of the gifs produced was flawed. When rerun, things worked fine. The process is intricate and uses some large, complicated programs (most notably, ghostscript).
Certainly this is close to a kludge (on-line dictionary definition: 1. an ill-assorted collection of poorly matching parts. 2. [Computing] a machine, system, or program that has been badly put together.), but it works, now. A Unix hacker could increase the efficiency of the whole process with another macro or two. The future will bring more efficient methods to display math. But, again, this works now!
fermat>chmod a+r *.html *.gifThe world should also have access to your gifstuff directory and other directories. Therefore, go "up" to the directory frog and write
fermat>chmod a+rx gifstuff gifs psstuff