sisl/TikzPictures.jl — pull request #2 by physicsd00d (2014-10-08 06:33:32+00:00)
Title: Saving PDFs now works with files not in $PWD; error messages now more verbose

This pull request seems to solve OP's problem in https://github.com/sisl/PGFPlots.jl/issues/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 whether `command` 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!