Saturday, June 11, 2011

Latex for Bloggers: Problems & Solutions

A few days back a visitor commented that the my equations on this blog are not showing in Google Chrome. It turned out that it was not working in any browser, let alone Google Chrome. I checked out the java script and everything seemed OK. Then I surmised that one of the servers that the script refers to might be down. I checked out and found the following to be not working in the mathtex3.js:

http://www.cyberroadie.org/cgi-bin/mathtex.cgi?.

Now one of the solutions could be the replacement of the above server with a valid working server such as the following:

http://mathcache.appspot.com/

But I chose a more simpler solution.

The Solution
The solution was quite simple. I replaced the java script location

https://sites.google.com/site/onestopallsolutions/course-materials/mathtex3.js?attredirects=0&d=1

with the working server's address

http://mathcache.appspot.com/

in the java script for latex equations. The final script looked like as shown below:

<script src="http://mathcache.appspot.com/" type="text/javascript">
</script>
<script type="text/javascript">
onload = function () {
 var els = document.getElementsByTagName("div");
 var i = els.length;
 while (i--) {
  if (els[i].className=="latexparse") {
   replaceMath(els[i]);
  }
 }
};
</script>

And now the equations are showing once again.

Setting Up Java Script for Latex in Blogger
If you are wondering how to setup a java script for latex in blogger, then you should read the post Latex for Bloggers: Watchmath not Working . It explains setting up scripts for latex equations in details.


There you go. See you next post.


No comments:

Post a Comment

Follow Husnain_Inayat on Twitter View Husnain Inayat Hussain's LinkedIn profile