szhorvat / MaTeX

LaTeX labels in Mathematica
http://szhorvat.net/mathematica/MaTeX
MIT License
375 stars 45 forks source link

MaTeX::gserr: Error while running Ghostscript. #2

Closed wanglongqi closed 9 years ago

wanglongqi commented 9 years ago

The function use to work, but today end up with MaTeX::gserr: Error while running Ghostscript. How can I get debug information?

Configuration file (no error):

<|"pdfLaTeX" -> "/usr/texbin/xelatex", "Ghostscript" -> "/usr/local/bin/gs", 
 "CacheSize" -> 100|>
szhorvat commented 9 years ago

Please show a complete example that triggers the error. Just by the error I am not able to tell what is going wrong. Also let me know your operating system, precise Mathematica version and Ghostscript version.

wanglongqi commented 9 years ago

@szhorvat I found the error eventually. The problem is caused by I am using xelatex instead of pdflatex. However, I do not understand why this package does not work with xelatex. I extracted the latex file generated, xelatex can also compile that file and generate pdf.

szhorvat commented 9 years ago

MaTeX has a document template that it pastes the snippet you write into. This is likely incompatible with xelatex. You can open MaTeX.m and take a look at template = ....

I am in the process of moving at the moment and do not have internet access at home. I'll take a look at this when everything is settled down and my internet is up.

szhorvat commented 9 years ago

I'm not sure what's going on here. The problem appears only when Mathematica is run with a front end. It does not appear when running it on the command line and I cannot reproduce it when running the commands manually.

szhorvat commented 9 years ago

@wanglongqi This happens because /usr/texbin is not in the PATH when running Mathematica using the front end. On OS X with MacTeX a temporary workaround is to do

SetEnvironment["PATH" -> "/usr/bin:/bin:/usr/sbin:/sbin:/usr/texbin" ]

from within Mathematica and re-add this directory to the path.

wanglongqi commented 9 years ago

Yes, adding /usr/texbin to PATH solve the problem.

szhorvat commented 9 years ago

Fixed by e1c3f9ddef751d30d412adb6650dfc2f61acb19c