html2latex - HTML to latex converter.


html2latex [OPTION]... URLS...

DESCRIPTION html2latex uses HTML::TreeBuilder to parse an HTML file and then it converts the HTML::Element into to a Latex file. Each URL will have a .*html extension stripped. If you use a URL, then the files taken from the Internet will be stored in your ~/.html2latex directory. If pictures are included, they are converted to .PNG, which can only be used with pdflatex. As an added bonus, there is an option to automatically create a PDF from the Latex file (using pdflatex).


If your html2latex is not working correctly, this may be because you do not have many of the needed packages. html2latex requires HTML::TreeBuilder perhaps LWP::Simple and URI. If you do not have either of these, try typing perl -MCPAN -e shell at the command line. This will bring up a shell for CPAN (The Comprehensive Perl Archive Network). Then, as root try typing install HTML::TreeBuilder. Should work like magic.


In your list of URLs any filename given after a URL will continue to use the latest HOST given. Also, files default to index.html, regardless of what the server thinks. So, if you type:

html2latex foo.html bar.html

html2latex will try to grab,,, and


Options are secondary to document-specified options. So, if your HTML file has border=1, a border will be printed regardless of the --border option. The do overide, however, options given in the configuration file. If you want to change things more permanently, try changing the config file, html2latex.xml. For information on it, try the HTML::Latex under section CONFIGURATION FILE.

-h -? --help

Print the brief help and usage.

--latex2pdf --pdf -p

Automatically create a PDF along with a latex file named FILE.pdf. This may fail and print a number of cryptic errors.

-i --image --image_scale=SCALE

Set the scale for images in the latex file. This is usefull because some images in HTML or much to big to fit on a page. Default is 1.0. SCALE can be any non-zere positive floating point number, large numbers are not reccomended.

-f --font --font_size=SIZE

Set the default font size. Can be 10-12. Do not try anything else. html2latex will not check it, but the latex file will not compile (at least I think not). Default is 12.

-d --debug

Level of debugging info to print. The more times this option is used, the higher the level. Default is 0, and you cannot lower that. Right now, 0 prints nothing. 1 prints fun code-tracking info. 2 prints lots of data-structure information, so don't do it unless you're serious.

--border --table --table_border

Sets table around borders on. Default is off. Also, --noborder or --notable will explicity turn table borders off.

--class --document --document_class=CLASS

Set the documentclass to use. Any valid latex document class is valid. Examples are report, book, and article. article is the default. If an invalid document class is used, the output latex file will not compile.


html2latex will create a latex file using any packages that you specify. PACKAGE will be added to the list of class to put in the file. html2latex will not make sure the packages are valid, but if they aren't the latex file won't compile.

--mbox -m

With any of these, html2latex will put a tex \mbox around all of the tables it creates. I do not know why, but with a lot of tables (especially nested ones), the tex and pdf output will work better. So, if you do not like your output with tables, try this.

--paragraph --par -P

Uses HTML-style paragraphs. This is by default, so try --noparagrph or --nopar or -P! to turn it back to Latex-style paragraphs.

--cache --local
--log -l LOGFILE

Print all messages to LOGFILE instead of STDERR.

--conf -C CONFFILE

Change the configuration file to CONFFILE. For more information on this file, see the HTML::Latex manpage.


Development is being carried out by Peter Thatcher ( and Stan Seibert ( Homepage is