0

I am running pdflatex from inside the python script. Python project is inside venv and my terminal command is like abs\path\to\pdflatex.exe abs\path\to\file.tex but when run, it cannot find my *.sty file which is placed in the same directory as my main .tex file. Program waits for me to enter the path to that sty file. I need this to be automatically done by running the command inside python script. How can I fix this?

mend4x
  • 113
  • 4
    it is usually better to make the script cd to the directory with the document then do pdflatex file any relative paths in the file are relative to the working directory of the pdflatex process not relative to the main document. If you cd first then these are the same and the result is a lot less confusing. – David Carlisle Jun 17 '21 at 13:38
  • David's answer is definitely the preferred one; but if you are somehow constrained, then you can get around this by setting environmental variables. TEXINPUTS does exist for a reason. – Willie Wong Jun 17 '21 at 13:41
  • @DavidCarlisle thanks, man! that was great, yet simple solution! I decided to make it that way, but then I saw -include-directory option and used it to make it one line command – mend4x Jun 18 '21 at 04:07
  • @WillieWong I'm going to perform pdf generation on a daily basis and each time new directory with the current date and new content is created. and all files are slightly modified. So, TEXINPUTS won't be a good solution, I guess – mend4x Jun 18 '21 at 04:13
  • 1
    @mend4x: you can set environmental variables dynamically in your script. – Willie Wong Jun 18 '21 at 13:13

0 Answers0