Great Answers to
Questions About Everything


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.

{ asked by zfm }


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. The zref package can be used for this. It provides the zref-xr subpackage which gives you the same functionality and should work fine with hyperref (after all both packages are from the same author). You only need to replace \externaldocument with \zexternaldocument.

{ answered by Martin Scharrer }