Numerous examples (see this one for instance) describe the the use of:


as way to broaden the compiler's search universe when externalized content is called via \input{} and the argument to \input{} lacks an explicit relative or absolute path.

In a project which involves moderate nesting (e.g. 3 or 4 levels), it's seeming as though it would be beneficial to be able to add (and possibly remove) paths from this path list.

Is this possible?

  • You can do this easily in expl3, if that's an option. If you're careful, you can presumably do the same thing with \input@path by saving the value to \input@oldpath and then using it to define \input@path. In the former case, you need to use expl3 functions rather than \input, but it is straightforward to create a wrapper e.g. \xinput for document-level use. I use this a lot. It broke recently, but Joseph Wright had it fixed in less than no time. – cfr Oct 19 '19 at 17:18
  • I wouldn't normally use \input@path (and I implemented it:-) it is much more efficient to set the input path in the environment, TEXINPUTS=path1//:path2//: pdflatex myfile will search all directories below path1, then all directories below path2 then all the standard places – David Carlisle Oct 19 '19 at 21:41
  • @DavidCarlisle It isn't more efficient if LaTeX gets to page 343 before failing to find a file because you forgot this one needed so-and-so path added :(. Generally, if I have to add it on the command line, I'll forget. If I can put it in the file, it's more efficient even if it wouldn't be more efficient if I didn't forget. – cfr Oct 19 '19 at 22:00
  • it doesn't have to be on the commandline every time, you can put it in the environment setup or in a texmf.cnf file, but if you want the macro it is there, you don't need any special commands you can just define it or redefine it using \def or \renewcommand at any point in the document. so if each chapter wants its own path, just define it at the start of each chapter. – David Carlisle Oct 19 '19 at 22:03

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Browse other questions tagged or ask your own question.