Home > latex > Produce one single HTML page with latex2html

Produce one single HTML page with latex2html


With latex2html you can convert a LaTeX document to a bunch of HTML files. However, by default latex2html generates one HTML for each subparagraph. How to produce less files, one per chapter for instance? Or how to produce one single HTML?


The behaviour of latex2html can be controlled with the file “.latex2html-init“. Type “locate .latex2html-init” to find a template that you can customize. On my machine I found a file called “dot.latex2html-init” that I had to rename:

$ locate .latex2html-init
$ cp /usr/share/latex2html/dot.latex2html-init .
$ mv dot.latex2html-init .latex2html-init

Copy this file next to your latex source and execute “latex2html source.tex”.

If you want less HTML files, this is the variable you need:

$MAX_SPLIT_DEPTH = 8;   # Stop making separate files at this depth

Set its value to 1 to have one file, 2 to have a page by “Part”, 3 by “Chapter”, etc.


With latex2html I had some small problems and I didn’t find a solution for all of them. For instance, the generated pages look good via the file: protocol but if I put them on-line, they look different. It’s as if CSS were not loaded properly. A typical example is the navigational header that gets broken.

Another thing: latex2html puts a link on “crossref.png” with the file: protocol. If you put the pages on-line, they are not loaded. So I had to replace the instances of “file:/usr/share/latex2html/icons/crossref.png” to “icons/crossref.png” to point to my local copy.

Summary: you can customize the behaviour of latex2html but be prepared that you’ll have to tweak a bit the end result manually.

Ref.: http://www.cnrm.meteo.fr/gmapdoc/meshtml/doc-info/latex2html/DOClatex2html/node3.html.

Categories: latex Tags: ,
  1. No comments yet.
  1. No trackbacks yet.

Leave a Reply

Please log in using one of these methods to post your comment:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out /  Change )

Google+ photo

You are commenting using your Google+ account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )


Connecting to %s

%d bloggers like this: