[Tex/LaTex] Clicking separate parts of an image link to different sections in the document

graphicshyperreflinks

Is is possible to make clicking on separate parts of an image link to different sections of the document.

for instance specify a region of a image (x, y, width height) and a hyperref.

(I am aware you can make clicking anywhere in an image link to a single section, but this is not what I need)

(I have seen Link subsections of image to different labels (like html image map) and Possibility to ref link different areas of an image to different labels? but couldn't see how to use what they had said)

Thanks

EDIT: What I have tried which handles a single link.

\documentclass{article}
\usepackage{graphicx}
\usepackage{hyperref}

\begin{document}

\begin{figure}
    \centering
    \hyperref[xxx]{\includegraphics[width=\linewidth]{image.png}}
\end{figure}

\pagebreak
\section{Section 1}

Some Text

\pagebreak
\section{Section 2}
\label{xxx}

Some Text

\end{document}

Best Answer

REVISED APPROACH (\stackinset)

Here, I just \stackinset any number of \hyperrefed \makeboxes to encompass the desired portion of the base image. The \stackinset can be specified relative to the l,c,r horizontal anchors and the t,c,b vertical anchors.

\documentclass{article}
\usepackage{graphicx}
\usepackage{hyperref,stackengine}
\begin{document}

\begin{figure}
    \centering
    \stackinset{l}{10pt}{t}{20pt}{\hyperref[topleft]{\makebox(100,100){}}}{%
    \stackinset{r}{30pt}{t}{40pt}{\hyperref[topright]{\makebox(50,40){}}}{%
    \stackinset{l}{40pt}{b}{50pt}{\hyperref[bottomleft]{\makebox(70,20){}}}{%
    \stackinset{r}{110pt}{b}{70pt}{\hyperref[bottomright]{\makebox(40,80){}}}{%
    \includegraphics[width=\linewidth]{example-image}}}}}
\end{figure}

\clearpage

\pagebreak
\section{Section 1}
\label{topleft}

Some Text

\pagebreak
\section{Section 2}
\label{topright}

Some Text

\pagebreak
\section{Section 3}
\label{bottomleft}

Some Text

\pagebreak
\section{Section 4}
\label{bottomright}

Some Text

\end{document}

enter image description here

ORIGINAL APPROACH (\clipbox)

Here I use \clipbox to partition the figure into 4 [unequal-sized] quadrants, though there is, in theory, no reason you can't slice it into any number of rectangles.

I don't know how, but I am sure hyperref provides the means to make the \hyperref bounding box invisible.

\documentclass{article}
\usepackage{graphicx}
\usepackage{hyperref,trimclip,stackengine}
\begin{document}

\begin{figure}
    \centering
    \setbox0=\hbox{\includegraphics[width=\linewidth]{example-image}}
    \stackunder[0pt]{%
    \hyperref[topleft]{\clipbox{0pt .4\ht0{} .3\wd0{} 0pt}{\copy0}}%
    \hyperref[topright]{\clipbox{.7\wd0{} .4\ht0{} 0pt 0pt}{\copy0}}}{%
    \hyperref[bottomleft]{\clipbox{0pt 0pt .3\wd0{} .6\ht0}{\copy0}}%
    \hyperref[bottomright]{\clipbox{.7\wd0{} 0pt 0pt .6\ht0}{\copy0}}}
\end{figure}

\clearpage

\pagebreak
\section{Section 1}
\label{topleft}

Some Text

\pagebreak
\section{Section 2}
\label{topright}

Some Text

\pagebreak
\section{Section 3}
\label{bottomleft}

Some Text

\pagebreak
\section{Section 4}
\label{bottomright}

Some Text

\end{document}

A click in separate corners of the image will take you to different pages in the document.

enter image description here