Using Z2HTML

Back to the Z2HTML home page.

Preparing the LaTeX source text
Translating the source files to HTML
Choosing a stylesheet
Installing the files on your web server


Preparing the LaTeX source text

Z2HTML translates a LaTeX source file to a single HTML page (not a collection of linked pages).

Z2HTML understands the LaTeX commands defined in the zed.sty and fuzz.sty style files. Compare this HTML test page to its LaTeX source. See the comments in the source file for more instructions. See also these Z examples and their sources.

(This fuzz-compat.sty enables files created for zed.sty and fuzz.sty to be used with oz.sty under LaTeX2e. All three style files are available through links on the Z home page.)

Z2HTML is not intended to be a full-featured LaTeX-to-HTML translator. There are many LaTeX commands which it cannot handle; it simply passes these through, untranslated, to the output file. You will probably want to do some editing of the LaTeX source or the HTML it produces.


Translating the source files to HTML

Run the Z2HTML scripts to translate your LaTeX source files to HTML.

The z2html.sed script is the first pass; it translates the Z LaTeX macros and some other LaTeX commands to HTML. The paragraph.awk script is the second pass; it puts paragraph tags around each informal paragraph so they don't all run together in the browser, and puts blank paragraphs between Z formulas to make some space. The z2html shell command invokes these two scripts in a pipeline, taking the name of the LaTeX source file from the command line.

Obviously, you must run the scripts on a system that provides sed and awk. If you want to use the z2html shell command the system must also provide a Unix-like shell with pipes.

The z2html shell script is just one line:

cat $1 | sed -f z2html.sed | awk -f paragraph.awk

When you invoke the z2html shell command, there must be copies of (or links to) z2html.sed and paragraph.awk in your current default directory (otherwise sed and awk will not be able to find the scripts). And of course the directory that holds the z2html shell script must be in your path.

To view the translated output on your terminal screen, invoke the shell command like this:

% z2html machine.tex

To save the translated output, redirect it to an HTML file:

% z2html machine.tex > machine.html

If you want a table of contents, use the toc.sed script. This script processes the HTML output of z2html.sed (or z2html.sed then paragraph.awk --- it doesn't matter) to produce an HTML file containing nothing but a list of links to all the sections, subsections and subsubsections in the input file. Invoke it like this (you must use the -n option):

% sed -n -f toc.sed machine.html > machine-toc.html

Then use a text editor to include the table of contents file near the top of the original file.

(The sed scripts work with GNU sed. They may not work with some other versions, in particular z2html.sed does not work with the sed shipped with HP-UX 10.20.)


Choosing a stylesheet

Pages translated by Z2HTML contain a link to an external stylesheet named zed.css. Use the stylesheet to control the appearance of the Z text.

Follow this link for an explanation and some examples of Z stylesheets.


Installing the files on your web server

The translated HTML files can go anywhere, but each directory that contains them must also contain a subdirectory named zimg that holds all the GIF image files for the Z symbols. The easiest way to provide this on Unix-like systems is to make a symbolic link in each directory to a single zimg directory.

In each directory you should also put a copy of zed.css. Again, the easiest way is to make symbolic links to a single stylesheet.

Back to top
Jonathan Jacky / Department of Radiation Oncology Box 356043
University of Washington / Seattle, Washington 98195-6043 / USA
Tel (206) 598-4117 / Fax (206) 598-6218

E-mail: jon@u.washington.edu