Skip to main content

LaTeX on Blogger

更新:
MathJax 在 2017/4/30 關閉了 CDN,並且提出了修改的方法。
(請參考:MathJax CDN shutting down on April 30, 2017. Alternatives available.)

新的 script 如下:

<script type="text/javascript" src="https://cdnjs.cloudflare.com/ajax/libs/mathjax/2.7.1/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> 

原來的文章接續如下:

畢氏定理:
$a^2 + b^2 = c^2$

LaTeX 的寫法:
$a^2 + b^2 = c^2$


一元二次方程式的解:

$ax^2 + bx + c = 0, a \neq 0$

$x = \frac{-b \pm \sqrt{b^2 - 4ac}}{2a}$

LaTeX 的寫法:
$ax^2 + bx + c = 0, a \neq 0$
$x = \frac{-b \pm \sqrt{b^2 - 4ac}}{2a}$




讓 Blogger 可以顯示 $\LaTeX$ 的算式,請參考討論串

How to use LaTeX on blogspot?

內 Matthew Leingang 的回答 (# 45)。

其操作是將下列的 script 插入到 Blogger template (html) 中,<head> 的後面,即可。

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

Comments