Take the 2-minute tour ×
TeX - LaTeX Stack Exchange is a question and answer site for users of TeX, LaTeX, ConTeXt, and related typesetting systems. It's 100% free, no registration required.

Possible Duplicate:
Making TikZ nodes hyperlinkable

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

share|improve this question

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

This question has been asked before and already has an answer. If those answers do not fully address your question, please ask a new question.

    
@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

1 Answer 1

up vote 8 down vote accepted
\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}
share|improve this answer
    
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

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