I have such a structure:


inside book1.tex there is:


from go.py (python script) i call commands:

set TEXINPUTS="..\\tex\\base"
pdflatex -quiet "..\\tex\\book\\book1.tex" -output-directory "..\\tex\\book\\bin\\"

but build fails because: File 'images/img.pdf' is not found

How can i tell pdflatex to read paths inside tex files as relative to its path..? (But this base.sty - can take its 1.jpg file which is attached like: img/1.jpg) If i remove image, everything builds succesfully.


I have found the answear!

inside book1.tex file just add \graphicspath command with two paths:


First path is valid from .tex files folder (usefull for manual build) The second path is valid from build scripts folder. Finally, images are included just by their filenames:

| improve this answer | |
  • I was halfway through that recommendation however it may help to consider expanding to include {../..//} which should include all subdirectories below grandparent directory, however beware that could also search in unwanted sibling directories – user170109 Apr 11 '19 at 13:52
  • It would be much better to change to the directory of your main file and to start the compilation from there. – Ulrike Fischer Apr 11 '19 at 13:55
  • i will try it.. as i understood: in go.py i change the folder and then set the texinput and run pdflatex? If so... it does not work for me. – pi.314 Apr 11 '19 at 13:57

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.