SublimeText / LaTeXTools

LaTeX plugin for Sublime Text
https://latextools.readthedocs.io/
2k stars 364 forks source link

math preview works only with workaround #1473

Closed Zaby1990 closed 4 years ago

Zaby1990 commented 4 years ago

Hello, I want to use the math preview but I have some problems with that and I didn't find my way in any issue. At first my system parameters: Win10x64, Sublime Version 3.2.2, Build 3211 x64, Texlive2020

If want to see the math preview, I got the error: ERROR: Failed to convert pdf to png to preview.

The System Check says all packages are availabe:


Variable   Value
--------   -----
PATH       C:\texlive\2020\bin\win32;C:\Program Files\ImageMagick-7.0.10-Q16;C:\WINDOWS\system32;C:\WINDOWS;C:\WINDOWS\System32\Wbem;C:\WINDOWS\System32\WindowsPowerShell\v1.0\;C:\WINDOWS\System32\OpenSSH\;C:\Program Files\gs\gs9.52;C:\texlive\2020\bin\win32;C:\Program Files\gs\gs9.52\bin;C:\texlive\2020\tlpkg\tlgs\bin;C:\texlive\2020\tlpkg\tlpobj;C:\Program Files (x86)\Python38;C:\Program Files (x86)\Python38\Scripts;C:\Program Files\Inkscape;C:\Program Files\Git\cmd;C:\Program Files (x86)\Python38\Scripts\;C:\Program Files (x86)\Python38\;C:\Users\Maxel\AppData\Local\Microsoft\WindowsApps;C:\Program Files\SumatraPDF;C:\texlive\2020\bin\win32;C:\Program Files\gs\gs9.52

TEXINPUTS  --I have to cut this... to many characters--

Program      Location                                            Status     Version
-------      --------                                            ------     -------
sublime      C:\Program Files\Sublime Text 3\sublime_text.exe    available  Sublime Text Build 3211
latexmk      C:\texlive\2020\bin\win32\latexmk.exe               available  Latexmk, John Collins, 17 Apr. 2020. Version 4.69a
pdflatex     C:\texlive\2020\bin\win32\pdflatex.exe              available  pdfTeX 3.14159265-2.6-1.40.21 (TeX Live 2020/W32TeX)
xelatex      C:\texlive\2020\bin\win32\xelatex.exe               available  XeTeX 3.14159265-2.6-0.999992 (TeX Live 2020/W32TeX)
lualatex     C:\texlive\2020\bin\win32\lualatex.exe              available  This is LuaHBTeX, Version 1.12.0 (TeX Live 2020/W32TeX)
biber        C:\texlive\2020\bin\win32\biber.exe                 available  biber version: 2.14
bibtex       C:\texlive\2020\bin\win32\bibtex.exe                available  BibTeX 0.99d (TeX Live 2020/W32TeX)
bibtex8      C:\texlive\2020\bin\win32\bibtex8.exe               available  This is 8-bit Big BibTeX version 0.99d
kpsewhich    C:\texlive\2020\bin\win32\kpsewhich.exe             available  kpathsea version 6.3.2
magick       C:\Program Files\ImageMagick-7.0.10-Q16\magick.exe  available  ImageMagick 7.0.10-10 Q16 x64 2020-04-28 http://www.imagemagick.org
ghostscript  C:\texlive\2020\tlpkg\tlgs\bin\gswin32c.exe         available  GPL Ghostscript 9.50 (2019-10-15)

Packages for equation preview  Status
-----------------------------  ------
standalone                     available
preview                        available
xcolor                         available
amsmath                        available
amssymb                        available
latexsym                       available
mathtools                      available

Builder      Status
-------      ------
traditional  available

Builder Setting  Value
---------------  -----
display_log      False
linux            {}   
osx              {}   
windows          {}   

TeX Root
--------
C:\Users\Maxel\Desktop\Paper_STWJ\Perfoming_weak_coupled_simulation_of_cdw.tex

LaTeX Engine
------------
pdflatex    

Viewer   Status     Location
------   ------     --------
sumatra  available  C:\Program Files\SumatraPDF\SumatraPDF.exe

I can solve this problem the following way:

  1. Installing Ghostscript 9.52 for Windows (64 bit) from https://www.ghostscript.com/download/gsdnld.html
  2. Copy the file C:\Program Files\gs\gs9.52\bin\gswin64c.exe
  3. Go to C:\texlive\2020\tlpkg\tlgs\bin
  4. Rename gswin32c.exe to gswin32c_old.exe (or everything else)
  5. Paste gswin64c.exe and rename to gswin32c.exe --> math preview works fine

BUT

after I do this little workaround the Latex Package epstopdf don't work anymore and I can't include eps-grafics to my Latex file

So is there another way to make the math preview work without substituting the gswin32c.exe?

I am very grateful for your help.

ibacher commented 4 years ago

The much simpler thing to do is just:

  1. Install Ghostscript and ensure it's added to your PATH variable
  2. Restart SublimeText (to ensure it has an updated environment)

We only use the TeXLive Ghostscript as a fallback.

Zaby1990 commented 4 years ago

Hi ibacher, thanks for your answer. I wish it would be that simple. Like you can see in the given path in the system check, I already have added the GS Path my PATH variable. I also checked, that the path of the seperately installed ghostscript comes first.

Do I have to install the 32bit Version of Ghostscript or do I have to tell sublime, that it have to use GSx64?

Edit: I got another idea because of your answer: I deleted the texlixe-GS-path from my PATH variable so sublime cannot see the wrong GS.exe. This solves the problem.

Thank you for your help.

pta-janssen commented 2 years ago

The updated solution of @Zaby1990 on May 7, 2020, did indeed do the trick. I've struggled quite a while with this issue. However I didn't notice that there were two entries for GhostScript in the PATH variable.

For future reference:

  1. Have GhostScript installed independently on your system
  2. Add C:\Program Files\gs\gs9.53.3\bin to your PATH variable (without the \bin it won't work and the naming will depend on the version of GhostScript you installed).
  3. Remove C:\texlive\2020\tlpkg\tlgs\bin from you PATH variable
  4. Restart Sublime and voila

Screenshot_133