Next: Hypertext Links in Bibliographic Up: Hypertext Extensions to LATEX Previous: Conditional Text   Contents   Index

## Symbolic References shown as Hyperized Text

Subsections
In printed documents cross-references are shown through a numeric or symbolic indirection e.g. see Figure 1'' (numeric indirection), or see section Changes' '' (symbolic indirection). LATEX2HTML can mirror this mechanism using the same numeric or symbolic references, or when these are not appropriate by using iconic references.

In a hypertext document however, cross-references can be shown without any indirection, just by highlighting a relevant piece of text. This can make a document more readable as it removes unnecessary information.

#### \hyperref

A single new LATEX command \hyperref can be used for specifying how a cross-reference should appear, both in the printed document and in the hypertext version. For example, assuming that the label {sec:cond} is defined somewhere within a document, the command \hyperref, taking 4 arguments, can be used in that document as follows:
\emph{Is the concept of
\hyperref
% This will be highlighted in the hypertext version
{conditional text}                      % argument #1
% This will be shown in the printed version
% followed by a numeric reference ...
{conditional text (see Section }        % argument #2
% ... followed by this text
% This is the common label
{sec:cond}                              % argument #4
a good idea? }


Here is how it will be shown:

Is the concept of conditional text a good idea?

In the printed version what would appear is:

Is the concept of conditional text (see Section 4.2 for more information) a good idea?

97.1
An extended syntax for \hyperref uses an optional argument, which determines what information is to be placed in the LATEX version of the document. The value of this optional argument can also affect the number of required arguments. These forms are recognised:

\hyperref[ref]{<HTML-text>}{<LaTeX-text>}{<post-LaTeX>}{<label>}
\hyperref{<HTML-text>}{<LaTeX-text>}{<post-LaTeX>}{<label>}

\hyperref[pageref]{<HTML-text>}{<LaTeX-text>}{<post-LaTeX>}{<label>}
\hyperref[page]{<HTML-text>}{<LaTeX-text>}{<post-LaTeX>}{<label>}

\hyperref[noref]{<HTML-text>}{<LaTeX-text>}{<label>}
\hyperref[no]{<HTML-text>}{<LaTeX-text>}{<label>}

The first two are the defaults, where LATEX uses \ref{<label>}. With the next two LATEX uses \pageref{<label>}, while with the final two LATEX completely ignores the <label>, setting just the <LaTeX-text>.
97.1

The preceding paragraph is an example of the use of the \hyperref[page] option. Its source code is:

For creating hyperlinks to other documents
using symbolic reference \Meta{label}s,
\hyperref[page]{command}{command, described on page~}{}{externref}.

which appears in the LATEX typeset version as:
For creating hyperlinks to other documents using symbolic reference <label>s, see also the \externalref command, described on page 31.

In fact both \hyperref and the \htmlref command, to be described next, permit textual hyperlinks based on symbolic <label>s from external files.

#### \htmlref

Another command also defined in html.sty is \htmlref which has the same effect as \hyperref during the conversion to HTML. It takes two arguments, some text and a label. In the HTML version the text will be hyperized'', pointing to the label. In the paper version the text will be shown as it is and the label will be ignored; e.g.
With \verb|\htmlref| \htmlref{it's easy to make links}{fig:example}.
`
which produces:
With \htmlref it's easy to make links.
In the LATEX typeset version it will appear simply as:
With \htmlref it's easy to make links.

Next: Hypertext Links in Bibliographic Up: Hypertext Extensions to LATEX Previous: Conditional Text   Contents   Index
Rob MacLeod 2004-10-10