MathJax is not defined while doing tex to svg

8 hours ago 1
ARTICLE AD BOX

By loading the file, the console says `MathJax is not defined' but I have no idea how to fix, despite many attempts. I have tried adding some code for the MathJax but then it says MathJax.tex2svg not defined, so I really need help.

var canvas = document.getElementById('surface'); var ctx = canvas.getContext('2d'); canvas.width = 202; var tex = "F=ma"; var svg = MathJax.tex2svg(tex); var svg = svg.childNodes[0] var ssvg = new XMLSerializer().serializeToString(svg); var base64 = "data:image/svg+xml;base64, " + window.btoa(unescape(encodeURIComponent(ssvg))); base64.addEventListener("load", (e) => { ctx.drawImage(base64, 105, 15, 102.3, 23.93); }); <canvas id="surface">Canvas not Supported</canvas> <script type="text/javascript" id="MathJax-script" async src="https://cdn.jsdelivr.net/npm/mathjax@3/es5/tex-svg.js"></script>
Read Entire Article