# [pdftex] Link to attached file?

Victor Ivrii vivrii at gmail.com
Sun Dec 11 10:59:01 CET 2005

On 12/10/05, Heiko Oberdiek <oberdiek at uni-freiburg.de> wrote:
> On Fri, Dec 09, 2005 at 10:12:33AM -0500, Victor Ivrii wrote:
>
> > With the attachfile package one can attach different files, including pdf
> > files. With hyperref (especially combined with xr-hyper)  package one
> > can make links to the specific anchors in the external pdf files.
> >
> > Is it possible to make a link to the specific anchor in the attached pdf file?
> > It is possible with Adobe Acrobat but I am interested in the LaTeX solution
>
> It is possible, Adobe's PDF specification knows "Embedded Go-To Actions",
> see section "8.5.3 Action Types". Unfortunately neither attachfile*,
> hyperref, or xr* support this. But you can study their code (hyperref's
> /GoTo or /GoToR links, file specification from attachfile) and
> write your own macros that implement the /GoToE action.
>

Thanks a lot (while I knew that pdf supports this, I surely have not
known the place in the reference to look up).

On the other hand I am puzzled while the following (easier task: link
from attachment to master) does not work:

\documentclass[12pt]{article}
\usepackage{xr-hyper}
\usepackage{hyperref}
\usepackage{attachfile}
\usepackage{filecontents}

\begin{document}
Oink-oink-oink
$$11111111 \label{a}$$

\begin{filecontents}{note1}
\documentclass[12pt]{article}
\usepackage{xr-hyper}
\usepackage{hyperref}
\externaldocument[master-]{master}[master.pdf]
\begin{document}
Blah-blah
\ref{master-a}
\end{document}
\end{filecontents}

\immediate\write18{pdflatex note1}
\attachfile{note1.pdf}
\end{document}
--

If after I run separately

pdflatex note1

it shows the correct reference, but no matter how many times I run

pdflatex --shell-escape  master

I am getting LaTeX Warning: There were undefined references and
really, the reference is undefined. I assume that after the first run
master.aux should stabilize and on the second run pdflatex note1
should be able to use it; however this does not happen. I am more
interested in explanation than in the fix.