19

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?

fiktor
  • 1,953
  • 5
    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
  • 1
    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 07: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 05 '13 at 16:39

1 Answers1

14

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.

Martin Heller
  • 11,391
  • 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