LaTeX2HTML: Publish Science to the Web
Ironically, 20 years after the advent of the World Wide Web, it is still a struggle to publish math-intensive scientific documents on the Web. New standards like MathML have been out, but before the popular web browsers support them, the best way to reach a maximum audience is still to put math formulae as in-line graphics in HTML documents.
In the off-line world, TeX/LaTeX packages are known to produce the best formatted scientific documents. LaTeX is, in fact, a standard format for many academic journals. For scientists and researchers, the best of two worlds is to write in LaTeX and then publish on the Web. LaTeX2HTML is the perfect tool for that.
LaTeX2HTML originally was written by Nikos Drakos in 1993 as an open-source project. It was improved and enhanced by many members of the Open Source community. LaTeX2HTML converts LaTeX documents to standard HTML format. Since HTML is a text format, it converts all the nontext elements into in-line graphics. It is a Perl application and runs on many platforms including most flavors of UNIX/Linux and Windows.
In this article, I first give an example of how to convert a simple LaTeX document to HTML and discuss how the program handles in-line graphics and style files. I then explain the LaTeX2HTML-specific LaTeX commands/environments. Finally, I discuss a more creative use of LaTeX2HTML—using it on the server side. For simplicity, the term formula refers to anything that is in LaTeX's math mode. That includes simple in-text math symbols, “displaymath” formulae and numbered equations.
The usage of the command is very straightforward. If you want to publish your LaTeX document, mydoc.tex, to the Web, you run
latex2html -local_icons mydoc.tex
LaTeX2HTML creates a new subdirectory (mydoc/) and puts all HTML files and image files in it. You can now copy mydoc/ under the document tree of your web server, and your document is available at http://yourserver/path/mydoc/index.html.
The title, headings and emphasized text are marked up properly with HTML tags. All the formulae/tables/figures and anything that normal HTML cannot display are converted into in-line graphics.
If mydoc.tex has several sections/subsections, LaTeX2HTML generates an HTML file for each section and a table of contents with links to each section. Each page has a navigation bar with links to next/prev sections and the table of contents. If you want only one big HTML file, use the -split 0 command-line switch.
LaTeX2HTML needs to know where to find the icon images on the navigation bar. The simplest solution is to use the -local_icons command-line switch, which instructs LaTeX2HTML to copy the navigation icons into the directory mydoc/. You also can use custom navigation icons by replacing mydoc/*motif*.gif files with your own.
I use math formulae as an example to explain how LaTeX2HTML handles in-line graphics. It does the same thing for floating objects such as figures and tables.
LaTeX2HTML scans through mydoc.tex and extracts all math formulae into a file called images.tex. In images.tex, each formula is on a separate page. It then calls latex images.tex and dvips -S 1 -i to generate a one-page PostScript file for each formula. Ghostscript is used to convert and resize PostScript files into GIF or PNG images. LaTeX2HTML will remember the image names and insert the links back to HTML files generated from mydoc.tex.
There are several command-line switches to control the image generation process. For example, switch ps_images instructs LaTeX2HTML to use links to external PostScript files rather than in-line graphics.
LaTeX2HTML handles style files differently for text and in-line graphics. LaTeX2HTML ignores any style file when it generates main text HTML files from mydoc.tex. However, style files often define new commands and environments that cannot be ignored. As a workaround, LaTeX2HTML allows users to rewrite the style file in Perl format. When LaTeX2HTML encounters a style file, it searches for the Perl translation and incorporates it into the main script. Fortunately, many popular style files already have been translated into Perl. To write such translations requires a working knowledge of the LaTeX2HTML internal structure. It is a difficult task, but you have the source code.
We want formulae, figures and tables to look exactly the same as they would print out on paper, with all the custom symbols, fonts and spacing. So, images.tex includes all the style files used by mydoc.tex. Since images.tex is processed by LaTeX, the style files are handled correctly.
Realizing the promise of Apache® Hadoop® requires the effective deployment of compute, memory, storage and networking to achieve optimal results. With its flexibility and multitude of options, it is easy to over or under provision the server infrastructure, resulting in poor performance and high TCO. Join us for an in depth, technical discussion with industry experts from leading Hadoop and server companies who will provide insights into the key considerations for designing and deploying an optimal Hadoop cluster.
Sponsored by AMD
Built-in forensics, incident response, and security with Red Hat Enterprise Linux 6
Every security policy provides guidance and requirements for ensuring adequate protection of information and data, as well as high-level technical and administrative security requirements for a system in a given environment. Traditionally, providing security for a system focuses on the confidentiality of the information on it. However, protecting the data integrity and system and data availability is just as important. For example, when processing United States intelligence information, there are three attributes that require protection: confidentiality, integrity, and availability.
Learn more about catching the bad guy in this free white paper.
Sponsored by DLT Solutions
| Designing Electronics with Linux | May 22, 2013 |
| Dynamic DNS—an Object Lesson in Problem Solving | May 21, 2013 |
| Using Salt Stack and Vagrant for Drupal Development | May 20, 2013 |
| Making Linux and Android Get Along (It's Not as Hard as It Sounds) | May 16, 2013 |
| Drupal Is a Framework: Why Everyone Needs to Understand This | May 15, 2013 |
| Home, My Backup Data Center | May 13, 2013 |
- New Products
- Linux Systems Administrator
- Senior Perl Developer
- Technical Support Rep
- UX Designer
- Web & UI Developer (JavaScript & j Query)
- Designing Electronics with Linux
- Dynamic DNS—an Object Lesson in Problem Solving
- Using Salt Stack and Vagrant for Drupal Development
- Making Linux and Android Get Along (It's Not as Hard as It Sounds)
- Reply to comment | Linux Journal
41 min 9 sec ago - Reply to comment | Linux Journal
57 min 19 sec ago - Favorite (and easily brute-forced) pw's
2 hours 48 min ago - Have you tried Boxen? It's a
8 hours 40 min ago - seo services in india
13 hours 12 min ago - For KDE install kio-mtp
13 hours 12 min ago - Evernote is much more...
15 hours 12 min ago - Reply to comment | Linux Journal
23 hours 58 min ago - Dynamic DNS
1 day 32 min ago - Reply to comment | Linux Journal
1 day 1 hour ago
Enter to Win an Adafruit Pi Cobbler Breakout Kit for Raspberry Pi

It's Raspberry Pi month at Linux Journal. Each week in May, Adafruit will be giving away a Pi-related prize to a lucky, randomly drawn LJ reader. Winners will be announced weekly.
Fill out the fields below to enter to win this week's prize-- a Pi Cobbler Breakout Kit for Raspberry Pi.
Congratulations to our winners so far:
- 5-8-13, Pi Starter Pack: Jack Davis
- 5-15-13, Pi Model B 512MB RAM: Patrick Dunn
- 5-21-13, Prototyping Pi Plate Kit: Philip Kirby
- Next winner announced on 5-27-13!
Featured Jobs
| Linux Systems Administrator | Houston and Austin, Texas | Host Gator |
| Senior Perl Developer | Austin, Texas | Host Gator |
| Technical Support Rep | Houston and Austin, Texas | Host Gator |
| UX Designer | Austin, Texas | Host Gator |
| Web & UI Developer (JavaScript & j Query) | Austin, Texas | Host Gator |
Free Webinar: Hadoop
How to Build an Optimal Hadoop Cluster to Store and Maintain Unlimited Amounts of Data Using Microservers
Realizing the promise of Apache® Hadoop® requires the effective deployment of compute, memory, storage and networking to achieve optimal results. With its flexibility and multitude of options, it is easy to over or under provision the server infrastructure, resulting in poor performance and high TCO. Join us for an in depth, technical discussion with industry experts from leading Hadoop and server companies who will provide insights into the key considerations for designing and deploying an optimal Hadoop cluster.
Some of key questions to be discussed are:
- What is the “typical” Hadoop cluster and what should be installed on the different machine types?
- Why should you consider the typical workload patterns when making your hardware decisions?
- Are all microservers created equal for Hadoop deployments?
- How do I plan for expansion if I require more compute, memory, storage or networking?




Comments
Re: LaTeX2HTML: Publish Science to the Web
HyperLaTeX is a very good one way to do it. Much pretty one for me.
The problem are the locales , but you can use LyX to do the frame and then build a skeletton to use HyperLaTeX. Ximo