In the paper I am currently writing I would really like to be able to \hyperref
another part of the paper from within a graphic. The graphic output format is eps which I then convert to pdf with eps2pdf and then include the pdf in my document. Now I "somehow" want to be able to specify a reference in my eps which gets preserved from the eps2pdf step and then I can have a clickable link within my graphic that refers to a different part of the document. I have no clue how to achieve this.
A completely different approach using a different starting format and end format is fine with me also but I prefer it to still be vector graphics.
I use pdflatex to render my document.
Below is a reproducable example.
In my case I have a eps file that contains links to both a url and a \hyperref
. To showcase this I made a quick dot file to illustrate what my kind of eps I am dealing with, I converted the dot file to eps with: dot -Teps test.dot -o test.eps
. Please be aware though that my files aren't dot files actually and I use it here because it makes for an easier example.
digraph Test {
g[href="https://www.google.com", fontcolor=blue, label="google"];
test[href="\hyperref[sec:Introduction]{Links to intro}", fontcolor=blue, label="Introduction"];
}
Then I convert the resulting eps to pdf using epstopdf: epstopdf test.eps
which then creates my pdf which has a \URL with the hyperref intact. Then I include the graphic in latex with \includegraphic
:
\documentclass{book}
\usepackage[utf8]{inputenc}
\usepackage[english]{babel}
\usepackage{hyperref}
\usepackage{hypcap}
\usepackage{graphicx}
\begin{document}
\section{Introduction}
\label{sec:Introduction}
\hyperref[sec:Introduction]{Links to intro}
\begin{figure}[htbp]
\centering
\capstart
\includegraphics{test.pdf}
\caption{test}
\end{figure}
\end{document}
So now they are 2 problems. The real URL to google doesn't work since it isn't clickable at all and also the hyperref embedded doesn't work. The real url works if I open the test.pdf
file.
So I don't mind writing some code to fix this with some transformations but I have no idea how.
Any help is appreciated.
graphicx
andpdfpages
packages. – AlexG Mar 27 '18 at 9:20pax
package:https://ctan.org/pkg/pax
. Though it does not seem to be actively developped currently. – AlexG Mar 27 '18 at 9:27