我有一个像这样的图像,我已将其包含在\includegraphics
命令中。
我希望每个圆圈都链接到文档的不同部分。例如,单击蓝色圆圈应将用户带到\label{blue}
,单击绿色圆圈应将用户带到\label{green}
,等等。
链接也可能是 URL,而不是文档内位置的链接。我得到的是类似于 HTML 中的地图/区域的内容(http://www.w3schools.com/tags/tag_area.asp)
为什么?因为所讨论的图像是由软件生成的,因此“地图”也可以由软件生成。子图不是一种选择,因为图形不能分开。
答案1
tikz
这是一个节点覆盖图像并放置\hyperlinks
在\nameref{...}
各个部分的版本:
节点位置由用户决定!
\documentclass[oneside]{article}
\usepackage{blindtext}
\usepackage{tikz}
\usepackage{graphicx}
\newcommand{\namereflink}[1]{%
\nameref{#1}%
% Or use
% \hyperlink{section.\getrefnumber{#1}}{\nameref*{#1}}%
% Or use
% \hyperlink{section.\getrefnumber{#1}}{\phantom{}}% Difficult to detect!!!!
}
\usepackage{hyperref}
\begin{document}
\begin{center}
\begin{tikzpicture}[scale=4]
\hypersetup{hidelinks}
\node[inner sep=1pt] (MYCENTER) at (0,0) {\includegraphics[scale=1]{ente.jpg}};
\node (BLUEEDGE) at (-1,1) {\nameref{sec:blue}}; % For example
\node (GREENEDGE) at (1,1) {};
\node (REDEDGE) at (-1,-1) {};
\node (ORANGEEDGE) at (1,-1) {};
\draw[help lines, step=0.25] (MYCENTER) (REDEDGE) grid (GREENEDGE); %Only for help purposes
\node (BLUE) at (-0.5,0.5) {\namereflink{sec:blue}};
\node (GREEN) at (0.25,0.5) {\namereflink{sec:green}};
\node (RED) at (-0.25,-0.25) {\namereflink{sec:red}};
\node (ORANGE) at (1,-0.25) {\namereflink{sec:orange}};
\shade[ball color=blue] (BLUEEDGE) circle (0.5);
\shade[ball color=green] (GREENEDGE) circle (0.5);
\shade[ball color=red] (REDEDGE) circle (0.5);
\shade[ball color=orange] (ORANGEEDGE) circle (0.5);
\end{tikzpicture}
\end{center}
\clearpage
\section{Blue} \label{sec:blue}
\blindtext[5]
\section{Red} \label{sec:red}
\blindtext[5]
\section{Green} \label{sec:green}
\blindtext[5]
\section{Orange} \label{sec:orange}
\blindtext[5]
And a normal link to \ref{sec:blue}
\end{document}
真实图像的代码
\documentclass[oneside]{article}
\usepackage{blindtext}
\usepackage{tikz}
\usepackage{graphicx}
\newcommand{\namereflink}[1]{%
% \nameref{#1}%
% Or use
% \hyperlink{section.\getrefnumber{#1}}{\nameref*{#1}}%
% Or use
\hyperlink{section.\getrefnumber{#1}}{\phantom{#1}}% Difficult to detect!!!!
}
\usepackage{hyperref}
\begin{document}
\begin{center}
\begin{tikzpicture}[scale=1]
\hypersetup{hidelinks}
\node (MYCENTER) at (0,0) {\includegraphics[scale=1]{sourceimage.jpg}};
\node (BLUE) at (-1,1) {\namereflink{sec:blue}};
\node (GREEN) at (1,1) {\namereflink{sec:green}};
\node (RED) at (-1,-1) {\namereflink{sec:red}};
\node (ORANGE) at (1,-1) {\namereflink{sec:orange}};
\end{tikzpicture}
\end{center}
\clearpage
\section{Blue} \label{sec:blue}
\blindtext[5]
\section{Red} \label{sec:red}
\blindtext[5]
\section{Green} \label{sec:green}
\blindtext[5]
\section{Orange} \label{sec:orange}
\blindtext[5]
And a normal link to \ref{sec:blue}
\end{document}