A Macro Package to Solve
the Netscape Math Problem ...
HTML w/Typeset Mathematics &
High-Quality TeX Outputs

©1996, Robert R. Curtis, (Home Page), San Joaquin Delta College

  • Download HTeX Files
    (being revised to v2.0, available soon!)
  • Download BBEdit Extensions
    (being revised to v2.0, available soon!)

What's The Problem?

Want to do math equations in HTML? Well, you're screwed.

HTML 3.0, which promises full math support, lacks any such promise. Besides which, I am afraid that the browser- developers' idea of high-quality output is quite suspect.

Why can't TeX be the source language for HTML browsers? Sure would be nice and make our lives much easier. TeX provides all of the beauty and power we mathematicians have come to rely on.

My solution: for a HTML page presented to the user, the user is provided with a high-quality printable alternative, such as a .dvi, .pdf, or .ps file. Which flavor of hiqual doesn't really matter.

But the problem this creates is multiple source files. Change your HTML source file, and you have to remember to change your mirror TeX source file for the high-quality alternative.

This is why I designed HTeX.

What is HTeX?

HTeX is a TeX-based macro package that you write your source files in. It is a hybrid between HTML 2.0 (well, really Netscape HTML 2.0), eplain TeX, and AMS-TeX. This macro package allows you to write a single source file, and using the TeX engine, output daughter .html and .tex files from this mother source file, ready for Netscape and/or TeX (for, in our case, a conversion to .pdf) output streams.

The math in HTML is handled by WebEQ, written by Robert Miner at the University of Minnesota Geometry Center. WebEQ is a Java Applet system for taking in math tags in an HTML file and producing screen typeset math in Netscape. The supported features of WebEQ are the base for what HTeX supports, at least currently.

WebEQ looks like crap, but that is what the high-quality alternative is for. WebEQ gets you through the day.

Also, as HTML 3.0 is far from standard, and other solutions will present themselves in the form of "TeX Plugins" for Netscape and other math typeset solutions, it will be quite advantageous down the road to only have to change converter files and not reset the source files.

I have also hacked up Carles Bellver's wonderful HTML Extension palettes for BBEdit (for the Mac) to now serve up HTeX macros. This will make learning HTeX much easier.


Writing HTeX

Probably the best way to learn how to write HTeX is to use the BBEdit Extension Macros to learn the tags, and then maybe once you get the hang of it, move to writing the tags from scratch (like most people do with TeX.)

If you are not on a Mac, then you are stuck with having to look at the source files:

tohtml.tex
totex.tex
These give all of the commands in the macro package.

The design of HTeX is closer to HTML than it is to TeX in terms of layout, since Netscape and HTML can only do so much.

In general, whenever there is a command in either TeX or HTML, the new command in HTeX is the same, but lowercase and preceeded by an "h". Thus the name of this package.

Examples:

HTML Tag TeX Tag HTeX Tag
<P> (blank line) \hp
<font color="red" size=+2> </font> (no equivalent) \font{COLOR="red"}{SIZE=+2}
<BR> \hfil\break \hbr
<B> </B> {\bf \/} \hbold{ }
(no equiv.) $ $ \smath{ ... }

Things to Remember

  1. I have not installed ALL TeX constructs to HTeX. Please let me know if I have left something out that is really necessary. I have also been restricted by what WebEQ supports.
  2. You CANNOT HAVE BLANK LINES in HTeX files.
  3. There may be some conflicts between amstex and eplain; I shall be fixing these ASAP.


To Install on a Mac:

  1. Put the contents of "Put in Preferences" in your Preferences Folder in your System Folder. These are the BBEdit Preferences that hold some of the settings that are kind of nice.
  2. Either (a) put the boxedeps.tex, eplain.tex, amstex.tex, and stables.tex in your TeX-Inputs folder in your local version of TeX; or (b) leave these files in the same folder as your source documents you will generate below.
  3. You may need to change the line "\noexpand\SetOzTeXEPSFSpecial ^^J" to the specific instruction for boxedeps.tex for your particular flavor of TeX. See the boxedeps.doc file for information on what this setting should be.
  4. Launch BBEdit Lite 3.5; select Extensions->Start Doc; You need to reset the "prefs" file and the "sig" file. Click on the "Set File" buttons for each, and navigate to the "htex-prefs.tex" and "htex-sig.tex" files, respectively.

To Install on Windows/Unix:

  1. Make sure the boxedeps.tex, eplain.tex, amstex.tex, and stables.tex are in the same directory as your source file (to be described below).
  2. View the files in the Samples directory to see how the HTeX files are set up, and then modify to your heart's content.
  3. You may need to change the line "\noexpand\SetOzTeXEPSFSpecial ^^J" to the specific instruction for boxedeps.tex for your particular flavor of TeX. See the boxedeps.doc file for information on what this setting should be.

Setting the Paths:

There are many paths that need to be set so graphics and java applets find their way.


The HTeX Composing Process with BBEdit:

  1. Open a blank text file; save it as "bozo.tex".
  2. Choose Extension -> HTeX Start Doc ...
  3. Decide what you want the output stream files to named for the .tex stream and .html stream; say "bozo-html.tex" and "bozo-html.html".
  4. In BBEdit, select Extensions->Start Doc; You need to reset the "prefs" file and the "sig" file. Click on the "Set File" buttons for each, and navigate to the "htex-prefs.tex" and "htex-sig.tex" files, respectively. Next click "Apply"; This will paste a whole mess of stuff into your text file. Where the cursor ends up is where you start inputting your stuff.
  5. Go nuts.

The HTeX Composing Process in Any Other Text Editor:

  1. Use the "htex-template.tex" file to start with. Make a copy of this file and work with the copy.
  2. Open the "tohtml.tex" file, and study the definitions therein. A knowledge of HTML is required.
  3. View the "Samples" files for examples on how the development of a source file goes.

To Process Your bozo.tex File to TeX and HTML Outputs:

  1. The "Switch" to output .html or .tex is in the header information of bozo.tex. It looks like the lines:
    %**% Line #1 = output to HTML %**%
    %**% Line #2 = output to a .tex file %**%
    % \writinghtmltrue\writinghtexfalse
    \writinghtmlfalse\writinghtextrue
    Here the "Switch" is set to output .html false, and to output tex true. The "%" turns off a line from being active in TeX. It seems rather obvious what to do if you want html output and not TeX output.
  2. Run the bozo.tex file through TeX.
  3. If you were running output to bozo-html.html, then open the file "bozo-html.html" with Netscape. (Mac users: Make sure you have plenty of memory for Netscape, like around 20 MB)
  4. If you were running output to "bozo-html.tex", then you need to RERUN TeX on "bozo-html.tex". This will produce a .dvi file, which then can be output to .ps using dvips (or whatever your TeX uses to do this), and then from .ps to .pdf using Adobe Distiller.


Plans for the Future

  1. I want the hyperlinks in the .pdf file to be live, and not just dumb underlines. This is possible using Adobe's pdfmark. There is a system for doing this on unix boxes called HyperTeX, which allow you to encode the url's in your .tex file with \specials allowing dvihps (dvi -> hyper ps) converter to encode these with pdfmarks. Then Adobe's Distiller will take this .ps file and covert it to .pdf with the pdfmarks inside of it, allowing Adobe Acrobat Reader to use WebLink and these urls are hot inside of Acrobat.

    I don't want to write these converters for the mac. I hope to get someone to do this. (i.e. Andrew Treverrow, author of OzTeX).

  2. Sure would be nice to get the SDK for BBEdit Extensions, and write these extensions the right way.
  3. Haven't got a clue what do with embedded objects in terms of what the TeX side of HTeX should do with them.
  4. I would love a Mac drag and drop or scriptable utility that converts .gif to .ps CORRECTLY. GraphicConverter does not lay down correct .ps code for TeX and boxedeps.tex to deal with correctly. I have to use SuperPaint right now, which can export .eps, which is kind of a joke as it is not real .ps, but it works with boxedeps.tex.


Road Map

Information Curriculum Contacts


http://www.calculus.net
C • I • R • L is powered by a DEC Alpha webcasting from Webster, Massachusetts, USA  •  Partial webcasting from a Macintosh PowerPC 6100 running WebSTAR 1.3.1 on a T-1 line from Stockton, California, USA  •  Project Director: Robert R. Curtis, Ph.D., San Joaquin Delta College  •  Executive Assistant to the Director: Diane Housken  •  C • I • R • L Associate Editors!  •  C • I • R • L Contributing Authors Listings  •  Other C • I • R • L Staff