## Thursday, 4 April 2019

### How to add Latex to blog

In this post, we will see how to add latex to blog. We can create blog by using blogger or wordpress. In this post, I have shown with blogger. Similar procedure, you can follow for wordpress blog.

What is the need of Latex in blog?
Latex is mostly required to write mathematical expressions. For e.g. Square root of 5, alpha, beta. This is not possible in our regular blogs.

To write following expressions in our blog, is almost impossible.

In this post, I will tell you how to achieve this.

How to write Latex code in blog?
An online library for latex code is provided by mathjax.org. We need to link it to our blog. To do it, follow the following procedure:

1. If you are using blogger.com for your blog, then go to Theme -> Edit HTML

3. Copy the following code.
<script src='http://cdn.mathjax.org/mathjax/latest/MathJax.js' type='text/javascript'>

MathJax.Hub.Config({

extensions: [&quot;tex2jax.js&quot;,&quot;TeX/AMSmath.js&quot;,&quot;TeX/AMSsymbols.js&quot;],

jax: [&quot;input/TeX&quot;, &quot;output/HTML-CSS&quot;],

tex2jax: {

inlineMath: [ [&#39;$&#39;,&#39;$&#39;], [&quot;\$$&quot;,&quot;\$$&quot;] ],

displayMath: [ [&#39;$$&#39;,&#39;$$&#39;], [&quot;\$&quot;,&quot;\$&quot;] ],

},

&quot;HTML-CSS&quot;: { availableFonts: [&quot;TeX&quot;] }

});

</script>



5. Then create New Post or open the existing post where you want to use latex symbol. You require latex code for mathematical expressions. e.g. \alpha, \beta. Enclose them in between 
e.g.
 $latex code$.

6. You will find mathematical symbols/expressions on your blog/website when you open it on browser.

7. You can try following latex code:

$2+\sqrt 5$

$a^{-i}$

$\alpha$

$\beta$

$\displaystyle\sum_{n=1}^{10} n^{2}$   


You can use this technique on your wordpress blog or your website. If you like it, please put an comment in comment section.

Thanks a lot.