[Tex/LaTex] Cross-referencing between two files in overleaf

#refcross-referencingexternal filesoverleafxr

I have two files, SI.tex and main.tex. There is a subsection in main.tex that is labeled subsec:A. I want to reference this subsection from SI.tex. I'm doing this in overleaf, just in case that makes a difference. I tried using xr:




This results in ?? in the output, and a warning in Overleaf saying LaTeX Warning: Reference 'subsec:protein' on page 3 undefined on input line 123.

What could be the problem?

Edit: I just tried this locally, without using Overleaf, and it gives the following warning, which is perhaps more descriptive:

W: /../test.tex:0 No file main.auxLABELS NOT IMPORTED.

Best Answer

Try recompiling your document from scratch in Overleaf. To the right of the "Recompile" button, choose the dropdown menu option "Recompile from scratch". I followed the guide provided by Overleaf for xr package implementation, but to no avail. It wasn't until I recompiled my project from scratch that I noticed a change! I think this should be added to their documentation.

Related Question