2

A typical example when writing a paper is that you have a main document main.tex and a document containing supplementary information si.tex. Both documents are stand-alone in the sense that they compile into separate documents with separate bibliographies, however one of or both document(s) may explicitly reference sections of the other.

This is often done by including something similar to

\usepackage{xr}
\newcommand*{\myexternaldocument}[1]{%
    \externaldocument{#1}%
    \addFileDependency{#1.aux}%
}

\myexternaldocument{si}

to main.tex and/or vice versa.

The problem arises from how arXiv processes your file submissions. All .tex files are compiled in alphabetical order, and each will have the corresponding .aux and .pdf files deleted beforehand. This order can be changed by renaming files or by specifying the toplevel file in 00README.XXX as described here. But the problem remains that arXiv deletes the .aux files corresponding to any .tex files that will be compiled. How is the best way to solve this?

2
  • related
    – Sterling
    Apr 12, 2021 at 21:48
  • Could you please gimme a simple example how this cross-referencing for each other works? I couldn't figure this out for PRL submission.
    – rainman
    Jan 16, 2022 at 2:53

1 Answer 1

3

The simplest solution I've come up with that doesn't require changing anything in your .tex files is to compile your two documents yourself before uploading, then rename your two .tex files. Since arXiv only deletes .aux files that correspond to a .tex file, this effectively removes the cross-dependency between the files.

Say that both main.tex and si.tex reference each other. After compiling, validating that everything looks alright and renaming the .tex files you should be left with a set of temporary files as well as

main_renamed.tex
main.aux
si_renamed.tex
si.aux

Once upload on arXiv, main_renamed.tex will be compiled first and since si.aux are not deleted, the references should compile successfully. Afterwards si_renamed.tex will be compiled and since main.aux exists, the references should compile successfully. Since main_renamed.tex was compiled before si_renamed.tex, that is the order the text will appear in the final pdf document.

2
  • 1
    One issue I encountered by doing this was that the hyperlinks (hyperref package) weren't working anymore. They were formatted correctly, but not clickable. Any idea why?
    – Ben
    Aug 19, 2020 at 18:40
  • @user2653663 Was stuck on this for hours (until trying this answer). Needed to rename other dependency files (.glo, .bbl, etc.), but seemed to work. No hyperlinks and not sure why (note: I had turned off ArXiv's HyperTeX due to a hyperref conflict), but at least the formatting is correct and I can submit! (but ditto on getting hyperlinks to work @Ben)
    – Sterling
    Apr 12, 2021 at 22:13

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.