Patch looks good to me, I like the approach of having GET-MATHML-MATHSPACE to return the appropriate value. I see there are a couple of literal values (lines 290 and 444), I guess those can be replaced by a suitable call to GET-MATHML-MATHSPACE. I see that there is a test script mathmltest in share/contrib/lurkmathml, which is great. Maybe we can think about generating some output files so that we can use those to verify that some change to the MathML code is either improving the output or preserving...
I made some adjustments and it seems to work better. I'll attach the current version.
draw with terminal=epslatex_standalone generate faulty latex file
Fixed by commit [ ce4e05a ]. I just removed set format '%h' so that the default tick format is applied by Gnuplot, which is $%h$ for LaTeX terminals and % h for all others. % h and %h are almost the same; the only difference is that % h puts a space before positive numbers. I don't think that matters. It's not clear why %h was put into the draw code; maybe the default was something else at the time.
draw with terminal=epslatex_standalone generate faulty latex file
I've reopened this ticket, it turns out the problem is in the code which generates the Gnuplot script -- it has to do with the non-default tic label. I'll try to fix the bug in the draw package, but in the meantime, you can patch your copy of Maxima by cutting out set format '%h' in share/draw/gnuplot.lisp.
epslatex terminal: tick labels contain LaTeX math but not enclosed in dollar signs
Thanks for the info, I'll go back and fix up the code which generated that Gnuplot script. I've marked this ticket as "not a bug" accordingly.