This is an extention of How to jump into any page in an article
I want to make an anchor on each page number with which clicking the page number will jump to the related page.
But the following MWE show that all anchors are in wrong positions(please see the attached figure).
Anyone have proposal or solution of this issue?
MWE:
\documentclass{article}
\usepackage{calc,ifthen,eso-pic,picture,xparse,lastpage,refcount,tikz,hyperref}
\AtBeginDocument{
\newcounter{totalpage}
\setcounter{totalpage}{\getpagerefnumber{LastPage}}
}
\begin{document}
\AddToShipoutPictureBG{\AtPageCenter{%
\put(0.5\paperwidth-0.5\marginparwidth,0.5\textheight) {%
\scalebox{0.7} {%
\begin{tikzpicture}[baseline=(current bounding box.north)]%
\foreach \i in {1,...,\thetotalpage}{%
\ifnum\value{page}=\i\relax%
\tikzset{pn/.style={fill=red,font=\bfseries}}
\else%
\tikzset{pn/.style={fill=gray,opacity=0.5}}%
\fi%
\hyperlink{page.\i}{%
\path[radius=0.5cm,scale=1,text=white,pn](0,-\i) circle node[scale=1.5]{\i};
}%\hyperlink
}%\foreach
\end{tikzpicture}%
}%\scalebox
}%put
}}
first page
\clearpage
second page
\clearpage
third page
\end{document}


node[scale=1.5]{\hyperlink{page.\i}{\i}}in my code. It does work, but only on the number. How to make the anchor on all the circle area? Would you please show me a MWE – lyl Jun 05 '21 at 10:28