# hyperref and cross-referencing

When you are using the hyperref package, it creates nice, clickable links within the PDF output when you use cross references (\ref{chap:label}). But, when I refer to "Section 1", only the "1" is clickable. Is there away to add arbitrary, or semi-arbitrary text to one of these references?

• What would you want to do? I'm not following with the "add text" part... Apr 26, 2013 at 20:07
• Welcome to TeX.sx! Apr 26, 2013 at 20:24

\documentclass{article}
\usepackage{hyperref}% http://ctan.org/pkg/hyperref
\begin{document}
\section{A section}\label{mysection}
See \hyperref[mysection]{Section~\ref*{mysection}}.
\end{document}

To avoid a hyperlink within a hyperlink, it also provides \ref*. For less arbitrary but still automated text additions to cross references, it provides \autoref:

\documentclass{article}
\usepackage{hyperref}% http://ctan.org/pkg/hyperref
%\providecommand{\sectionautorefname}{Section}
\begin{document}
\section{A section}\label{mysection}
See \hyperref[mysection]{Section~\ref*{mysection}} or \autoref{mysection}.
\end{document}

You need to set \<counter>autorefname for each of the <counter>s you would reference.