Path to External Files in Nested \input

Use the package import, which does exactly one thing: to solve this problem. See

http://www.ctan.org/pkg/import

Basically the package defines two commands: \import and \subimport. \import needs an absolute path, while subimport needs a relative path. They both look at the current folder and TEXINPUTS first. If you want to avoid checking TEXINPUTS, use the starred version.

Example

For your case, the only line you need to change is to update \input to \subimport (and of course, add \usepackage{import}). That is, you would need to write:

\subimport{common}{cosmetix.tex}

No changes are necessary in cosmetix.tex.


I personally try to avoid having to remember to change settings just because I switched computers. And since you are using Dropbox, I would recommend you set up your directory structure so that it is portable and does not require special settings:

 /Projects
     common/
     paper1/
     paper2/

Don't keep files in the \Projetcs directory, but only in the sub-directories, and always use relative paths:

\newcommand*{\CommonPath}{../commom}% 
\input{CommonPath/abbreviations.tex}%

Alternatively, you could adapt one of the solutions from How to detect and condition based on hostname to define a different root path depending on which machine you are on.


As discussed in comments on the question, it seems a reasonable solution is to update the TEXINPUTS variable. You will have to update this variable on all of your computers. If you are using Dropbox or any sync software to keep your computers in sync, you should put the common folder in their path.

For WindEdt/Win7, Choose Variables tab from Options | Execution Modes. Under TEXINPUTS variable (or add it if it's not there) enter the absolute path to the folder. The screen shot below shows how when the common folder is called _Common.

enter image description here

Tags:

Input