Aha - thanks for making me analyze it better. It seems to be a conflict with how the package hyperref effects labels.
We're talking about cross-referencing so I need two files. The main one is text.tex:
Code: Select all
\documentclass{article}
\usepackage{xr}
\externaldocument{external} %aux files are in same folder
\begin{document}
See Section \ref{newsec}.
That's it!
\end{document}
Then in the other file (called by xr) - say external.tex - I either include hyperref or not. Here are the two cases,
Code: Select all
\documentclass{article}
\usepackage{hyperref}
\begin{document}
\section{This new section} \label{newsec}
This is an external file.
\end{document}
The file external.aux then contains the following line:
\newlabel{newsec}{{1}{1}{This new section\relax }{section.1}{}}
with the result that compiling text.tex gives the line,
See Section 1This new sectionsection.1.
That’s it!
Without hyperref, the following code
Code: Select all
\documentclass{article}
\begin{document}
\section{This new section} \label{newsec}
This is an external file.
\end{document}
In this case, the file external.aux then contains the following line:
\newlabel{newsec}{{1}{1}}
And the reult of compilation is as it should be,
See Section 1.
That’s it!
Is there anyway to make hyperref and xr work together?[/quote]
Thanks again, James