protz / LatexIt

An extension for Thunderbird that allows you to generate LaTeX in your emails and send it as inline images
http://www.xulforum.org/go_code
37 stars 16 forks source link

LatexIt doesn't work for me on Windows #56

Closed urigrupel closed 4 years ago

urigrupel commented 4 years ago

Hi,

I am running Windows 10 (1803), Miktex 20.6, Thunderbird 68.9.0 and LatexIt 0.6.8. It doesn't matter which latex code I try to convert, it doesn't work. The error message I get is

LatexIt! run report...

*** Found expression $a^2$
LaTeX process returned 1
Proceeding anyway...
Severe error. Missing package?
We left the .tex file there: C:\Users\URIGRU~1\AppData\Local\Temp\tblatex-1.tex, try to run latex on it by yourself...

In the above code I don't use any package. It happens to me on several computers with similar setup. I can run both latex and dvipng manually on the temporary file without a problem. The path for both is correct.

The add-on used to work for me with ImageMagick convert, but this option is not available anymore.

What should I do? Thanks

sphh commented 4 years ago

Can you please switch on the option Generate debug info in addition to Generate a log report and try to LaTeX It! again. Please post the output. Thanks.

urigrupel commented 4 years ago

Thank you. This is what I got.

LatexIt! run report...

*** Found expression $a^2$

$PATH is C:\Program Files\ImageMagick-7.0.8-Q16;;;;C:\Program Files\MATLAB\R2018b\bin;C:\Program Files\MATLAB\R2018b\bin\win64;C:\Windows\system32;C:\Windows;C:\Windows\System32\Wbem;C:\Windows\System32\WindowsPowerShell\v1.0\;C:\Program Files\PuTTY\;C:\Program Files\TortoiseSVN\bin;C:\Program Files\Git\cmd;C:\Program Files\TortoiseGit\bin;C:\Program Files\MiKTeX 2.9\miktex\bin\x64\;C:\Program Files\MATLAB\R2018b\runtime\win64;C:\Users\Admin\AppData\Local\Microsoft\WindowsApps;C:\WINDOWS\system32;C:\WINDOWS;C:\WINDOWS\System32\Wbem;C:\WINDOWS\System32\WindowsPowerShell\v1.0\;C:\WINDOWS\System32\OpenSSH\;C:\Users\Uri Grupel\AppData\Local\Programs\Python\Python37\Scripts\;C:\Users\Uri Grupel\AppData\Local\Programs\Python\Python37\;C:\Users\Uri Grupel\AppData\Local\Microsoft\WindowsApps;C:\Users\Uri Grupel\AppData\Local\atom\bin

*** Generating LaTeX expression:
\documentclass{article}
\usepackage[utf8x]{inputenc}
\usepackage{amsmath, amssymb}
\pagestyle{empty}
\begin{document}
$a^2$ %this is where your LaTeX expression goes
\end{document}

I ran C:\Program Files\MiKTeX 2.9\miktex\bin\x64\latex.exe -output-directory=C:\Users\URIGRU~1\AppData\Local\Temp -interaction=batchmode C:\Users\URIGRU~1\AppData\Local\Temp\tblatex-2.tex error code 1
LaTeX process returned 1
Proceeding anyway...
Severe error. Missing package?
We left the .tex file there: C:\Users\URIGRU~1\AppData\Local\Temp\tblatex-2.tex, try to run latex on it by yourself...
--> Failed, not inserting
sphh commented 4 years ago

Thanks. What happens if you run the command C:\Program Files\MiKTeX 2.9\miktex\bin\x64\latex.exe -output-directory=C:\Users\URIGRU~1\AppData\Local\Temp -interaction=batchmode C:\Users\URIGRU~1\AppData\Local\Temp\tblatex-2.tex from the command prompt? Can you please post the output.

urigrupel commented 4 years ago

It seems to be a permissions problem. When I run the command from another folder, in the log file I see

Emergency stop.
<to be read again> 
                   \protect 
<*> C:/Users/URIGRU~

When I run this locally in the folder it works without a problem. An easy solution is to add an option to choose the temp folder. If I just use "C:\tmp" for example, it works.

If you want I can attach a log file and a print screen, but it doesn't seem to contain any information.

sphh commented 4 years ago

I have to admit that I am not a Windows person...

Does the LaTeX command work, if you use the full path, that is C:\Users\URIGRUPEL\AppData\Local\Temp (or whatever it is) instead of C:\Users\URIGRU~1\AppData\Local\Temp in one or both occurrences?

urigrupel commented 4 years ago

Yes. Surprisingly, this solves the problem. Thank you for your patience.

sphh commented 4 years ago

If it works with the long path, but not the short path, then this is probably a problem in the realm of MiKTeX. Have you checked with them?

urigrupel commented 4 years ago

No I didn't. Since I compile latex files all the time I assumed that the problem was not with MikTeX. Thanks.

sphh commented 4 years ago

No worries. If you find a solution with MiKTeX, could you please (cross)post it here. Thanks.

urigrupel commented 4 years ago

It seems that MiKTeX no longer support short paths.

sphh commented 4 years ago

Thanks for checking with MiKTeX and posting the result.

LatexIt uses the temporary directory provided by javascript/Thunderbird (see https://github.com/protz/LatexIt/blob/master/content/main.js#L139-L141), which returns the temporary directory in short 8.3 DOS notation.

Personally I don't know enough Javascript and don't work on Windows, hence would not be able to test it. I am afraid we have to wait for @protz or someone else to step in. Sorry.

PS: I wonder, how MiKTeX handles the file tmp~tmp.tex, which I believe is a perfectly legal filename? You might want to try it and if it is not working, issue a bug report. (Just my 2 cent thought, because as I already said, I don't have access to MiKTeX on Windows.)

urigrupel commented 4 years ago

In a blog post they write that it doesn't support it anymore. The reason for the change is that ~ is used as a special character for some packages.

sphh commented 4 years ago

Well, they write, that they don't support Windows/DOS 8.3 file names anymore. But tmp~tmp.tex is not the 8.3 version of a long Windows file name, but a proper Windows file name...

urigrupel commented 4 years ago

I just checked it, it doesn't work. As they mentioned in the response to my issue, the problem is that ~ is used for some other purposes.

sphh commented 4 years ago

~ is a non-breaking space in LaTeX.

My point is, that tmp~tmp.tex is a legal file name in Windows and must (should!) work when used as a file name, but you confirmed that it does not work. IMHO this is a regression. (I can understand that they don't want to support short file names anymore, but why not supporting tmp~tmp.tex escapes me.)

sphh commented 4 years ago

Just for the record: #15 and #32 report the same problem.