I used Matjax 3 with this code below successfully:
BEGIN CODE **********************************************
MathJax = {
options: {}
, tex: {
packages: packages
, processEnvironments: true
, noundefined: {
color: 'red'
, background: ''
, size: ''
}
, formatError(_, error) {
throw error;
}
}
, svg: {
fontCache: 'local'
}
, startup: {
typeset: false
}
};
//
// Load all the needed components
//
require('mathjax-full/components/src/startup/lib/startup.js'); //line 001
require('mathjax-full/components/src/core/core.js'); //line 002
require('mathjax-full/js/adaptors/browserAdaptor'); //line 003
require('mathjax-full/components/src/input/tex-base/tex-base.js'); //line 004
require('mathjax-full/components/src/input/tex/extensions/all-packages/all-packages.js'); //line 005
require('mathjax-full/components/src/input/tex/extensions/noundefined/noundefined'); //line 006
require('mathjax-full/components/src/output/svg/svg.js'); //line 007
require('mathjax-full/components/src/output/svg/fonts/tex/tex.js'); //line 008
require('mathjax-full/components/src/startup/startup.js'); //line 009
//
// Let MathJax know these are loaded
//
MathJax.loader.preLoad(
'core'
, 'adaptors/browserAdaptor'
, 'input/tex-base'
, '[tex]/all-packages'
, '[tex]/noundefined'
, 'output/svg'
, 'output/svg/fonts/tex'
);
MathJax.config.startup.ready();
function _tex2svg(tex, callback, _errCallback) {
MathJax.tex2svgPromise(tex, {
display: false
, em: 16 // em-size in pixels
, ex: 8 // ex-size in pixels
, containerWidth: 80 * 16
}).then(function (node) {
callback(node.firstElementChild);
}).catch(function (err) {
_errCallback(err.message);
});
}//END function _tex2svg(tex, callback, _errCallback)
function create(o, canvas, callback, errCallback) {
_tex2svg(o.formula, function(svg) {
fabric.parseSVGDocument(svg, function(objects, options) {
const opts = $.extend({}, o, options);
const obj = objects.length === 1
? new fabric.Group(objects, opts)
: fabric.util.groupSVGElements(objects, opts);
obj.selectable = canvas.selection;
obj.type = 'group';
if (typeof(callback) === 'function') {
callback(obj);
}
canvas.add(obj).requestRenderAll();
});
}, errCallback);
}//END function create(o, canvas, callback, errCallback)
END CODE ***************************************************
As you can see, I use the SVG output and put it on the browser canvas with fabric.js.
I could recompile
Mathjax 4.0.0-beta.4 (
MathJax-src-4.0.0-beta.4.zip
) successfully.
Now I want to use the code above but with
Mathjax 4.0.0-beta.4
.
*******************************
MY QUESTION:
Where are the relevant components in
4.0.0-beta.4
?
*******************************
Thank you.