Consider image sample below. I'm including it using \includegraphics and I have linked it to an url using \href.

What I would like is to have it in the pdf file in such a way that the mouse would only allow you to follow the link when passing over the grey zone and not through the white background.

I'm using a png file with no background but with no success...

Does someone know how to do this?

Thank you so much in advance!

enter image description here:

  • 1
    The only way I can see this being possible is if you break up the shaded area into small rectangles (yes, a rectilinear object), overlap them with the shaded area manually and hyperlink them all. Good luck. – Werner May 9 '14 at 15:55
  • Hi Werner! Thanks for the answer. It would take me forever to get it done... So i'm going to give up on this feature. Although I would really love to have it :) Thanks anyway. – Pedro May 13 '14 at 17:23
  • This could be done, but it would take a lot of work. Basically one could construct a somewhat pixelated version of the image using a tikz matrix. For a 50x50 grid using 1 letter (local) macro names would involve 50 lines of 151 characters each. You would need both upper and lower case for the map shown. – John Kormylo Aug 12 '15 at 13:02

This was done on a smaller scale for a map of Hawaii using a 20x20 grid. For the final version you set the opacity of the map to 1. I find using a checkerboard background helps when aligning links to the map. Using a \parbox instead of tikz \matrix is much faster.

I stole the map from http://www.enchantedlearning.com/usa/states/hawaii/map.GIF and converted to png.

map of hawaii



\setlength{\cellwidth}{\dimexpr \wd\tempbox / 20}
\setlength{\cellheight}{\dimexpr \ht\tempbox / 20}
\node (links) {\parbox{\wd\tempbox}{\lineskip=0pt
\node[opacity=.5] at (links) {\usebox{\tempbox}};

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.