MathJax in JQuery

前端 未结 2 998
醉酒成梦
醉酒成梦 2020-12-18 11:30

I have many different MathJax formulas that are going to be dynamically moved around different lists on the webpage. I am trying to control this with JQuery and the append a

2条回答
  •  再見小時候
    2020-12-18 11:52

    There are two problems with your fiddle example. First, the array of math expressions loses the backslashes, because these are used as escape characters in the javascript strings. You need to double them:

    var jax = ['\\(\\mathbb{Q}\\)','\\(\\mathbb{Z}\\)'];
    

    Second, you need to tell MathJax to process the mathematics once you have added it to the page. Use

    MathJax.Hub.Queue(["Typeset",MathJax.Hub,div]);
    

    after appending the math in order to do that.

    Version 120 of you fiddle shows a working version.

提交回复
热议问题