# Can you have hyperlinks to locations in different PDFs?

It's possible to hyperlink to another PDF file using Adobe Acrobat using the following LaTeX code:

\href{run:target.pdf}{Click me!}


If this is placed in source.pdf, then you can click on the hyperlink to open up target.pdf on the front page.

Is there any chance of hyperlinking to a different section in another PDF, similar to second.html#target in HTML?

-

## 1 Answer

(for reference the Adobe Knowledge base entry about pdf from html linking)

Checkout section 4.1 in Hypertext capabilities with pdfLaTeX (F. Garcia, TUGBoat, Vol. 28, No. 1, 2007), which describes the hyperdef and hyperref commands.

Just a small example:

src.tex:

\documentclass{article}
\usepackage{hyperref}

\begin{document}
\section{Source a}
\hyperdef{cat1}{link1}
Foo bar
\hyperref{dest.pdf}{cat1}{link1}{Link 1}

\section{Source b}
\hyperdef{cat2}{link2}
Fu baz
\hyperref{dest.pdf}{cat2}{link2}{Link 2}
\end{document}


dest.tex:

\documentclass{article}
\usepackage{lipsum}
\usepackage{hyperref}

\begin{document}
\section{One}
\lipsum

\section{Two}
\hyperdef{cat1}{link1}
Fill paragraph.
\hyperref{src.pdf}{cat1}{link1}{Back 1}
\lipsum

\section{Three}
\hyperdef{cat2}{link2}
Fill paragraph.
\hyperref{src.pdf}{cat2}{link2}{Back 2}
\lipsum

\end{document}


Create the PDFs via:

$pdflatex src$ pdflatex dest


Now you can try to jump back and forth between the both documents in your favorite PDF Viewer.

(Tested it with Okular under Ubuntu 10.04)

-
Could you expand your answer a bit to make it self-contained? –  doncherry Aug 17 '11 at 8:38
@doncherry, sure, added a small example. –  maxschlepzig Aug 17 '11 at 17:06