# [pdftex] Link to attached file?

Victor Ivrii vivrii at gmail.com
Mon Dec 12 10:32:24 CET 2005

On 12/11/05, Ross Moore <ross at ics.mq.edu.au> wrote:

>
> I'm interested in this too, and have tried it with these modifications,
> except for the  absolute-path-to-  bit.

Well, it is how attachfile works (according to my observations):

internal links in the attached pdf file remain working;
external links (including those to the file which becomes a parent)
remain working
only if these are absolute pathes (or http links to remote server).

>
> For me, I'd link clicking on the ref to open and show the attached file,
> without it being present on disk yet.
>
> Have you managed to achieve this ?

attachfile does the job. The problem for me was during writing a paper
have a single tex file (so why I messed up with filecontents).

There are two other problems: easy one - how to make a reference from
(attached) note1.pdf to master.pdf

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

\immediate\write18{cp master.aux master2.aux}
\begin{document}
Oink-oink-oink
$$11111111 \label{a}$$

\begin{filecontents}{note1}
\documentclass[11pt]{article}
\usepackage{xr-hyper}
\usepackage{hyperref}
\externaldocument[master-]{master2}[absolute-path-to/master.pdf]
\begin{document}
Blah-blah
\ref{master-a}
\end{document}
\end{filecontents}

\immediate\write18{pdflatex note1}

\IfFileExists{note1.pdf}{%
\attachfile{note1.pdf}
}{%
}

\end{document}

%%%%%%%%%%%%%%%%%%%%%%

and how to make a reference from master.pdf or from (attached)
note2.pdf or from remote.pdf  to (attached) note1.pdf.

While as Heiko Oberdiek pointed out these links (at least two first)
are in pdf specifications (all links to parents, childs, siblings and
other relatives) and they
can be done by Acrobat 7 (don't have earlier versions), the existing
LaTeX packages
do not allow this.

> This might lead to a strategy for popping-up a moveable window.
>
> The application that I have in mind is for Academic Journal articles,
> in which a \ref to a {figure} or {table} pops up a window to the
> figure/table rather than jumping to it in the current window.

It could be appendices of different sorts, even references. With paper articles
it was the problem where to put this staff: in the end where nobody would look
or as needed just to break the paper. With e-articles it is easier:
one can always put
in the end and provide a link but I think that attached files could be
of interest on their
own. F.e. a  book could also contain as attachments e-talks made with (say)
beamer; one can always append them to the book but the single pdf
document with so different pages doesn't sound right (following Adobe
I distinguish between file and document <single file - many
documents>).

>
> This way a reader can see what is being referred-to, without
> interruption
> to his/her reading of the article. The window must be moveable
> and closeable, in case it would otherwise obscure where the text
> in the article at the place being read.
>
> If the figures/tables are present in a separate PDF file on disk,
> that was
> initially attached to the main article PDF, then I can get this strategy
> to work. But that requires the reader to extract the attachments and
> save
> them in the same directory as from where the document is being read.
> This is OK sometimes, but is an extra step for the user that I'd like
> to avoid. Also, if the document is read from a browser, then it probably
> won't work.

The disadvantage with all this fancy staff is that AR is needed and
are not available for all platforms.

Victor

PS As attachment there could be files of the different types which
allow some kinds of anchors: (pdf), html, djvu and may be some
multimedia files having tracks, chapters etc and  links directly to
these anchors could be interest aas well but this seems to be a long
shot
--  Victor
========================
Victor Ivrii, Department of Mathematics, University of Toronto