# Possibility to ref link different areas of an image to different labels?

I have a diagram as an image. There are described different components which are later described and marked with \label tags.

Can I ref link different areas/sections of one image to different \label tags? Or do I have to combine the diagram out of different images and ref them each?

I am using the package hyperref at the moment.

\documentclass[11pt, a4paper, oneside]{article}

\usepackage{graphicx}
\usepackage{hyperref}

\begin{document}

\includegraphics[scale=0.2]{diagrammPicture.pdf}
% something like    \refInsidePicture{area1}{fromX}{toX}{fromY}{toY}
%                   \refInsidePicture{area2}{fromX}{toX}{fromY}{toY}
%                   \refInsidePicture{area3}{fromX}{toX}{fromY}{toY}
%                   \refInsidePicture{area4}{fromX}{toX}{fromY}{toY}
\section{area1 explained} \label{area1}
\section{area2 explained} \label{area2}
\section{area3 explained} \label{area3}
\section{area4 explained} \label{area4}
\end{document}

• Yes you can. Can you provide us with a minimal working example (MWE) that shows the community exactly what you mean? Jul 29 '14 at 6:00
• If all you want is to link, use \hyperlink and \hypertarget. \label and \ref are intended to keep track of counters. Jul 30 '14 at 12:50
• @John Kormylo Thank you. I looked into the \hyperlink and \hypertarget docs and I do think that it is not what I searched. I do want something like the <area> tag from HTML. HTML area: [stackoverflow.com/questions/18560097/… Jul 31 '14 at 8:40
• Consider \hypertarget{area1}{\makebox[2in]{\rule{0pt}(1in}}. This will target an area 2 inches wide by 1 inch tall. Now all you need is to use \raisebox to overlay the areas onto the image. Jul 31 '14 at 13:51

It seems \hypertarget aims for the baseline, so I had to move the areas below the baseline.

\documentclass[11pt, a4paper, oneside]{article}

\usepackage{graphicx}
\usepackage{hyperref}
\usepackage{mwe}

\newsavebox{\tempbox}
\newlength{\tempheight}
\newlength{\tempwidth}

\newcommand{\area}{\rule[-0.49\tempheight]{0.49\tempwidth}{0.49\tempheight}}
% better too small than too big

\begin{document}

\savebox{\tempbox}{\includegraphics[scale=0.5]{example-image}}
\settoheight{\tempheight}{\usebox{\tempbox}}
\settowidth{\tempwidth}{\usebox{\tempbox}}

\hfil\parbox{\tempwidth}{%
\hypertarget{area1}{\area}\hfill%
\hypertarget{area2}{\area}%
\newline%
\hypertarget{area3}{\area}\hfill%
\hypertarget{area4}{\area}%
\newline%
\raisebox{0pt}[0pt]{\usebox{\tempbox}}% overlay
}

\begin{center}