[OS X TeX] Referencing to figure in another document
Don Green Dragon
fergdc at Shaw.ca
Mon Feb 21 23:54:53 EST 2011
Hi Shahriar,
As to your subject line, I think you mean "in another chapter".
> On Feb 21, 2011, at 7:33 PM, Shahriar Anwar wrote:
>
>> Dear LaTeX Community,
>>
>> I am writing a manuscript using the memoir class. The different chapters ( .tex files) of the manuscript are entered in the main document with the command \include{Path/ChapterName}. Now if I have a figure in Chapter2 (\label{fig:AGreatFigure}), say, and want to reference it from Chapter4, then how would I go about doing it?
>>
>> I have tried \ref{fig:AGreatFigure} and \ref{Path/Chapter2/fig:AGreatFigure} and different variants of it in Chapter4, but upon compiling my main manuscript.tex file I get question marks (??) where I expect the proper referencing to be. Of course I have saved and compiled my documents several times but haven't figured out the solution.
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
More information about the MacOSX-TeX
mailing list