Instructions:

1. Restart the kernel using Evaluation -> Quit Kernel -> Local
2. Evaluate this notebook using Evaluation -> Evaluate Notebook
3. Save the notebook and mail it to szhorvat at gmail.com along with a description of the problem.
4. Restart Mathematica to reset the temporary modifications done by the code below.

Below you will find some notes which may help in finding the root cause of the problem.

Basic system information

FilterRules[SystemInformation["Kernel"],{"Version","ReleaseID","ProcessorType","Language","CharacterEncoding"}]//TableForm

FilterRules[SystemInformation["FrontEnd"],{"Version","OperatingSystem","OperatingSystemVersion","ExternalCharacterEncoding","Language","DebuggerEnabled"}]//TableForm

Special characters in these paths may cause problems, depending on the Language and CharacterEncoding values from above. If the cause of the problems is indeed special characters, please report it.

{Directory[],$TemporaryDirectory}

This shows the system environment, including PATH.

GetEnvironment[]//TableForm

MaTeX information

Are you actually using the MaTeX installation you think you are using?

FindFile["MaTeX`"]

PacletInformation["MaTeX"]

PacletFind["MaTeX"]

<<MaTeX`

Is the configuration correct?

config=ConfigureMaTeX[]

MaTeX`Developer`$Version

Test the TEX installation

Does your TEX system work independently of MaTeX?

SetDirectory@CreateDirectory[]

Export["mytest.tex",
"
\\documentclass{article}
\\begin{document}
Test $x$
\\end{document}
","String"];

pdflatex="pdfLaTeX"/.config

RunProcess[{pdflatex,"mytest.tex"}]

FileNames[]

Test a second time, after applying the Linux ZLIB incompatibility workaround.

CopyFile["mytest.tex","mytest2.tex"]

RunProcess[{pdflatex,"mytest2.tex"},ProcessEnvironment->MaTeX`Private`$environment]

FileNames[]

Check pdflatex version. Is it TEX Live, MiKTeX or something else?

RunProcess[{pdflatex,"--version"},ProcessEnvironment->MaTeX`Private`$environment]

ResetDirectory[]

Test Ghostscript

SetDirectory@CreateDirectory[]

Does Ghostscript work independently of MaTeX?

gs="Ghostscript"/.config

RunProcess[{gs,"--version"}]

Test a second time, after applying the Linux ZLIB incompatibility workaround.

RunProcess[{gs,"--version"},ProcessEnvironment->MaTeX`Private`$environment]

Can Ghostscript convert PDF files?

Export["gt.pdf",Graphics[{Circle[],Text["foobar"]}]]

res=RunProcess[{gs,"-o","gt-gs.pdf","-dNoOutputFonts","-sDEVICE=pdfwrite","gt.pdf"}]

If the exit code is None, Ghostscript may be crashing (meaning that your Ghostscript installation is broken).

res["ExitCode"]

FileNames[]

Test a second time, after applying the Linux ZLIB incompatibility workaround.

res=RunProcess[{gs,"-o","gt-gs.pdf","-dNoOutputFonts","-sDEVICE=pdfwrite","gt.pdf"},ProcessEnvironment->MaTeX`Private`$environment]

FileNames[]

Can Mathematica read the result back?

Import["gt-gs.pdf"]

ResetDirectory[]

Basic MaTeX test

What errors do you see when running MaTeX? Try clicking the (...) on the left of the message and see if there is a documentation page that explains it. In older versions of Mathematica, try clicking the >> sign after the error message, if there is one.

MaTeX["x"]

The LATEX log file will contain more detailed error information.

MaTeX["x^2","TeXFileFunction"->Print,"LogFileFunction"->Print]

Get stack trace

This attempts to display a stack trace in human readable form for each error.

Block[{$ContextPath},
Needs["GeneralUtilities`"];
]

SetAttributes[GeneralUtilities`PrettyForm,HoldAllComplete]

messageHandler=StackInhibit@If[Last[#],Internal`InheritedBlock[{$ContextPath},AppendTo[$ContextPath,"MaTeX`Private`"];Print["stack: \n",Column[Style[#,"Input",FontWeight->Plain,ShowStringCharacters->True]&/@GeneralUtilities`PrettyForm@@@Stack[_],Automatic,2,Frame->All]]]]&;
Internal`AddHandler["Message",messageHandler]

<<MaTeX`

MaTeX["x^2"]

Verify that code was run in a fresh kernel

If[$Line≠41,Uncompress["1:eJw1jl0KwkAMhNc/8Ag+pgfQQyjokyDtCbaa1dCQ6G5Wqad3W/VlyDBfhqlarcPMOZcWRRrrGZu+XEffIaQcEXrN8MhkYDeEDqMgQ4tBS4RPz9kbybWElEDUsFXtKjgx+oQQlFlf4ydJspjPRioJ/LfN9A5eLhBx/avCzXfMskh92O6UNdKkGHJ/CdMBmA9AZhzJvYo19EZaFfMBUpo9Zg==" ]
]

Quit kernel to reset system modifications

Quit[]