peer
peer

Reputation: 65

include mathjax in android app

I am trying to include MathJax in my app. I removed files not needed for my app and brought down the size of the MathJax folder to 3Mb.

My mathjax folder is in the assests directory of my app. I tried to link mathjax using

<script type="text/javascript" src="/mathjax/MathJax.js?config=default"></script>

This does not seem to work. Is my path to the mathjax wrong? Because my app worked fine when i gave my source as

 <script type="text/javascript" src="http://cdn.mathjax.org/mathjax/latest/MathJax.js?config=default"></script>

Solution:

W.R.T Paul's solution, here are the changes that i made

  <script type="text/x-mathjax-config">
  MathJax.Hub.Config({  
skipStartupTypeset: true,
config: ['default.js'],
jax: ["input/TeX","output/HTML-CSS"],
extensions: ['tex2jax.js'] 
});
</script>
<script type="text/javascript"   src="file:///android_asset/antest_files/MathJax/MathJax.js"></script>

Upvotes: 4

Views: 4313

Answers (2)

DAG
DAG

Reputation: 2630

I know it's a long time a go, but I also had the same issue and I figured out that by installing the cordova crosswalk webview plugin, there is no need to change the way to load the MathJax script.

Just run:

ionic plugin add cordova-plugin-crosswalk-webview

And you are good to go!!!

Upvotes: 0

christopher
christopher

Reputation: 520

In Android you have to reference a little different:

<script type="text/javascript" src="file:///android_asset/js/MathJax/MathJax.js"></script>

Notice that you can't add the config parameter, as it won't load correctly. You need to make configurations using:

<script type="text/x-mathjax-config">
...
</script>

More information on this post: http://cs.jsu.edu/wordpress/?p=498

Hope I could help

Upvotes: 8

Related Questions