I'm trying to throw different projects into one document that are in different folders. These folders include images and texfiles. I know that I can always include files with \input{} or \include{} like this:


but this runs into problems as soon as texfile1 for example includes a graph that is stored in a subfolder of <path1>. In effect, I want to do something like changing the working directory of a statistical program like this:

% change directory to <path1>

input several files that again include images etc just as if I were compiling a latex document inside <path1>

% now change directory to <path2>

and input all the files from there as if I were in that folder

I've tried playing with TEXINPUTS= as suggested here but couldn't get it to work. A workaround I have in mind is including the path inside every \input{} and changing \graphicspath{} in between the two projects but it seems that there must be a less hack-y solution, no?

  • 3
    ctan.org/pkg/import – Henri Menke Apr 25 at 10:45
  • 3
    To get accurate result you need to give clear example of what you use (mwe) based on current description the texinputs= for ubuntu would need to be .:path1/:path2/: but more importantly for your description \graphicspath in each document needs to be something like {{.//}{path1/}{path2/}{./}} – user170109 Apr 25 at 10:50
  • the import package is what I was looking for, thanks! works like a charm – Peter Pan Apr 25 at 12:00

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.