1
$\begingroup$

My system: Windows 10, Mathematica 11.2

Yesterday I had to upgrade my MikTeX because I absolutely needed to compile a document needing a newer version.

Today MaTeX stopped working. I started getting error messages like the following.

MaTeX::stderr: Additional error information received:
Sorry, but "C:\Users\Jyrki\AppData\Local\Programs\MiKTeX 2.9\miktex\bin\x64\pdflatex.exe" did not succeed.

The log file hopefully contains the information to get MiKTeX going again:

C:\Users\Jyrki\AppData\Local\MiKTeX\2.9\miktex\log\pdflatex.log

I tried uninstalling and reinstalling the latest version, but to no avail:

Needs["PacletManager`"]
PacletInstall["C:\\Users\\Jyrki\\Downloads\\MaTeX-1.7.8.paclet"]

worked without incident. But the test command

MaTeX["x^2"]

gives a repeat of the previous message.

I try and follow the instructions, and take a look at the pdflatex log file. The latest entries read:

2022-05-13 13:12:36,162+0300 INFO  pdflatex - starting with command line: "C:\Users\Jyrki\AppData\Local\Programs\MiKTeX 2.9\miktex\bin\x64\pdflatex.exe" -halt-on-error -interaction=nonstopmode C:\Users\Jyrki\AppData\Local\Temp\MaTeX_eztxwxztseqtbklv\ngzykhpmqouyaimb.tex
2022-05-13 13:12:36,172+0300 INFO  pdflatex - allowing known shell commands
2022-05-13 13:12:36,173+0300 INFO  pdflatex - enabling input (output) from (to) processes
2022-05-13 13:12:36,188+0300 FATAL pdflatex - Bad parameter value.
2022-05-13 13:12:36,188+0300 FATAL pdflatex - Info: parameterName="font_mem_size"
2022-05-13 13:12:36,188+0300 FATAL pdflatex - Source: Libraries\MiKTeX\TeXAndFriends\include\miktex\TeXAndFriends\TeXMFMemoryHandlerImpl.h
2022-05-13 13:12:36,188+0300 FATAL pdflatex - Line: 105
2022-05-13 13:12:36,188+0300 INFO  pdflatex - finishing with exit code 1

I'm afraid this is all Greek to me. Can anyone interpret this and/or suggest a fix?

Update

Following the suggestions by Szabolcs and Nasser reveals the following.

  • My TeX-system compiles the output MaTeX generated just fine.
  • But something went wrong with my TeX upgrade. Namely, there are now two copies of MikTeX on my system, Version 2.9 and the upgraded version! The installation software unexpectedly (?) did not remove the earlier version of MikTeX.
  • And the problem seems to be that, from within Mathematica, MaTeX still attempts to call the old version. After all, the error message refers to MikTeX2.9.
  • Making the first bullet more precise: the file containing the output of ClearMaTeXCache[]; MaTeX["x^2", "TeXFileFunction" -> Print] compiles with pdflatex.exe just fine when I use the version of pdflatex in the new folder. But if I call the version of pdflatex in the MikTeX2.9 hierarchy of folders, it will abort immediately.

So:

  • I might be able to fix this problem by reconfiguring MaTeX to use the updated version of pdflatex.exe.
  • And therefore I'm grateful for all tips related to that.
  • But it also looks like I need to rebuild my TeX-system from scratch. Something I cannot afford to do today. I don't cherish the prospect of reconfiguring WinEDT (if I end up having to install that). I don't know what went wrong when upgrading MikTeX, but that's a problem for another site.
$\endgroup$
8
  • $\begingroup$ I can't really tell what's going on, but it seems that the problem may be with MiKTeX (i.e. your TeX installation). I suggest trying to compile the TeX file that MaTeX produces in isolation. Run this to see the contents of the TeX file: ClearMaTeXCache[]; MaTeX["x^2", "TeXFileFunction" -> Print] Copy this into a .tex file and try to run it through pdflatex. What happens? Do you get any errors? $\endgroup$
    – Szabolcs
    Commented May 13, 2022 at 10:49
  • $\begingroup$ Also: debugging this might take a while, and StackExchange is not the ideal medium to do it. Feel free to email me directly. $\endgroup$
    – Szabolcs
    Commented May 13, 2022 at 10:51
  • $\begingroup$ @Szabolcs Thank you very much for the suggestion. I access my TeX-system via WinEdt. Copy/pasting the output your snippet gave into a new file had the following effects. The package manager was called to install a missing package. After that the file compiled fine. Alas, it still won't work within Mathematica. $\endgroup$ Commented May 13, 2022 at 10:55
  • $\begingroup$ The error suggest that font_mem_size is set to a bad value. This appears to be a MiKTeX configuration (see here) specific to your system. MaTeX certainly does not change these options. Can you try to verify this setting on your system? I don't have a Windows machine handy so I can't try it here. $\endgroup$
    – Szabolcs
    Commented May 13, 2022 at 10:56
  • 3
    $\begingroup$ Try to rebuild format or reset your local configuration. see tex.stackexchange.com/questions/500534/… $\endgroup$
    – Nasser
    Commented May 13, 2022 at 10:56

1 Answer 1

2
$\begingroup$

I seem to have solved the problem in the sense that now MaTeX works again on my system. I first tried to untangle my MikTeX by uninstalling version 2.9. (which unfortunately also uninstalled the updated MikTeX). And then reinstall the updated MikTeX. This did not complete as well as it should, because my Windows start menu currently shows both MikTeX and MikTeX 2.9 (but won't give a way to remove the obsolete version). But that's a question for a different SE.


The procedure was basically to follow the instructions and run the following commands

 Needs["PacletManager`"]
 PacletInstall["C:\\Users\\Jyrki\\Downloads\\MaTeX-1.7.8.paclet"]

At this point I gave the command

<<MaTeX`

This gave the helpful error message that it cannot find pdflatex.exe in the expected location. Hardly a surprise because that path still involved MikTeX2.9 in the directory tree. Anyway, the system kindly referred me to the manual, where this is explained. So giving the command

ConfigureMaTeX[
 "pdfLaTeX" -> 
  "C:\\Users\\Jyrki\\AppData\\Local\\Programs\\MiKTeX\\miktex\\bin\\\
x64\\pdflatex.exe", 
 "Ghostscript" -> "C:\\Program Files\\gs\\gs9.27\\bin\\gswin64c.exe"
 ]

fixed that problem.

MaTeX still wouldn't run right away because of the old issue. But this answer has the remedy of giving the commands

Quiet[MaTeX["x"]];
ClearMaTeXCache[];

After those MaTeX began to work as expected. :-)

$\endgroup$
2
  • $\begingroup$ It would still be nice to know why those two commands in the end are needed before MaTeX works, but that is for the other thread. They have become more or less initialization cells for those notebooks where MaTeX is used. $\endgroup$ Commented May 15, 2022 at 11:01
  • $\begingroup$ I still don't know why MaTeX could not use the (at the time of me asking this question) still existing older version of pdflatex.exe. Possibly some environment variable (or registry entry) was wrong, but I lost touch of all that when DOS6.2 was discontinued. $\endgroup$ Commented May 15, 2022 at 11:15

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.