Problem
I usually load a helping TeX file that contains my customizations, e.g., usual packages, corporate standard colors, and macros for abbreviations. I want my helping file to also load another external file that is in the same folder. I certainly want to avoid giving the explicit path to the second external file every time.
Example
Let's say the helping file is cosmetix.tex
, which loads abbreviations.tex
. abbreviations.tex
is in the same folder as cosmetix.tex
and both are in a folder called common
:
% cosmetix.tex
% ... some customization
% load abbreviations
\input{abbreviations.tex}
My main file is tester.tex
:
% tester.tex
\documentclass{article}
% load cosmetix
\input{common/cosmetix.tex}
\begin{document}
Dummy text.
\end{document}
This leads to the following error: LaTeX error: File `abbreviations.tex' not found.
Question
How can I use nested \input
s with files in different folders without (i) converting my code to a package and (ii) using absolute paths?
Context
Although this question is pretty generic, it is also a follow up to my previous question: Reproducing an official letterhead. I have reproduced my institute's letterhead, which in turn needs to load the logo. I load the letterhead using the \input
mechanism. I know this is not the most elegant way, but until I get time to convert this to a package (or read scrlttr2
documentation to convert my letterhead to an option file), this is a solution that reasonably works for me.
As I mentioned above, I can't use absolute paths because I'm using multiple computers with different operating systems, and therefore, the root of the directory tree is different for each computer.
../common/
(with as many../
needed to get to a common point) assuming that you keep all the files at the same hierarchy depth. Otherwise you could define a\Path
which has the full path and use\input{\Path/common/<file>}
. – Peter Grill Jun 17 '12 at 1:57~/texmf/tex/latex/commons
. See tex.stackexchange.com/a/1167/9626 by @JosephWright – Ali Mehrizi Jun 17 '12 at 5:22