NAME
     math2html - convert a Mathematica notebook	to HTML	format

   SYNOPSIS
     math2html [-B] [-b] [-c] [-e] [-f optionsfile] [-i] [-l logofile] [-m
     mask] [-n numspaces] [-p paramfile] [-r color] [-s	scalefactor] [-T pro-
     log] [-t prolog] [-u] [-x cgifile]	[-Z epilog] [-z	epilog]	mathfile

   DESCRIPTION
     Converts an evaluated Mathematica notebook	into two collections of	HTML
     files, one	evaluated and one unevaluated.	The evaluated version has
     numbered input and	output cells and Mathematica-generated graphics	are
     converted to GIF images or	MPEG movies. GIF images	are created using
     ppmtogif and MPEG movies are created using	mpeg_encode.  The unevaluated
     version is	stripped of all	output and graphics cells, encouraging
     readers to	evaluate the cells using their own Mathematica kernels.	 Each
     closed cell group and closed cell in the Mathematica notebook is placed
     in	its own	HTML document.	A link is created from the parent document to
     the one for the closed group.  The	HTML documents for the evaluated ver-
     sion are named mathfile*.html and the unevaluated documents are named
     mathfile0*.html, where mathfile is	the name of the	Mathematica notebook
     and * takes on consecutive	integer	values.

   OPTIONS

     -B	  By default, math2html	inserts	the HTML line break directive, <BR>,
	  in text cells	wherever the original Mathematica notebook has a hard
	  return.  This	option suppresses the line break directive, causing
	  Web viewers to use wordwrap to combine the lines in each text	cell
	  into one paragraph.

     -b	  Output cells will be in boldface.  This is not how most Mathematica
	  notebooks appear, but	it makes the output cells stand	out more.

     -c	  If this option is set, closed	cells (don't confuse these with
	  closed groups) in the	Mathematica notebook will be skipped.  Other-
	  wise,	they will be placed in their own HTML documents	with links to
	  their	parent HTML documents.

     -e	  Create only an evaluated version of the HTML documents.

     -f	optionsfile
	  The options file is used to specify any or all of the	options
	  above.  If any parameters are	missing, they are assumed to be
	  unset.  Options set on the command line take precedence over
	  options specified in the options file.  Blank	lines and lines
	  beginning with # are ignored.	 A sample file is listed in the	next
	  section of this man page.

     -i	  Create interactive input cells, by converting	all input cells	to
	  HTML forms.  In order	to use this option, a MathLink-based CGI pro-
	  gram must be available to evaluate the Mathematica input.  The URL
	  the math2html	program) or using the -x option.

     -l	logofile
	  The GIF image	contained in logofile will be displayed	at the top of
	  the root html	documents.  If not set,	the default logo, specified
	  during the installation of math2html,	will be	used.  If a full path
	  name is used,	it should start	at the root of the web server, not at
	  the root of the Unix file system.

     -n	numspaces
	  Convert tabs to numspaces spaces.

     -m	mask
	  If mask is 1,	adjacent Mathematica-generated graphics	cells will be
	  combined to form an MPEG movie.  The first frame of the movie	will
	  be displayed in-line in the html document with a link	to the MPEG
	  movie.  If mask is 0 or if the -m option is missing, separate	GIF
	  images will be created for each graphics cell.  These	will be
	  included as individual in-line images	in the html document.  A
	  value	of 2 combines the features of 0	and 1.	That is, if mask is
	  2, each frame	will be	included as individual in-line images and the
	  first	frame will be a	link to	an MPEG	movie.	The mask can be	used
	  to determine which graphics sequences	should be combined into	an
	  MPEG movie.  For example,  if	mask is	100120,	then the first and
	  fourth sets of adjacent graphics cells will be combined into three
	  MPEG movies and the second, third, and sixth sets will be displayed
	  as separate GIF images.  The fifth set will be combined into an
	  MPEG movie and they will also	be displayed separately.  The mask is
	  applied cyclically, so that 110 is equivalent	to 110110110 and 1 is
	  equivalent to	1111111.

     -p	paramfile
	  Specifies a parameter	file for mpeg_encode.  In the parameter	file,
	  dummy	values can be used for the filename and	the frame numbers.
	  math2html will replace these with whatever values it needs.  If
	  this option is not included, default settings	specified in the
	  math2html script will	be used. See mpeg_encode's man page for	a
	  description of parameter files.  math2html will create .param
	  files. These files may be modified later and mpeg_encode could be
	  used directly	to re-create the MPEG movies.

     -r	color
	  Convert color	to transparent in in-line GIF images.  Color may be
	  specified in index form, in rgb.txt from, or in #rrggbb form.	 For
	  example, the color white may be specified as white, White, or
	  #ffffff, or if white happens to be color 0 in	the color table,
	  color	may be specified as 0.

     -s	scalefactor
	  Scale	all in-line GIF	images by a factor of scalefactor.

     -T	prolog

	  fied during the installation of math2html, will be used.

     -t	prolog
	  A statement to be placed at the beginning of the root	html document
	  in the unevaluated version.  If not set, the default prolog, speci-
	  fied during the installation of math2html, will be used.

     -u	  Create only an unevaluated version of	the HTML documents.

     -x	cgifile
	  The URL of a MathLink-based CGI program to evaluate Mathematica
	  input	and to return the output in HTML format.  This option is only
	  meaningful if	the -i option is also used.

     -Z	epilog
	  A statement to be placed at the end of the root html document	in
	  the unevaluated version.  If not set,	the default epilog, specified
	  during the installation of math2html,	will be	used.

     -z	epilog
	  A statement to be placed at the end of the root html document	in
	  the unevaluated version.  If not set,	the default epilog, specified
	  during the installation of math2html,	will be	used.



      #------------- Sample Options File for Use with -f Option	----------
     -----
      #	Specifications for Mathematica notebooks developed under the
      #	Interactive Calculus and Differential Equations	Project.

      m:
      100110

      l:
      /MathDept/Projects/CalcDEMma/InterCalcDELogo.gif

      #	Notice that html formatting directives can be included in the prolog.
      #	${filebase}0.html refers to the	unevaluated version of the root	html
      #	document and $filebase.html refers to the evaluated version.
      #	$filebase will be replaced by the name of your Mathematica notebook
      #	file.
      T:
      <HR>This is an evaluated
      <A HREF="http://mathsource.wri.com"><I>Mathematica</I></A>
      notebook developed for the <A
      HREF="http://www.ma.iup.edu/MathDept/Projects/CalcDEMma/Summary.html">
      Interactive Calculus and Differential Equations Project</A> under
      <A HREF="stis.nsf.gov">NSF</A> ILI grant number DUE-9351896.  Since the
      notebook is intended to be interactive, it may be	helpful	to also	view
      the <A HREF="${filebase}0.html">unevaluated version</A>.<HR><P>

      <I>Mathematica</I></A> notebook developed	for the	<A
      HREF="http://www.ma.iup.edu/MathDept/Projects/CalcDEMma/Summary.html">
      Interactive Calculus and Differential Equations Project</A> under
      <A HREF="stis.nsf.gov">NSF</A> ILI grant number DUE-9351896.  If you do
      not have a copy of <I>Mathematica</I> handy, you may want	to also	view
      the <A HREF="$filebase.html">evaluated version</A>.<HR><P>

      Z:
      Go up to <A HREF="/MathDept/Projects/CalcDEMma/Summary.html">
      Calculus and Differential	Equations Project Description</A>

      z:
      Go up to <A HREF="/MathDept/Projects/CalcDEMma/Summary.html">
      Calculus and Differential	Equations Project Description</A>

      p:
      drum.param

      ------------------------ End of Options File --------------------------

   PROCEDURE
      1. Prepare the Mathematica notebook for conversion:
	 a. Evaluate all of the	input cells.
	 b. Eliminate any non-standard characters that are part	of special
	    fonts, because the web server has no control over which fonts
	    are	used by	web clients.  Eliminate	subscripts and superscripts.
	 c. Close any cell groups that are to be placed	into their own HTML
	    documents with links to the	parent document.
      2. Create	the HTML documents:
	 a. Create a directory and copy	the Mathematica	notebook to it.	 All
	    of the HTML	and graphics files will	be created in this directory.
	    If the Mathematica notebook	has many closed	cell groups and/or
	    many graphics cells, then math2html	will create many files.
	 b. Run
	      math2html	-m1 mathfile
	    where mathfile is the name of the Mathematica notebook, using
	    whatever command line options you wish.  This will create a
	    number of html, PostScript,	ppm, GIF, and MPEG files.
	 c. Delete the intermediate graphics files, unless you have some use
	    for	them.  The .ps files are Encapsulated PostScript and the .ppm
	    files are in portable pixmap format.  The .param files supply
	    parameters to mpeg_encode for creating the MPEG animations.
	      rm *.ps *.ppm *.param
	 d. If the first cell in any of	the closed cell	groups was a text
	    cell, then the title of that html document is the first eight
	    words of the text cell followed by "...".  If the first cell
	    is a graphics cell,	the title of the html document is
	    "Graphics Group n".	 The html documents can	be edited to give
	    them more descriptive titles.
      3. Install the html and gif files	on the web server:
	 a. Create a directory on the web server.
	 b. Copy all of	the .html, .gif, and .mpg files	to this	directory.
	    Mathematica	notebook.

   RESTRICTIONS
     The Mathematica notebook must have	exactly	one Title cell and it should
     be	the first cell in the notebook.

     Graphics cells that are not created from Mathematica graphics commands,
     are given .gif filenames and referenced in	the HTML document, but the
     GIF files are not created.	 They will have	to be created individually.
     For example, a PICT file placed into a Mathematica	notebook for Macin-
     tosh could	be copied and pasted into GIFConverter and saved in GIF	for-
     mat.

     Sounds are	not converted.	The program creates an empty GIF image where
     the waveform graphic ought	to be.	You will have to convert the sound
     and graphic yourself.  For	example, if you	have a copy of the Mathema-
     tica front	end for	Macintosh, you can copy	and paste the sound into the
     shareware program SoundEffects and	save it	in aiff	format.	 You can copy
     and paste the waveform graphic into the shareware program GIFconverter
     and save it in GIF	format.	 If you	want to	 be able to click on the
     graph to hear the sound, include the following line in your HTML docu-
     ment:

     <A	HREF="file.aiff"><IMG SRC="file.gif"></A>

     where "file" is replaced by the filename of your GIF waveform graph and
     your aiff sound file.

     Only standard ASCII characters are	supported.  Font information in	the
     Mathematica notebook is ignored.

   BUGS
     ppmtogif generates	the warning:
       ppmtogif: a file	read or	write error occurred at	some point
     but it seems to have no ill effect.

     The bottom	few rows of pixels are missing from MPEG movies.

   SEE ALSO
     rasterps, ppmtogif, mpeg_encode

   AUTHOR
     Copyright (C) 1995	by Ed Donley <hedonley@grove.iup.edu>.
     Inspired by Terry Robb's nb2html <tdr@vaxc.cc.monash.edu.au>.

     Suggestions, corrections, or comments should be sent to
     <hedonley@grove.iup.edu>