I am not willing to make MaTeX compatible with Mathematica 9 for the simple reason that it would create too much of a maintenance burden, and I already don't have time to properly respond to all support requests.
If anyone is willing to hack MaTeX to work with Mathematica 9, here's what needs to be done.
The primary reason why Mathematica 10 is required is RunProcess
, which makes it much easier to call external commands than it was possible before. It lifts the burden of assembling command lines with proper handling of spaces in paths, escaped characters, etc., in a cross platform way. It can also capture standard output easily, and it doesn't cause a command window to pop up on Windows every time it is used, like Run
does.
In the iMaTeX
function, RunProcess
needs to be replaced with Run
. You need to make sure spaces in paths are handled correctly. Note that on Windows, there's typically in a space in the path to either Ghostscript of pdflatex and there's also a space in the path to the temporary directory, where MaTeX creates temporary files.
The most important place where I used RunProcess
to capture standard output is when running pdflatex
. Instead of capturing standard output (not easily possible with Run
), you can just read in the TeX log file. See the logfile = ...
line in iMaTeX
.
MaTeX also uses the exit code of processes, but that is already returned by Run
.
I used Association
s for storing and handling various permanent settings, including the paths to Ghostscript and pdflatex. As a simplest solution, I would recommend ripping out the whole configuration system and instead hard-coding these settings as DownValues
of $config
inside MaTeX.m
. This will get rid of some uses of associations and the remaining uses of RunProcess
. Everything from the comment (* Load and check persistent configuration *)
up to and including the definition of ConfigurMaTeX
can be removed and replaced with something like $config["Ghostscript"] = "...hardcoded path to Ghostscript..."
.
I also used Association
s for caching results, which speeds up things and significantly improves the user experience. There are three choices here: (a) either remove the caching functionality entirely or (b) use plain memoization, without any bound on how many results are cached, and without the possibility to clear the cache, or (c) implement limited caching using DownValues
using something similar to what I wrote here many many years ago...
I hope this information will help anyone who would like to try to make MaTeX work with Mathematica 9 on their own machine. Making it compatible with M9 and work robustly on all platforms, for everyone, without hard-coding settings, would take more work.