Take the 2-minute tour ×
TeX - LaTeX Stack Exchange is a question and answer site for users of TeX, LaTeX, ConTeXt, and related typesetting systems. It's 100% free, no registration required.

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

main.tex:

\documentclass{article}
\usepackage{import}
\begin{document}
\subimport{X/}{bla.tex}
\end{document}

bla.tex

BLA

X/bla.tex

XBLA

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
add comment

1 Answer

up vote 3 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
add comment

Your Answer

 
discard

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.