\subimport*{}{} from the package import seems to break listings languages, but only if listings with a language hasn't been used in the root document:

! Package Listings Error: Couldn't load requested language.

My hypothesis is that the starred version of subimport is breaking the path for listings, but somehow it's cached if the listing is used outside the import first.

Is there a solution to this (outside of not using the starred sub import; I'd like to keep using it if possible...)

MWE below.



% Uncommenting the problem, oddly enough.
%public static void main(String[] args) {} 



//Returns true
private static bool P() { 
  • It's best to describe the problem as much as possible in your question. Can you specify what you mean by "break"? Do you get an error?
    – jub0bs
    Feb 20, 2014 at 21:28
  • 1
    @Jubobs Whoops. Editing to add.
    – Matthew G.
    Feb 20, 2014 at 22:05

1 Answer 1


From the package documentation:

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

This means that pdflatex is not able to look for files other than those in the specified directory. However, settings for listings languages are imported at usage time, so the memory is not cluttered with tens of useless languages.

Solution: use \lstloadlanguages.






enter image description here

You must log in to answer this question.

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