JuliaTeX / TikzPictures.jl

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

PDF and SVG ouput not working on Windows on Julia 1.4 #53

Closed VinciTec closed 4 years ago

VinciTec commented 4 years ago

Trying to save TikzPicture as PDF or SVG on windows seems to give a LaTeX error. I think the error lies in how the path is given to LuaLaTeX.

Example:

tp = TikzPicture("\\draw (0,0) -- (10,10);\n\\draw (10,0) -- (0,10);\n\\node at (5,5) {tikz \$\\sqrt{\\pi}\$};", options="scale=0.25", preamble="")
save(PDF("testPic"), tp)

Error:

ERROR: LaTeX error
Stacktrace:
 [1] error(::String) at .\error.jl:33
 [2] (::TikzPictures.var"#6#7"{PDF,TikzPicture,String})() at C:\Users\jesse\.julia\packages\TikzPictures\x0ZWu\src\TikzPictures.jl:269
 [3] cd(::TikzPictures.var"#6#7"{PDF,TikzPicture,String}, ::String) at .\file.jl:93
 [4] save(::PDF, ::TikzPicture) at C:\Users\jesse\.julia\packages\TikzPictures\x0ZWu\src\TikzPictures.jl:213
 [5] top-level scope at REPL[3]:1

The LaTeX error:

! Emergency stop.
<*> /jllOleMv\testPic
                  .tex
End of file on the terminal!

Here is how much of LuaTeX's memory you used:
 4 strings out of 481351
 100000,319454 words of node,token memory allocated 270 words of node memory still in use:
   1 hlist, 39 glue_spec nodes
   avail lists: 2:12,3:1,4:1,5:3
 17247 multiletter control sequences out of 65536+600000
 24 fonts using 2830079 bytes
 0i,0n,0p,0b,6s stack positions out of 5000i,500n,10000p,200000b,100000s
!  ==> Fatal error occurred, no output PDF file produced!

The temporary directory seems to be made in the root folder, of my D: drive in this case. I could not find out whether this was wanted behaviour, but I think this directory should be local.

The problem does not appear to be with my TeX distribution: when I manually execute lualatex --enable-write18 testpic.tex I do get the correct PDF.

Hope this is enough information. Thank you very much for helping in advance.

mykelk commented 4 years ago

I ran your code on Windows 10 with TikzPictures v3.0.5 and it worked just fine. Can you confirm your version of Windows and TikzPictures?

VinciTec commented 4 years ago

I can confirm I'm running Windows 10 with TikzPictures v3.0.5. I did just update Windows and reinstalled TikzPictures, but the same issue persists unfortunately.

Might it be related to me having the Julia installation on a different drive than my user (and thus also .julia) directory?

mykelk commented 4 years ago

That shouldn't be an issue, but maybe git it a try? Out of curiosity, does naming it "mypic" fix this? I wonder if the \t in the path is interpreted as a tab character.

VinciTec commented 4 years ago

Thanks again for the quick replies. Changing the filename does not fix the problem; note that I am able to safe the picture as TEX (and then compile it manually). Also when trying to save as SVG the same problem seem to arise, but in this case the temporary folder is not removed, causing me to end up with a lot of temporary folders in my root directory: was this meant to be implemented for windows in this way (apart from being not removed of course)?

I will try to use a clean Julia installation and see if the issue is still present.

mykelk commented 4 years ago

It could be an issue with the creation of the temporary directory. What version of Julia are you using?

VinciTec commented 4 years ago

I just performed a clean install of Julia with packages, so I'm runnning:

VinciTec commented 4 years ago

I thought the issue might be related to the REPL, which I was using for all tests. But I just tried running the same code in a Julia file and the same error message still appears.

mykelk commented 4 years ago

Ah, okay. I'm using Julia 1.3. I know 1.4 had some changes with how temporary directories work. I'll check it out.

VinciTec commented 4 years ago

Ah alright thank you. I just tried downgrading to 1.3.1, this indeed fixed the issue. So there might be something there.

mykelk commented 4 years ago

Works on Julia 1.4 now.

VinciTec commented 4 years ago

I noticed, thanks