I would like to use the following folder structure for my project:


The doc documents are supposed to access the template that defines part of the preamble. So, doc looks like

\usepackage{...} %additional packages to load

and template.tex looks as follows:


However, this does not work, because template.sty is not found, which seems to be a problem of relative/absolute paths. Is there a nice solution to this problem?

1 Answer 1


Search path at TeX macro level

The macro \input@path can contain additional search paths:

% ...

Environment variables

Another way is setting the environment variable TEXINPUTS to add the path ../template to the search path for TeX input files, e.g. for TeX Live/Linux/bash:

export TEXINPUTS=:../template

Also an absolute path could be used instead of the relative path. The colon at the begin (probably semicolon in Windows) says that first the configured paths without TEXINPUTS are searched, then TeX looks into ../template.


Also the template files could be installed in the home TEXMF tree, example for TeX Live/Linux:


Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.