码迷,mamicode.com
首页 > Web开发 > 详细

网页引入mathjax,latex

时间:2020-05-13 14:04:47      阅读:137      评论:0      收藏:0      [点我收藏+]

标签:htm   def   undefined   conf   name   lan   data-   click   word   

Mathjax:2.x

整理一

<script type="text/x-mathjax-config">
MathJax.Hub.Config({
    showProcessingMessages: false,
    messageStyle: "none",
    extensions: ["tex2jax.js"],
    jax: ["input/TeX", "output/HTML-CSS"],
    tex2jax: {
        inlineMath:  [ ["$", "$"] ],
        displayMath: [ ["$$","$$"] ],
        skipTags: [‘script‘, ‘noscript‘, ‘style‘, ‘textarea‘, ‘pre‘,‘code‘,‘a‘],
        ignoreClass:"comment-content"
    },
    "HTML-CSS": {
        availableFonts: ["STIX","TeX"],
        showMathMenu: false
    }
});
MathJax.Hub.Queue(["Typeset",MathJax.Hub]);
</script>
<script src="//cdn.bootcss.com/mathjax/2.7.0/MathJax.js?config=TeX-AMS-MML_HTMLorMML"></script>

整理二

<script type="text/x-mathjax-config">
var mathId = document.getElementById("post-content");
MathJax.Hub.Config({
    showProcessingMessages: false,
    messageStyle: "none",
    extensions: ["tex2jax.js"],
    jax: ["input/TeX", "output/HTML-CSS"],
    tex2jax: {
        inlineMath:  [ ["$", "$"] ],
        displayMath: [ ["$$","$$"] ],
        skipTags: [‘script‘, ‘noscript‘, ‘style‘, ‘textarea‘, ‘pre‘,‘code‘,‘a‘],
        ignoreClass:"comment-content"
    },
    "HTML-CSS": {
        availableFonts: ["STIX","TeX"],
        showMathMenu: false
    }
});
MathJax.Hub.Queue(["Typeset",MathJax.Hub,mathId]);
</script>
<script src="//www.bsck.org cdn.bootcss.com/mathjax/2.7.0/MathJax.js?config=TeX-AMS-MML_HTMLorMML"></script>

修复与Instantclick的冲突

代码如下

适用于整理一的代码

<script data-no-instant>
InstantClick.on(‘change‘, function(isInitialLoad){
    if (isInitialLoad === false) {
        if (typeof MathJax !== ‘undefined‘){
            MathJax.Hub.Queue(["Typeset",MathJax.Hub]);
        }
    }
});
InstantClick.init();
</script>

适用于整理二的代码

 
<script data-no-instant>
InstantClick.on(‘change‘, function(isInitialLoad){
    if (isInitialLoad === false) {
        if (typeof MathJax !== ‘undefined‘){
            var mathId = document.getElementById("post-content");
            MathJax.Hub.Queue(["Typeset",MathJax.Hub,mathId]);
        }
    }
});
InstantClick.init();
</script>

网页引入mathjax,latex

标签:htm   def   undefined   conf   name   lan   data-   click   word   

原文地址:https://www.cnblogs.com/Dean0731/p/12881872.html

(0)
(0)
   
举报
评论 一句话评论(0
登录后才能评论!
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!