I'm not sure it matters for this question but, in any event, I'm using TeXlipse as my latex editor and project management tool. Now, suppose one has two projects A and B that are built with separate output files, say, A.pdf and B.pdf. Further, suppose that theorems in B refer to theorems in A. Is there an established way to "link" these projects where the references in B to A resolve properly? For example, suppose that in project A on has the following:


And in project B one writes

Here in project A we note the result \ref{a_1}

Is there a way for the compiler to "find" the item labeled "a_1" and display the appropriate theorem number? If these are PDF's that live in the same directory, I would also expect to be able to click on the link and be taken to the appropriate place in the referenced document.


1 Answer 1


You should have a look at the xr package. Suppose you have two .tex files, a.tex and b.tex. Load the xr package in the preambles of both files. In a.tex, insert the instruction (after \usepackage{xr})

\externaldocument{b} % the extension .tex is assumed

and in b.tex, insert the instruction


As long as the labels used in the two files are unique, everything should compile smoothly. (Actually, be sure to compile both files at least twice, to let LaTeX resolve all cross-references. And, be sure not to delete the .aux files, as they will contain the information LaTeX needs to process the cross-references...) The manual of the xr package explains what to do if some of the labels are not unique.

By the way, the xr package doesn't cooperate smoothly with the hyperref package. If you want to combine them, you need to first load xr-hyper instead of xr, and then load hyperref. The file xr-hyper.sty is distributed with the hyperref package.

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .