# Error using MaTeX, MaTeX::texerr : LaTeX Error: Missing \begin{document}

I've managed to install MateX with all prerequisites. pdflatex and GhostScript paths are correctly specified. I am able to load it into Mathematica. However, a simple command such as MaTeX[x^2] gives me a MaTeX::texerr : LaTeX Error titled "Missing \begin{document}".

Has anyone faced a similar issue? Any help would be much appreciated..!

Thanks,

• Please follow the instructions at the end of the troubleshooting section: szhorvat.net/pelican/latex-typesetting-in-mathematica.html Evaluate the troubleshooting notebook and send it to me. – Szabolcs Oct 14 '19 at 7:20
• However, I can say that almost certainly MaTeX is installed incorrectly on your computer. Double-check that you followed the installation instructions exactly, and that you did not do anything that the instructions did not explicitly ask for (if you did, undo it). Make sure you have no old versions installed and that there is no MaTeX directory in this location: SystemOpen@FileNameJoin[{\$UserBaseDirectory, "Applications"}] – Szabolcs Oct 14 '19 at 7:32
• @Szabolcs, As you rightly pointed out, the problem was with Matex installation. I think I didn't follow the instructions when I installed it first. Thanks a ton for pointing out..!!! – Krishna Phanindra Oct 14 '19 at 7:56
• It might be useful if you could add a self-answer so that others who encounter the same error might find it useful. I searched my email and the only time when someone encountered this error it turned out that they had a very old (years) version of MaTeX still installed – Szabolcs Oct 14 '19 at 8:43

• Now there is a simpler installation method: just run ResourceFunction["MaTeXInstall"][] (this method requires Mathematica 11.3 or later; MaTeX works with Mathematica 10.0, but you need to use the manual installation method) – Szabolcs Oct 18 '19 at 15:23
• @murray I did not realize that local documentation links would be translated to online links ... of course, Wolfram does not host the MaTeX documentation, so those online links can't work. The links do work in the notebook opened with ResourceFunction["MaTeXInstall", "DocumentationNotebook"] (provided that MaTeX is installed already). This function page, which I modelled mine on, suffers from the same problems. I guess I should just remove the links because the current situation is confusing. – Szabolcs Oct 18 '19 at 18:36