pdflatex document to html

2.8k Views Asked by At

I need to convert a bunch of pdflatex only documents (because of graphics-- .pdf's jpgs & pngs) to html. tex4ht is giving a bunch of garbage output. the documents are built using the \input command. Is there anything I can do to help tex4ht with a pdflatex document? I've looked at many converters (pandoc, hevea, tth, latex2rtf) but none of them can include my figures well. Is tex4ht my best bet?

4

There are 4 best solutions below

0
On BEST ANSWER

You can write macros that use tex4ht's \HCode to redefine \includegraphics (or whatever) so that they emit the appropriate html code.

2
On

Converting from LaTeX to html is tricky and not well documented in my opinion. Have you taken a look at Texmaker at http://www.xm1math.net/texmaker/ ? It's free and it offers an integrated LaTeX to html conversion tool.

0
On

I use tex2html, which I like better than latex2html. It seems to work pretty well.

0
On

The sl2h program that ships with noweb is a terrible hack (I wouldn't wish it on my worst enemy), but you can do this job with it. I have used it to prepare handouts for my classes. If you find yourself in extremis you can use horrible tricks like this:

\ifhtml
  \begin{center}
  \includegraphics{address.png}
  \end{center}
\else
  \begin{center}
  \includegraphics[scale=0.5]{address.eps}
  \end{center}
\fi

(As you can probably tell, I don't use pdflatex; I use plain latex.) But hacks like this work, and the figures do get included. I think they would all have to be PNG or JPEG, however; I'm pretty sure that sl2h does not know how to convert a PDF figure to an image for a web page.)