-
Notifications
You must be signed in to change notification settings - Fork 102
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Log if the generated Python output file is missing #40
Conversation
I am sorry, I just now saw #13 which essentially does the same thing. That issue was closed as "solved in a different manner", but without the log entry, pythontex.py does not get run. (There is no output in the log for \InputIfFileExists) |
When the package expects Python output to be present, it attempts to input the .pytxmcr file. If this file is not found, nothing was done, expecting the user to know that pythontex.py should be run. This patch prints a message to the log which enables scripts such as latexmk to deduce that a file is missing and run pythontex.py automatically to create it (and re-run latex on the original document afterwards). Such a dependency can be setup if you add the following lines to your latexmkrc: add_cus_dep('pytxcode','pytxmcr',0,'pythontex'); sub pythontex { return system("pythontex.py \"$_[0]\""); } When latexmk sees that the .pytxmcr file is missing, it will make it from .pytxcode. When changes are detected for the .pytxcode, it will re-run pythontex.py to update the .pytxmcr file. Currently, this requires you to specify \setpythontexoutputdir{.} so that the .pytxmcr file is expected to be in the same directory as the .pytxcode, as this is the only place latexmk will look for it.
Which version of PythonTeX and latexmk are you using? Also, are you using latexmk with the
from #13 in a |
Versions used are: latexmk 4.24 (from Ubuntu Precise repositories) and PythonTeX from master branch. Using Adding a dependency from the .tex file only works if you have the .tex file in the same directory as the output. |
I guess I'm not understanding how latexmk isn't working for you. Maybe you can try to describe it a little differently. If I'm understanding correctly, this is what happens currently: Suppose you have just a .tex document and a .latexmkrc in a directory. latexmk will compile the document. The rule By the way, regardless of what is necessary to get latexmk working, I will change things so that some comments are written to the log. |
Not necessarily. I have a setup where the .tex source files are stored on a network disk, but the latex program itself is run in a directory on /tmp where all the files are generated. |
That clarifies things a lot. I assume you are using |
The approach I am using is actually to add the document directory to |
This should be fixed now. Sorry for the delay. Please open a new issue if you discover any other |
When the package expects Python output to be present, it attempts to input the .pytxmcr file. If this file is not found, nothing was done, expecting the user to know that pythontex.py should be run.
This patch prints a message to the log which enables scripts such as latexmk to deduce that a file is missing and run pythontex.py automatically to create it (and re-run latex on the original document afterwards).
Such a dependency can be setup if you add the following lines to your latexmkrc:
When latexmk sees that the .pytxmcr file is missing, it will make it from .pytxcode. When changes are detected for the .pytxcode, it will re-run pythontex.py to update the .pytxmcr file.
Currently, this requires you to specify
so that the .pytxmcr file is expected to be in the same directory as the .pytxcode, as this is the only place latexmk will look for it.