Hevea: the Win-32 portPhilip A. Viton |
This note describes the Win-32 port of Hevea and Hacha, a fast LATEX-to HTML translator, provided by permission of the author, Luc Maranget, INRIA, France. The port runs under Windows 95 and later.
Starting with version 1.07 we provide a native-code system. This runs significantly faster than earlier versions, which used a bytecode interpreter (ocamlrun.exe). If you really want the old byte-code system (which now involves a dll file for the interpreter), send me an email and I’ll be glad to provide it.
If you want to use Hevea in conjunction with Mackichan Software’s ScientificWord / Scientific WorkPlace systems, there is a supplementary distribution available. You can read the SWP documentation here or you can download the SWP supplementary distribution (which also contains the documentation) here. Note that you will also need the main Hevea distribution, from this page.
Hevea is a command-line program, intended to be run from a DOS session within Windows. However, Steve Mayer has written a nice GUI interface — called the TeXConverter — to a number of LaTeX conversion programs, including Hevea: with this, you can run Hevea from an icon on your desktop. The TeXConverter also makes it easy to add Hevea style (.hva) files. You can get the TeXConverter here. I recommend that you have Hevea running correctly as a command-line program before installing the TeXConverter.
The current official version of the Win-32 port is Hevea version 2.06, compiled March 29, 2013. The distribution is available in a zip file, winport.zip, from here. The archive includes a copy of this note.
There is also available Hevea version 1.99, which is the final version to produce HTML-4 code (Hevea 2.00+ produces HTML-5). You can get the distribution, winport-199.zip from here. Note that unless you have a special reason to use HTML-4, the recommendation is to upgrade to the latest in the Hevea 2.00+ series.
Upgrades: 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.
The problem has been reported, and we can always hope that Miscrosoft will it, but meanwhile, with some help from Luc, I’ve come up with a temporary hack. It relies on defining a Javascript function in the HTML document: the function decides whether the browser being used to view the page is Internet Explorer or not, and if it is, displays symbols using the Windows Symbol font; otherwise it uses standard entities. This appears to solve the problem, but of course there’s a downside: these symbols won’t be displayed at all — IE or not — unless scripts are allowed to run. In IE, whether scripts are blocked is fairly obvious; but in Firefox, if you’re running the NoScript extension, you may want to set it up to Enable Message About Blocked Scripts (NoScript setup, bottom of the Appearance tab).
My solution uses a special version of winfonts.hva called winfonts2.hva. As of today, the file is included in the Windows distribution: if you’ve already set up Hevea, you can get it separately here: unzip it to Hevea’s HTML folder. I have not made it the default in the Hevea batch file: if you want to use it, just edit the file, and replace winfonts.hve by winfonts2.hva. Note that you don’t want to use it for text translation, since Javascript has no meaning there.
Note that winfonts2.hva is an unofficial fix, and is not included in Luc’s distribution. If Unix users want it, they can download it from the stand-alone link given above.
Please let me know of any problems (symbols that don’t display correctly): there may be typos. It may also be possible, using another Javascript function, to provide a better solution for the delimiters problem: I’m currently thinking about how this could be done. Watch this space.
Note that if you want to try both the current version and the last HTML-4 version (Hevea 1.99), the files in both archives have the same name. This means that you should unzip the two distributions to different directories, and then modify one set of batch files to take account of the two different locations.
The system is now ready to run.
The distribution includes a tiny test file pavtest.tex which you can use to test that your installation is running, as follows:
The batch files make a copy of your current path before calling Hevea; they add the Hevea directory to your path, call Hevea, and restore the original path when done. Under Windows 95/98 only (but not under NT4/Win2k/WinXP) you may run out of the space allocated by the operating system to store these strings. The symptom is a message “Out of Environment Space”. If this happens, you will need to increase the size of your environment area: here are two ways to do this.
I’m always glad to try to help when the system doesn’t work, and to this end the distribution now includes a copy of redir.exe from D.J. Delorie in redir.zip. Here’s the simplest way to send an error report:
this will create redir.err. Send it to me.
As you can see from the redir documentation, this program may be useful in other instances as well. You can move it to some directory in your path, where it will be generally available. But at least in Windows NT, just calling it may conflict with a built-in function. If you get a message saying The VDM Redirector is already loaded, then the operating system is using its internal function in preference to redir.exe. You can get round this either by explicitly including a path to redir.exe when you call it; or — possibly easier — renaming redir.exe to (say) xredir.exe.
This version of Hevea / Hacha requires that the environment variable HEVEADIR point to the location of the Hevea executables. The batch file hevea.bat sets this up for you, and you should probably use it instead of calling Hevea.exe directly.
If you call any of the batch files without an argument, they’ll print out a summary of their purpose and syntax.
Note that xxcharset, described in section B2 of the Hevea manual, is not supported (and xxcharset.exe is not included in the distribution). This program is supposed to deduce the appropriate character set from your locale information, but I don’t know how to find this in Windows. If you need this facility, you can follows Luc’s suggestion: include the command in an .hva file, and load this file; or, more directly, put into your document preamble: \makeatletter \def\@charset{xxx} \makeatother , where xxx is a character set known to Hevea (one of the file names in Hevea’s mappings folder, without a .map extension, eg, ISO-8859-7).
When Hevea see reference to a graphic in your source (typically via an \includegraphics macro) it writes some informative material into the “image file”: when you’re processing mydoc.tex this file will be called mydoc.image.tex. This is supported in the Win32 distribution. Under Unix Hevea, the image file is to be processed through a shell script called imagen, to actually generate the graphic (typically .gif) image. The difficulty here is that Unix shell scripts can do much more than DOS/Windows batch files; in addition, imagen assumes that certain supplemental utilities like GhostScript are installed on your computer, as they usually would be under Unix, but not under Windows.
The bottom line here is that the imagen script is not supported under Win32 (even though it is included in the distribution). However, your HTML file includes correct references to all graphics — it’s only the graphics files themselves that are missing — so all you need to do is convert your source graphics to web graphics yourself. There are a number of solutions for this: one very capable, small, fast and free system is Irfan-View, obtainable from
Irfan-View can run either as a command-line utility or as a Windows application. It will convert .wmf and .png graphics to .gif; and I think it will do .eps graphics as well. It will not, however, handle the PostScript files produced by dvips. If you need to work with PostScript, a solution is ImageMagick plus Ghostscript. This is also free, but is more cumbersome than Irfan View, not to mention slower. GhostScript is available from
and ImageMagick from
Good luck! Hevea is an extremely capable and flexible translator, and I’m glad to be able to make it available to Windows users. All us Win-32 LATEX’ers owe Luc Maranget a real debt for providing it.
This document was translated from LATEX by HEVEA.