9 Problem Shooting

9.1 What is LaTeX?

LATEX is a high-quality document preparation system that is particularly powerful if you have a lot of math or cross-links in your document. LATEX2HTML is an add-on program to convert these documents into web pages instead of printed hard copies.

Of course, before you can use LATEX2HTML, you need to know how to create documents in LATEX format. There are books like that of Leslie Lamport (see the bibliography of the original online manual). A powerful free resource is the web page of the TeX Users Group. In my opinion, the current dominant free implementation of LATEX for Windows is MiKTeX. It has a useful manual, and there is an easy install script to add LATEX2HTML-FU to it.

But let me give a really really basic intro first if you are really clueless about it all. On MS Windows, download and install the emTeX/LATEX2HTML-FU bundle using the easy install script; on Unix, install TeXLive from the TeX Users Group and add LATEX2HTML-FU according to instructions. Also add the ghostview and perl programs. Create a folder for your first document; avoid spaces and points in the folder name, they are just trouble. On Windows, you might create a new folder myfirsttry in the top C: disk. Open Windows Notepad, or your favorite Unix editor (pico, nedit, ...). In it, type in the following text, case-sensitive, avoid typos, wrong brackets:

Hello world.

Now save this to the folder myfirsttry that you created, naming the saved file index.tex. Windows users beware! You have to specify the name between double quotes as "index.tex", or Notepad will save it as index.tex.txt instead. It’s Microsoft.

Now on Windows double-click the Windows_XP (or 98-ME icon for older Windows) in the “l2hsup” folder in the top C: drive, or on Unix open an xterm or telnet command window. In the created window, cd to the folder with the index.tex file you just created (for example, in Windows use cd \myfirsttry). Enter the following commands:

latex index

Then examine the created pdf file index.pdf in the folder myfirstry; It should show the text “Hello World”, as shown here.

To make web pages instead of a pdf file, use:

latex index
and examine the created web page index.html. It should look like this.

Like HTML, LATEX is a “mark-up language”, which means that you type in formatting information instead of pick it from menus. For example, a more realistic document would look like:



\title{My Second Document}
\author{J. Doe}

\section{Quadratic equations}

The general quadratic equation
  a x^2 + b x + c = 0  \label{eq:quad}
has two solutions given by
  x_{1,2} = \frac{-b \pm \sqrt{b^2 - 4ac}}{2a}  \label{eq:quadsol}

\section{Numerical solution}

In section \ref{sec:quad}, we gave the solution of the quadratic
equation.  This solution can be put in a computer program as is, but
is then likely to suffer from round-off error problems.

The better way to do it is to find only one solution, call it $x_1$,
from the given formulae (\ref{eq:quadsol}), selecting $x_1$ as {\em
  the solution for which the two term in the top of the ratio have the
  same sign.}  Then compute the other solution from
  x_2 = \frac{c}{a x_1}  \label{eq:altsol}


Note that fractions and square root signs are obtained by typing them in. If you do a lot of math, you will find that this is actually much quicker and more reliable than picking items from menus. Also note that I use mnemonics instead of actual section and equation numbers. That avoids having to do do extensive renumberings in large documents if you insert a new section or equation number somewhere, and it cuts down tremendously on incorrect numbers. LATEX2HTML likes the equation labels to be following the math. There seems to be a lot of other typing involved, but a LATEX-aware editor like Emacs will put it in for you.

Process as:

latex index
latex index
The pdf file so produced is here and the web pages are here.

See the sources mentioned above to get more in depth info. The FAQ on is especially useful.

9.2 General

If you get into trouble processing documents with latextohtml-FU, the first thing you have to make sure of is that your index.tex file processes correctly under latex (and dvips). If not, everything stops right there.

Browsers are buggy too. Try hitting “reload” or “refresh”.

If the document is correct, the next thing to ask is whether it is fairly standard LATEX. LATEX2HTML has extensive translation capability, but there are very definite limits. If necessary, create a very standard form index.tex to convert into web pages.

If you made elective changes from my installation procedure, however seemingly minor, repeat installation and don't.

Check the log file C:\Temp\l2h.log (in the Temp directory of the C: disk) for clues. (For Unix users, the log file is in either $L2HTOP/temp or $HOME/temp.)

If you specify “ -debug” behind “l2h”, you will get much more error information on the screen and in C:\Temp\l2h.log. It will also leave the ghostscript files in a subdirectory of “Temp”, and their conversions. You can look at the .ps files using Ghostview, and at the pnm files using an image viewer like CompuPic. Alternatively, you can convert them to .bmp using the Netpbm utilities you installed and look at them with Paint.

To slow down the screen a bit, in the DOS window use:

set L2H_SLEEP=1
(or 2) before running l2h. Do not try output redirection.

If there were problems processing images.tex, see section 9.20.1 for more.

If you are familiar with Perl, try setting -d option behind perl.exe and $PERL in latex2html.bat and stepping with n, s, and r.

Unix users should make sure that the L2HTOP name is set and that its l2hsup directory is in their PATH. If not, use

setenv L2HTOP "$HOME/l2h" (or where the LaTeX2HTML files have been installed)
setenv PATH "$L2HTOP/l2hsup:$PATH"
Make sure that L2HTOP/l2hsup is before other parts of the path that may have netpbm files of the wrong version number, or strange things may happen.

If that does not solve it, the next subsections are some solutions to various potential problems that I am aware of, sorted by type.

The official online manual also has a list of known problems and solutions in Chapter 6 that you also want to read through.

You can also have a look at the sample documents in section 6 for examples.

Good luck.

9.3 Problems not covered here

The official online manual also has a list of known problems and solutions in Chapter 6 that you should read through.

The manual list some sources of support for the official version of LATEX2HTML. I do not know how active they are. There is a TEXusergroup, which includes a very useful FAQ and much software.

E-mail me problems, section 3, and I will add them to the list. If they are due to my stuff, or if they are important enough to me, I will fix them or devise a work-around.

9.4 Installation

Note: Much of what is in this section is outdated. For current software and its usage instructions go to either or

All I know is in the respective installation section. When people send me corrections or additions, I add it there. Or weird stuff maybe here.

9.5 Uninstall

Note: Much of what is in this section is outdated. For current software and its usage instructions go to either or

See item 4 of the installation instructions.

9.6 Weird problems

There are some potential problems that cause symptoms that are just weird. If you are baffled, try each of them and see whether it solves the problem. None of them can hurt:

  1. You may be short on disk space. Unfortunately, LATEX2HTML uses big temporary files, so you should have a fair amount of free space on your C: disk. Right-click the C: disk in “My Computer” and select “Properties” to see available disk space. While you are at it, check folder “Temp” and make sure there is no garbage from previous runs left.

  2. DOS has a limited environment space. If you see any message “No environment space!” flashing by, you are in trouble. In the DOS window, enter the following:
    command /e:3072
    Now try again. This will give you 3072 bytes of environment space, for this DOS window only. (This goes at the expense of other DOS memory. You also lose additional memory from now having two copies of running, so if you have to do this frequently, consider increasing the corresponding value in file CONFIG.SYS.)

  3. Windows loses file handles, causing it to corrupt itself over time. Especially if you get pop-up boxes that “l2hcrop.exe” has performed an illegal operation, do not contact the vendor. It is reboot time. Spend the time it takes to reboot by calling Bill Gates, preferably at 2 am Pacific, demanding a refund for Windows.

  4. Unix users should make sure that the L2HTOP name is set and that its l2hsup directory is in their PATH. If not, use
    setenv L2HTOP "$HOME/l2h" (or where the LaTeX2HTML files have been installed)
    setenv PATH "$L2HTOP/l2hsup:$PATH"
    Make sure that L2HTOP/l2hsup is before other parts of the path that may have netpbm files of the wrong version number, or strange things may happen.

Browsers are buggy too. Try hitting “reload” or “refresh”.

For your comparison, I have full copies of my own Windows 98 CONFIG.SYS and AUTOEXEC.SYS files. Do not use such files on Windows XP.

The official online manual includes some other potential problems.

9.7 Freezing

If the screen freezes, and there are notices on the screen that .tex and .log files are being moved to the Temp folder, a problem occurred in latexl2h.bat. Examine the log files moved into the Temp folder for the problem. Also have a look at rb.err. Then hit Return. L2h should continue.

If the DOS window freezes solidly, see section 9.6 on weird problems.

9.8 Abnormal termination

See section 9.2 on how to use the debug option and the log file.

See section 9.6 for random DOS problems.

Review the Installation section for potential installation problems.

9.9 L2hcrop performs illegal operations

No, it does not. Reboot time.

If it still occurs, make sure the FILES value in CONFIG.SYS is big enough. L2hcrop opens three files.

9.10 I do not want to use l2h/makel2h

Note: Much of what is in this section is outdated. For current software and its usage instructions go to either or

LATEX2HTML works normally, (or rather, as it should.) Run as C:\l2h\bin\latex2html or
$L2HTOP/bin/latex2html, using options as in the manual in the C:\l2hsup\l2hdocs folder.

The orginal .latex2html-init file that comes with the unmodified LATEX2HTML can be found in the l2h directory under name dot.latex2html-init. Copy the file to the directory with your index.tex file and rename it to .latex2html-init; in other words, remove dot. (This will make the file invisible on Unix.) LATEX2HTML has its own style sheet index.css hard-coded.

However, do make sure that is loaded. Various fixes have only been impemented for that version (and not for the default

9.11 Missing/crashing packages/style files

The critical html package (file html.sty) should have been installed with your installation. If not, try putting a copy of it in with your document.

You need to have the epsf.sty and hyperref packages installed in your version of TEX. If you do not yet have them, TUG has them in downloads/CTAN.

However, as of 2005 or so, hyperref is no longer backward compatible with the htmlimage command as described in the LATEX2HTML manual. The solution is to follow every htmlimage command with an empty pair of braces, {}.

However, as of 2006 or so, hyperref is no longer backward comptable with html.sty. The solution is to load hyperref before html.sty:


However, as of 2007 or so, hyperref needs package kvoptions, and TeXlive 2007 does not seem to include kvoptions. You can find the kvoptions on TUG in downloads/CTAN. (Or you can just put kvoptions.sty in with your file.)

However, as of 2008 or so, ...

9.12 Figure/table/sectional numbers are wrong

The procedure that LATEX2HTML uses to determine the correct section, figure, and table numbers can fail. The results are unsightly, with missing or wrong numbers. I reduced its likelyhood of this occurring very much, but nothing is perfect.

In particular, if you put HTML-only sort of stuff in a figure or table caption or in a sectional title, (like a latexhtml, htmlcode or htmlonly command), it will prevent its number to be found. Latex2html will then guess at the number. To fix this, provide the optional shorter caption or title, and leave out the html stuff from it. (Do not forget that there may no line break between ] and {.)

I believe the above is nowadays enough to fix the problem. But a few older suggestions might still be useful.

Avoid discretionary hyphens in captions and section names. Embedded math or accents may also cause problems; try to rewrite it without.

Remove duplicate caption or section titles that give problems. For example, if you have two sections called “Introduction”, rename one “Introduction to ...”

Examine the log file C:\Temp\l2h.log; it often shows why LATEX2HTML did not find the latex caption matching the html one. Try rephrasing the part that does not match.

Or, if you are not afraid of a bit of Perl, edit file C:\l2h\bin\latex2html.bat, and find the string “leon: use brute force now”. The last-resort number search is below it. For example, the statement $cap_key_s =~ s/\\'/é/g; makes the latex \' match the html e-acute symbol.

9.13 Shortened section titles are wrong.

See the next item.

9.14 Do not put a linebreak between ] and {

This will produce erroneous processing if done for the shorter version of a caption or title or similar. Break inside the brackets instead.

9.15 \[re]newcommand or \def does not work

If definitions do not work in image environments or similar, they may be missing in images.tex. Try putting a copy of the definition in an “imagesonly” environment.

9.16 No \input in \[re]newcommand or \def

Do not put a \input or \include command inside a \[re]newcommand or \def. It does not work properly. (Yes, this is a bit of a pain. But it is probably unavoidable.)

9.17 Erroneous space behind one-character commands

Yes. For example, if you try to redefine a command like
-, there will be an erroneous space produced. This author does not know how to fix this. However,
0 through
9 work correctly. So if you need a one-character, and/or nonalphabetic command, use these.

9.18 Erroneous space at rawhtml

The manual says that you need the linefeed behind the \begin{rawhtml} or before the \end{rawhtml}. But that is not always needed.

See also subsection 9.20.17.

9.19 HTMLcode refuses a html tag

Note: Much of what is in this section is outdated. For current software and its usage instructions go to either or In particular, look at, not .latex2html-init.

\HTMLcode only accepts tags from the corresponding official HTML version. For example, a NOBR tag, which prevents line breaking, is not official, so refused. To fix this, go into the versions subdirectory of the top LATEX2HTML directory. Edit file or whatever is the version of html that you have set in your .latex2html-init file. Add the tag to either closed_tags_list or unclosed_tags_list, depending whether there is a closing tag. For example, NOBR has a closing tag /NOBR.

Instead you could try to use the rawhtml environment. Unfortunately that adds unwanted space before and after the tags.

9.20 Figures, tables, and formulae

9.20.1 General

Problems with images (figures and mathematical formulae) are varied. Images are made through the following steps:

Obviously, any of the above steps can cause problems. Your best bet is then to specify the debug option and examine the log file and images as in section 9.2.

If there were problems processing images.tex, you can create a temporary subfolder “tmp” in the same folder as index.tex, move images.tex to that subfolder, and then process it from the DOS window like:

cd \My Documents\mydoc\tmp
C:\l2hsup\latexl2h images
This should give you a better view of LATEX error messages and problems.

Unix users should make sure that L2HTOP/l2hsup is in their PATH before other parts that may have netpbm files of the wrong version number, or strange things may happen. Their log file is in either $L2HTOP/temp or $HOME/temp.

Note that some web graphics used through the graphics or graphicx packages might conceivably not be converted correctly since ppmquant no longer exists. Solution if this would actually happen: convert the figures to eps, or edit l2h/styles/graphics-support.perl and replace ppmquant by an equivalent current utility.

9.20.2 Images.tex has no header.

See the next item.

9.20.3 Make sure [re]newcommands are properly bracketed.

If you have [re]newcommands in which the command name is not within curly brackets, latex may eat it, but images.tex may not have a documentclass line. Of course, everything stops there.

9.20.4 Do not put labels on empty lines

Do not put labels of equations on otherwise empty lines. It will cause LATEX to shout a lot when it processes images.tex. The reason is that LATEX2HTML removes the label, leaving a blank line in the formula.

It is recommended that you put the label immediately following the math and hide the end-of-line by following it with a percent sign. If not, you will get errors in images.log.

9.20.5 Shortened figure captions are wrong.

See the next item.

9.20.6 Do not put a linebreak between ] and {.

This will produce erroneous processing if done for the shorter version of a caption or title or similar. Break inside the brackets instead.

9.20.7 No figures or mathematics images are made at all

This sounds like an installation problem. Review the installation procedure.

Review the general notes on images in subsection 9.20.1

See section 9.2 on how to use the debug option and the log file.

See section 9.6 for random DOS problems.

9.20.8 Randomness in image sizes

When processing the images, LATEX2HTML uses its own page size. So whitespace may be stretched differently. To fix this, immediately behind the \begin{document} line, put

Change the numbers according to your document text size. Here 1pt is 1/72 inch.

9.20.9 Misaligned eps figures

If you use emTeX, eps file names must be 8 characters or less (excluding the .eps), or the bounding box will not be read. Rename or add the bounding box explicitly to the epsffile command.

9.20.10 Problems with frameboxes in pictures

LATEX2HTML does not know that frameboxes in pictures are different.

The following is cheating, but it works for me. In the preamble. define:

then use \picfrbox instead of \framebox in your pictures.

9.20.11 Some figures are not being made (correctly)

Note: Much of what is in this section is outdated. For current software and its usage instructions go to either or In particular, you should edit, not .latex2html-init.

If you misspell “transparent” as “transparant” inside \htmlimage, the figure is going to fail. Take it from me.

Do not use \hsize or \textwidth in pictures, images.tex may not conform to your document. Specify actual dimensions in pt or in.

If a picture has too much empty space around it, it may cause a problem if \resizebox is used. Try reducing the declared the picture size to closer conform to the actual size.

Make sure .eps files have proper bounding boxes. Use ps2eps -l -B. Don’t think commercial software puts out correct postscript files; most do not. If the bounding box is wrong, the picture may only show up half or not at all.

In picture environments, a circle at the far left may show up as half a circle, as only the center is considered as area that is written to. To fix it up, put a tiny \rule{.2pt}{.2pt} on the leftmost perimeter point of the circle.

Plain TEX \def definitions in the preamble may not always be correctly transferred to the images.tex file, causing figures using them to fail. One fix to this bug is to add the line

to your .latex2html-init file. Alternately, the -notex_defs command line option could be used with (make)l2h. (The .latex2html-init file is hidden on Unix.) More simply, add the definitions explicitly to images.tex using the imagesonly environment.

Examine the images.log file and check that the figures can be found. Note that image processing takes place in a subdirectory, so, for example \epsffile{myfigs/myfig.eps} would fail to find the figure. Use a complete path, or simply put the figures in with index.tex and get rid of myfigs/.

If they are figures using \special commands or other complex graphics procedures, and your dvips supports the -E option, delete the bad figures, if they were made at all, and try the following in the DOS window:

set L2H_NOEPS=s
l2h  (or makel2h)
set L2H_NOEPS=
This uses the non-eps version of latex2html, which may more robust. (Unix users use setenv and unsetenv, with no equals signs.) However, I find this trick no longer works on at least some new versions of TEX; it will make things worse. It works fine with the emTeX version, though. Sorry, I do not know why, the headers of the postscript versions seem equivalent except for the dvips version number and I am using the same gswin32c for both. So, do not set L2H_NOEPS as the default!

Alternatively, and better, convert the figure into a proper eps file. Copy index.tex to folder Temp, in the preamble set \pagestyle{empty}, and remove the caption(s) and any other text and headers on the page(s) of the bad figure(s). In the DOS window:

cd Temp
dvips -Ppdf -E -p XXX -n 1 -o index
where XXX is the page number with a bad figure. Load the generated file into Ghostview, turning OFF "EPS Clip" under options. From the “File” menu, select “PS to EPS”. Use automatic bounding box, and save the file under name figpXXX.eps. Open that file using Ghostview and check that it now has a proper bounding box. Move the file back to the original index.tex document folder, and replace the specials garbage in index.tex there with \epsffile{figpXXX.eps} (if you use the epsf package.) Repeat with the other bad figures.

Some additional items for the sophisticated: There are some perl scripts in folder l2hsup that are supposed to do much the same thing without ghostview. If in DOS you

set L2H_PUTPS=1
the postscript files generated by latex2html will be moved to the temp folder for messing around with. If you
set L2H_GETPNM=1
pstoimg will import matching pnm files from the Temp folder, bypassing normal conversions.

9.20.12 LaTeX problems near htmlimage command

MiKTeX 2.5, and probably any other LaTeX loading the Aug 2006 hyperref package, produces random cryptic errors in figure environments with an htmlimage command in it, typically complaints about 'extra }' or 'Missing \endcsname inserted.' Some problems go beyond the figure environment.

The problem appears to be incompatibility of the html package with the new hyperref package loaded by MiKTeX 2.5. To fix the problem, before loading the html package, turn off hyperref using the line:


If this is not possible for some reason, put an empty pair of brackets behind the htmlimage command, for example:

It is in fact recommended that you use such an empty pair of braces with recent versions of LATEX whether you have problems or not.

9.20.13 Background color is shining through my figure

Put \htmlimage{notransparent}{} in the figure environment. Do not misspell this!

9.20.14 Figure colors seem limited

Gif files have only 256 different colors, unlike jpeg ones which have 16 million. You can create jpeg versions of the figures. Unfortunately, jpeg files might have a bit of visible “ghosting”. Little is ideal is this world.

9.20.15 Figure file sizes are excessive

Jpeg files are typically smaller than gif ones. Try using them, with a L2H_JPGQ of 75.

There are also utilities on the web that compress images to the maximum, letting you see the effects while doing it.

9.20.16 Ghosting around my formulae

Note: Much of what is in this section is outdated. For current software and its usage instructions go to either or In particular, the l2h menu should take care of this. And edit, not .latex2html-init.

If you change the background color from white, this is likely to happen. You need to get ghostscript to use a different background color in its anti-aliasing, by changing the pagecolor in the preamble of index.tex or in .latex2html-init (set WHITE_BACKGROUND to 0 and the LATEX_COLOR to appropriate RGB fractions.) (The .latex2html-init file is hidden on Unix.)

Delete the bad images and remake.

9.20.17 Erroneous space before inline math

If you have inline math with inline math inside it (like in a mbox), latex2html puts a comment in front of it that introduces an additional space.

To fix that, go into the latex2html script. Inside sub replace_verbatim_marks, find

$tmp.(($tmp =~/\n\s*$/s)? '':"\n")!eg;
Get rid of the \n inside the double quotes.

9.20.18 Missing added whitespace, maybe in eqnarrays

At the image state, there is no way for LATEX2HTML to know about whitespace that extends beyond the area with ink on it. Ignore it, rewrite it not to have leading or trailing whitespace, or if it is a real problem, put a tiny dot (ruler) in front or behind the whitespace to extend the area with ink on it.

9.20.19 Missing lines in formula on Firefox/Mozilla

A browser problem. Press refresh.

9.20.20 Incomplete or missing lines or text in figures

This is really a Ghostscript problem. Ghostscript does not anti-alias embedded bit maps in the postscript files it processes. Delete the bad gif file. Inside the figure environment of the bad figure, put the command \htmlimage{extrascale=3}{}. (Make sure that you are using the html package.) Rerun l2h or makel2h.

Unfortunately, this only works for figure environments. If you are using displaymath to force a figure in a given place (What is this with LATEX changing [h] into [ht]?? If a user with a brain says [h], some stupid program with none should not second-guess that), you will need to use figures and strategically placed \newpage commands instead. Or use the float package and specify the figure location as “[H]”.

9.20.21 I changed the latex of a figure/formula and it is not remade

The first step is to press “Refresh” or “Reload” on your browser, to check that you are really see the latest version and not a cache one. Also, in Mozilla, use “Edit” / “Preferences” / click on the plus sign in front of “Advanced”, select “Cache”, and select “Every time I view the page”.

The following problem no longer exists for versions of LATEX2HTML-FU downloaded after Sep. 20, 2007. For older version only: Unfortunately, LATEX2HTML is not very observant about changes in figures and math. Just delete the image (use “Properties” or “View Image” in your browser to find its name). It will be remade according to the new latex code next application of l2h or makel2h.

9.20.22 Figures and/or formulae are all mixed up

The first step is to press “Refresh” or “Reload” on your browser, to check that you are really see the latest version and not a cache one. Also, in Mozilla, use “Edit” / “Preferences” / click on the plus sign in front of “Advanced”, select “Cache”, and select “Every time I view the page”.

Sometimes, latex2html gets all mixed up about what image goes where. The only thing to do then is clrl2h all (keep the user-modifiable files!) and start from scratch.

The following problem no longer exists for versions of LATEX2HTML-FU downloaded after Sep. 20, 2007. For older version only: Two formula or figures starting with the same long LATEX string may be considered equal even though the LATEX is eventually different. Put a \strut at the start of one of the formulae to make them different.

9.20.23 Bars below or to the left of images

Pestilential critters.

If a sidebar occurs for a figure or formulae in which you do tricky things like lowering and raising items, or where you write outside of bounds in a picture, putting a suitably sized \rule[..]{..}{0pt} strut at the start may help. The idea is to make the formatter recognize what the size of the image really is.

I had a sidebar in a big makeimage that could be fixed by moving a renew of arraystretch outside, in front, of it.

Otherwise, make sure you have the latest and greatest version of the alignment bar fixes, posted Sep 8, 2006 or later.

If so, to have me fix this, e-mail me the corresponding:

To try to fix it yourself, edit C:\l2hsup\doc\l2hcrop.f and try increasing the barthb and barths values a unit. Recompile l2hcrop with g77 according to instructions in the file.

Make sure, in l2h.log, that GraphicsAlphaBits is not used by Ghostscript in processing the images.

9.20.24 Incorrect figure numbers

See section 9.12

9.20.25 A caption has become part of the image

Do not use two captions in the same figure environment. Use two figure environments. Or combine the two captions into one.

If you use an optional argument to the caption, make sure there is no linebreak between the ] and the {. Or the caption will become part of the image, probably with an incorrect figure number. Try to keep math out, and try to avoid captions with the same text save for the math. If the caption involves (even implicitly) \html or \latexhtml commands, the correct figure number may not be found.

9.20.26 Text has become part of the image

It will. To avoid this, put the text in a caption, and use \addtocounter{figure}{-1} in front of the figure environment.

Or live with the text being graphics.

You may be able to play around with the makeimage command described in the LATEX2HTML manual.

9.20.27 Images not correctly aligned in Explorer

This issue is obsolete. Using the “e” browser, Internet Explorer changes the vertical positioning of inline images if there are other images in the same line. Since that depends on the browser width setting, there is nothing LATEX2HTML can do.

However, nowadays L2H_BROWSER is by default “a”, which has little alignment error. Switching to “x” may improve alignment even more.

9.20.28 I do not know how to include my figure in latex

The best way to include figures is as .eps files, typically using the epsf package. Unfortunately, much graphics software does not, or not correctly, produce .eps files. Use your netpbm files to convert from the existing picture format to .pnm, and then to eps.

If your figure is a Windows .bmp, as produced by MS Paint, you can use C:\l2hsup\bmptoeps. (It will tell you how to use it when called.)

If latex processes the figure correctly, consider using dvips to create an eps file of it, by putting the figure by itself on a page with an empty page style. Use the -p and -n options of dvips to select the page.

9.20.29 How do I move figures to the side of the web page?

Inside the figure environment, use a command like

\htmlimage{align=left}{}                (normal image, left aligned)
\htmlimage{thumbnail=0.5,align=right}{} (thumbnail of the image, at the right)
Be sure to use lower case.

Put the figure at a place where there is some following text to flow around it, not right at the end of the web page.

9.20.30 How do I include animations and rollovers?

Use the “rawhtml” environment. Quantum Mechanics for Engineers has examples of animations, activated by a roll-over, in the sections on wave packets and following (search for “animation”).

(The animation themselves were made using a Fortran program to generate the curve data, a plotting program to convert them into postscript curves, the netpbm libraries to convert them into pnm, l2hcrop.exe to crop them to the frame, l2hcomp.exe to compress them in size, ppmquant to reduce the colors to 256, netpbm to convert them into gifs, and “gifsicle” to combine them into a moving gif. But all that has nothing to do with LATEX2HTML.)

The navigation panels are not readily modified to include rollovers. You would have to go into the perl, I think.

9.21 Lists

9.21.1 general

If you try to customize lists such as itemize, enumerate, and list, maybe decrease the font size of the entire list or so, you will find it does not work. While you are encapsulating the list in your font size or whatever, LATEX2HTML unencapsulates the list just as quickly. This is obviously deliberately, though the reason is unknown.

The only solution I have is to put in the html yourself. To create quoted small, bold, italic lists in the preamble define:

<blockquote><small class="small"><b><em>
Feel free to leave out some of the blockquote, small, b, or em <...> tags if you like your tables less garish. But do not change indentation or line breaks, they must be as shown.

Then in your document, use them as:

  \item Item a.
  \item Item b.

Also LATEX2HTML may not reset counters to zero if you define a list and use it a second time. The following works:

% questions list environment
{\setcounter{enumiv}{0}\listbeg\centerline{\bf #1 Review Questions}
 \begin{list}{{\bf \arabic{enumiv}}}{\usecounter{enumiv}
 \settowidth{\labelwidth}{{\bf 99}}
Note the explicitly added \setcounter{enumiv}{0} before the list.

9.21.2 Counters

If you define new counters, LATEX2HTML puts their definition twice in the images.tex file, leading to nasty error messages. It will not hurt anything, but if it drives you crazy like it does me, don't define new counters but simply use enumiv.

9.21.3 Description environments

In description environments, the index key is put in bold case just like in LATEX, but on a line by itself. If you do not like that, you can enter the following HTML style information using the rawhtml environment:

<STYLE TYPE='text/css'>
DT {float: left; margin: 0px 0px 0px 0px}
DD {margin: 0px 0px 0px 45px}
If you put this in your index.css file instead, leave out the two STYLE lines. Do note that this will mess up your index unless you use the short_index option. The margins are in order top, right, bottom, left.

9.21.4 Keys on separate lines in bibliography, index lists

The item keys in the bibliography and index are by default put in separate lines. To fix, use the short_index option and redefine the style of the HTML DT element as described in the previous subsubsection.

9.21.5 Adding blank lines in enumerate environments

To automatically add blank lines 25 px high in the HTML enumerate environments, you can enter the following HTML style information using the rawhtml environment:

<STYLE TYPE='text/css'>
OL LI {margin: 0px 0px 25px 0px}
If you put this in your index.css file instead, leave out the two STYLE lines. The margins are in order top, right, bottom, left.

It may be noted that LATEX2HTML seems to respect blank lines between entries put in the list environment, but not the enumerate one. In any case, try that first.

9.22 How do I change the navigation icons

Note: Much of what is in this section is outdated. For current software and its usage instructions go to either or In particular, use the second l2h menu to change the icons. Create a theme to make the icons generally available. Do not edit .latex2html-init, edit

Use C:\l2hsup\giftobmp next to turn the “next” icon next.gif into bitmap next.bmp. Load that in MS Paint and edit away. (If you change the icon size using attributes, you must also edit the .latex2html-init file to put in the new size; the .latex2html-init file is hidden on Unix.)

After completion, use C:\l2hsup\bmptogif next FFFFFF to convert back, making the color white
(FFFFFF) transparent.

It is not a good idea to use “New” in MS Paint instead of C:\l2hsup\giftobmp, since Paint will mess up your colors on saving.

To make changed icons available to all future documents, use the DOS commands

cd \l2hsup
xcopy iconsby myicons
and answer “D” when prompted. Now edit the icons in subfolder “myicons” of folder “l2hsup” at will. They can be included in future documents by editing .latex2html-init in subfolder “files” of folder “l2hsup”. (The .latex2html-init file is hidden on Unix.)

9.23 How do I add my logo?

Note: Much of what is in this section is outdated. For current software and its usage instructions go to either or In particular, you must edit, not .latex2html-init. And you can insert your image directly from index.tex.

The easiest is to do it with the wiz. Also use it to change the bar colors to match your logo. But if you need special customizations, here is the manual process.

Edit file .latex2html-init, (hidden on Unix), in the files subdirectory of the l2hsup directory and locate the line

This line exists at two locations; the first is for the header, the second for the footer. Immediately behind the line, add a line
"<TD COLSPAN=3 ALIGN=\"aaa\"><IMG SRC=\"uuu\"></TD></TR><TR>\n" .
substituting for “aaa” the desired alignment, left, middle, or right, and substituting for “uuu” the url of the image, e.g, mylogo.jpg. Don't forget the trailing point.

To make the logo clickable, use instead

"<TD COLSPAN=3 ALIGN=\"aaa\"><A HREF=\"ccc\"><IMG\n" .
" SRC=\"uuu\" BORDER=0></A></TD></TR><TR>" .
substituting for “ccc” the desired target url, e.g. Don't forget the trailing points.

You may need to also play around with the TD.runner colors in file index.css to get it to match your logo's text and background colors.

To make the changes retroactive for existing documents, make the same changes to .latex2html-init in the directory with the index.tex file and index.css in the directory with the web pages. Putting the image itself in the directory with the index.tex file is strongly recommended, in case somebody decides to move a centrally located image file.

9.24 How do I change the running bars?

Note: Much of what is in this section is outdated. For current software and its usage instructions go to either or In particular, you must edit, not .latex2html-init. And try the second l2h menu first.

Most changes are best made with the wiz, but here is some more.

To add a border around the bars, copy files template.html and select.html in the files subfolder of l2hsup over to the folder with your index.tex file, renaming select.html into select0.html. Edit these files and find the

TABLE tag pairs (two occurences per file). Change the border value from zero to the desired border size in pixels, say 5. Run the wiz and select “change headers and footers”. No changes need to be made, they just must be rebuild. Rerun (make)l2h.

Other changes to the HTML code can be made similarly, within reason. If the changes you make are too big for the wiz to implement, the actual code that is used is in file .latex2html-init.

If the style changes that the wiz can do are not sufficient, edit index.css (current document) and/or index.css in subfolder “files” of folder “l2hsup” (future documents) and change the values of TD.runner(b) to change bar colors, font, etcetera. Change the a.runner(b) values to change the appearance of active links in the bars. (B stands for bottom.)

Remake the web pages with (make)l2h.

9.25 Colors

Note: Much of what is in this section is outdated. For current software and its usage instructions go to either or In particular, use the second l2h menu for this.

9.25.1 How do I change the background color from white

Note: Much of what is in this section is outdated. For current software and its usage instructions go to either or In particular, you must edit, not .latex2html-init. And try the second l2h menu first.

(Without using the wiz, that is.)

Edit .latex2html-init in the folder of the current document and/or .latex2html-init in subfolder “files” of folder “l2hsup” (for future documents) and set WHITE_BACKGROUND to zero and the desired color, in RGB fractions, in LATEX_COLOR. (The .latex2html-init files are hidden on Unix.)

Also edit index.css (current document) and/or index.css in subfolder “files” of folder “l2hsup” (future documents). Put in the desired color in the BODY style.

Editing index.css and then reloading a web page in that directory is a good way to experiment with possible background colors.

Existing images not made on the correct background color should be deleted so that they can be remade on the right color, or ghosting will result.

As far as your figures are concerned, they should be at least one of the following:

Otherwise, if you rely on transparancy to change the background color, you will either end up with ghosting or with aliasing errors. The only way around that is to make the figures nontransparent, using
\htmlimage{notransparent}{} in the figure environment. This will show the background color of the figures on which they were created.

Before running l2h or makel2h, in the DOS box enter:

where 123456 is the hex specification of your background color.

9.25.2 How do I give each page a separate color

I do not know an automatic way of doing that. Given time, you could start your document with section one, in the right background color as described above. Process. Add section two to index.tex, and process giving it the right background color (ignoring that web page one will now also assume that color.) Repeat until all sections have been added. Now edit index.css and remove the background-color line from the BODY tag. Edit index.html and each node...html and change <BODY > into <BODY BGCOLOR="#CCCCCC">, where CCCCCC is the desired color of that page.

Try to ensure that images from one page are not being used on another, or they will show ghosting on the later pages. Maybe put in a small strut of varying vertical size?

To correct an error, reprocess in the color of the corrected web page and repeat the editing of the html files.

9.25.3 How do I specify colors

Note: Much of what is in this section is outdated. For current software and its usage instructions go to either or In particular, you must edit, not .latex2html-init. And try the second l2h menu first.

In LATEX's rgb model, (also used near the end in .latex2html-init,) you specify the amount of red, green, and blue, separated by commas. Each is on a scale from 0 to 1, so {0.23, 0.23, 0} is 23% red, 23% green, no blue: in other words, a dark yellow.

In HTML, and in index.css, you scale these numbers up by a factor 255, so in the example above you get 59, 59, 0. Each is then converted in a two “digit” hex number as follows: divide by 16 to find the first digit; the division remainder is the second. For example 59/16=3.68, so the first digit is 3. The second digit is 59 - 3$\times$16=11. Now the hex system takes digit 10 to be “A”, digit 11 to be “B”, etcetera, until 15 is “F”. So 59 is 3B and the full example color specification is 3B3B00.

Remember that 000000 is black (all colors off) and FFFFFF is white (all digits to the max.) Also remember that the color in html is preceeded by #, e.g. #FFFFFF for white.

9.26 I must have frames

Note: Much of what is in this section is outdated. For current software and its usage instructions go to either or In particular, selecting the original_frames theme will give frames. And you must edit, not .latex2html-init.

For your dose of prison bars, follow the example of the manual. Note that you will not see much frames unless you click on the contents or index buttons.

Use clrl2h all in the folder with your index.tex file to clean up any old web pages you may have made. Then download the .latex2html-init file, (this is a hidden file on Unix,) and the index.css file and put them in with your document. Run latex index and l2h or makel2h to process.

Frames are not compatible with the wiz. In particular, you will need to edit .latex2html-init to change colors. Font sizes and styles can still be changed with the wiz, though.

9.27 Text conversion problems

9.27.1 Incorrectly processed environments

Rewrite index.tex to use more standard LATEX. Or use the htmlonly/latexonly environment described in the manual.

9.27.2 Html package crashes while latexing index.tex

The Proceedings of the Royal Society style does not define \paragraph, causing the html package to crash. I used \newcommand{\paragraph}{\subsubsection} before loading html.

9.27.3 Addcontentsline is not supported

No. But by default the titles of starred chapters and sections are added to the contents web page, so try to make use of that. You might be able to do some tricks with \htmlonly (see the manual) too.

9.27.4 Numbering changes are ignored

This may not be as bad as it sounds. Check the output.

Otherwise, try to avoid the need to explicitly change chapter numbers or whatever.

9.27.5 Line spacing is not consistent

This happens if there are inline images, especially big ones, and more for Internet Explorer than Mozilla. It is due to the need for additional whitespace around the images to get them at the right height in the line.

Relatively small images with a vertical ink-region center about half-way the letter “a” are least susceptible.

Consider turning big inline mathematics into displaymath.

9.27.6 Lousy quotes

Use {\lq} for left quotes, {\rq} for right ones.

9.27.7 Accented characters not vertically aligned

Some accented characters are unknown to LATEX2HTML and represented by images. To get the character to align well, put it in an mbox in a math environment. For example, use $\mbox{\.p}$ instead of \.p.

9.27.8 I want different whitespace

Play around with index.css.

9.27.9 I want a different font

Note: Much of what is in this section is outdated. For current software and its usage instructions go to either or For one, you must change, not .latex2html-init. And try the second l2h menu first.

To change the font size of the current document, edit the index.css file in the directory of the web pages and set the desire body font size. Do not put a blank before “px”. You also want to change the sizes of the headings H1 through H6, captions, small and large styles, table cells, and verbatim stuff correspondingly.

In addition, edit the file .latex2html-init in the directory with the index.tex file and change the value of $MATH_SCALE_FACTOR according to the formula given there. (The .latex2html-init file is hidden on Unix.)

Delete all images in the directory with the web pages and rerun l2h or makel2h. Repeat for the web page directory of the second browser, if any, copying the index.css file over from the first.

To make the changes apply to future documents, instead edit index.css and .latex2html-init in the directory C:\l2hsup\files.

Note that if you make the font size much less than 15px, subscripts may become ink splots, and at about 8px, ordinary text becomes splots.

The vertical alignment of inline images is computed based on data for the Arial font family. If you select a body font that is very different from Arial, you might have to play games with the scaling factor used to compute font size in C:\l2h\bin\pstoimg. Alternatively, you can force the font size being passed to l2hcrop directly by setting the environment variable L2H_FONT_SIZE equal to the desired font size in px.

9.27.10 Problems with the verb command

The online manual notes that double quotes should not be used as terminators of verbs.

9.27.11 Problems with tildes

If you are using tildes in a url, you probably want to use the hthtml package instead. Documentation is in the docs directory of l2h.

The online manual notes to use \~{} to put in tildes.

9.27.12 Definitions run out of bounds

LATEX2HTML is not very strong on redefinitions. Try to contain them within an environment or within curly braces. Or just redefine the variable back to the original value after the need for the change is gone.

In general, encapsulating redefinitions within math environments or other environments send to LATEX for processing seems to keep them out of the main loop.

9.27.13 Font changes run over

The end of an environment may not end a font change as it does in LATEX. Simply put additional curly brackets around the font change and its text.

9.27.14 Math mode font changes

The online manual notes that the font change in {\LARGE $a_b$} does not work, since the surrounding text is not included in math processing. So, put it inside the math: {$\mbox{\LARGE $a_b$}$}.

9.27.15 Optional arguments in description environments

The manual notes that you may sometimes need to enclose the argument in the square brackets also with curly brackets.

9.28 Problems with the index

Note: Much of what is in this section is outdated. For current software and its usage instructions go to either or For one, you must change, not .latex2html-init.

In LATEX2HTML the index keys are sorted case-insensitive. Worse, if you have say an entry with sort key “D” followed by one with sort key “d,” the two entries end up as a single entry “d”. Since the index coding is a mess, the only solution I have is to index the second entry as, say, \index{d-@d|...}.

The short_index option, or $SHORT_INDEX = 1; in .latex2html-init, is highly recommended if you use section numbers.

You might want a blank line in front of each starting letter, (to visually separate different starting letters in the index). The standard way is to use \index{D| }. But that does not work for me, as this D is put inside an HTML DT tag even using SHORT_INDEX. I float the DT tags (labels) in my style sheet to get them on the same line as the DD data (descriptions) of description environments. However, \index{D@\HTMLcode{BR}D|...} does work. But you must of course have entries for each capital letter.

If you want an index entry refering to a sectioning title, put the index command on the same line as the sectioning command. Alternatively, end the sectioning command with a percent sign and put the index command on the next line. If you have more than one index command for the same title, make sure to put them all on the same line. Do not break this line, even using a percent sign to comment away to line break. For some reason, that does not work.

Unlike LATEX, LATEX2HTML bolds the entries in the index. That may be a problem, for example if you use bold for vectors. I also think it is ugly. If you do not like it, go into the latex2html script, find sub add_idx and remove <STRONG> and </STRONG> from the second line.

9.29 Problems with the bibliography

Ntabib's \citeindextrue does not work correctly in l2hfu and versions of l2h up to and including 1.1. This will be fixed in the next version of l2h, still to be posted at the time of writing, Sep. 1 2013.

If you want links from the bibliography entries to where they are cited in the text, note that latextohtml does not implement the hyperref package. So it does not implement its backref option. However, such links will be made using \citeindextrue when fixed.

9.30 Problems near input commands

Somehow, LATEX2HTML confuses \input{...} with \begin{...}, so make sure that your input file names do not look anything like latex environments. You will see [the start of] all your input file names show up in the "unrecognized commands" listing at the end. They will have been faithfully read, however. To cut down on the error messages, try starting each input file name with a z.

9.31 Image alignment

9.31.1 I must know about image alignment

Once upon a time, on a world far, far, away from you and me, the wise men of the entire world came together to establish how web pages should understand the words of their designers. They talked much, and thought many deep thoughts, about what the designer would mean with saying that an image should be aligned in the middle of the line, vertically speaking. And their thoughts allowed them to conclude that aligning with the middle of the line clearly should be understood to mean, aligning with the bottom of the line, rather than the middle of it. And so it was done.

But a small band of malcontents thought their browsers might grab a bigger audience if it would align the middle of images with the middle of the line, instead of its bottom. And so they did it. And so they grabbed pretty much all of the audience.

Still, not everybody was happy. A very rich, but not very bright, kid noticed that everyone was having a good time with browsers, and that he did not have any piece of the action, having been unaware that something was up earlier. He thought long about how he could get in on the action, which did not help. He designed his own browser, but it was not very good, since he did not understand well where the middle of a line is supposed to be, and people did not like it. And he became very angry and decided to use his riches to give away his browser for free. He hired thugs to ensure that even people who did not want his browser got one for free or by force. And he paid for vast amounts of web pages to be created with poor formatting. This was really pretty clever, if you think of it, since while it did not improve his browser's appearance, it made other browsers look bad too. So people no longer bothered with the browsers that were not free.

And in this way the rich little kid made web pages mediocre for everyone with his browser, which was a pretty good feeling. But it got pretty boring soon, so the rich little kid went on to spread mediocrity elsewhere.

And new, more interesting browsers were then created by people who still liked their images to be centered in the middle of the line. And some poor kids got all excited about improving the new browsers. And one of them noticed the words the wise men had spoken many years ago. She saw it all. “Aligning images in the middle of the line means aligning them to the bottom of the line!”, she exclaimed to her friends, “The wise men have decreed it!”

And so it came about that half a score of years after the wise men had spoken, their words of wisdom were finally heard and adhered to. And it was established all over that world that the middle is the bottom. Just like for people.

9.31.2 I mean, of course, understand all those browsers

Ahem. I now see what you mean. Since the capabilties of HTML, even its derivatives, in producing good math formulae, are abysmal, LATEX2HTML uses LATEX to create proper formulae, and then converts them to images. A great idea, but of course, those images have to be put in the right place in the web page. No big deal if they are displayed formulae, but tricky if the math appears in the middle of a sentence. Horizontally speaking, it is still not much of a problem; browsers simply put them in the place whereLATEX2HTML says to put them.

The difficulty is the vertical position of the image compared to the surrounding line. For a math symbol such as $\alpha$ this is not much of a problem; when properly directed, the browser will align the bottom of $\alpha$ with the bottom of the line. Or rather, with the “baseline”; the bottom of letters such as a, b, and c, that don't have appendages sticking down. Definitely, bottom alignment with the baseline is not a problem. (Except under some conditions for Internet Explorer, which is another story.)

While $\alpha$ is OK, where should the browser put an image of the letter $\beta$, descending below the baseline? The browser does not understand the meaning of the image, and so has no clue what part of it should be at the height of the baseline if it is not the bottom. The original LATEX2HTML cleverly solved this conundrum by adding enough blank space so that if the image is properly centered vertically (instead of bottom-aligned), the image will be at the right height in the line.

Unfortunately, browsers do not manage to properly center images vertically in the line. The way to do it was specified in international standards, but they were ignored by all browsers I have seen.

My own initial take on the matter was that of a realist; I just measured where the various leading browsers did put the image vertically, and then sized the image so that it would end up at about the right height. Which was a significant improvement.

Yet there was a difficulty. The practical standard of where to vertically center images was set by Mosaic and Netscape. Yet, when Microsoft entered the browser market with Internet Explorer, they did not just ignore the internationally agrred upon standards, like everyone else, they also ignored the reigning standard established by Mosaic and Netscape. I have the suspicion that the real reason was that the Microsoft software designers did not really know where the baselines of their lines were. It appears that they only kept track of where the overall highest and lowest points in their lines were, and that they averaged the two to get some sort of approximate “baseline”. Of course, for very large images, the highest and lowest points are the image itself, and those images are aligned with their own center, a singular problem that led Mircrosoft to a “baseline” that is the center of the image. Gee, just like the international standard stipulate! Unfortunately, this is only true for very large images. Realistically, if the image is at the right height in Internet Explorer, it is not in Mosaic, Netscape, Mozilla, or Firefox, and vice versa.

So I set things to create middle-aligned images of two different sizes, one for Explorer, and one for the rest of the world. Not ideal, but it seemed the best I could do. Then Firefox 1.5 threw a monkey wrench into that idea too, by deciding out-of-the-blue to suddenly follow the international standards. A good idea, but much, much, too late in my view. I had now ended up with the need of sizing math images three different ways.

It got me to think about style sheet alignment. Style sheets are a later development in HTML, specifying in greater detail the visual appearance of web pages. In other words, style sheets appeared when browser designers might have developed a vague clue what was going on and might have gotten some of it right. And indeed, it turns out that style sheet alignment is much more uniform among browsers than the normal version. Enough to create a single size of images and have them OK for all browsers.

In fact, the international standard for style sheet aligment is very clear: the center of the image must be aligned with the center of the lower case letter “x”. True, Internet Explorer thinks the middle of the letter x is two third of the way up, instead of where the lines cross; they probably got confused with the capital letter X. But still, the differences between browsers remain small if you average them. So, I switched back to one type of images for all, though you can still generate the other versions if you want alignment to be more precise.

9.31.3 So, how about all those browsers??

Note: Much of what is in this section is outdated. For current software and its usage instructions go to either or In particular, only the a-style is currently still supported.

Right. So, as explained in the last section, optimal vertical alignment of math images requires different size images for different browsers. The following sizings are available:

(Mosaic) Math images are sized to properly align vertically when viewed in Mosaic, Netscape, Mozilla, and early-version Firefox browsers. Their market share is small, except maybe early Firefox.

(Explorer, obsolete) Math images are sized to properly align vertically when viewed in Internet Explorer, but only if they are the only image in the line. If there is, say, a big bottom-aligned image in the same line, the image will hover way above the line it is supposed to be part of. Remember what I told you the previous subsubsection? Explorer takes the baseline as the middle between the highest and the lowest point of the line (without putting the text there.) A big image can raise that way up. For that reason, the “e” alignment is obsolete. If you have to size for explorer, use the advanced (a) or explorer (x) style sheet alignments below.

(Correct) Math images are sized for their middle to align with the baseline. This is how it should be. But only late versions of Firefox do it. (1.0 does not, 1.5 does.)

(Generic, obsolete) Used to be an average of m and e, now an average of c and e.

(Advanced) This is a style-sheet based alignment. Reasonably accurate for most browsers. At the default font size of 15 pixels, more accurate for Internet Explorer than x below! In general, an average of x and f below, with an alignment that is not likely to be much more than a pixel too high or low for whatever browser.

(Explorer) This is also an style-sheet based alignment, but optimized for Internet Explorer. Note that IE seems to perform all alignment computations in integer arithmetic, producing large rounding errors (frequently, when the font size goes up, the center of the line goes down according to IE.)

(Firefox) Another style-sheet alignment. This one optimized for the Mosaic/ Netscape/ Mozilla/ Firefox line. Works better at the default font size of 15 pixels than a. Unfortunately, browsers in this line have a random variation of about a pixel in vertical image alignment that cannot be removed.