wko27 / react-mathjax

MathJax as React component
MIT License
168 stars 71 forks source link

The second and third node in context seem to lose the nice typesetting #13

Open light-and-salt opened 5 years ago

light-and-salt commented 5 years ago

First of all, thanks for making this wonderful library! Finding your repo made my day! πŸ‘πŸ’πŸ† Using your package, typesetting is really fast. Kind of changed my impression that MathJax is always slower than Katex.

It's explicitly said in the documentation but I assume we can use multiple nodes inside the context. I tried the following:

<MathJax.Context input='tex'>
  <div>
    <div>This is the first node<MathJax.Node inline>{`f(x) = 0.22x + 14`}</MathJax.Node></div>
    <div>This is the second node<MathJax.Node>
      {String.raw` 
        \begin{align}
          \widehat{y} = f(x) & = \sum \limits_{i=0}^d w_i x^i  \\
          & \class{math-d0}{ = w_0} \\
          & \class{math-d1}{ + w_1 x^1} \\
          & \class{math-d2}{ + w_2 x^2} \\
          & \class{math-ddots}{ + \cdots} \\
          & \class{math-dd}{ + w_d x^d}
        \end{align}
        `}
    </MathJax.Node></div>
    <MathJax.Text text={String.raw`This is the third node $$ \sum E \ne mc^2 $$`}></MathJax.Text>
  </div>
</MathJax.Context>

In the rendered HTML, the first node is nicely typeset, but the second, third (and perhaps the rest?) nodes seem to lose the nice typeset: image

What could have caused the problem? Am I missing some style somewhere? Can this be fixed by force updating all nodes in the context?

declanclark commented 4 years ago

Hi, I have this problem currently (though I am using different contexts on the same route), don't suppose you managed to find a solution?

light-and-salt commented 4 years ago

Hi, I have this problem currently (though I am using different contexts on the same route), don't suppose you managed to find a solution?

No... I didn't find a solution...