Can A Default Path Be Set Globally For \input{...} Akin To \graphicspath{...}?


Answer :

\graphicspath comes from LaTeX's \input@path, just using the paths for graphics files. \input@path can be set independently, e.g.:

\makeatletter \def\input@path{{path1/}{path2/}} \makeatother 

Internally package graphics stores its path of \graphicspath in \Ginput@path and locally sets \input@path to \Ginput@path, if it looks for files via \IfFileExists.

Addition to \input@path

The macro \input@path can be undefined (usually the default in LaTeX) or it can already contain other path entries. Therefore, \providecommand in the following code first defines the macro for the case that \input@path is undefined. Then \g@addto@macro extends the definition of \input@path.

\makeatletter \providecommand*{\input@path}{} \g@addto@macro\input@path{{path1/}{path2/}}% append \makeatother 

Alternatively \edef can be used, which expands the definition text. The next example uses it to prepend the contents to \input@path to the old meaning of \input@path:

\makeatletter \providecommand*{\input@path}{} \edef\input@path{{path1/}{path2/}\input@path}% prepend \makeatother 

Comments

Popular posts from this blog

Are Regular VACUUM ANALYZE Still Recommended Under 9.1?

Can Feynman Diagrams Be Used To Represent Any Perturbation Theory?