hyperref
provides the command \hyperlink
, with syntax:
\hyperlink{name}{text}
where name is the name of a hypertext object, and text is used as the link to jump to the defined mark. Page anchors, e.g., page.12
, can also be used as hypertext objects. For example,
Click \hyperlink{page.23}{here} to jump to page 23.
This was proposed by Martin Scharrer as a solution to this problem.
I would like to link a string of text to a page (by page number) using \hyperlink
, but being able to refer to an implicit page anchor page.<number>
whose ''number'' is not known in advance. That is, use a value of the counter page
, which is only set later in the document, in the argument of \hyperlink
.
Here's a hypothetical solution:
\documentclass{article}
\usepackage[pageanchor]{hyperref} % option is the default anyway
%% Martin Scharrer's patch for hyperref
%% available at https://tex.stackexchange.com/a/19416/9237
\makeatletter
\let\orig@Hy@EveryPageAnchor\Hy@EveryPageAnchor
\def\Hy@EveryPageAnchor{%
\begingroup
\hypersetup{pdfview=Fit}%
\orig@Hy@EveryPageAnchor
\endgroup
}
\makeatother
\def\getpageref{???} % \getpageref extracts the numeric value of \pageref{key}
% for use in the first argument of \hyperlink
\begin{document}
See
\hyperlink{page.\getpageref{lkd}}{this page}
for further clarification.
\newpage
This is the linked page.\label{lkd}
\end{document}
I know how to achieve a similar solution by simply using \label
and then \pageref
(or \autopageref
), but I am interested in making use of a hyperref
patch proposed here by Martin to make all page anchors be displayed in full page mode. (This patch only seems to work with \hyperlink
.)
cleveref
, which, when used, should BTW loaded afterhyperref
.cleveref
are part of the solution to my question.pageanchor
inhyperref
is true by default, so I left it out in my answer.