# how to hyperlink a shape using tikz [duplicate]

Possible Duplicate:

something that has been giving me trouble for some time now. I would like to attribute a hyperlink to a shape, that is, not to text but to a whole area. For eg. in the MWE below, I would like the whole of the green circle to react as the mouse is positioned on top of it.

\documentclass{article}
\usepackage{tikz}
\usepackage{hyperref}
\usetikzlibrary{positioning}

\begin{document}

\begin{tikzpicture}
\node[circle, draw=black, fill=red!20, minimum size=2cm] (c1) {\hyperlink{t1}{long text}};
\node[circle, draw=black, fill=red!20, minimum size=2cm, right= 3cm of c1] (c1) {\hyperlink{t1}{}};
\end{tikzpicture}

\newpage

\begin{tikzpicture}
\node[circle, draw=black, fill=red!20] (t1) {\hypertarget{t1}{target}};
\end{tikzpicture}

\end{document}


Any idea? Thanks

-

## marked as duplicate by Jake, egreg, Loop Space, percusse, Marco DanielJul 1 '12 at 10:47

@Jake In my solution, it's not the node the hyperlink but the box. It's only possible if the shape is a rectangle. Is it possible with your solution with a circle? – Alain Matthes Jun 18 '12 at 21:36
@Altermundus: In my solution, the clickable area with a circle node is too small, in yours it's too big =) – Jake Jun 18 '12 at 21:45

\documentclass{article}
\usepackage{tikz}
\usepackage{hyperref}

\begin{document}

\hyperlink{t1}{\tikz\node[circle, draw=black, fill=red!20, minimum size=2cm] (c1) {long text};}

\newpage

\begin{tikzpicture}
\node[circle, draw=black, fill=red!20] (t1) {\hypertarget{t1}{target}};
\end{tikzpicture}

\end{document}


Possible nested tikzpictures

\documentclass{article}
\usepackage{tikz}
\usepackage{hyperref}
\usetikzlibrary{positioning}
\begin{document}

\begin{tikzpicture}
\node (c1) {\hyperlink{t1}{\tikz\node[circle, draw=black, fill=red!20, minimum size=2cm]  {long text};}};
\node[right= 3cm of c1] (c2) {\hyperlink{t1}{\tikz\node[circle, draw=black, fill=red!20, minimum size=2cm]  {};}};
\end{tikzpicture}

\newpage

\begin{tikzpicture}
\node[circle, draw=black, fill=red!20] (t1) {\hypertarget{t1}{target}};
\end{tikzpicture}

\end{document}

-
OK, thanks it works fine. – jejuba Jun 18 '12 at 21:48
@BiauDavid The area clickable is not the disk but a square; it's the only problem. – Alain Matthes Jun 18 '12 at 21:57