I have a table where I am trying to include mathjax. The user should be able to type latex into a cell and it displays properly. Currently, it will display properly for the first latex equation entered into a cell however, if I type another equation into a different cell then it will display same answer in both cell.
Example:
user enters \pi into cell 1.
cell 1 gets rendered.
cell 1 displays pi.
user enters \frac {1} {2} into cell 1
cell 1 gets rendered.
cell 1 displays \frac {1} {2}
user enters \frac {pi} {4} into cell 2
cell 1 and cell 2 re-render and display \frac {pi} {4}
this is my current code:
<div id="MathOutput" style="display:none;">$${}$$
</div>
//called whenever user enters formula into a cell
MathEnteredInCell = function (formula)
{
MathJax.Hub.queue.Push( function ()
{
math = MathJax.Hub.getAllJax("MathOutput")[0];
} );
MathJax.Hub.queue.Push(["resetEquationNumbers", MathJax.InputJax.TeX], ["Text", math, "\\displaystyle{" + formula + "}"]);
return $('#MathOutput').html();
};
I tried to copy MathOutput and then return the copy and remove() MathOutput but that doesn't work either. I don't want to put a div into every cell. Am i doing this completely wrong? I am new to mathjax
Anyone have ideas ?