[OS X TeX] OT: hyperref.sty, graphics.sty, pdfTeX and dvips
Ross Moore
ross at ics.mq.edu.au
Sat Apr 3 01:22:37 CEST 2004
Hi Will, Bruno, and others
On 02/04/2004, at 6:33 PM, Will Robertson wrote:
>
>> Is this a well-known bug?
>
> I wouldn't know, but it sounds serious. I assume you've alerted the
> authorities, etc. Very good to know for the future!
No; it isn't serious --- just an irritation.
Here's how to work around it:
Firstly, here is an example:
\scalebox{2}{\href{http://www.legi.hmg.inpg.fr}{LEGI}}
which may not work correctly using pdf-LaTeX.
\setbox0=\hbox{\scalebox{2}{LEGI}}
But this workaround: \href{http://www.legi.hmg.inpg.fr}{\box0}
works just fine, and is indeed logically more correct.
The point is that the anchor-text of the \href is the scaled box;
this is a well-defined concept, and the 2nd example above does it
right because the scaled box is constructed *before* the \href
is processed.
With the initial example, it may not be fully defined as to what should
be the result when scaling an area of the page containing an active
link.
From an implementation point-of-view, it is not reasonable to have
to re-parse everything within that area of the page, looking for things
that need to be scaled.
On the other hand, if the \scalebox has adjusted an internal
scale-factor,
which is referenced when the active-region for the anchor-text is
computed,
then the "correct" size could be created automatically.
With the current implementation of pdfTeX, then the best way (IMHO)
of coping with this issue is via a macro. Your document should have,
in its body, usages such as:
But this workaround: \LEGIlink\ works just fine,
and is indeed logically more correct.
where the preamble (or a style-file or package) contains
a definition such as:
\newcommand{\LEGIlink}{{\setbox0=\hbox{\scalebox{2}{LEGI}}%
\href{http://www.legi.hmg.inpg.fr}{\box0}}}
If you have a lot of these, then use something like:
\newcommand{\scalehref}[2][1]{% 2 mandatory + 1 optional arg.
% #1 = optional scale-factor, default = 1
% #2 = URL to link to
% #3 = anchor-text
{\setbox0=\hbox{\scalebox{#1}{#3}}\href{#2}{\box0}}}
\newcommand{\LEGIlink}{\scalehref[2]{http://
www.legi.hmg.inpg.fr/}{LEGI}}
\newcommand{\TUGlink}{\scalehref[1.5]{http://www.tug.org/}{TUG}}
....
Hope this helps,
Ross
> Will
> -----------------------------------------------------
> Please see <http://www.esm.psu.edu/mac-tex/> for list
> guidelines, information, and LaTeX/TeX resources.
>
>
>
------------------------------------------------------------------------
Ross Moore ross at maths.mq.edu.au
Mathematics Department office: E7A-419
Macquarie University tel: +61 +2 9850 8955
Sydney, Australia fax: +61 +2 9850 8114
------------------------------------------------------------------------
-----------------------------------------------------
Please see <http://www.esm.psu.edu/mac-tex/> for list
guidelines, information, and LaTeX/TeX resources.
More information about the macostex-archives
mailing list