Take the 2-minute tour ×
TeX - LaTeX Stack Exchange is a question and answer site for users of TeX, LaTeX, ConTeXt, and related typesetting systems. It's 100% free, no registration required.

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:


\begin{theorem}\label{a_1}
...
\end{theorem}

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.

share|improve this question
1  
Give a look at this: tex.stackexchange.com/questions/6210/… –  Arianna Jan 4 '12 at 15:17

1 Answer 1

up vote 12 down vote accepted

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

\externaldocument{a}

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.

share|improve this answer

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.