tags:

views:

125

answers:

1

I use LaTeX with the hyperref package and I have things like:

hyperref is 
\href{http://www.tug.org/applications/hyperref/}{documented in detail}. 
It allows...

In the PDF output, it shows:

hyperref is documented in detail. It allows...

The link works but the URL is not displayed which is a big problem when printing the file. I do not find an option to change that in the documentation.

Some of the hyperref files I work with are not generated by hand but by dblatex so changing every \href{...} is probably not an option.

For the hyperref side, see Will Robertson's solution. For dblatex, I wrote a customization script, by copying the XSL templates for <ulink> and similar elements and then producing a different LaTeX code. It is no longer necessary since the release of dblatex 0.2.10 which has the necessary option.

+2  A: 

I suggest adding a switch in your preamble when generating "print-ready" versions of the output.

For example, (untested)

\newif\ifprint
\printtrue
\ifprint
  \let\oldhref\href
  \renewcommand\href[2]{%
    \oldhref{#1}{#2}%
    \footnote{\url{#1}}%
  }
\fi

Of course, you'll still need to generate two versions of the document, one for print and one for screen. But I'm not sure if you were expecting anything different :)

Will Robertson
Works perfectly. Thanks. The dblatex case is a bit more complicated because there is apparently no easy way to add this preamble. Working on it.
bortzmeyer