JuliaTeX / TikzPictures.jl

Creating PGF/TikZ pictures and saving them in various formats
Other
89 stars 28 forks source link

Shushman/1.0 fixes #39

Closed Shushman closed 6 years ago

Shushman commented 6 years ago

Several bug fixes about file saving in tmp dirs that were breaking PGFPlots. Essentially, with the multiple calls to mktempdir, nesting of temp dirs was happening, and the tmp_10000001.png files generated by PGFPlots were not being found.

I have basically changed it to output everything to the current directory or the directory preceding the filename, and then switch back to the current directory after being done. Please review

mykelk commented 6 years ago

This looks good to me. @tawheeler it looks like you added the mktempdir calls? It seems to break things by creating a bunch of nested temp directories. If you agree with these changes, you can merge.

Shushman commented 6 years ago

Making a PR comment about a question I had - I believe that Base.show, at least when called from the PGFPlots notebook, looks for the tmp_1000000x.png file created by PGFPlots (which is sent to it as tp.data?). I think the .png is always created in the current directory, which means that the save called inside Base.show should also be in the current directory. Since the save(SVG) is called with filename "tikzpicture" without any prefixed foldername, is that always going to be fine?

tawheeler commented 6 years ago

IMO the package should not expose any files to the user unless the user asks for them. I'd change it so that show generates the file in a temp directory.

mykelk commented 6 years ago

Agreed with @tawheeler

Shushman commented 6 years ago

@mykelk has suggested I merge after the tests pass. I have changed save(SVG) to have independent behavior and also made usePDF2SVG a global flag