[OS X TeX] Re: Referencing to figure in another document

Shahriar Anwar anwar at asu.edu
Wed Feb 23 02:37:11 EST 2011


Message: 4
Date: Mon, 21 Feb 2011 21:54:53 -0700
From: Don Green Dragon <fergdc at Shaw.ca>
Subject: Re: [OS X TeX] Referencing to figure in another document
To: TeX on Mac OS X Mailing List <macosx-tex at email.esm.psu.edu>
Message-ID: <B5761223-7308-46AC-933D-D3C29D876A78 at Shaw.ca>
Content-Type: text/plain; charset=us-ascii

Hi Shahriar,

As to your subject line, I think you mean "in another chapter".


I hesitate to reply, but the following works for me.

With respect to figures, I label them fig1a, fig1b, ... for figures in chapter 1. For figures in chapter 2, I use fig2a, fig2b, .... and so forth.

At this point, only two chapters are involved.

In chapter 1, I have a figure which is labelled with \label{fig1a}. When I refer to it in the source files, I simply use

       In Figure \ref{fig1a}, the notion of ....

and the proper reference to Figure 1.1 appears in the PDF file whether the reference occurs in the source code for chapter 1 or chapter 2.

By the way, in the preamble of the root file, I include the line

\graphicspath{{Drawings/Chap1/}}

since I keep the graphic files (usually .pdf guys) in the directory

<path>/Drawings/

where <path> leads to the root file for the document. For example, if the directory where the root files lies is

~/Documents/NewDoc/

then <path> is the path above. Specifically:

<path>/Drawings/Chap1/  contains the graphic files for chapter 1,
<path>/Drawings/Chap2/  contains the graphic files for chapter 2,
and so forth.

Consequently in the source file for chapter 1, I can use simple references like:

\includegraphics[scale=<scalefactor>]{<name of file in Drawings/Chap1/>}

for example

\includegraphics[scale=.95]{Fiveness}

In the past, I have used longer paths in the commands \includegraphics such as

\includegraphics[scale=.95]{Drawings/Chap1/Fiveness}

but I think (not sure) that <Drawings> must be a subdirectory of the directory where the root/master file is located. If you had different graphic files in different directories, but with the same name --- e.g., 'Fiveness' --- then would surely be an ambiguity and I don't know how TeXShop would handle it.

When I add some figures to chapter 2, I think the \graphicspath line must be changed to

\graphicspath{{Drawings/Chap1/}{Drawings/Chap2/}}

Have not yet used the above extension. The ideas for this came from The LaTeX Companion (start on page 624)  and Graetzer discusses these matters in section 3 of chapter 18 (i.e., 18.3).

I don't claim the above system is "a good one", merely that, so far, it has worked fairly well.

Hopefully, more experienced users will suggest improvements.  :-)


Don Green Dragon
fergdc at Shaw.ca

********************************
Dear Don Green,

You are correct, I do mean ``in another chapter." I like your way of organizing and putting all the figures in a Drawings directory. Makes it much easier to locate them. Your suggestion to use \graphicspath worked! Many thanks!!

Shahriar


More information about the MacOSX-TeX mailing list