# inputting a file not from a subdirectory

Say I have a set up like this:

I have a main folder in which I have both preamble.tex and a folder sub_1. In sub_1, there is another folder sub_2 - and in sub_2 there is my_file.tex

What must I write in my_file.tex in order to input preamble.tex? A cursory google and tex.stackexchange search of "input" and "different directory" seems only to address the case when, say, the preamble is located in some subdirectory of where the main file is.

Any help is appreciated.

-
\input{../../preamble} –  Daniel Jun 24 '12 at 21:29
Daniel, thank you. –  JSeaton Jun 24 '12 at 21:54

Moreover, if one wants to input a file n levels above your file (file_name.tex), write \input{ then ../ n times, and then file_name}.

-
Meta-comment: this is not TeX-specific; it's just the way that relative paths are written in UNIX operating systems (in Windows, you turn the slashes around, but as Joseph Wright reminded me, TeX always uses forward slashes even in Windows). –  Ryan Reich Jun 24 '12 at 22:04
I would recommend using \def\Path{../..}, and then use \input{\Path/premable}, in case you ever decide to change the hierarchy. –  Peter Grill Jun 24 '12 at 22:55
One should mention that \include will not work for files above the current directory. –  egreg Jun 24 '12 at 23:00
@RyanReich: Meta-meta-comment: Path separation in Windows is good for quite some myths. In fact, the Win32/64 subsystems (at the API level) have always supported both, slashes and backslashes as path separator; the NT kernel under the hood even uses only forward slashes. The support of backslashes (and drive letters, which inside the kernel are just symbolic links, somewhat like UNIX) is a compatibility inheritance from DOS. It's only the shell (cmd.exe) that insists on backslashes and some applications that use archaic algorithms to sanitize file paths. –  Daniel Jun 28 '12 at 6:57