# What happens to a relative path in a file added with \input{}?

I stumbled upon the following question:

In the preamble of my main tex file for my thesis, I've included several other files with definitions for abbreviations which are in the same path as main.tex, so I've only used the filename with the relative path to include them:

\include{abbrevations.tex}

For using some of my definitions also in other TeX-Documents (e. g. graphics created with IPE) I've created a file called IPE-Preamble.tex, which contains selected parts of my preamble, so also the lines \include{abbrevations.tex}.

Both mentioned files are located in the same path THESIS/

I've included the file IPE-Preamble.tex in many other files which are located in the path THESIS/graphics successfully, it works:

\input{/drive/path/path2/THESIS/IPE-Preamble.tex}

Now I wanted to use this file also in .tex files which are located elsewhere on the same computer (let's say path /drive/path3/path4/main2.tex). I used the same input command with the full path for IPE-Preamble as stated above, but I get an error message, that commands (which are defined in abbreviations.tex are "not defined", so it seems that the include command does not work in this case.

Does TeX search for the file /drive/path3/path4/abbreviations.tex because of the relative path of the include command in IPE-Preamble.tex?

-
Don't use \include for code snippets. \include is only useful for document parts like a complete chapter. In all other cases use \input. Regarding the relative pathes see the FAQ: tex.ac.uk/cgi-bin/texfaq2html?label=docotherdir – Ulrike Fischer Jul 1 '11 at 15:00
\include{abbrevations.tex} is wrong it should be called without any extension: \include{abbrevations}. While \input can be used with and without (defaults to .tex) extension to load any kind of text file (e.g. \lstinputlisting is using it internally), \include is explicitly for .tex files only. If you use the extension a file abbrevations.tex.aux is created not abbrevations.aux. I'm not sure if and what issues that may cause. – Martin Scharrer Jul 1 '11 at 15:11
You can also set the environment variable TEXINPUT=".:/drive/path/path2/THESIS:", to make LaTeX look for files also there. I do this a lot for my thesis. – Martin Scharrer Jul 1 '11 at 15:14
@Ulrike: :-) I actually have an \include{abbrevations} in my Ph.D. thesis, so I can just use \includeonly if I need to give that list to my supervisor as PDF. Same for the ToC etc. They all belong on pages of their own anyway. But you are of course right, that \include shouldn't be used for code snippets and only if you have a reason to use it. – Martin Scharrer Jul 1 '11 at 15:53