Google Groups no longer supports new Usenet posts or subscriptions. Historical content remains viewable.
Dismiss

Referencing from other documents

95 views
Skip to first unread message

Yeong Wai LEE

unread,
Apr 14, 2004, 11:03:58 PM4/14/04
to
Hi all,

I would like to know how to \ref from other documents.

thankx
Yeong

Le TeXnicien de surface

unread,
Apr 15, 2004, 2:26:19 AM4/15/04
to
Yeong Wai LEE wrote / a écrit :

> Hi all,
>
> I would like to know how to \ref from other documents.

xr.sty could be what you're looking for.
hih
--
Le TeXnicien de surface

Yeong Wai LEE

unread,
Apr 15, 2004, 4:05:27 AM4/15/04
to
Thankx for your reply, after i have searched through xr.sty in google, i
managed to find that file, but it is still not working for my document.

I want to crossreference from about document, let's say, i want to
crossreference a.tex to b.tex, but they are in different directory.

Yeong

Robin Fairbairns

unread,
Apr 15, 2004, 5:28:12 AM4/15/04
to
Yeong Wai LEE <iy...@students.cs.mu.OZ.AU> top posts:

>after i have searched through xr.sty in google, i
>managed to find that file, but it is still not working for my document.

xr.sty is part of the latex required tools. if your system does not
contain it, you have a defective system. a properly configured system
will provide both the package and its documentation.

>I want to crossreference from about document, let's say, i want to
>crossreference a.tex to b.tex, but they are in different directory.

so make the .aux file accessible; for example, have a tex inputs
variable looking something like

TEXINPUTS=.:/dir/that/contains/aux/file:

(that example assumes you're working on a un*x system).
--
Robin (http://www.tex.ac.uk/faq) Fairbairns, Cambridge

Yeong Wai LEE

unread,
Apr 15, 2004, 8:44:45 AM4/15/04
to
Thankx Robin, it is working, but i have to copy let's say a.aux to
directory b/ if i want to crossference from a.tex. Basically i need to put
them into the same directory.

I search about TEXINPUTS in google, but still can't figure out how to use
it. I think TEXINPUTS can just put this line into b.tex so that i can
called a.aux, but i don't know how to use it.

Thankx
Yeong

Danie Els

unread,
Apr 15, 2004, 10:12:53 AM4/15/04
to
Yeong Wai LEE <iy...@students.cs.mu.OZ.AU> wrote in message news:<Pine.GSO.4.56.04...@murree.cs.mu.OZ.AU>...

> Hi all,
>
> I would like to know how to \ref from other documents.
>

Use the xr package as pointed out in the other threads, or use
xr-hyper for hyperlinked refs with hyperref.

A small example:

(a) write the following two tex file, docA.tex and docB.tex
(b) put both files in the same directory, otherwise the path
must be specified as part of the xr header.
(c) run pdfLaTeX twice on both filles. First on docA and then on docB.
docB reads docA.aux to get label info.

%%%%% docA.tex %%%%%%%%%%%%%%%%%%%%%%
\documentclass{article}
\usepackage{hyperref}
\begin{document}
This is a test for math.
\begin{equation}
E=mc^2 \label{eq:1}
\end{equation}
\clearpage

This is a second test for math.
\setcounter{equation}{5}
\begin{equation}
r = \sqrt{x^2 + y^2} \label{eq:2}
\end{equation}
\end{document}

%%%%% docB.tex %%%%%%%%%%%%%%%%%%%%%%%%%%%%
\documentclass{article}
\usepackage{xr-hyper}
\usepackage{hyperref}
\externaldocument[A-]{docA}[docA.pdf]% <- full or relative path
\begin{document}
As was shown in Eq.~\ref{A-eq:1} is it ...
\clearpage

... or in Eq.~\ref{A-eq:2} is ...
\end{document}
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%

I hope it helps

Danie Els: (dnjels at sun dot ac dot za)

Yeong Wai LEE

unread,
Apr 15, 2004, 7:35:28 PM4/15/04
to

On Fri, 15 Apr 2004, Danie Els wrote:

> Yeong Wai LEE <iy...@students.cs.mu.OZ.AU> wrote in message news:<Pine.GSO.4.56.04...@murree.cs.mu.OZ.AU>...
> > Hi all,
> >
> > I would like to know how to \ref from other documents.
> >
>
> Use the xr package as pointed out in the other threads, or use
> xr-hyper for hyperlinked refs with hyperref.
>
> A small example:
>
> (a) write the following two tex file, docA.tex and docB.tex
> (b) put both files in the same directory, otherwise the path
> must be specified as part of the xr header.

It is working, but my problem is i don't put docA.tex and docB.tex into
the same directory, how do i modify xr.sty? Or do i need to use TEXINPUTS?
which i don't know how to use either. Thankx for your help

Yeong

------------ And now a word from our sponsor ------------------
Do your users want the best web-email gateway? Don't let your
customers drift off to free webmail services install your own
web gateway!
-- See http://netwinsite.com/sponsor/sponsor_webmail.htm ----

Yeong Wai LEE

unread,
Apr 15, 2004, 8:00:06 PM4/15/04
to
I don't know how to use \externaldocument, what if docA in docA/ directory
and docB in docB/ directory. In this case, how do i use \externaldocument.

You mentioned that \externaldocument[A-]{docA}[docA.pdf]% <- full or
relative path,

I do this, \externaldocument[A-]{docA}[../docA.pdf]
it is not working.

Thankx alot.

Yeong


On Fri, 15 Apr 2004, Danie Els wrote:

Brooks Moses

unread,
Apr 16, 2004, 12:31:08 AM4/16/04
to
Yeong Wai LEE wrote:
> I don't know how to use \externaldocument, what if docA in docA/ directory
> and docB in docB/ directory. In this case, how do i use \externaldocument.
>
> You mentioned that \externaldocument[A-]{docA}[docA.pdf]% <- full or
> relative path,
>
> I do this, \externaldocument[A-]{docA}[../docA.pdf]
> it is not working.

According to your explanation, from docB, docA is at ../docA/docA.pdf.
This may explain why \externaldocument[A-]{docA}[../docA.pdf] isn't
working.

(Also, please don't top-post; that is, please put your reply below the
text that you're quoting, and quote only the relevant bits, as I've done
here.)

- Brooks


--
The "bmoses-nospam" address is valid; no unmunging needed.

Danie Els

unread,
Apr 16, 2004, 3:53:57 AM4/16/04
to
Yeong Wai LEE <iy...@students.cs.mu.OZ.AU> wrote in message news:<Pine.GSO.4.56.04...@muntye.cs.mu.OZ.AU>...

> I don't know how to use \externaldocument, what if docA in docA/ directory
> and docB in docB/ directory. In this case, how do i use \externaldocument.
>
> You mentioned that \externaldocument[A-]{docA}[docA.pdf]% <- full or
> relative path,
>
> I do this, \externaldocument[A-]{docA}[../docA.pdf]
> it is not working.


The format for \externaldocument is

\externaldocument[<refprefix>]{<aux-file>}[<pdf-file>]

Note that you must use the same relative directory structure for your
document development and you final distribution setup!

For a directory structure

./docAdir/docA.tex
./docBdir/docB.tex

you will use inside docB for references to docA:

\externaldocument[A-]{../docAdir/docA}[../docAdir/docA.pdf]

Hope it helps

Danie Els: dnjels at sun dot ac dot za

Yeong Wai LEE

unread,
Apr 16, 2004, 10:45:45 AM4/16/04
to

It is working now if i use \usepackage{xr-hyper}, but it is not working
when i use \usepackage{xr}, which i downloaded xr.sty from google. Because
in my document, i am not using hyperref, i just need to cross-reference
from different documents in different directory.

The errors it gave me was :

IMPORTING LABELS FROM ../docA/docA.aux

! LaTeX Error: Missing \begin{document}.

See the LaTeX manual or LaTeX Companion for explanation.
Type H <return> for immediate help.
...

l.4 \externaldocument[A-]{../docA/docA}[
../docA/docA.pdf]% <- full or
rela...


Thankx for your help

Yeong

>

Danie

unread,
Apr 16, 2004, 3:07:35 PM4/16/04
to

"Yeong Wai LEE" <iy...@students.cs.mu.OZ.AU> wrote in message
news:Pine.GSO.4.56.04...@muntye.cs.mu.OZ.AU...
>

> > \externaldocument[A-]{../docAdir/docA}[../docAdir/docA.pdf]


>
> It is working now if i use \usepackage{xr-hyper}, but it is not working
> when i use \usepackage{xr}, which i downloaded xr.sty from google. Because

xr and xr-hyper is part of the base LaTeX distro?

> in my document, i am not using hyperref, i just need to cross-reference
> from different documents in different directory.
>
> The errors it gave me was :
>
> IMPORTING LABELS FROM ../docA/docA.aux
>
> ! LaTeX Error: Missing \begin{document}.
>
> See the LaTeX manual or LaTeX Companion for explanation.
> Type H <return> for immediate help.
> ...
>
> l.4 \externaldocument[A-]{../docA/docA}[
> ../docA/docA.pdf]% <- full or
> rela...

Please read the documentation in the file xr.sty. It is in the begining of
the file and in plain English! The documentation states the format for xr
is:

\extenaldocument[<refprefix>]{<./path/to/aux-file>}

It do not have the [<url>] part at the end.

Danie Els


jqui...@brookstoneschool.org

unread,
Jun 22, 2016, 10:30:25 AM6/22/16
to
I used these packages in THIS order.

\usepackage{xr-hyper}
\usepackage{hyperref}
\usepackage{cleveref}
\externaldocument[]{DissertationWithNoSpacesinFileName}

If you have keyboard shortcuts, put them BEFORE THIS! E.g.



%Keyboard Shortcuts
\newcommand{\ME}{ Math Equation}
\usepackage{xr-hyper}
\usepackage[bookmarks=false]{hyperref}
\usepackage{cleveref}
\externaldocument[]{DissertationWithNoSpacesinFileName}

0 new messages