2

This is asking for a clarification on a package suggested for cross-referencing with hyperlinks using online editors in this question: Cross-referencing between different files . My folder structure might cause the suggested solution to fail. In my preamble, I call:

\usepackage{zref-xr}

Below that I define:

\makeatletter
\newcommand*{\addFileDependency}[1]{% argument=file name and extension
  \typeout{(#1)}
  \@addtofilelist{#1}
  \IfFileExists{#1}{}{\typeout{No file #1.}}
}
\makeatother

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

Now, in a folder, I have the file:

chapter2/main.tex

in which I call:

\myexternaldocument{Appendices/appendix_to_chapter2}

Obviously, there exists a folder Appendices containing a file "appendix_to_chapter2.tex"

However when compiling this, I get the error message:

Package zref-xr Warning: File `Appendices/appendix_to_chapter2.aux' not found or empty, labels not imported on input line 2.

I am not sure how to provide a MWE replicating a specific folder structure but I suspect the error is in renaming something. Does anyone know what I can do please?

JamesT
  • 3,169

1 Answers1

1

Ok, I found the answer to the question myself. I forgot to include appendix_to_chapter2.tex to the main file. Clearly, the file wasn't created before so there was no .aux file either. Now it works fine. I hope this helps anyone in the future.