# Matching Rotated \hyperref in arbitrarily rotated x-label in Pgfplots

Similar to this question: How to make pgfplots vertical labels have proper hyperref erence box? Except, that I am trying to get hyperref working with angled rotated x-axis labels:

Got it working, thanks to @Jake.

Update: Got it sorted with href. Thanks.

\newcommand{\nenameref}[1]{\noexpand\nameref{{#1}}}
\newcommand{\nehref}[1]{\noexpand\href{{#1}}}
\begin{tikzpicture}

-
There was a similar post with hyperref rotation stuff, perhaps this is of use how-to-make-pgfplots-vertical-labels-have-proper-hyperref-erence-box – Christian Feuersänger Jun 6 '11 at 1:24

You can wrap all the tick labels in a rotatebox by using the \ticklabel key (instead of \ticklabels) and defining the references in a list with \noexpand so they survive all the processing. You should use an anchor that is equivalent to the rotation of the labels, to avoid getting an offset:

\documentclass{article}
\usepackage{hyperref}
\usepackage{rotating}
\usepackage{pgfplots}
\usepackage{nameref}
\usepackage{graphicx}
\begin{document}
\section{the beginning}
This is a test.\label{test} \\
This is \nameref{test}.
\section{second section}
Test two \label{testtwo}

\newcommand{\nenameref}[1]{\noexpand\nameref{{#1}}}
\begin{tikzpicture}
\def\labellist{{"\nenameref{test}","\nenameref{testtwo}","reallylonglabel"}},
\begin{axis}[xtick={1,...,3},
xticklabel={\pgfmathparse{\labellist[\tick-1]}\rotatebox{65}{\pgfmathresult}},
x tick label style={anchor=65}]
error bars/.cd,
y dir=both,
y explicit,
error bar style={line width=2pt},
error mark options={
rotate=90,
red,
mark size=8pt,
line width=2pt}
]
coordinates {
(3,1) +- (0,0.35665)
(2,1) +- (0,-0.35048)
(1,1) +- (0,0.150255)
};
\end{axis}
\end{tikzpicture}
\end{document}


-
oooo that looks good. I will get right on it. Many thanks. As always. – Frank_Zafka Jun 6 '11 at 8:18