[OS X TeX] include cannot be nested?

Themis Matsoukas matsoukas at psu.edu
Sun Nov 5 17:49:59 CET 2006


On Nov 4, 2006, at 5:10 PM, Charilaos Skiadas wrote:
>  I am guessing pdfsync might also not work with \input'ed
> files, but I haven't tested this.

Yes, it does. In fact, if you command click on the line \input 
{myfile.tex} of the main file, the pdf will open on the page  
corresponding to myfile.tex. Then, command-clicking on the pdf page  
takes you to myfile.tex. This makes navigation between multiple  
documents very convenient. Sometimes these synchronizations fail  
unpredictably but for the most part they work.

It is also possible to nest \includegraphics but this is a bit messy.  
It goes like this:

Root file:   folder0/folder1/main.tex
input file:  folder0/folder2/folder3/myfile.tex
graphics file:  folder0/folder2/folder3/mygraph.eps

In this example, folder2 is at the same level as folder1 and  may  
contain several problems in parallel subfolders, eg folder2/folder3,  
folder2/folder4, etc. I use this setup to keep track of homework  
problems by placing all associated files (graphs, notebooks, etc) in  
a separate folder for each problem.

To make graphics work, in myfile.tex load the graphics using:
    \includegraphics[scale=0.5]{folder3/mygraph}

In main.tex (root file) set the  graphics path to
    \graphicspath{{../folder2/}}

and load the source file using
    \input{../folder2/folder3/myfile.tex}

This should load the source file and the graphics. If the nesting of  
folders is different, one must make the corresponding changes.

The messy part is that the graphics path must be split into two  
parts, one that goes in  \graphicspath (this is the common part of  
the path of all graphics files) and the rest that goes in  
\includegraphics. This split is necessary if you want (as I do) to  
\input multiple files, each stored in different folders.

tm

On Nov 4, 2006, at 5:10 PM, Charilaos Skiadas wrote:

>> On Nov 4, 2006, at 4:43 PM, Alain Schremmer wrote:
>>> I have now spent a whole day trying to understand file paths up and
>>> down folders and I think that I finally got to understand how LaTeX
>>> works but now I am getting a message saying "include cannot be
>>> nested". Since I would of course swear on anything that it used to,
>>> I am now terminally stuck as I don't know what it really means and
>>> what to do.
>>
>> \include's can't be nested. You would probably want to use \input for
>> your exercises.
>>
>> http://www.eng.cam.ac.uk/help/tpl/textprocessing/teTeX/latex/latex2e-
>> html/ltx-245.html
>>
>> The following is from a blog post that I haven't managed to finish
>> yet, about managing large projects in LaTeX. It's, as far as I
>> understand, the differences between \include{afile} and \input 
>> {afile}:
>>
>> 1. You cannot have nested \include's, while you could have as many
>> nested \input's as you like. This makes \input a great command to use
>> for including libraries of custom commands and other preamble stuff.
>> 2. \include'd files generate their own .aux files, while \input'ed
>> files don't. I am guessing pdfsync might also not work with \input'ed
>> files, but I haven't tested this.
>> 3. \include'd files start on a new page no matter what. Depending on
>> the document class used, they might even start on the first available
>> odd-numbered page. This makes \include's perfect for starting a new
>> chapter.
>> 4. \include calls \clearpage right before starting its work. This
>> means that any floats, like tables and figures, that haven't been
>> rendered yet for one reason or another, will now be inserted.
>>
>>
>> Hopefully someone will correct me if I'm wrong in any of the above.
>>
>> Haris
>
>
> ------------------------- Info --------------------------
> Mac-TeX Website: http://www.esm.psu.edu/mac-tex/
>          & FAQ: http://latex.yauh.de/faq/
> TeX FAQ: http://www.tex.ac.uk/faq
> List Archive: http://tug.org/pipermail/macostex-archives/
>
>

------------------------- Info --------------------------
Mac-TeX Website: http://www.esm.psu.edu/mac-tex/
          & FAQ: http://latex.yauh.de/faq/
TeX FAQ: http://www.tex.ac.uk/faq
List Archive: http://tug.org/pipermail/macostex-archives/




More information about the macostex-archives mailing list