KristofferC / PGFPlotsX.jl

Plots in Julia using the PGFPlots LaTeX package
Other
301 stars 40 forks source link

Make Graphics convert to absolute path and expand ~. #295

Open tpapp opened 2 years ago

tpapp commented 2 years ago

Fixes #283.

tpapp commented 2 years ago

These is the cleanest way I found to fix #283. Alternatives include adding the current directory to the path somehow, either via enviroment variables (TEXINPUTS) or inside the preamble (\graphicspath). I don't think those are very robust across various operating systems and LaTeX engines.

The solution above fails if the user changes the current directory between creating the image and running Graphics, but at least in that case the error message is informative.

KristofferC commented 2 years ago

Hm, I am not sure this should be done unconditionally. For example, when you export to a .tex file you probably want to use a relative path if that is what you gave. It is only when previewing a file (and we use a temp folder) that the relative -> absolute translation should happen.

There could be some global flag that says whether we are currently previewing and print_tex could look at that for Graphics and decide to print the absolute path or the path as given there?