JelteF / PyLaTeX

A Python library for creating LaTeX files
https://jeltef.github.io/PyLaTeX/
MIT License
2.26k stars 287 forks source link

Includegraphics fails with filename that contains dot (newest version of LaTeX) #320

Open juanscr opened 3 years ago

juanscr commented 3 years ago

In previous versions of LaTeX, if a filename contained a dot in it's name such like dir/name.with.dots.pdf the include graphics function will error out. To fix this, it was enough to put brackets only in the name file in this manner: dir/{name.with.dots.pdf}.

For newer version of LaTeX this does not work. According to the following comment found in Stack Overflow the solution has changed:

image

Therefore to fix the filename it must be changed in order that it adds the brackets surrounding the whole directory instead of only the last file.

I tested this and the error (and solution) works with latexmk 4.70b

jrast commented 3 years ago

Seems like the current implementation also fails (on windows) if a folder contains a dot in the name:

C:\Temp\pylatex-tmp.abc\image.pdf will become C:\Temp\{pylatex-tmp.abc\image}.pdf which will not work in latex.

JelteF commented 3 years ago

A pull request to fix this is apreciated.