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.

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

I want to compile sections of the article independently. Clearly, I can make their numbers right just by using something like \setcounter{section}{4}.

How can I get something like \ref{VeryUsefulTheorem} working if the command \label{VeryUsefulTheorem} is in another section (i.e., in another TeX file, which is compiled to its own PDF file)?

I'm using the hyperref package, and, therefore, inter-document links are clickable. Is it possible to make links to a stuff in a different PDF file clickable?

share|improve this question
Do you really need to produce separate pdf files? Maybe the \include and \includeonly features would be enough for you? – Juan A. Navarro Aug 15 '10 at 14:14
I'd like to quote Juan A. Navarro. This is not the recommended way to work with LaTeX... You are just complicating what LaTeX allows you to do so easily... – Alessandro Cuttin Aug 16 '10 at 7:27
There are other use cases where it makes sense to have that capability. For example, when writing a document that discusses another document (e.g., a response letter for an academic journal explaining what was changed in a manuscript). – tmalsburg Nov 5 '13 at 16:39
up vote 11 down vote accepted

Use the xr package and xr-hyper if you need hyperref.

If all you want to do is compile selected parts of you document you should \include them and use \includeonly to select which files to compile. This will keep track of references and numbering.

share|improve this answer
Yes, it works if I write \usepackage{xr-hyper} before \usepackage[some options]{hyperref} and will not write \usepackage{xr} (otherwise I will have warnings "... has been referenced, but doesn't exist."). Thank you. – fiktor Aug 15 '10 at 16:42

Your Answer


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.