[l2h] hyperref

Ross Moore ross@ics.mq.edu.au
Sat, 20 Oct 2001 06:58:15 +1000 (EST)

> I have been using the hyperref package to put links to external docs
> into my latex.  This puts \specials in that, when viewed with a modern
> dvi viewer, will follow the links to the specified URLS, and will also
> work when used with pdflatex and acroread.

> It doesn't look like latex2html is quite setup for this.  I see lots
> of options for putting in links (probably too many!), but none that
> seem to be designed to work when converting to dvi or pdf.

It is not the job of LaTeX2HTML to put in \special commands.
LaTeX2HTML interprets the high-level coding of LaTeX markup,
to understand the intention of the markup. This is then translated
to the HTML that will achieve the desired effect in a web-browser,
when it is possible to do so in a relativele straight-forward manner.

There has been compatibility between hyperref and LaTeX2HTML for
many years:

Always load the html package, when using LaTeX2HTML.
It should be one of the first packages to be loaded.

With  \usepackage{html}  and the engine is  pdfTeX, (via pdflatex)
then  hyperref is loaded automatically, with some select options.
(Other options can be invoked using \hypersetup  commmands.)

Similarly, if you are running a LaTeX job with hyperref, then
the standard commands from html.sty are already recognised:
  \htmladdnormallink, \htmlref, \htmladdnormallinkfoot, etc.
These are interpreted in terms of the different variants of \href .

Thus you can easily write documents that interpret well with
both LaTeX2HTML and pdflatex (or any LaTeX + hyperref).
With such documents it's more convenient to use the LaTeX2HTML
commands for hyperlinks, rather than \href .

I've been doing this for many years now; especially with my
mathematics notes/exercises/study-guides, etc.
See e.g.
and follow the links to course materials.
All of it is done using standard TeX tools.
(The directories are open; the sources have the obvious names.)

The only conflict is that html and hyperref both have a command
name \hyperref . The syntax differs in the two versions.
Indeed hyperref has two distinct syntaxes for \hyperref,
using different numbers of arguments and options.
To help resolve this problem, the package  html.sty  defines
an optional argument  \hyperref[html]  or  \hyperref[hyper]
that lets you specify which syntax is being used.
Other options are available, such as \hyperref[page], \hyperref[noref], ..
to give even more control on what information should be printed
and how the link should be constructed.

The whole structure is described in  The LaTeX Web Companion
 (Addison-Wesley, 1999, 2000) and 2001 (German),
as well as comments in the file  html.sty and in the LaTeX2HTML manual.

> I guess it shouldn't be very hard to combined the \htmladdnormallink
> with the \href function of hyperref.

In fact \href has ambiguous syntax too.
So it's better to use LaTeX2HTML's syntax for links,
or use conditional definitions:



then use the macros in your document body.
(You should be doing this anyway, for clearer manuscripts
that are easier to maintain, as URLs change.)

Hope this helps,

	Ross Moore

> _______________________________________________
> latex2html mailing list
> latex2html@tug.org
> http://tug.org/mailman/listinfo/latex2html