Hello,
Here is a simple patch to mactex.lisp which eliminates two bugs:
1. Some variables (including those generated by maxima) contain "%";
it was passed to TeX output unquoted. This, of course, makes the generated
TeX completely wrong.
(This was corrected in the TeXmacs-interface version long ago, but is
still wrong in the mainline maxima; it seems that tex(...); is not so much
used, except by the TeXmacs interface :-)
2. User variables may contain "_"; they can lead to generation of
syntactically wrong TeX. For example,
tex(x_1);
produced
$$
x__1
$$
Both bugs are now eliminated by this patch. It does not change anything
else. I think it is not controversial, and should be merged now (or at
least before the next release).
Best wishes,
Andrey