# [OS X TeX] referencing external documents with xr

peter.frings at agfa.com peter.frings at agfa.com
Fri Sep 11 09:05:24 EDT 2009

Good afternoon all,

I was trying to find a way to refer to sections, figures, etc. in
external document, and stumbled upon the hyper-xr package. However,
I'm having a problem with it that I cannot figure out by myself...

The problem is that the link to the external file uses the same path
as the one specified in the \externaldocument directive.

In our system, we have many (PDF) documents, available to all co-
workers, in a single, source-controlled folder. The .tex and other
files (images, ...) for each of these documents live in a separate
subtree, with a subfolder per document

Ex:
.../proposals/abc.pdf
.../proposals/def.pdf
.../proposals/gih.pdf

.../proposals-src/abc/abc.tex + other files
.../proposals-src/def/def.tex + other files
.../proposals-src/gih/gih.tex + other files

You see it coming, right?

When writing the documents in the proposals-src tree, I add e.g., in
abc.tex:

\externaldocument[def/]{../def/def}
...
\ref{def/section1}
...

Sure enough, when working on the document in the src tree, the link in
the resulting abc.pdf file properly links to proposals/def/def.pdf and
opens it when clicked. However, when I move it to it's final folder
and check it in, the link no longer works: it tries to access document
"../def/def.pdf", which is of course not there.

So, finally, my question: is there a way to make this work, one way or
another, preferably without changing the structure of the  src and
final trees?

Thanks,
Peter.