Open quanzhongxian opened 1 month ago
Because you are loading MathJax modules directly rather than using MathJax Components, you have to load all the needed modules yourself by hand. In particular, you need to load the ams
package code using
import 'mathjax-full/js/input/ams/AmsConfiguration.js';
Similarly, load any other packages you may need. Listing it in the tex.packages
array is not enough to cause it to be loaded. The matrix
environment is part of the ams package, which is why you are getting the message about it being undefined.
Note that you don't have to create and register the adaptor each time renderMathToImg()
is called (in fact, you should not re-register the adaptor each time). These can be global values that renderMathToImg()
re-uses each time.
You haven't said which version of MathJax you are using, but 4.0.0-beta.7 includes an option in the "Show Math As" menu for generating an SVG image (if the SVG output is selected), so perhaps you can take advantage of that.