[Tex/LaTex] PDF hyperlinks to a given page.

hyperrefpdf

I would like a command that takes two arguments: a page number and a block of text. I would like the command to create a PDF hyperlink around the text that will jump to the given page.

I see that the undocumented \hyperpage{} command from the hyperref package will create a link to the given page, however, I don't see how it can be used to make a link for arbitrary text. I took a look at the underlying code in hyperref.sty but I can't really figure it out.

I do realize that I could use \hyperlink{}{}, but that requires I put a \hypertarget{}{} on each of the pages to be linked. In my case, I only know the numerical number of the page to be linked.

Best Answer

You could use \hyperlink with the already defined page targets:

\documentclass{article}
\usepackage{hyperref}
\begin{document}
\hyperlink{page.2}{Go to page 2}
\newpage
text on page 2
\end{document}
Related Question