ipython icon indicating copy to clipboard operation
ipython copied to clipboard

Use relative filename in latex and dvips commands of latex_to_png_dvipng

Open eendebakpt opened this issue 3 years ago • 5 comments

This prevents problems with temporary directories with special characters in them.

Fixes #13678

eendebakpt avatar May 24 '22 20:05 eendebakpt

Similar to one of the earlier PR of yours, could you please add a what's-new entry that describes the change to users?

https://github.com/ipython/ipython/tree/master/docs/source/whatsnew/pr

MrMino avatar May 26 '22 14:05 MrMino

@MrMino Could you review again?

eendebakpt avatar Jun 07 '22 20:06 eendebakpt

Come to think of it, maybe there's actually a way of making latex accept the tilde?

Have a look at https://tex.stackexchange.com/questions/425954/tilde-in-a-image-path.

Have you tried to do a str.replace("~", "\string~") on that path when passing it to latex?

The link is about using a title inside a latex document, this PR is about a title in a command line argument to latex. I tried to put the argument inside "", escape the ~ (with \ or \string), but did not manage to get it working that way.

eendebakpt avatar Jun 13 '22 11:06 eendebakpt

I understand, but from my experience with latex, IIRC it parses some of its arguments as if they are written in latex. Unfortunately I don't have the environment ready to check this, so that's why I'm asking about it.

I'll check the code, and if there truly is no way to achieve that, we'll merge.

MrMino avatar Jun 13 '22 14:06 MrMino

I understand, but from my experience with latex, IIRC it parses some of its arguments as if they are written in latex. Unfortunately I don't have the environment ready to check this, so that's why I'm asking about it.

I'll check the code, and if there truly is no way to achieve that, we'll merge.

@MrMino Any update on this? On my system

In [78]: import tempfile; tempfile.mkdtemp()
Out[78]: 'C:\\Users\\EENDEB~1\\AppData\\Local\\Temp\\tmpnzyikr5c'

The ~ in the output should not only be parsed properly by latex, but somehow the name 'C:\Users\EENDEB~1\AppData\Local\Temp\tmpnzyikr5c' should also be expanded to `'C:\Users\EENDEBAKPT\AppData\Local\Temp\tmpnzyikr5c'.

eendebakpt avatar Jul 12 '22 11:07 eendebakpt

Thanks, let's try.

Carreau avatar Aug 30 '22 09:08 Carreau