how to know which file is included when we use the command \input if we have many files with the same name in various directories


2 Answers 2


If you look in the log file the full path of the input file is shown, which tells you after the fact which file is input.

If you want to control in advance which file is input then you need to look at TEXINPUTS this may be set as an environment variable or (more usually these days) as a setting in a texmf.cnf file.

You can use kpsexpand to see the current value.

For me

kpsexpand '$TEXINPUTS'



so each : segment is searched in order so the current directory (.) is first then each of the directories is searched as listed, paths ending // are recursively searched in any subdirectory, paths beginning with !! the actual file system is not searched (which would be slow) but the pre-made filelist (texhash or mktexlsr commands) is consulted the form {kpsewhich,generic,} at the end means that for latex for example tex/latex is searched before tex/generic which is searched before (the whole of) tex.


As far as I know,


inserts the file 'filename' -- if it does not exist it automatically looks for 'filename.tex'

You can use


to erase any ambiguities.

  • this does not answer the question, which is which file is input if there are multiple files of that name. Jan 28, 2016 at 13:53
  • I see. The question has been edited and is now much more specific. Jan 28, 2016 at 14:04

You must log in to answer this question.

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