Sep 27, 2015

LaTex renders equations in blog using Mathjax script in template

LaTex is a high-resolution, postscript-savvy document formatting language. It specifically separates formatting from the content. It is particularly useful for rendering equations. To embed Latex in a web page or a blog, there is a javascript function called mathjax which makes this work. For Blogger (or another web site), add the following script inside the head tag of the page or design template.

<script type='text/x-mathjax-config'>   MathJax.Hub.Config({tex2jax: {inlineMath: [[&#39;$&#39;,&#39;$&#39;], [&#39;\\(&#39;,&#39;\\)&#39;]]}}); </script> <script src='http://cdn.mathjax.org/mathjax/latest/MathJax.js?config=TeX-AMS-MML_HTMLorMML' type='text/javascript'> </script>


Add the LaTex string in the body of the post. Surround the string by double dollar signs.
 EX1:  
$$y = 3.02 cos(\omega t + \theta)$$
$$y = 3.02 cos (\omega t + \theta)$$

EX2:
$$y = k _{0} + k_{1} \left[ \frac {\beta - 1}{ 2x + \alpha t} \right]$$

 $$y = k _{0} + k_{1} \left[ \frac {\beta - 1}{ 2x + \alpha t} \right]$$

You can use an online formatter gui such as this tool at codecogs.com to generate the expression. This site will generate the syntax for Latex, and render as html and as a graphic. Here is the same equation rendered in html. (it is slower to render, as it links to codecogs.)






.