Referring to labels in other documents
If you write several related documents that refer to each other, you might want to use references to labels of another document. The package with the name xr
(standing for external references) implements this. First, load the xr
package:
\usepackage{xr}
If you need to refer to sections or environments in an external document, say, doc.tex
, insert this command into your preamble:
\externaldocument{doc}
This enables you to additionally refer to anything that has been given a label in doc.tex
. You may do this for several documents. If you need to avoid conflicts when an external document uses the same \label
as the main document, declare a prefix using the optional argument of \externaldocument
, which you can use to add a prefix. For example, we can use D-
as a prefix:
\externaldocument[D-]{doc}
This way, all references from doc.tex
would be prefixed by D-
, and you could write \ref{D-name}
to refer to name
in doc.tex
. Instead of...