wordpress上安裝MathJax

MathJax是什麼?

MathJax是一個JavaScript,用於在博客或其他html頁面上渲染Latex、MathML的工具,由服務器端提供,可以在網頁上顯示公式。

1,安裝MathJax,需要在本地安裝MathJax的Javascript,以及wordpress裏面的MathJax插件

MathJax-LaTeX

This plugin enables MathJax (http://www.mathjax.org) functionality for WordPress. Version 1.0 is compatible with MathJax 1.1 and the CDN.

Download Version 1.0

  1. Unzip the downloaded .zip archive to the /wp-content/plugins/ directory
  2. Download the MathJax Javascript library (http://www.mathjax.org/download/)
  3. Place the Javascript library in the mathjax-latex directory (/wp-content/plugins/mathjax-latex/MathJax)
  4. Activate the plugin through the 'Plugins' menu in WordPress
  5. You can configure the plugin to load MathJax from a different URL to the default. See the options page.
  6. Alternatively you can use the MathJax Content Distribution Network (http://www.mathjax.org/docs/1.1/start.html#mathjax-cdn) to deliver the Javascript, just tick the relevant box on the options page.
2,設置MathJax

要支持公式的引用需要修改MathJax的設置,參考http://zhiqiang.org/blog/it/mathjax-make-mathematics-beautiful.html

<script type="text/x-mathjax-config">
    MathJax.Hub.Config({
        TeX: {equationNumbers: {autoNumber: ["AMS"], useLabelIds: true}},
        "HTML-CSS": {linebreaks: {automatic: true}},
        SVG: {linebreaks: {automatic: true}}
    });
</script>

如何修改,參考http://www.mathjax.org/docs/2.0/platforms/index.html

3,wordpress中使用MathJax

顯示效果,可以採用完全Latex的寫法寫下面的公式1

\begin{equation}\label{eq1}r = r_F+ \beta (r_M - r_F) + \epsilon\end{equation}

得到:

r=rF+β(rMrF)+ϵ(1)


發佈了135 篇原創文章 · 獲贊 12 · 訪問量 111萬+
發表評論
所有評論
還沒有人評論,想成為第一個評論的人麼? 請在上方評論欄輸入並且點擊發布.
相關文章