1

I am aware of the question below about how to refer, in file1, to labels from file2.

latexmk with external references

However, I must also refer, in file2, to labels from file1.

I am able to do it by using xr and \externaldocument in both files and running latex in the command line of my computer.

I want to run it on overleaf, and imagine that latexmk is the answer, but don't know how.

bmello
  • 133
  • This isn't a full answer, but a general way to handle this sort of situation in make is to create a dummy "master" document which calls up the cross references in all the real documents (and it doesn't need to do anything else apart from that). Then, when you compile the master document, the dependencies mean that all the real documents get compiled first. If any of the references in them have changed, that means the master document needs to be compiled again, which will force another recompile of all the real documents … and repeat, till everything converges. – alephzero May 23 '19 at 20:45
  • 1
    (I'm on support staff at Overleaf.) I started with our xr example here: https://www.overleaf.com/learn/how-to/Cross_referencing_with_the_xr_package_in_Overleaf and copied the helper code from File1.tex also into File2.tex. In File2.tex, I used \myexternaldocument{File1} to mark File1.tex as containing external labels to use in File2.tex. With this setup I have references working in both directions: https://www.overleaf.com/read/qpsqvqqwshpm . If that's not working for you, could you please write us at support@overleaf.com with your Overleaf project URL, so we can take a closer look? Thanks. – Paul Gessler May 23 '19 at 22:26
  • @PaulGessler should be labelled as correct answer - thanks! – dsg38 Dec 08 '20 at 18:18

0 Answers0