Open 645978336 opened 7 years ago
Does it work with simpler equations? What's the content of the report (Show Report)? It should work with texlive 2017.
No, it doesn't work. and the report is "Failed to convert pdf to png to preview." but I have added the magick.
If you click on (Show Report) it should open a file, which contains a bug report.
Yeah, the file in C:\Users****\AppData\Local\Sublime Text 3\Cache\LaTeXTools\internal\preview_math with the suffix 'err' and I only get one sentence:"Failed to convert pdf to png to preview." in every file
You may try to restart Sublime Text. Do you have any output in the ST console ctrl+`
?
ST3 console output:
Running "'C:\texlive\2017\bin\win32\pdflatex.EXE' -interaction=nonstopmode 61f2a40c739fed82c5f0e277f5532eef.tex"
Running "'C:\texlive\2017\tlpkg\tlgs\bin\gswin32c.EXE' -dSAFER -dBATCH -dNOPAUSE -dNOPROMPT -dQUIET -q -sDEVICE=bbox -r72 -dLastPage=1 'C:\Users\Benjamin\AppData\Local\Sublime Text 3\Cache\LaTeXTools\internal\preview_math\61f2a40c739fed82c5f0e277f5532eef.pdf'"
Running "'C:\texlive\2017\tlpkg\tlgs\bin\gswin32c.EXE' -dSAFER -dBATCH -dNOPAUSE -dNOPROMPT -dQUIET -q -sDEVICE=pngalpha -dLastPage=1 '-sOutputFile=C:\Users\Benjamin\AppData\Local\Sublime Text 3\Cache\LaTeXTools\internal\preview_math\61f2a40c739fed82c5f0e277f5532eef.png' -r1200 -dDownScaleFactor=8 -dTextAlphaBits=4 -dGraphicsAlphaBits=4 'C:\Users\Benjamin\AppData\Local\Sublime Text 3\Cache\LaTeXTools\internal\preview_math\61f2a40c739fed82c5f0e277f5532eef.pdf'"
Is the gswin32c.EXE wrong? Should I install the GhostSrcipt once again?
It should work with your ghostscript version. I don't know what the issue is.
ok, I give up, maybe something is wrong.
I am seeing the same issue after switching from TeX Live 2016 to 2017. At first it tried to use the convert.exe from system32 and after manually installing ImageMagick the LatexTools System Check now points towards the newly installed magick.exe instead of to the wrong convert.exe.
I also have MacTex 2017 which has the same program versions according to the LaTeXTools System Check and there a no problems with the equation preview.
It may be worth to add that we aren't using ImageMagick for the preview anymore. It is only used to convert images in the preview, which aren't png, jp(e)g, (gif), pdf, ps, or eps. So we may also remove it from the system check, because other image formats aren't common in latex documents.
The conversation from pdf to png is done via ghostscript, which usually ships with the tex distro. I don't know what the problem is or how to debug the best. You can see the executed commands in the ST console ctrl+`
and may try to convert a pdf document via ghostscript and check for errors. You may also try to install a different ghostscript version.
In my \AppData\Local\Sublime Text 3\Cache\LaTeXTools\internal\preview_math
I can see the pdf output only for a short moment before it is immediately deleted again. All that is left is that .err file which contains only the message Failed to convert pdf to png to preview.
which is already shown within Sublime.
Can I somehow disable that instant cleanup of these temp files? This way I could run the failing commands with the same input manually and watch for any errors.
Yes you can juste delete for loop and restart Sublime Text afterwards to reload the plugin.
Is this any helpful? Do I need to set up a proper environment for Ghostscript first? I ran it with PowerShell in the \internal\preview_math\ folder.
C:\texlive\2017\tlpkg\tlgs\bin\gswin32c.EXE -dSAFER -dBATCH -dNOPAUSE -dNOPROMPT -dQUIET -q -sDEVICE=bbox -r72 -dLastPage=1 'C:\Users\Hakan Siktas\AppData\Local\Sublime Text 3\Cache\LaTeXTools\internal\preview_math\d919d613033be9ef237050652d7cfd47.pdf' GPL Ghostscript 9.21: Can't find initialization file gs_init.ps.
I also don't know much about ghostscript, but it should automatically create a sane environment when you install ist.
You may try to press alt+r
and write regedit
then open HKEY_LOCAL_MACHINE > SOFTWARE
and look for an entry with the name ghostscript
in it. This should have the keys GS_DLL
and GS_LIB
, which point to the corresponding directories. You can check that these values are valid.
That "Can't find initialization file..." error message sounds like a messed up GS install. I'm not sure what we can do to alleviate the issue.
I installed the latest version of Ghostscript via Chocolatey, manually added C:\Program Files\gs\gs9.21\bin
into my PATH environment variable and after a restart of Sublime Text your System Check now recognized the new gswin64c.exe as my Ghostscript binary.
The equation previews are working again. 😀 So it seems that the bundled Ghostscript in TexLive 2017 has some issues on Windows.
thank you!, It works @hsiktas
FYI, I set environment variable GS_LIB
to path\to\texlive\tlpkg\tlgs\Resource\Init;path\to\texlive\tlpkg\tlgs\kanji
and it works now.
I had the same problem too. But I installed Ghostscript and my problem has been solved !!!
@taroxd 's fix works for the version of GS in texlive 2017 for Windows. The install just seems to not set the relevant paths / registry entries for GS (that is, I can confirm I had no registry entry for ghostscript upon searching).
There also seems to be a problem with the bundled ghostscript in MacTex2016 on MacOS. I had the same issue and it was solved by installing ghostscript via homebrew.
Thank you! It works @hsiktas
Thanks @taroxd . This solution works perfectly.
Thanks @taroxd . This solution is really helpful.
Thanks @taroxd
Thanks @hsiktas . This solution works perfectly.
Thanks @taroxd
@taroxd Thanks. The solution works perfectly.
Thank @taroxd I had the same problem.
Installed Chocolatey via PowerShell (admin), as instructed on the page Then installed GhostScript using command: choco install ghostscript
Added path = "C:\Program Files\gs\gs9.24\bin" to environment variable Restarted Sublime Text 3 (Build 3176) + LaTeXTools and it worked.
On Windows 10 (Version 1809: OS build 17763.55) and using Texlive 2018
Also I've changed before: In: Preferences > Package Settings > LaTeX Tools > Settings - User Under heading "windows" changed distro to texlive "distro" : "texlive",
Resource\Init
works great!
Yes it works, but crashes were frequent
On Mon, Apr 1, 2019, 12:22 PM Brightchu notifications@github.com wrote:
Resource\Init
works great!
— You are receiving this because you commented. Reply to this email directly, view it on GitHub https://github.com/SublimeText/LaTeXTools/issues/1148#issuecomment-478457569, or mute the thread https://github.com/notifications/unsubscribe-auth/ACi4oRnLgfSQcLbmszWOxBAfRbw4E0g-ks5vcayrgaJpZM4Nyi7U .
@taroxd Thanks. This problem waste me too time!!!
I encountered this problem too. All the methods above did not work. But it finally worded after I added path = "C:\Program Files\gs\gs9.50\bin" to user's environment variable. I used to add that path to system's environment variable.
Thank you! @hsiktas It really helps me a lot!
Recently had this issue too. Choclatey was not necessary to fix it. I just installed the latest 32-bit GhostScript from ghostscript.com and put its \bin directory near the top of the Windows path (see https://www.architectryan.com/2018/03/17/add-to-the-path-on-windows-10/). I restarted Sublime Text and preview now works! Even though the texlive version of ghostscript shows up green in the configuration report, I guess it doesn't actually work.
If you encounter the following error:
Failed to convert pdf to png to preview.
Add the following two paths to the environment variable, and pay attention to replacing them with your own version of texlive.
C:\texlive\2021\tlpkg\tlgs\Resource\Init
C:\texlive\2021\tlpkg\tlgs\kanji
Here's how I found the solution. After encounter the error, I installed Ghostscript myself at the beginning and added it to the top of the environment variable. However, after checking the system, LaTeXTools prompts me that the path of Ghostscript is still C:\texlive\2021\tlpkg\tlgs\bin\gswin32c.exe
.
So I run
cd C:\texlive\2021\tlpkg\tlgs\bin
gswin32c.exe
I got
GPL Ghostscript 9.54.0: Can't find initialization file gs_init.ps.
.
I finally found this solution in a blog.
@taroxd Thanks, It does work.
Hello, I am a new user of your amazing working, LaTexTools I just meet some strange problems.
Can you help me? those are my sublime text 3 reports:
I don't know why I can't preview the equation with everything OK? shouldn't I use texlive 2017?