[l2h] Interaction with pdf-TeX
Chris Fox
foxcj at essex.ac.uk
Wed Aug 6 19:11:40 CEST 2003
On Thu, Jul 31, 2003 at 04:42:40PM -0800, Herb W. Swan wrote:
>
> It is apparent from looking at html.sty that various
> latex2html commands are implemented differently, depending
> on whether pdf-TeX is in use or not. Yet I see no mention
> of pdf-TeX in any of the latex2html documentation.
>
> It would be nice if some of my internal and external
> hyperlinks could make it into my final pdf document.
> (Pdf is a preferable to postscript as the final form
> of the written document, since it more universally
> readable.) Has this already been implemented?
>
> To what extent are latex2html and pdf-TeX compatible?
> Would I be able to insert my figures into my final
> pdf file if I used pdf-TeX in conjunction with
> latex2html?
I frequently produce HTML and hyperlinked PDF output from the same
document sources, using latex2html for HTML output, and pdflatex or
latex->dvips->ps2pdf for PDF output. If you include figures in the
usual latex manner (e.g. with the graphicx package), and let
latex2html take care of the details, then there are few problems in
producing PDF and HTML output that contain figures. If you include
graphical elements in the latex2html output using raw HTML, or other
tricks, then you may have to do a bit more work, using conditions in
the source to use different code for the HTML and PDF output.
Your latex source document should uses the html package for the
commands that give hyperlinks under latex2html to compile under latex.
If you compile your document with pdflatex, then the html package
automatically loads the hyperref package, which allows for hyperlinks
and other things in the PDF output. Although hyperref has its own
syntax for hyperlinks, the latex2html syntax will work when both html
and hyperref packages are loaded. You may find there is an issue
getting external links to work correctly, even if you set an
appropriate path with hyperref (this could be due to an acroread bug).
Whether this is a problem for you may depend on how you make your
documents available, and how they are viewed (e.g. with a browser
plugin over http, or using a stand-alone program and the local file
system).
If you use the graphicx package to include figures (and you leave off
the filename extension for files containing the graphics), then when
compiling with ordinary latex, the package will look for files with
the extension .eps (encapsulated postscript), to be included by an
appropriate postscript driver (e.g. dvips), and under pdflatex it will
look for .(e)pdf (encapsulated PDF). If you are compiling postscript
and PDF output, you just need to make epdf versions of all your eps
files (there are ghostscript tools for this). LaTeX2html will
typically generate a GIF or PNG image for you.
If you have hyperlink aware versions of dvips or similar, you will
find that you can also produce hyperlinked PDF output even when going
via postscript (using ps2pdf for the final conversion step). In this
case you will have to explicitly load the "hyperref" package in your
latex source, as the "html" package may not know that it should load
it. Going this way, you might have to include an option an option to
hyperref, such as \usepackage[dvips]{hyperref}. Also, if you use
bitmapped fonts in your postscript (such as the original Computer
Modern, as rendered by MetaFont) the resultant PDF will look terrible
on screen and will not be searchable. Adding appropriate lines to
.dvipsrc, such as
p +psfonts.cmz
p +psfonts.amz
can fix this, if you have the appropriate type 1 fonts installed
(assuming you are using dvips).
You may find that the page dimensions of the PDF come out slightly
different depending on whether you use pdflatex or the latex, dvips,
ps2pdf combination, and depending on which versions of these programs
you are using, and how they have been configured. This can be
particularly irritating if your landscape document suddenly appears as
a portrait PDF. Passing appropriate options to dvips can fix the worst
of this.
There are also tools that will produce PDF from your DVI output (such
as dvipdf, which just wraps up the dvips and ps2pdf steps, and dvipdfm).
If you find you are getting strange results when producing PDF, do
first check that you are using a recent LaTeX distribution with recent
versions of the relevant packages and tools; there have been
significant improvements in this area in recent years.
Hope this helps,
Chris
--
Dr Chris Fox Email: foxcj at essex.ac.uk
Department of Computer Science Web: FoxEarth.org/chris/
University of Essex Tel: +44 (0)1206 87 2576
Colchester CO4 3SQ, United Kingdom Fax: +44 (0)870 054 7770
More information about the latex2html
mailing list