Previous Up Next

Part I

1  Introduction

Luc Maranget’s Hevea is a LATEX-to-HTML translator written in the Objective Caml programming language. It is small, fast, and features support for basic mathematics without using inline images; but its most important feature is that it is built around a sophisticated parsing engine that understands LATEX. This means that you can take a complicated LATEX macro and re-define it to do only the much simpler things available to you in HTML. Of course, you will need to understand how to write simple LATEX macros, but as I show in Part V, this is often simple. I was recently able to “persuade” Luc to provide direct parser support for SWP’s graphics (the \FRAME macro) and Unicode, and this makes Hevea viable for SWP users.1 An additional advantage is that, unlike some other translators, Hevea does not require a TEX/LATEX system, and it can therefore be used off-the-shelf with Scientific Notebook documents.2 (But see below: even Scientific Notebook now contains its own built-in HTML generator).

Copies of this document in HTML and dvi formats are included in the SWP distribution, as heveasw.html and heveasw.dvi.

2  Availability

Hevea is available only for Windows NT/2000/XP and later.3 If you’re running on one of those operating systems, Hevea should work with SWP 2.5 and later; probably 2.0 also, but I’ve not tested this one.

3  Help me decide!

SWP users now have three or more alternatives for HTML generation: Luc Maranget’s Hevea, and Eitan Gurari’s TeX4ht (not for Scientific Notebook), or (SWP4+ only) built-in HTML generation. Which is best for you? Bearing in mind that you may have to work with the systems to get them to work for you, here are some considerations.

Machichan Software
All the Mackichan Software products after version 4 (including Scientific NoteBook) come with a built-in HMTL generator. One advantage of this over Hevea is that it will automatically generate graphics images for your math, so you are not limited to HTML entities. A potential disadvantage is that the built-in HTML generator bases its output on the appearance of the document in the editor (for example, it takes the appearance and color of section titles from the way they look on-screen); Hevea and TeX4ht both try to utilize LaTeX to format the HTML, TeX4ht more so than Hevea.
Hevea takes only a few minutes to set up, and requires no helper applications to run. By contrast, TeX4ht is more complicated to install, and requires both Ghostscript and ImageMagick to run properly. Of course, SWP native support is available as soon as you’ve installed the system.
Basic Text Handling
If your document consists largely of text (as opposed to mathematics) and uses only standard LATEX constructs, all translators produce good HTML. But Hevea has a noticeable speed advantage over TeX4ht, and a small advantage over native SWP, since images do need to be generated. However, with reasonably fast computers, the difference between Hevea and SWP’s native HTML generation is pretty small, and may not even be noticeable.
Real-time support
As of Hevea version 1.07+ you get a compiled version of Hevea: previous versions used an interpreted bytecode system. The native-code version is much faster: one result is that Hevea is now suitable for real-time on-demand translations of LaTeX documents. Neither TeX4ht nor the SWP built-in support can do this.
Simple Math
Hevea now (version 1.08+) uses HTML entities to represent math symbols: previous versions, like the well-known TtH translator, represented mathematical symbols using the symbol font that is present on almost all computers. Either way, you get HTML which is fast to generate and fast to load. The downside is that it works only for “simple” math — math which uses only the available symbols; and even when it can display the content of your math, the display may not be optimal. TeX4ht and SWP native support, on the other hand, use images to represent math, and thus can represent exactly what you’d see on the printed page. But these images need to be generated, and documents containing them take longer to load. There’s an obvious trade-off involved here: how you resolve it is up to you.
Complicated Math
For math which uses symbols not present in the symbol font, or math where accuracy of placement is important, Hevea cannot cope well. On the other hand, the image-based solution offered by both TeX4ht and SWP’s built-in support will accurately reproduce both the symbolism and the layout of your formulas. So for complicated math, either of these is preferred over Hevea.
Translation to plain text
Hevea does an excellent job of converting your non-mathematical LATEX to plain text: numbered lists get the correct numbers, sectioning is nicely set off from the main text, etc. By contrast, TeX4ht can do a traditional “detex” translation, just stripping off the LATEX commands. SWP cannot do this at all. Hevea is probably what you want for plain-text production.
User Effort
Unless you use only standard LATEX, you will probably need to tell Hevea how to deal with at least a few of the macros in your document; and this means being able to write a few simple LATEX macros. This is not difficult but goes against SWP’s philosophy of shielding the user from LATEX. As for TeX4ht, my experience has been that once the system is installed and working properly, user intervention is rarely required. (You can tweak TeX4ht, but you usually don’t have to).
By construction, both Hevea and TeX4ht handle SWP graphics in much the same way: they write HTML IMG tags and leave it up to you as author to produce versions of the graphics that will be understood by browsers. TeX4ht will usually do this automatically, while Hevea needs some assistance: see section 10. SWP’s native support generates its graphics automatically, which is a considerable advantage.

4  Call for assistance

I’ve developed the SWP support in swp.hva based on my own experience with Hevea and SWP, and I’m adding material as necessary. User contributions are welcome. This applies especially to the Scientific Notebook support: I don’t use SN myself, so I’ve got only a rudimentary idea of what needs to be dealt with.

There is no SWP support for Info translation; if anyone wants to supply a swp.hva file for Info, I’d be glad to include it.

5  Updates

This section lists updates to the SWP-Hevea system and documentation, for easy reference. You should know that unless there’s a specific Windows issue, I tend to recompile Hevea only when there are major improvements. But if for some reason you need the latest version, please feel free to ask for it: I can usually produce a new distribution in a day or so.

Previous Up Next