Pavan Tiwari
Pavan Tiwari

Reputation: 3187

How can I get the MathExpression from MathJAX.js

I am new to MathMl.

I have below MathML

<math xmlns='http://www.w3.org/1998/Math/MathML'>
<mrow>
  <mrow>
    <msup>
      <mi>x</mi>
      <mn>10</mn>
    </msup>
    <mo>+</mo>
    <mrow>
      <mn>4</mn>
      <mo>&InvisibleTimes;</mo>
      <mi>x</mi>
    </mrow>
    <mo>+</mo>
    <mn>4</mn>
  </mrow>
  <mo>=</mo>
  <mn>0</mn>
</mrow>
</math>

How can i get the corresponding MathExpression which is x^10 +4x+4=0 by using MathJax.

I need the expression inside javascript variable or inside generated html content itself.

Thanks

Upvotes: 0

Views: 192

Answers (1)

Cylexx
Cylexx

Reputation: 346

you have just to add the MathJax library like this :

<!DOCTYPE html>
<html>

<head>
  <title>MathJax TeX Test Page</title>
  <script type="text/x-mathjax-config">
    MathJax.Hub.Config({tex2jax: {inlineMath: [['$','$'], ['\\(','\\)']]}});
  </script>
  <script type="text/javascript" async src="https://cdnjs.cloudflare.com/ajax/libs/mathjax/2.7.1/MathJax.js?config=TeX-MML-AM_CHTML">
  </script>
</head>

<body>
  <math xmlns='http://www.w3.org/1998/Math/MathML'>
<mrow>
  <mrow>
    <msup>
      <mi>x</mi>
      <mn>10</mn>
    </msup>
    <mo>+</mo>
    <mrow>
      <mn>4</mn>
      <mo>&InvisibleTimes;</mo>
      <mi>x</mi>
    </mrow>
    <mo>+</mo>
    <mn>4</mn>
  </mrow>
  <mo>=</mo>
  <mn>0</mn>
</mrow>
</math>
</body>

</html>

Upvotes: 1

Related Questions