peer - 6 months ago 86
Android Question

# 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>


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>