en français

Installing LATEX2HTML with MiKTEX

Luis Seidel Gómez de Quero
CervanTEX
Dpto. de Física Aplicada ETSI Industriales UPM
Translated by Joseph Hilferty

Version 1. 4 February 2000

1 Preliminary comments

This document describes how to install the LATEX2HTML package as part of a scientific typesetting system implemented with MikTEX in a Windows 9x environment. My hope is that it will be useful for the users of this system and that it will be a valuable tool for converting LATEX documents to html. It is not the only tool of this type, nor will I say that it is the best; I of course do not want to discount similar efforts, such as TtH or fpTEX.

Mi aim is to show that LATEX2HTML can be installed under Windows 9x (something I did not believe just a few days ago) and that it is not too complicated (to be sure, with Linux it is all much simpler). The source of this small adventure was the course that I will be teaching at my university. I therefore would like to extend my thanks to my department, ICE at the Polytechnical University of Madrid, and Professor J.M. Goicolea, who invited me to teach the subject.

I have tried my best to make this document error-free and precise, but be warned that I have only tested what I describe herein on two systems: a Pentium 166MMX (64Mb RAM, W98) and another 166 (32Mb RAM, W95). I do not have access to an NT system, but I doubt it would be very different in the essentials. It goes without saying that this document HAS NO GUARANTEES WHATSOEVER. USE IT UNDER YOUR OWN RESPONSIBILITY AND AT YOUR OWN RISK. In no case can the present author, his institution, the developers of LATEX2HTML MiKTEX, or the members of CervanTEX be faulted. If something goes wrong, it's Mr. Gates' fault.1

Unfortunately, I cannot guarantee that I will be able to update this document, nor can I guarantee that I will be able to take care of questions that may arise. This document should therefore be considered PROVISIONAL and only valid for this week (and maybe next).

2 Ingredients

Before starting, we need to be sure that we have all the necessary programs. I assume that MiKTEX is installed and that it is the most recent version. It is not especially necessary that it be the latest version (1.20e), though. My setup includes the installation directory c:\texmf and the local directory c:\localtexmf. Note the directory c:\texmf\miktex\bin, which is located in the $PATH.2As usual, you should have Ghostscript installed. I am going to assume that version 5.50 is installed in c:\texutils\gs5.50 .3 I am going to put all the utilities in the texutils directory so as to maintain a bit of order. Nonetheless, it is probably a good idea to avoid directories or folders with spaces (e.g., Program Files).

You should get a version of perl for Windows9x/NT. As mentioned in MiKTEX 's Local Guide, the most recommended option can be found at http://www.activestate.com/ActivePerl/download.htm. The size of the installation file is about 5.5 Mb and is called APi522e.exe. This file is not freely distributable, although the Web page says that it can be distributed to everybody at every institution. You may also notice that you will need DCOM for Win95. However, for our purposes this is not the case.

At SourceForge http://gnuwin32.sourceforge.net/packages/netpbm.htm you can find Netpbm. This contains graphics-conversion utilities for programs such as LATEX2HTML.

Finally, you will need LATEX2HTML. You can get this program at http://saftsack.fs.uni-bayreuth.de/~latex2ht/current/ (it is important to get the latest version). As of right now the most recent version is latex2html-99.2beta6.tar.gz. It is important to remember that LATEX2HTML is just a set of scripts written in perl. Therefore, nothing has to be compiled, so long as you have perl and the above-mentioned auxiliary utilities.

3 Installing perl and netpbm

To install perl no instructions are needed. Just execute the installation program and it will do the rest, including modify your autoexec.bat so that it is included in the $PATH. I assume that it will install itself in c:\Perl.

You now have to unzip the file netpbm.zip. Be sure to keep all the folder names intact. I assume that everything will be unzipped into the c:\texutils\netpbm subdirectory.

4 Installing and configuring LATEX2HTML

Now we have to unzip latex2html-99.2beta6.tar.gz into a temporary directory, also making sure that we keep the folder names intact. Next, we can configure and install LATEX2HTML. This is quite simple thanks to the scripts config.bat, test.bat, and install.bat. Since they are .bat files, it is best to open an MS-DOS window (if we remember what that is). It is also useful to print and read the install file that can be found in c:\TEMP\latex2html-99.2beta6.

4.1 Editing prefs.pm

Look in the c:\TEMP\latex2html-99.2beta6 subdirectory. There you will find the file prefs.pm. Open it with your favorite editor and modify:

line 123

$prefs('EXTRAPATH')='C:\\TEXUTILS\\GS5.50;C:\\TEXUTILS\\NETPBM\\BIN';

Added by Steve Mayer October 2001
Later versions of Ghostscript may use different directories. It is important to give the exact directory in which gswin32c.exe can be found. Thus using Ghostscript Version 7.00 would require:

$prefs{'EXTRAPATH'} = 'C:\\TEXUTILS\\GS7.00\\BIN;C:\\TEXUTILS\\NETPBM\\BIN';

line 129

$prefs('PREFIX')= 'C:\\TEXUTILS\\L2H';

(Note the double backslashes.) By doing this we are saying where to find Ghostscript and netpbm and we are deciding that the directory in which we are going to install LATEX2HTML is c:\texutils\l2h.

4.2 Executing config.bat

In our venerable MS-DOS window, we now change directories to c:\TEMP\latex2html-99.2beta6 and execute config.bat. This is the most critical moment of all. In my experience the program hangs when it is going to recognize the version of dvips. Nevertheless, pressing the return button a couple of times is enough to get it going again. I have also already mentioned that the the latest version of Ghostscript (5.99) does not recognize it very well. Except for these potential problems, everything should go well. If not, then start over again. For reference purposes, I include the result that is saved in the config.log file.

config.pl, Release 99.2 beta 6 (Revision 1.30)
Accompanies LaTeX2HTML, (C) 1999 GNU Public License.
checking for old config file (cfgcache.pm)... not found (ok)
checking for platform... MSWin32 (Windows 32 bit)
checking for C:\Perl\bin\perl.exe... C:\Perl\bin\perl.exe
checking perl version... 5.00503
checking if perl supports some dbm... yes
checking if perl globbing works... yes
checking for tex... C:\TEXMF\MIKTEX\BIN\tex.exe
checking for latex... C:\TEXMF\MIKTEX\BIN\latex.exe
checking for initex... C:\TEXMF\MIKTEX\BIN\initex.exe
checking for kpsewhich... no
checking for TeX include path... NONE
Warning: Will not automatically install LaTeX2HTML style files.
checking for dvips... C:\TEXMF\MIKTEX\BIN\dvips.exe
checking dvips version... 5.86
checking if dvips supports the combination of -E and -i -S 1... yes
checking for html4-check... no
checking for gswin32c... \TEXUTILS\GS5.50\gswin32c.exe
checking for ghostscript version... 5.50
checking for ghostscript portable bitmap device... pnmraw
checking for full color device for anti-aliasing... ppmraw
checking for ghostscript library and font paths... built-in paths are correct
checking for pnmcrop... \TEXUTILS\NETPBM\BIN\pnmcrop.exe
checking if pnmcrop can crop from one direction... yes
checking for pnmflip... \TEXUTILS\NETPBM\BIN\pnmflip.exe
checking for ppmquant... \TEXUTILS\NETPBM\BIN\ppmquant.exe
checking for pnmfile... \TEXUTILS\NETPBM\BIN\pnmfile.exe
checking for pnmcat... \TEXUTILS\NETPBM\BIN\pnmcat.exe
checking for pbmmake... \TEXUTILS\NETPBM\BIN\pbmmake.exe
checking for ppmtogif... \TEXUTILS\NETPBM\BIN\ppmtogif.exe
checking if ppmtogif can make transparent GIFs... yes
checking if ppmtogif can make interlaced GIFs... yes
checking for pnmtopng... \TEXUTILS\NETPBM\BIN\pnmtopng.exe
checking if multiple pipes work... no
Unfortunately multiple pipes are not reliable on this OS.
checking for temporary disk space... C:\WINDOWS\TEMP
creating cfgcache.pm
creating test.bat
creating install.bat
Note: Will install...
... executables to : C:\TEXUTILS\L2H\bin
... library items to : C:\TEXUTILS\L2H

4.3 Executing test.bat and install.bat

So as to be sure that everything has gone perfectly, try executing the test.bat file. This will check the program and the utilities on a small TEX file. The result can be seen on our favorite Web browser. You should see various equations against a rather ugly grey background. By default, LATEX2HTML creates images of equations and uses the PNG format; the problems is that Web browsers do not render transparent-background PNGs very well. This can be changed if we do not mind the controversy surrounding the GIF-format patents.

Lastly, execute install.bat. This will copy certain necessary files to C:\TEXUTILS\L2H (about 5.5 Mb). Now we can erase the temporary directory c:\TEMP\latex2html-99.2beta6. The only thing left to do is configure a few things so it suits our needs. Perhaps this is a good moment to copy what is in C:\TEXUTILS\L2H\texinputs so that MiKTEX can find everything (for example, C:\localtexmf\tex\l2h, remember to update the database (Maintenance -- Refresh Filename Database)).

4.4 Configuring LATEX2HTML

Although configuring LATEX2HTML can be done by command-line options or by a file (.latex2html-init) for every user and every task, I would suggest editing the l2hconf.pm file, which is now found in C:\TEXUTILS\L2H, to make a few general modifications. From here on, you should read the manual (125 pages).

Edit the above-mentioned file and make the following changes:

line 52

@IMAGE_TYPES = qw(gif png);

line 290

$LOCAL_ICONS = 1;

line 553

$HTML_VERSION = '3.2,math';

line 567

$UNSEGMENT = 1;

line 767

$EXTRA_IMAGE_SCALE = 2;

In order to understand the usefulness of these modifications, you will have to use the program. As the manual (which can be generated with LATEX or converted to HTML), LATEX2HTML converts the file, say, thesis.tex into a series of tt HTML and GIF files, which are then saved in a subdirectory (e.g., thesis) containing the source file. It is not the purpose of this document to explain the ins and outs of LATEX2HTML. Note that, upon executing latex2html thesis.tex, what you will see in the MS-DOS window might be a bit disquieting and it can take a while. It is worthwhile to test a few examples (i.e., simple small files) before trying to convert a book-length monograph with lots of equations and figures. I have almost forgotten to mention that you will want to have the folder C:\localtexmf\tex\l2h\bin in your $PATH.

Surely there are more elegant or simple ways to do what I have just described. To give me signs of support, helpful pointers or criticisms, please write author.

Appendix (by Steve Mayer)

A. Ghostscript 6.01

The instructions so far have concentrated on installation using Ghostscript 5.50. However, recent versions of Ghostscript can cause problems because it reports its version number in a way that the installation program doesn't understand. This results in the following error message in config.log and on screen:

checking for ghostscript version... no
Error: could not determine gs version
Warning: Will not be able to generate images due to above failure

A workaround is to edit config.pl which can be found in the \config subdirectory:

After the line

close(GS);

and before the line

# Configure things determined by the Ghostscript version

add the two lines

@gs_devs=qw(pnmraw ppmraw);
$gs_version=6.01;

B. Paths

It may also help to change the first few lines in config.bat to say:

@ECHO OFF
REM this is a DOS batch file
REM *vital* This is the path to the perl interpreter
set opath=%path%
REM put in the correct paths for perl in the next two lines
set path=%path%;c:\perl\bin;c\perl\lib
set PERL=c:\perl\bin\perl.exe
REM change the following paths if necessary
set gs_lib=c:\aladdin\gs6.01\lib;c:\aladdin\fonts
REM ------------------------------------------------------------
ECHO Starting Configuration...

and at the end of config.bat add

ECHO Configuration procedure finished
set path=%opath%
set perl=
set gs_lib=
:END

C. Other Problems

If you receive the error message

checking for gswin32c... no

it means that Ghostscript can't be found. This can happen if the LATEX2HTML installation is on a different drive from that of Ghostscript. I would suggest keeping all the programs (including Perl and Netpbm) on the same drive.

If while the following message is displayed

checking if perl globbing works...

the program stops or even crashes, then this could be due to conflicts with Norton or McAfee anti-virus programs.
Turn off the anti-virus checker and make the changes to config.bat given in B. above. You will also need to turn these programs off later on when you wish to run LATEX2HTML.
(globbing means understanding wildcards like * and ? in file names).

D. Environment Size (Windows 95, 98 and Me only)

If you get Out of environment space messages then change the environment space from Auto to 1024 for config.bat. To do this:

In Windows Explorer right-click on config.bat then click on Properties then Memory tab and in the 'Initial Environment' dropdown box select 1024.

It is not necessary to do this in Windows NT or 2000.

For an analysis of the problems with the Perl coding in config.pl see
[l2h] 99.1beta8 on Win98 - problems and solution

2000-10-02

About this document ...

Installing LATEX2HTML with MiKTEX

This document was generated using the LaTeX2HTML translator Version 99.2beta6 (1.42)

Copyright © 1993, 1994, 1995, 1996, Nikos Drakos, Computer Based Learning Unit, University of Leeds.
Copyright © 1997, 1998, 1999, Ross Moore, Mathematics Department, Macquarie University, Sydney.

The command line arguments were:
latex2html -split 0 -no_navigation -show_section_numbers l2h_eng.tex

The translation was initiated by usuario on 2000-02-04


Footnotes

... fault.1

Translator's note: Despite the Italian saying tradutore, traditore, the translator also washes his hands of anything that can be attributed to him.

...$PATH.2

I assume that the reader already knows how the change this variable.

... .3

The latest Beta, version 5.99, has been giving problems with script config.bat. If you have this version installed, you should make some modifications.

 


usuario 2000-02-04