I have two documents in LaTeX, one called main.tex and the other supplement.tex. They are both linked together by the xr package and compile without error. (They have to be compiled in the order: pdflatex on main followed by pdflatex on the supplement and then pdflatex on the main again to complete the cross-referencing. Is there a way to put this on arXiv and letting the compiler there know that pdflatex has to run a few times on each docment? Many thanks! Should one put up the .aux files also in that case?


You can workaround a problem. Take your file.aux, create xx.tex and upload it to arxiv along with your latex file. the xx.tex is:

The content of file.aux

In your latex file add (on top) \usepackage{filecontents}

and before \end{document} add


This way your latex file will create the file.aux that you can use with xr and \externaldocument

| improve this answer | |
  • This answer should be more highly publicised. Other answers (around the internet) seem to basically say "no, it can't be done" or give a more complicated answer that doesn't always work with the fact that arXiv only runs through once. I would +10 if possible! – Sam T Nov 5 '19 at 10:57
  • It works! I Just add a clarification, since I was a bit confused at first. Here file.aux refers to the main.aux in the question, and your latex file is the supplement.tex. So you take the generated aux file from your main tex file and add it to the supplement. – Makan Jul 1 at 19:25
  • This trick is really good and applicable to any other submission files, e.g., file.toc (for Table of Contents). Some packages (e.g., pagesel) forces ArXiv NOT to generate the required files like .aux, .toc, etc. – Jae Young Lee Sep 7 at 21:26

I would upload the compiled supplement.pdf, and supplement.aux with main.tex so the arXiv compiler can extract all the labels used in supplement.tex (via xr) when building main.tex, that should compile fine.

However I really would suggest including the supplementary in the main PDF (e.g. combining the tex sources or appending supplement.pdf using pdfpages) as finding supplementary through downloading the source is a pain and can leave the supplement's existence poorly advertised.

| improve this answer | |
  • I tried uploading supplement.aux and main.aux since both documents cross-reference each other, but to no avail. – user3236841 Nov 12 '17 at 14:13
  • Also, I am not sure how pdfpages works but not sure that the cross-referencing can work as is being suggested. Note that both main.tex and supplement.tex reference each other and it works very well for my purposes. – user3236841 Nov 12 '17 at 14:20
  • The arXiv wants a single file to compile to produce the paper, anything else should be included as an ancilliary file so I am suggesting upload the pre-compiled supplement.pdf and as long as supplement.aux is bundled with main.tex all references should appear correctly in the produced main.pdf. Are you looking for hyperlinking to work? This would be much more of a problem. – Dai Bowen Nov 14 '17 at 14:23

the xr package (and packages like it, such as xref that rely on having an external aux file present) don't work in arXiv's autotex engine. You'll need to re-work you citations between the two documents to not be cross-referenced from the same aux file.

| improve this answer | |

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.