[pdftex] Link to attached file?

Heiko Oberdiek oberdiek at uni-freiburg.de
Sun Dec 11 12:07:11 CET 2005

On Sun, Dec 11, 2005 at 04:59:01AM -0500, Victor Ivrii wrote:

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

Now, the .aux file is read and cleared for the entries
in of the current run.

> Oink-oink-oink
> \begin{equation}
> 11111111
> \label{a}
> \end{equation}

References are written at page shipout time, because then the
page number is known.

> \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}

The reference of \label{a} is not yet written, because this
is on the same page and the page is output at this time.

> \attachfile{note1.pdf}
> \end{document}

At least you need a page break between the \label command
and the run of pdflatex in \write18. But a risk in your approach
remains: The writing of the .aux file could be delayed/cached
by the OS. Thus the "pdflatex note1" is better executed after
the .aux file is closed, e.g. after the "pdflatex master" run.

Yours sincerely
  Heiko <oberdiek at uni-freiburg.de>

More information about the pdftex mailing list