LaTeX forum ⇒ GeneralPackage xr warning: No file file4.aux LABELS NOT IMPORTED on input line 30

LaTeX specific issues not fitting into one of the other forums of this category.
almcgowan
Posts: 4
Joined: Mon Feb 03, 2020 9:19 pm

Package xr warning: No file file4.aux LABELS NOT IMPORTED on input line 30

Postby almcgowan » Wed Mar 25, 2020 3:36 am

Hi everyone,

I'm working on an article with tons of appendices that we need a cross referencing system for. Since we user hyperref, I gave the xr-hyper package a try. After MANY attempts, I got it to work with three external documents, but the moment I add a fourth, I get the error message "Package xr warning: No file file4.aux LABELS NOT IMPORTED on input line 30".

Here's the thing: We're using Overleaf (and pdflatex). Doing this locally is unfortunately not an option at this point.

I've read every thread I could find, applying all the working examples I could find, but to no avail.

I'm attaching a MWE of the various pages below. Can anyone figure out why on earth it won't accept references to the fourth file?


[MWE] % the preamble

%\usepackage{xcite}
\usepackage{xr-hyper}
\usepackage{hyperref}

\makeatletter
\newcommand*{\addFileDependency}[1]{% argument=file name and extension
\typeout{(#1)}% latexmk will find this if $recorder=0 (however, in that case, it will ignore #1 if it is a .aux or .pdf file etc and it exists! if it doesn't exist, it will appear in the list of dependents regardless)
\@addtofilelist{#1}% if you want it to appear in \listfiles, not really necessary and latexmk doesn't use this
\IfFileExists{#1}{}{\typeout{No file #1.}}% latexmk will find this message if #1 doesn't exist (yet)
}
\makeatother

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

% put all the external documents here!
\myexternaldocument{file1}
\myexternaldocument{file2}
\myexternaldocument{file3}
\myexternaldocument{file4}

[/MWE]

[MWE]
% the latexmkrc file

add_cus_dep( 'tex', 'aux', 0, 'makeexternaldocument' );

sub makeexternaldocument {
# if the dependency isn't one of the files that this latexmk run will consider, process it
# without this test, we would get an infinite loop!
if (!($root_filename eq $_[0]))
{ # PLEASE ENABLE ONLY ONE OF THE FOLLOWING
# DEPENDING ON THE ENGINE YOU'RE USING

# FOR PDFLATEX
system( "latexmk -pdf \"$_[0]\"" );

# FOR LATEX+DVIPDF
# system( "latexmk \"$_[0]\"" );

# FOR XELATEX
# system( "latexmk -xelatex \"$_[0]\"" );

# FOR LUALATEX
# system( "latexmk -lualatex \"$_[0]\"" );
}
}
[/MWE]

[MWE]
% File 1

\documentclass[12pt]{article}

\input{preamble}

\begin{document}

\section{section 1 in file 1}
\label{sec1file1}

\section{section 2 in file 1}
\label{sec2file1}

Testing some references: \\

Referencing section one in file one: \ref{sec1file1}\\
Referencing section two in file one: \ref{sec2file1} \\
Referencing section one in file two: \ref{sec1file2} \\
Referencing section two in file two: \ref{sec2file2} \\
Referencing section one in file three: \ref{sec1file3} \\
Referencing section two in file three: \ref{sec2file3} \\

\end{document}
[/MWE]

and finally, an example of the rest of the files:

[MWE]
\documentclass[12pt]{article}

\input{preamble}

\begin{document}

\section{section 1 in file 3}
\label{sec1file3}

\section{section 2 in file 3}
\label{sec2file3}

Testing some references: \\

Referencing section one in file one: \ref{sec1file1}\\
Referencing section two in file one: \ref{sec2file1} \\
Referencing section one in file two: \ref{sec1file2} \\
Referencing section two in file two: \ref{sec2file2} \\
Referencing section one in file three: \ref{sec1file3} \\
Referencing section two in file three: \ref{sec2file3} \\
Referencing section two in file four: \ref{sec2file4} \\

\end{document}
[/MWE]

User avatar
Johannes_B
Site Moderator
Posts: 4145
Joined: Thu Nov 01, 2012 4:08 pm

Postby Johannes_B » Wed Mar 25, 2020 6:20 am

The smart way: Calm down and take a deep breath, read posts and provided links attentively, try to understand and ask if necessary.


Return to “General”

Who is online

Users browsing this forum: No registered users and 4 guests