在寫Matlab筆記時,其中要輸入一些公式。如果用截圖,上傳圖片到博客中,會因為截的圖大小不一很難看,而且圖片數據很大,很不科學,這有點麻煩!
so,我google搜索下解決方法和資源,整理如下:
首先肯定是解決如何在博客中插入公式:
1,在博客設置中,html頭中添加代碼,導入mathML庫如: <script type="text/javascript" src="http://common.cnblogs.com/script/ASCIIMathML.js"></script>
然后直接在博客中(不是html)書寫latex語法公式,公式前后有$ \$ $ 來包圍住,例如$\$$\frac{{-b}\pm\sqrt{b^2-4ac}}{2a}$\$$,就會顯示:
$ \frac{{-b}\pm\sqrt{b^2-4ac}}{2a} $
2,或者直接在html中添加:<img src="http://latex.codecogs.com/gif.latex?在這里填寫你的latex代碼" />
例如:<img src="http://latex.codecogs.com/gif.latex?35*d_5+1(\oe%20)" />
參考文獻:HZAU_追風少年的博客
現在最主要的是要得到公式的LaTex代碼:
1、會寫LaTex的
就相對比較容易了:
這里有相應的網站看代碼生成公式的效果。
2、MathType to LaTex
以前熟悉MathType的使用,在想MathType能不能生成LaTex代碼,沒想到果然有
具體步驟:
在 Mathtype 的 Preference(參數) 中,選 Translator(轉換),會出來一個對話框,然后選 Translation to other language (text),里面就有 Tex-AMS-LaTex 等選項。設定好之后就可以直接選中部分公式,Ctrl+C 復制,然后再粘貼到文本中就直接看到代碼了。可以把代碼貼到這里有相應的網站看代碼生成公式的效果。查看效果。

MathType 中Ctrl+C得到的代碼:
- % MathType!MTEF!2!1!+-
- % feaaguart1ev2aaatCvAUfeBSjuyZL2yd9gzLbvyNv2CaerbuLwBLn
- % hiov2DGi1BTfMBaeXatLxBI9gBaerbd9wDYLwzYbItLDharqqtubsr
- % 4rNCHbWexLMBbXgBd9gzLbvyNv2CaeHbl7mZLdGeaGqiVu0Je9sqqr
- % pepC0xbbL8F4rqqrFfpeea0xe9Lq-Jc9vqaqpepm0xbba9pwe9Q8fs
- % 0-yqaqpepae9pg0FirpepeKkFr0xfr-xfr-xb9adbaqaaeGaciGaai
- % aabeqaamaabaabauaakeaadaGabaabaeqabaGaamyyaiabgUcaRiaa
- % dkgacqGHRaWkcaWG4bGaeyypa0JaaG4maiaadMhaaeaacaWGHbGaam
- % iEaiabgkHiTiaadkgacaWG5bGaeyypa0JaaGymaaqaaiaadggacaWG
- % IbGaey4kaSIaamiEaiaadMhacqGH9aqpcaaIYaaabaGaamyyaiabgU
- % caRiaadkgacqGH9aqpcaGGOaGaamiEaiabgUcaRiaadMhacaGGPaWa
- % aWbaaSqabeaacaaIYaaaaaaakiaawUhaaaaa!5D4F!
- \[\left\{ \begin{gathered}
- a + b + x = 3y \hfill \\
- ax - by = 1 \hfill \\
- ab + xy = 2 \hfill \\
- a + b = {(x + y)^2} \hfill \\
- \end{gathered} \right.\]
- \[\left\{ \begin{gathered}
- a + b + x = 3y \hfill \\
- ax - by = 1 \hfill \\
- ab + xy = 2 \hfill \\
- a + b = {(x + y)^2} \hfill \\
- \end{gathered} \right.\]
加入到 <img src="http://latex.codecogs.com/gif.latex? 在這里填寫你的latex代碼 " /> 紅色字體當中
注意:代碼中有空格的地方一律用%20替代,因為網址中%20就代表空格;
最終的網址是 http://latex.codecogs.com/gif.latex?\left\{%20\begin{gathered}%20a%20+%20b%20+%20x%20=%203y%20\hfill%20\\%20ax%20-%20by%20=%201%20\hfill%20\\%20ab%20+%20xy%20=%202%20\hfill%20\\%20a%20+%20b%20=%20{(x%20+%20y)^2}%20\hfill%20\\%20\end{gathered}%20\right.
3、在線數學公式輸入
網址1:http://codecogs.com/latex/eqneditor.php
網址2:http://www.numberempire.com/texequationeditor/equationeditor.php
網址3:http://webdemo.visionobjects.com/equation.html?locale=zh_CN
注意:網址3是通過鼠標畫而生成公式的,識別比較准確,但對於多行的方程組不好用,單行公式的輸入最佳。