Latex2html
From Liki
latex2html is a program designed to, well, convert LaTeX documents into html. The basic syntax is
Contents |
11pt
latex2html defaults to 11pt. Don't tell it 11pt or it will add lines to your equation pictures
Basics
latex2html document.tex
which creates a folder titled 'document' in which the html can be found. Equations are first rendered as ps files and then converted to png files to be displayed as web content. The program creates handy navigation menus based on whatever level of sectioning you'd like for easier online navigation, and even creates a blank css template. For the most part, the rendering is quite good, but sometimes a little manual tweeking is necessary to get things exactly how you'd like it.
Some Basic Options
The options to latex2html are vast, indicative of its long revision history. A thorough manual can be found here. We will only look at a few basic options here relating to the navigation of the document.
First, the option '-no_navigation' turns off the top navigation bar completely. This is useful if the output html spans only a single page. There are other related commands, such as '-bottom_navigation' which place the navigation bar at the bottom (default is top) and '-contents_in_navigation' to add a link to the table of contents of your document into the navigation menu.
The '-split #' option tells latex2html to stop splitting up the document into seperate files at the depth given by #, which is a number between 0 and 8. The levels are
0 document 1 part 2 chapter 3 section 4 subsection 5 subsubsection 6 paragraph 7 subparagraph 8 subsubparagraph
so that a '-split 0' puts the entire document onto one page. Related to this is the '-show_section_numbers', which is helpful when you are not breaking up a document as, usually, section numbers are supressed to encourage multiple page document creation.
Finally, the related command 'split +#" stops document splitting at # levels beyond the topmost. So if highest division your document contains is section, then 'split +2' stop splitting the document at subsubsections.
Extra Configurations
There are other configuations that are set in a configuration file rather than given as commandline parameters. The global configurations are found in the latex2html.config file in the install directory for latex2html, usually /usr/lib/latex2html. These settings are global.
Per User settings can be changed in the .latex2html-init file in a user's home directory. Each line has the form of
$VAR = value;
where the semicolon must end each line. A full list of variables can be found here, but three I will mention here are
1) $LOWER_CASE_TAGS=1 which uses lowercase html tags in the final product. This is good option to implement since html 4.0 requires lowercase tags.
2) $FIGURE_SCALE_FACTOR = number; which sets the relative scale of rendered images. The default value is 1.6.
3) $LOCAL_ICONS = 1; which creates local copies of the navigation icons in the html directory and marks up the html img urls appropriately. This is necessary for the icons to be seen on a machine that does not have the icons locally (since the default is to link to the copies in /usr/local...) which includes all windows machines.
Black underlines with inline equations
Black lines appear underneath equations created inline with the $ command. This turns out to be a bug in the latex2html package that can easily be fixed with a quick hack. For a single user, WTK finds:
I did have to add
$DVIPSOPT = ' -E'; # remove -Ppdf flag
to my ~/.latex2html-init file following Julius Smith.
However, for those of us with root access, the following is a global hack-fix (i.e. it will fix the problem for all users):
In your file /usr/share/latex2html/l2hconf.pm replaced the line
$DVIPSOPT = ' -Ppdf -E';
with
$DVIPSOPT = ' -E';
The " -Ppdf" option supposedly does some extra formatting steps to optimize the output for pdf printing, but it ends up confusing latex2html in missing an entire row of pixels. It is non-essential and removing this option eliminates the problem. There are better fixes, see for details, that are more involved; but for those of us who regularly update our systems, or at least update latex2html whenever our distro has an update available, this hack-fix works just fine in the hopes that our distro will pick up and fix this bug on the next update of latex2html (in which case the more detailed fixes will have been over-written anyway).
Inline Equation Cropping Problems
Note: most version of linux include latex2hml packages in which this solution no longer applies; please try the above fix first. See WTK's note:
WTK: I didn't have to edit my pstoimg script. My version info is
$ pstoimg --version pstoimg (Revision 1.19, perl 5.008008), part of LaTeX2HTML Release V2002-2-1.
There is a problem with inline equations sometimes being badly cropped, causing them to hover quite above the baseline in the displayed html. The actual problem is not with latexhtml itself, but rather the program pstoimg which is a perl script that handles the ps->png conversion (it's probably in /usr/bin. If not, do 'which pstoimg'). For some reason there are alternating, black and white bars that appear at the bottom of some of the intermediate images, resulting in the bad crop. The (hack) work around is to edit line 1137 (at least that was the line in the version I had - your version may vary - look around this line number) of the pstoimg script from
$cmd .= "| $PNMCROP $croparg";
to
$cmd .= "| $PNMCROP $croparg | $PNMCROP | $PNMCROP -black | $PNMCROP";
which adds extra calls to the cropping function (pnmcrop is the default) to remove the offending lines. Note that you must be root to edit this script.
This should eliminate the bulk of the cropping issues encountered and, inparticular, make your inline equations look decent.
However, if you have equations in tables there will still be some irregularities due to the fact that html doesn't really have any clue about baselines, as TeX does, when typesetting. These further irregularities must be smoothed out by hand, unfortunately. In the end, there doesn't seem to be a perfect solution to this problem. If you have one, though, please post it here!
For example, in Fedora we edit /usr/bin/pstoimg and make the following change about halfway down:
if($cmd) {
# Continue command pipe
# $cmd .= "| $PNMCROP $croparg";
#################HACK################################
$cmd .= "| $PNMCROP $croparg | $PNMCROP | $PNMCROP -black | $PNMCROP";
} else {
# start new pipe
$cmd = "$PNMCROP $croparg< $in ";
}
} # end cropping
Grey backgrounds on some equations
Following Alex Barnett, just limit yourself to white backgrounded, opaque images (sigh) by adding
# Force white background and black text
$BODYTEXT = "text=\"\#000000\" bgcolor=\"\#FFFFFF\"";
# This ensures that some figures do not end up with a grey background
$WHITE_BACKGROUND = 1;
# Tell LATEX:
$LATEX_COLOR = "\\pagecolor{white}";
to your ~/.latex2html-init file.
It's possible that you could code in a different solid color, but I haven't played with that yet.
Examples
If you do something cool with latex2html, put a link here :)
- cantilever calibration: fancy footer with links to source code, .latex2html-init, and pdf version.
Quick Links
- Jose Manchini Berita Unik Berita Hari Ini Berita Terkini my trans
manfaat madu manfaat internet pengertian internet edit foto online manfaat minyak zaitun hari valentine 17 tahun video 17 tahun
sms lucu sms lucu gokil sms cinta romantis sms selamat malam sms selamat malam romantis sms ungkapan cinta sms ungkapan rasa cinta sms selamat malam lucu sms selamat ulang tahun sms patah hati sms sakit hati kata cinta sedih kumpulan sms gokil waptrick trans 7 online rcti online sctv online mnc tv online indosiar online tv online indonesia

