Cross Referencing between thesis chapters

886 views
Skip to first unread message

Catscan

unread,
Sep 21, 2009, 7:17:36 PM9/21/09
to LaTeX Users Group
How do I make a reference to a label in other chapter?

Each Chapter is its own .tex and I compile them all by using \include
{} in a main file thesis.tex

The problem is if I do a \ref{} it will only bring up the labels I
have created in the current chapter I am in.

How do I get \ref{} to recognise all the other chapter labels too?

Cheers!

C

Werner Grundlingh

unread,
Sep 21, 2009, 7:27:51 PM9/21/09
to LaTeX Users Group
This is possible by default. That is, if you \include{...} the files
in a main file, the .aux file contains all labels across all included
files, implying that it is possible to reference labels in other files
through \ref{...}.

To see whether this is indeed possible, try putting the same label in
two difference .tex files:
\label{test_label} % in file_1.tex
\label{test_label} % in file_2.tex
and use
\include{file_1.tex}
\include{file_2.tex}
in your main_file.tex file. Now when you compile main_file.tex, you
should receive a warning:
Warning: Label `test_label' multiply defined

Werner

Catscan

unread,
Sep 22, 2009, 2:28:17 PM9/22/09
to LaTeX Users Group
Thanks for the reply!

I've tried this and I don't get an error and the document still
compiles.
I checked the mainfile.aux and it only contains bibcite information
across all chapters. Each chapter also has a .aux file which contains
the label information.
Any further ideas as to where I'm doing wrong?

Thanks for your help,
Cathy

Werner Grundlingh

unread,
Sep 22, 2009, 2:33:33 PM9/22/09
to LaTeX Users Group
On Sep 22, 11:28 am, Catscan <cathyscanl...@gmail.com> wrote:
> Thanks for the reply!
>
> I've tried this and I don't get an error and the document still
> compiles.
> I checked the mainfile.aux and it only contains bibcite information
> across all chapters. Each chapter also has a .aux file which contains
> the label information.
> Any further ideas as to where I'm doing wrong?
>
> Thanks for your help,
> Cathy

Perhaps try deleting all auxilliary (.aux) files, both the
main_file.aux and chapter_files.aux files and try to recompile. I
wouldn't know what else to do other than breaking down the document
into minimal components and building it up from there. That is, start
with the same setup you currently have, stripped down to (say) 3 files
- 2 chapters and a main file, each of the chapters having a label in
them, referencing each other, and going from there.

Werner

Ariovaldo V Garcia

unread,
Sep 22, 2009, 3:01:08 PM9/22/09
to latexus...@googlegroups.com
Hi

Could you send us the preamble (from the beginning of the file up to the \begin}document} )
of your mainfile and of one of the chapters you are including? I guess that this will help us to help you...

Ariovaldo

Seamus

unread,
Sep 23, 2009, 5:28:18 PM9/23/09
to LaTeX Users Group
What do you mean "it will only bring up the labels you have created in
the current chapter"?
Say you're referencing section two of chapter two in your introduction
to chapter 1. Does the reference say "2" when you want it to say "2.2"
or does it just come up as (??)

If the first case, then it might be you need to look at the following
page:
http://www.tex.ac.uk/cgi-bin/texfaq2html?label=running-nos

If the second case, check your \label and your \ref are not mis-
spelled (and make sure no labels are duplicated), and try recompiling
your file...
Reply all
Reply to author
Forward
0 new messages