Open arthur-lebee opened 2 years ago
Dear Casey,
I dug further. The problems comes from the windows path short format (with ~): this is not supported when the pdflatex command is cast in LatexProject.run_pdflatex
(see also: https://stackoverflow.com/questions/11420689/how-to-get-long-file-system-path-from-python-on-windows )
As usernames are rather long, this bug may affect most of Windows users...
Best Arthur
Thanks for opening this issue. I don't have access to a Windows machine to test this but I can give some pointers. Please let me know how you end up resolving this.
Error messages starting with This is pdfTeX...
are the log straight from pdflatex so locating pdflatex seems to be fine. The best way to debug is to use proj.write_src('src-dir')
to output the source tex files, then you can read all the intermediate tex files and run pdflatex main.tex
manually in src-dir
.
This line from the error catches my eye: I can't find file 'C:/Users/ARTHUR'
. One possibility is you or latextools needed to escape the .
in the path when used in that tex file. That's where I would start investigating.
Dear Casey,
Thanks for your quick reply.
My quick and dirty fix is inserting at line 102 of project.py:
from ctypes import create_unicode_buffer, windll
buffer_size = 500
buffer = create_unicode_buffer(buffer_size)
get_long_path_name = windll.kernel32.GetLongPathNameW
get_long_path_name(tmp_dir, buffer, buffer_size)
tmp_dir = buffer.value
This forces the Windows path to be in the right format. I don't think my coding is plateform independent. If you find a way... Additionnally, I have not checked if a similar bug may occur elsewhere (I noticed there are several calls to tempfile of fs.tempfs )
Finally, as I am your Windows beta tester... I suggest using pdftocairo instead of pdf2svg which I have not found for Windows (I assume pdftocairo does exactly the same thing?).
This ends up by changing line 269 in convert to:
args = ['pdftocairo','-svg', 'image.pdf', 'image.svg']
Hope this helps a bit!
Great. I think the best solution would be to write a helper function that checks the platform type (Windows vs. other) and does the correct conversion. Then it's easy to use for all calls of tempfile.
I believe someone else previously requested pdftocairo but I would need to confirm they have equivalent output (especially with respect to unit scaling) before switching or supporting both.
Dear Casey,
Thank you for providing latextools and drawSvg.
I have a functionnal install following the readme instructions:
Neverthless, when running the examples, latex compilation fails on my machine. Here is the result with the first example on the readme page:
I tried my best to find out if the temp directory and its files to be compiled are actually created or not. As everything is wiped out after execution, I could not figure out.
Any suggestion?
Best Regards
Arthur