mathJax offline

1、

https://www.drupal.org/node/2420509

I got it. first download library from mathjax.org (https://github.com/mathjax/MathJax/archive/v2.6-latest.zip) , then unzip to libraries folder and rename folder to mathjax ( all small caps) and uncheck the cdn path in mathjax module configuration page.

 

2、

https://stackoverflow.com/questions/48867501/mathjax-offline-for-web-view?r=SearchResults

Mathjax offline for web view

Using webview to render math content by linking mathjax cdn for react native is common. But how to approach the problem of making it offline.

  1. Is there a way to locally maintain that bundle? 

  2. Is it even prefered? 

  3. What will be the size of the bundle ? I dont want my app size to go beyond 10mb.

Answer

file:///android_asset/MathJax/Found the solution. Download your mathjax from 

http://docs.mathjax.org/en/latest/installation.html

into => android/app/src/main/assets/

Now in your webview html code set script reference to 

<script src="file:///android_asset/MathJax/MathJax.js?config=TeX-MML-AM_CHTML"></script>

and your necessary config inside html. Also make sure to set base url to your folder name.

<WebView source={{ html, baseUrl: 'file:///android_asset/MathJax/' }} />

Also you can https://github.com/mathjax/MathJax-grunt-cleaner to reduce the Mathjax asset size by removing unnecessary fonts and formats that you don't use.

shareimprove this answer

edited Feb 21 '18 at 14:54

answered Feb 19 '18 at 15:11

Gaudam Thiyagarajan

560415

  • Its not working for me after using MathJax-grunt-cleaner. any idea? – Shahzad Akram Feb 11 at 14:57

  • you have to make sure you are removing only files that you don't need – Gaudam Thiyagarajan Feb 12 at 11:05

  • Sorry but I have zero experience with JavaScript, can you guide me about this? – Shahzad Akram Feb 12 at 11:09

  • 1

    basically you would have a config set on mathjax script loading location MathJax.Hub.Config. In the grunt file you can disable other configs that you dont need. for example Im using HTML-CSS as output so I don't need commonHtmlOutput, svgOutput, previewHtmlOutput, plainSourceOutput. So comment those out and then run the grunt file. Make sure you don't remove anything that you might need – Gaudam ThiyagarajanFeb 12 at 11:34 

add a comment

 

3、

https://docs.mathjax.org/en/latest/misc/mathjax-in-use.html?highlight=offline

https://pastebin.com/rBA40eq

How to make the source(path) of MathJax.js environment dependent?
<script src="https://c328740.ssl.cf1.rackcdn.com/mathjax/latest/MathJax.js"></script>
<script>
if( !window.MathJax ) {
    document.write(
        '<script type="text/javascript" src="../lib/MathJax.js"></script>'
    );
}
</script>
	
<script>
var url= location.protocol == 'http:'? 
         "https://c328740.ssl.cf1.rackcdn.com/mathjax/latest/MathJax.js" :
         "../lib/MathJax.js";
document.write(
    '<script type="text/javascript" src="' + url + '"></script>'
);
</script>

 

 

  • 0
    点赞
  • 1
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值