I'm trying to achieve something similar to an html image map, i.e. linking certain areas of an image to different labels in my document.
Problems I'm facing:
- The picture is too big for the page and therefore scaled down. How can I ensure that the overlay scales the same?
- I want the overlay itself to be invisible and fill an area. I was able to achieve this using TikZ nodes with an opaque image. Is there a better way, e.g. a TikZ command to make the entire node a reference and not only the contents of it?
- the code will be generated automatically, so manually making the positions work is not an option. Any calculations made should work for every (or at least a wide range of) picture size/scale.
I looked at this post:
Possibility to ref link different areas of an image to different labels?
but I don't think I can achieve the desired accuracy and flexibility for the map coordinates using \rule.
I tried what is suggested here: Drawing on an image with TikZ using own coordinate system but have issues with the coordinate system of the overlay.
This is some sample code:
\documentclass[10pt,twoside,a4paper,openany]{report}
\usepackage{tikz}
\usepackage{pdflscape}
\usepackage[pdftex]{hyperref}
\newlength\iwidth
\newlength\iheight
\begin{document}
\begin{landscape}
\begin{figure}[h]\centering
\settoheight\iheight{\includegraphics[width=1.414\textheight, totalheight=\textheight, keepaspectratio]{fig_2}}
\settowidth\iwidth{\includegraphics[width=1.414\textheight, totalheight=\textheight, keepaspectratio]{fig_2}}
\begin{tikzpicture}[x=\iwidth/1320,y=\iheight/864]
\node[anchor=south west,inner sep=0] (image) at (0,0) {\includegraphics[width=1.414\textheight, totalheight=\textheight, keepaspectratio]{fig_2}};
\node[anchor=south west,inner sep=0,minimum height = 5mm, minimum width = 5mm, opacity=0.1] (block1) at (50,100) {\hyperref[TEM_TExMnfldMdl/TEM_TExMnfldMdl/EfficiencyCalculation]{\includegraphics[width=20pt, height=10pt]{dummyPicture}}};
\end{tikzpicture}
\caption[TEM\_TExMnfldMdl]{TEM\_TExMnfldMdl}\label{fig_2}
\end{figure}
\end{landscape}
\newpage
\subsection[EfficiencyCalculation]{TEM\_TExMnfldMdl\_EfficiencyCalculation} \label{TEM_TExMnfldMdl/TEM_TExMnfldMdl/EfficiencyCalculation}
\end{document}
Open issues with this are the need for a dummy picture and that i cannot manage to get the positions of the overlay calculated from the position of the box in the unscaled image.
Thanks for any help or hints regarding this!
hyperreflast. Don't specify the driver when loading it. Don't loadepstopdfat all. Use\usepackage{}in the preamble rather than\RequirePackage{}. – cfr Jan 03 '17 at 23:48\RequirePackagecomes from copy pasting it from a .sty file I was using to create this example. – Jochen P Jan 04 '17 at 09:14hyperrefto keep the code flexible/portable. – cfr Jan 05 '17 at 03:18epstopdfI get an "File ... not found" (or "unknown graphics extension 'eps'" if i specify the extension)Do I need to do anything else to load include eps images?
– Jochen P Jan 05 '17 at 08:50graphics.cfg? I can't think of any other reason it would not accept the EPS. All recent configurations will auto-convert EPS by default. – cfr Jan 05 '17 at 22:15