6

I would like to have the entire node part a link. But, it seems that once you rotate, hyperref has issues. The reference below say to place the rotated content in the hyperlink, but not sure how to do that when using Tikz's nodepart:

enter image description here

Notes:

  • The links work fine if \def\VerticalText{} is commented.
  • Ideally, I'd prefer the entire rectangular region to be a link, but having just the text would be acceptable.

References

Code:

\def\VerticalText{}% <--- All links work if comment this out.
\documentclass{article}
\usepackage{tikz}
\usetikzlibrary{shapes}

\usepackage[colorlinks=true]{hyperref}

\ifdefined\VerticalText
    \tikzset{My Rotate/.style={rotate=90}}%
\else
    \tikzset{My Rotate/.style={}}%
\fi

\tikzset{Node Label Style/.style={
    anchor=south, 
    above, 
    align=center,
    }
}

\tikzset{Rectangle Split Style/.style={
        rectangle split, rectangle split parts=3, 
        My Rotate,
        anchor=south,
        thick, fill=gray!10,
    }
}
\tikzset{Node Part Style/.style={draw, minimum width=2.1cm, align=center}}


\newcommand*{\GoogleLink}{\href{http://www.google.com}{\shortstack{Google \\ Web Site}}}%


\begin{document}

This multi-line link works: \GoogleLink

The link in the title also work:

\bigskip
\begin{tikzpicture}

\node[Rectangle Split Style] (MyNode) at (0,0) [Node Part Style]  
        {\nodepart{one}   \GoogleLink %% <-- This link does NOT work if \VerticalText is defined
         \nodepart{two}   \shortstack{Yahoo \\ Web Site} 
         \nodepart{three} \shortstack{TeX.SE \\ Web Site}
        };
        
\ifdefined\VerticalText
    \coordinate (Title Location) at (MyNode.east);
\else
    \coordinate (Title Location) at (MyNode.north);
\fi

%% This link works fine:
\node [Node Label Style] at (Title Location)  {\GoogleLink};

\end{tikzpicture}
\end{document}
1
  • I would like to declare a horizontal version of rectangle split. Then the remaining is not TikZ anymore.
    – Symbol 1
    Jul 5 '15 at 13:12
1

Something like that?

\href{<www-Link>}{\tikz{<....>}}

or

\node [<styles>] 
{\rotatebox{90}{<...>}
\nodepart{two}  \rotatebox{90}{<...>}
\nodepart{three} \rotatebox{90}{<...>}
};

enter image description here

\documentclass[10pt]{article}
\usepackage{tikz}
\usetikzlibrary{shapes}

\usepackage[colorlinks=true]{hyperref}

\newcommand*{\GoogleLink}{\href{http://www.google.com}{\shortstack{Google \\ Web Site}}}%
\newcommand*{\YahooLink}{\href{http://www.google.com}{\shortstack{Yahoo \\ Web Site}}}%
\newcommand*{\TeXLink}{\href{http://www.google.com}{\shortstack{TeX.SE \\ Web Site}}}%
\begin{document}
\tikzset{Rectangle Split Style/.style={
rectangle split, 
rectangle split horizontal, 
rectangle split parts=3, 
anchor=south, align=left, 
draw=black, thick, fill=gray!10,
text width=2em, minimum size=2cm,
},
}

\newcommand\AllOneLink{%
\tikz{\node [Rectangle Split Style] 
{\rotatebox{90}{All}   
\nodepart{two}  \rotatebox{90}{one}
\nodepart{three} \rotatebox{90}{Link}
};
}}

\href{http://www.google.com}{\AllOneLink}

\begin{tikzpicture}[]
\node [Rectangle Split Style] 
{\rotatebox{90}{\GoogleLink}   
\nodepart{two}  \rotatebox{90}{\YahooLink}
\nodepart{three} \rotatebox{90}{\TeXLink}
};
\end{tikzpicture}
\end{document}

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.