Saving PDFs now works with files not in $PWD; error messages now more verbose #2
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
This pull request seems to solve OP's problem in JuliaTeX/PGFPlots.jl#7
The issue was that if you say save("folderName/fileName",tp), then the .tex file will be placed in folderName, but lualatex will compile it in the present working directory. So not only is the final pdf file in the wrong place, but when save() tries to delete the intermediate tex file, it tries to delete it from pwd() but that's not where the .tex file was placed...so rm throws an error (which should really only be a warning) which got caught and treated as fatal.
The solution was to parse out the foldername, instruct lualatex to place the pdf aux and log files in the folderName, and tell rm to delete the intermediate files from within folderName.
Also, I had trouble getting PGFPlots to work because the pdf save function in this package was failing but not telling me why in any meaningful way. My specific problem was that my latex libraries were from 2012, which is too old for the Julia PGFPlots package. So I figured it would be nice if the error messages weren't caught and replaced with vague messages and instead have the errors just be thrown themselves. That's part of what I did here. In addition to making the error messages more meaningful, I also specifically catch the error that gave me so much grief. Namely, success(
command
) returns true or false based on whethercommand
succeeded or failed; so if lualatex tried but failed to generate the pdf file, that was not treated as an error and wasn't caught at all until rm() tried to delete files that had never been created. Now, there is a check to ensure that the pdf files are generated successfully.This is my first github pull request ever. Let me know if the level of detail in this comment was too much or any other tips to help me improve my github etiquette.
Cheers!