[texhax] Hyperlinks in plain TeX

Rodolfo Medina rodolfo.medina at gmail.com
Thu Jun 9 15:07:15 CEST 2016


Hi to all (La)TeX users.

Here:

 http://tex.stackexchange.com/questions/85148/plain-tex-and-different-hyperlink-styles-in-dvi-and-pdf

there are some macros (written by Alan U. Kennington) about how to produce
hyperlinks and cross-reference-hyperlinks in plain TeX.  I tested them but for
me the link disappears when I convert the dvi format to pdf with: `dvips -z
file.dvi' and then `ps2pdf file.ps'.  Here is my simple example:

% This \PreHatch macro to prefix a text string with a hatch character.
{\catcode`\^=6 \catcode`\#=12 \gdef\PreHatch^1{#^1}}

% Anchor points for cross-reference hyperlinks.
\def\LinkNameText#1#2{%
 \special{html:<a name="#1">}#2\special{html:</a>}}
\def\LinkNamePRE#1{\special{html:<a name="#1">}}
\def\LinkNamePOST{\special{html:</a>}}
\def\LinkName#1{\LinkNameText{#1}{}}

% Cross-reference hyperlinks to defined anchor points.
\def\LinkHrefText#1#2{%
 \special{html:<a href="\PreHatch{#1}">}#2\special{html:</a>}}

% Pre-text and post-text macros.
\def\LinkHrefPRE#1{\special{html:<a href="\PreHatch{#1}">}}
\def\LinkHrefPOST{\special{html:</a>}}

% External hyperlinks.
\def\LinkHrefExtText#1#2{%
 \special{html:<a href="#1">}#2\special{html:</a>}}
\def\LinkHrefExt#1{\LinkHrefExtText{#1}{#1}}
\def\LinkHrefExtTT#1{\LinkHrefExtText{#1}{{\tt#1}}}

hallo\LinkName{label}

\LinkHrefText{label}{please click here}

\end

, to be processed with simply `tex file'.  The link works fine in dvi format
but, as I said, it is no more there after `dvips -z -> ps2pdf' conversion.

Please help whoever can.

Thanks,

Rodolfo



More information about the texhax mailing list