\ times和\ Omega在本地html文件中的mathjax / katex中不起作用

时间:2018-10-26 13:09:49

标签: android latex mathjax

我想在Android应用中显示数学方程式。我为此使用mathjax。在我的Web应用程序中,mathjax运行正常。当我在本地应用程序(在资产文件夹中)使用本地html文件在android应用程序(在android studio中)中使用mathjax时某些符号无法正常运行,例如\ times,\ Omega等。

这是我的html文件

<!DOCTYPE html>
<html>
<head>
<meta name="viewport" content="width=device-width"/>
<title></title>
<script type="text/x-mathjax-config">
    MathJax.Hub.Config({tex2jax: {inlineMath: [['$','$'], ['\\(','\\)']]}});
</script>

 <script type="text/javascript"  src="https://cdnjs.cloudflare.com/ajax/libs/mathjax/2.7.4/MathJax.js?config=TeX-MML-AM_CHTML"></script>

 </head>
<body>

<div id="divMain">
</div>

    <script type="text/javascript">
            function replace(id, newContent){
                var div = document.getElementById(id);
                div.innerHTML=newContent;
                    MathJax.Hub.Queue(["Typeset", MathJax.Hub, "body"]);
            }
   </script>

  </body>
 </html>

MainActivity.java

 myWebView.setWebViewClient(new WebViewClient() {
                @Override
                public void onPageFinished(WebView view, String url) {
                    super.onPageFinished(view, url);
                    view.loadUrl("javascript:replace('divMain', 'V $\times$ I')");
                }
            });

            myWebView.loadUrl("file:///android_asset/html_katex.html");

0 个答案:

没有答案