# [Tex/LaTex] \input and absolute paths

inputpaths

Sometimes it is convenient to use an absolute path to include a preamble. To do so, I use the following "hack":

\documentclass[a4paper, 12pt]{article}
\newcommand{\folder}{/path/to/folder}
\input{\folder/preamble}

\begin{document}
\end{document}


Now my question is, whether there is a more elegant way to do this, especially a way which is compatible with one of the flatten scripts from Replace \input{fileX} by the content of fileX automatically ?

You can define the internal macro \input@path to hold a list of base directories:

\makeatletter
\def\input@path{{/path/to/folder/}}
%or: \def\input@path{{/path/to/folder/}{/path/to/other/folder/}}
\makeatother


Then you can use \input{fileinthatfolder} everywhere. It also works for \includegraphics IIRC.

But I don't think this is supported by the mentioned scripts. AFAIK they simply take the string from the file and don't look at any macros.