批处理之家's Archiver

happy886rr 发表于 2017-3-17 21:45

mathjax.js 解析html中的数学公式

用mathjax.js 可以轻松解析html中的数学公式,数学公式用$$符号包围。详见官方文档 [url]http://docs.mathjax.org/en/latest/start.html[/url]。
测试代码:[code]<html>
        <head>

                <script type="text/x-mathjax-config">
                        MathJax.Hub.Config({tex2jax: {inlineMath: [['$','$'], ['\\(','\\)']]}});
                </script>

                <script type="text/javascript" async
                        src="https://cdn.mathjax.org/mathjax/latest/MathJax.js?config=TeX-AMS_CHTML">
                </script>

        </head>

        <body>
                <h1>DEMO</h1>
                If
                $$a \ne 0$$
                there are two solutions to \(ax^2 + bx + c = 0\) and they are
                $$x = {-b \pm \sqrt{b^2-4ac} \over 2a}.$$  


        </body>

</html>[/code]

页: [1]

Powered by Discuz! Archiver 7.2  © 2001-2009 Comsenz Inc.