[XeTeX] Hyperref support in XeLaTeX

Bruno Voisin bvoisin at mac.com
Tue Oct 4 17:22:28 CEST 2005


Hi Jonathan,

Le 4 oct. 05 à 13:39, Jonathan Kew a écrit :

> You could possibly hack around this by wrapping your graphic  
> inclusion in a macro that outputs glyphs at two diagonally opposite  
> corners of the image; they could be small blank glyphs (e.g.,  
> \char32), so as not to show on the page, as long as they're real  
> glyphs in a font so that xdv2pdf "sees" them. I think that would  
> trick the driver into creating the proper link area.

Thanks for the very quick response, and useful hint.

After loads of trial-and-error during a couple of hours, the  
following seems to work:

\newsavebox{\ximagebox}\newlength{\ximageheight}
\newsavebox{\xglyphbox}\newlength{\xglyphheight}
\newcommand{\xbox}[1]
   {\savebox{\ximagebox}{#1}\settoheight{\ximageheight}{\usebox 
{\ximagebox}}%
    \savebox{\xglyphbox}{\char32}\settoheight{\xglyphheight}{\usebox 
{\xglyphbox}}%
    \raisebox{\ximageheight}[0pt][0pt]{%\raisebox{-\xglyphheight}[0pt] 
[0pt]{%
      \makebox[0pt][l]{\usebox{\xglyphbox}}}%}%
    \usebox{\ximagebox}%
    \raisebox{0pt}[0pt][0pt]{\makebox[0pt][r]{\usebox{\xglyphbox}}}}

to be used as in:

\href{http://www.legi.hmg.inpg.fr/}{\xbox{\includegraphics 
[width=150pt]{LogoLegiPantone}}}

If the glyph "a" is used instead of \char32, for example, then the  
commented out correction for glyph height must be uncommented. I'm  
not sure to understand fully why.

Thanks again,

Bruno




More information about the XeTeX mailing list