How to convert latex to a string that can be evaluated in JS or PHP

831 views Asked by At

I'm using mathquill that allows users to enter equations and save them. the output from mathquill is LaTex, how would one go about parsing this to an expression that can be evaluated.

var mathFieldSpan = document.getElementById('math-field');
var latexSpan = document.getElementById('latex');
var MQ = MathQuill.getInterface(2); // for backcompat
var mathField = MQ.MathField(mathFieldSpan, {
    spaceBehavesLikeTab: true, // configurable
    handlers: {
        edit: function() { // useful event handlers
            latexSpan.textContent = mathField.latex(); // simple API
        }
    }
});
0

There are 0 answers