ipython icon indicating copy to clipboard operation
ipython copied to clipboard

latex_to_png fails on windows

Open eendebakpt opened this issue 3 years ago • 1 comments

The latex_to_png command fails in the method latex_to_png_dvipng. The reason is the temporary file that is generated, contains a ~ in the path, which is not accepted by the latex command.

The temporary file generated is 'C:\\Users\\EENDEB~1\\AppData\\Local\\Temp\\tmpxefqozm3\\tmp.tex' The command that fails is:

            subprocess.check_call(
                ["latex", "-halt-on-error", tmpfile,
                cwd=workdir, stdout=devnull, stderr=devnull)

Locally I can fix this by changing the command to

            subprocess.check_call(
                ["latex", "-halt-on-error",  os.path.split(tmpfile)[-1]],
                cwd=workdir, stdout=devnull, stderr=devnull)

(only the last part is required, since the cwd is also set).

To make this work some other calls need to be modified as well

eendebakpt avatar May 24 '22 19:05 eendebakpt

I think you should do a pull request to fix this.

ccordoba12 avatar May 24 '22 20:05 ccordoba12