2

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
index.tex

>ls -l folder/index.tex
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

\documentclass[11pt]{report}%        
\usepackage{standalone}   
\usepackage{import}

\begin{document}   
\subimport{folder/}{index} 
\end{document}

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

%file  folder/index.tex
\documentclass[12pt]{article}%
\usepackage{standalone} 
\standalonetrue

\begin{document} 
test
\end{document}

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.
(./index.tex
LaTeX2e <2016/03/31> patch level 3
Babel <3.9r> and hyphenation patterns for 1 language(s) loaded.
(/usr/local/texlive/2016/texmf-dist/tex/latex/base/report.cls
.
.
(/usr/local/texlive/2016/texmf-dist/tex/generic/oberdiek/kvdefinekeys.sty))
(/usr/local/texlive/2016/texmf-dist/tex/latex/latexconfig/epstopdf-sys.cfg))
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
s
   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. – Ulrike Fischer Dec 26 '16 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 '16 at 20:37
2

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.

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.