Crossing referencing with 'xr' not working

3,505 views
Skip to first unread message

Vikram Chhatre

unread,
Jun 8, 2012, 11:51:57 AM6/8/12
to latexus...@googlegroups.com
Hello -

I am having difficulty referring to figures and tables in an external
document using the 'xr' package.


Main document
-----------------------
\usepackage{xr}

\externaldocument[S]{../../supplementary/supp}

Where supp is the name of the external document (supp.tex).

\ref{tab:supptable1}



External Document
-------------------------

\label{tab:supptable1}



The log shows that the xr package was reading the label information
from external document and no errors were reported. I also tried
putting supp.tex and supp.aux in the current directory and updating
the path above, without any success. All I get in both cases is a
question mark in the main document.

Thanks for any input.

Vikram

Peter Flynn

unread,
Jun 8, 2012, 3:04:40 PM6/8/12
to latexus...@googlegroups.com
On Fri, Jun 8, 2012 at 4:51 PM, Vikram Chhatre <cryptic...@gmail.com> wrote:
Hello -

I am having difficulty referring to figures and tables in an external
document using the 'xr' package.


Main document
-----------------------
\usepackage{xr}

\externaldocument[S]{../../supplementary/supp}

Where supp is the name of the external document (supp.tex).

\ref{tab:supptable1}

No, if you have defined the external document as "S", then references to it must be prefixed by "S-", so you need \ref{S-tab:supptable1}

This is on p.1 of the documentation for the xr packages.

///Peter

Vikram Chhatre

unread,
Jun 8, 2012, 3:12:18 PM6/8/12
to latexus...@googlegroups.com
Peter,

Thanks for your reply. I thought you either had to assign a S- at
every call of the reference, or initial as an option in the preamble,
not both.

\externaldocument[S]{../supp/supp}

\ref{S tab:supptable1}

I do not want a hyphen after the S. The references should appear as:
table S1 and figure S1.

I tried the above example, but still got only question marks. Perhaps
I still don't understand what syntax is needed.

Thanks again
Vikram
> --
> You received this message because you are subscribed to the Google Groups
> "LaTeX Users Group" group.
> To post to this group, send email to latexus...@googlegroups.com.
> To unsubscribe from this group, send email to
> latexusersgro...@googlegroups.com.
> For more options, visit this group at
> http://groups.google.com/group/latexusersgroup?hl=en.

Peter Flynn

unread,
Jun 8, 2012, 5:29:23 PM6/8/12
to latexus...@googlegroups.com
On Fri, Jun 8, 2012 at 8:12 PM, Vikram Chhatre <cryptic...@gmail.com> wrote:
Peter,

Thanks for your reply.  I thought you either had to assign a S- at
every call of the reference, or initial as an option in the preamble,
not both.

\externaldocument[S]{../supp/supp}

\ref{S tab:supptable1}

I'm sorry, I also misread the documenation. It would be \ref{Stab:supptable1}
 
I do not want a hyphen after the S.  The references should appear as:
table S1  and figure S1.

That's a completely different thing. That's the resolution of the reference.

The [S] is there to enforce the uniqueness of the labels, NOT to prefix the resolution value. I don't think the xr package provides any automated way to do what you seem to want.

///Peter

Vikram Chhatre

unread,
Jun 8, 2012, 5:35:15 PM6/8/12
to latexus...@googlegroups.com
Hi Peter,

Now it works. Thank you for clarifying again. I read the
documentation to mean that [S] was going to be prefixed AND PRINTED to
every occurrence of an imported label/reference.

\ref{Stab:supptable1} works as it should.

Thanks again.
Vikram

Peter Flynn

unread,
Jun 8, 2012, 6:06:34 PM6/8/12
to latexus...@googlegroups.com
On Fri, Jun 8, 2012 at 10:35 PM, Vikram Chhatre <cryptic...@gmail.com> wrote:
Hi Peter,

Now it works.  Thank you for clarifying again.  I read the
documentation to mean that [S] was going to be prefixed AND PRINTED to
every occurrence of an imported label/reference.

I think your idea is right: it should be printed, otherwise there is no way to distinguish a reference from one document from a  reference to another.

Perhaps you should ask David Carlisle to consider adding this...it was written in 1994.

///Peter

Bruno Remillard

unread,
Sep 14, 2022, 9:18:52 PM9/14/22
to LaTeX Users Group
It works with miktex. However it does not work with overleaf. It seems that all aux files are called output.aux which is the problem.
Reply all
Reply to author
Forward
0 new messages