1

I have two files which I want to cross-reference to each other. following this latexmk with external references this is what I did. I am compiling in overleaf.

In file 1 I have the following:

\usepackage{xr}
\makeatletter
\newcommand*{\addFileDependency}[1]{
  \typeout{(#1)}
  \@addtofilelist{#1}
  \IfFileExists{#1}{}{\typeout{No file #1.}}
}
\makeatother

\newcommand*{\myexternaldocument}[1]{
    \externaldocument{#1}
    \addFileDependency{#1.tex}
    \addFileDependency{#1.aux}
}

\myexternaldocument{D_appendix}

In file 2 this is what I have

\usepackage{xr}
\makeatletter
\newcommand*{\addFileDependency}[1]{
  \typeout{(#1)}
  \@addtofilelist{#1}
  \IfFileExists{#1}{}{\typeout{No file #1.}}
}
\makeatother

\newcommand*{\myexternaldocument}[1]{
    \externaldocument{#1}
    \addFileDependency{#1.tex}
    \addFileDependency{#1.aux}
}

\myexternaldocument{A_main}

Any idea what I have to do with the latexmkrc file? Thanks in advance

  • [Disclaimer: I'm a support personnel at Overleaf.] The procedure may fail if your A_main.tex contains some compile errors, or due to the version of xr.sty your project is using. It may be easier to debug if you contact support@overleaf.com with your project's URL, thanks! – imnothere Oct 23 '19 at 02:44

0 Answers0