Translate

Showing posts with label blogger. Show all posts
Showing posts with label blogger. Show all posts

How to add code block in blogger

Use the following code to add code block in blogger:

<pre class="prettyprint">source code here</pre>

Example: 

def test(a, b):
    return a + b


ref: https://kkyard.blogspot.com/

How to add LATEX Mathematical formula on blogger

  1. change to HTML mode
  2. add the follow code at the top
  3. save it

<script type="text/javascript" src="http://cdn.mathjax.org/mathjax/latest/MathJax.js">
MathJax.Hub.Config({
 extensions: ["tex2jax.js","TeX/AMSmath.js","TeX/AMSsymbols.js"],
 jax: ["input/TeX", "output/HTML-CSS"],
 tex2jax: {
     inlineMath: [ ['$','$'], ["\\(","\\)"] ],
     displayMath: [ ['$$','$$'], ["\\[","\\]"] ],
 },
 "HTML-CSS": { availableFonts: ["TeX"] }
});
</script>

  • use dollar when you want to add it within a line like $\vec{A}$
  • use double dollar if you want to let the formula in a single line like $$\cos\theta=1$$


ref: https://2formosa.blogspot.com/2016/07/equations-in-blogspot.html