TeX - LaTeX Stack Exchange is a question and answer site for users of TeX, LaTeX, ConTeXt, and related typesetting systems. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

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.

share|improve this question
up vote 4 down vote accepted

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}.

share|improve this answer

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

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