I am trying to learn the import package but I find it extremely unreliable - perhaps I am missing something? One case study I tried is as follows:

Created 3 tex files:

  • ./main.tex
  • ./bla.tex
  • ./X/bla.tex







However, when compiled, in the produced pdf I see BLA instead of XBLA as I have expected. Only when I remove the file ./bla.tex (or change its name), the correct one X/bla.tex is included and XBLA appears in the pdf.

What is going on? How can I make it work?

In my real-life case scenario with much bigger file structure, I have some common file names in each directory, such as config.tex and cannot afford making each name unique.


Refering to manual:

Depending on on how your TeX ystem is configured, if a file with the same name as the import file exists in the current directory or in the TEXINPUTS path, that other file will be read in preference to one in the import directory.

So, it tries to read the file from the . dir (for you MWE), finds it and includes, so, the result is "BLA".

The solution is to use the starred version: \subimport*{X/}{bla.tex}.

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.