TIPS FOR CONVERSION FROM LATEX TO HTML
latex2html | tth | hevea
latex2html
You can download latex2html from https://www.latex2html.org/.
Run
latex2html -split 0 -show_section_numbers -local_icons -no_navigation foo.tex
Then edit the HTML a little bit. For example, the internal links
to the tables and the table numbers don't always come out properly.
Joseph Lorenzo Hall adds that the Mac version tends to eliminate spaces after footnotes. You can fix this with a sed command:
sed 's/<\/SUP><\/A>/<\/SUP><\/A> /g' < index.html > index2.html
(Then mv index2.html index.html.)
Joe Hall also graciously offers his Makefile, which should require very little editing.
Dan Tsafrir points out that you may need to edit /etc/latex2html.conf:
- To deal with the problem of underlined math formulas (which occurs with recent TeX versions), replace
$DVIPSOPT = ' -Ppdf -E';
with
$DVIPSOPT = ' -E';
- To eliminate the ugly gray background of figures that messes up transparency, replace
$LATEX_COLOR = "\\pagecolor[gray]{.7}";
with
$LATEX_COLOR = "";
Navendu Jain offers some additional tips:
- In $HOME_DIR/.latex2html-init or /.latex2html-init
Set $DVIPSOPT =''; # setting ='-E' option doesn't always work
Set $LATEX_COLOR = ""; # to remove gray image backgrounds
- latex2html doesn't support "ifthen" package. However, if the boolean conditions to \ifthenelse are content-independent i.e., specified once in the LaTex header file (e.g., a techreport flag), then a simple fix is to:
Define a new command in the header file: e.g.,
\newcommand{\ifthenelsetr}[2]{#2}
# assuming text in the first argument text goes to tech report
# and the second to the camera-ready version
Do global string replacement of (e.g., using :argdo %s vim commands)
\ifthenelse{\boolean{tr}} --> \ifthenelsetr
tth
A site for tth is https://hutchinson.belmont.ma.us/tth/.
These instructions, from an author who gave up on latex2html, have worked well for a number of people:
|
cat foo-head.html > foo.html |
|
cat foo.tex | tth -r -Lfoo -e2 | grep -v '\<title\>' >> foo.html |
|
cat foo-tail.html>> foo.html |
|
# knowingly overwrite the version generated by tth |
|
>eps2png -png -output extattrfile.png extattrfile.eps |
I.e., rely on tth for most aspects of the conversion, including inlining
the images, but strip the <title> and prepend/append your own headers and
footers to set background color to white, provide a cleaner title, etc.
Then regenerate the png at a slightly nicer resolution (82 dpi).
hevea
A site for hevea is https://pauillac.inria.fr/~maranget/hevea/index.html.
It runs very fast and generates good html.
However, the figures have to be converted by hand
to jpgs or pngs and included.
Caveat: If you declare the \title & \author sections after \begin{document}, hevea may drop them from the html output. But if you declare them before \begin{document} (in the preamble), it works fine. (Tip courtesy Mike Kasick)
|