[pdftex] Link to attached file?

Heiko Oberdiek oberdiek at uni-freiburg.de
Sun Dec 11 13:32:03 CET 2005

On Sun, Dec 11, 2005 at 06:54:10AM -0500, Victor Ivrii wrote:

> On 12/11/05, Heiko Oberdiek <oberdiek at uni-freiburg.de> wrote:
> > On Sun, Dec 11, 2005 at 04:59:01AM -0500, Victor Ivrii wrote:
> > References are written at page shipout time, because then the
> > page number is known.
> I understand this but I presume that on the second run it should be already
> known. I suspect I am wrong here but why?

Yes, the current LaTeX run has read the .aux file and knows
the reference (\r@<labelname>). But after reading the .aux
file LaTeX deletes the .aux file and starts a new one, thus
the .aux file is *empty*.

> > 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.
> >
> I tried to use \write18 without \immediate but it did not work either.
> Is there any command opposite immediate?
> However the problem is that I need note1.pdf at the moment to attach it.

  ...attach note1.pdf...
  ...do nothing or print a warning...

> Should I use some extra auxillary file to store some info?

1. "pdflatex master" and repeat it until the references are correct.
   Now the aux file is correct and not1.tex is written
   (filecontents environment).
2. "pdflatex note1" and repeat it until note1.pdf is correct.
3. "pdflatex master" in order to attach note1.pdf.

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

More information about the pdftex mailing list