# How to configure MaTeX correctly under the environment of TeXLive2019

I installed texlive2019.And I configured Matex as follows, but there was a strange error:

ConfigureMaTeX[
"pdfLaTeX" -> "D:\\texlive\\2019\\bin\\win32\\pdflatex.exe",
"Ghostscript" -> "D:\\texlive\\2019\\tlpkg\\tlgs\\bin\\gswin32c.exe"]


File::badfile: The specified argument should be a valid string or File.

MaTeX["\\int x \\, dx = \\frac{x^2}{2} + \\text{const.}"]


MaTeX::gserr: Error while running Ghostscript. GPL Ghostscript 9.26: Can't find initialization file gs_init.ps.

I want to know the cause of the error report and how to solve it.

• Try MaTeX@..... Feb 7, 2020 at 10:24
• have you read this? zhuanlan.zhihu.com/p/102478498 Feb 7, 2020 at 11:09
• Have you tested if your TeXLive installation work? Feb 8, 2020 at 0:51
• @vipa My texlive2019 can compile Chinese PDF. I think this error is probably caused by the slow update speed of Matex and the new change of texlive2019. Feb 8, 2020 at 1:09

Through this link, I found the cause of similar problems:

> gswin32c -h としてみると，

TeX Live に入っている Ghostscript は，直接「gswin32c」というコマンドで呼び出すことを想定していません。 あくまでそれは TeX と一緒に使うためのものなので，「rungs」という名前で呼び出すことになっていて， 外部ツールから呼び出すことはサポート外と書かれています。 tlpkg フォルダの中の tlgs/README.TEXLIVE を読んでください。Web 上で読むならここですね。

Translate this into English through Google translate as follows:

Ghostscript included in TeX Live is not supposed to be called directly with the command "gswin32c".

It is only for use with TeX, so it is called as "rungs", and calling from an external tool is not supported.

I found out how to correctly configure Matex in the environment of texlive2019 as follows:

<< MaTeX
ClearMaTeXCache[];
(*MaTeX/tutorial/ConfiguringMaTeX*)
MaTeXDeveloperResetConfiguration[]
ConfigureMaTeX[
"pdfLaTeX" -> "D:\\texlive\\2019\\bin\\win32\\xelatex.exe",
"Ghostscript" -> "D:\\texlive\\2019\\bin\\win32\\rungs.exe"]
MaTeX["\\ce{2H2 + O3 ->T[\\text{燃烧}] 2H2O}",
"Preamble" -> {"\\usepackage[version=4]{mhchem}",
"\\usepackage{ctex}"}, FontSize -> 20]


We can also download the independent Ghostscript from here and configure Matex after installation:

ConfigureMaTeX[
"pdfLaTeX" -> "D:\\texlive\\2019\\bin\\win32\\xelatex.exe",
"Ghostscript" -> "C:\\gs\\gs9.50\\bin\\gswin32c.exe"]
`

In this way, the correct output can also be obtained.