I want to cross-reference between different .tex
files, just because I want to put every chapters separately.
Let's say in file chapterI.tex
I have \label{a}
and I want to access this in file chapterII.tex
using something like \ref{a}
. How to do this exactly in LaTeX, moreover if LEd
have an easy feature to cover this, it will be better (I have put those both files in the same project).
I found another question with similar title, but I just didn't really understand. It's here: Cross-reference between LaTeX files.
Best Answer
You can use the
xr
package to reference to other LaTeX document.So in
chapterII.tex
you say:And then can use
\ref{a}
like normal. You can also add a prefix:then you can reference it as
\ref{I-a}
which is useful if you have identical label names in different chapters.Note that the normal
xr
doesn't add hyperlinks. It only adds the label text. Thezref
package can be used for this. It provides thezref-xr
subpackage which gives you the same functionality and should work fine withhyperref
(after all both packages are from the same author). You only need to replace\externaldocument
with\zexternaldocument
as well as\ref
with\zref
.Note that the
xr
package reads theaux
file, e.g. in this case, it checkschapterI.aux
for references.