I could swear this used to work before, as I did not change my makefiles or files name. Now, after doing update to texlive, I get an error when parent file, called index.tex tried to subimport from lower folder, a file which happens to also be called index.tex.

>ls -l index.tex

>ls -l folder/index.tex

I am sure this worked before, since this is how it was for years in my source tree. Now it fails to compile. Here is a MWE

File name is index.tex



And in subfolder, called folder/ I have child file called index.tex

%file  folder/index.tex


When I compile the parent index.tex, I get this

lualatex index.tex
This is LuaTeX, Version 0.95.0 (TeX Live 2016) 
 restricted system commands enabled.
LaTeX2e <2016/03/31> patch level 3
Babel <3.9r> and hyphenation patterns for 1 language(s) loaded.
ABD: EveryShipout initializing macros (./index.tex (./index.tex (./index.tex
(./index.tex (./index.tex (./index.tex (./index.tex (./index.tex (./index.tex
(./index.tex (./index.tex (./index.tex (./index.tex (./index.tex
! TeX capacity exceeded, sorry [text input levels=15].
<argument> index 

l.8 \subimport{folder/}{index}

 326 words of node memory still in use:
   1 hlist, 1 rule, 1 dir, 5 glue, 39 glue_spec, 2 write, 1 pdf_colorstack node
   avail lists: 2:15,3:1,4:1,5:4,7:2,8:1,9:3
!  ==> Fatal error occurred, no output PDF file produced!
Transcript written on index.log.

I can fix this by renaming the child to index_1.tex so the names are not the same.

My question is: Can parent and child files be the same name?

I use index.tex for many things, and use standalone to pull all files into one document. I do not want now to go renames all the files and change makefiles. This used to work before? (else how did my tree build before?)

Using texlive 2016, just did full update.

  • 2
    I can reproduce the behaviour with TL14, 15 and 16. It is actually even documented. Use the star-version of \subimport if you want to avoid it. Dec 26, 2016 at 14:36
  • @UlrikeFischer thank you. I have changed to non-star version long time ago, and must have not rebuild this part of the tree since. I have large tree and sometimes I do not build it all. Actually it was you who told me not to use the star version :) Here is the link why-font-missing-message-shows-up-when-using-standalone-and-import-packages-only Using star version of submiport causes a problem. Ok, so I have to rename the child files to something different now :)
    – Nasser
    Dec 26, 2016 at 20:37

1 Answer 1


This is the documented behaviour (and it hasn't change since at least TL14):

Depending on on how your TEX system 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.

To avoid it you will have to use the starred versions of the commands:

To avoid searching the TEXINPUTS path when importing files, use the ‘star’ versions of the commands: “\import*” and “\subimport*”.

This can have side effects as the imported document will no longer find files in the texmf tree. E.g. here you had a problem with fd-files: https://tex.stackexchange.com/a/309504/2388. So you will have to choose which feature is more important to you.

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .