在寫Matlab筆記時,其中要輸入一些公式。若是用截圖,上傳圖片到博客中,會由於截的圖大小不一很難看,並且圖片數據很大,很不科學,這有點麻煩!javascript
so,我google搜索下解決方法和資源,整理以下:php
首先確定是解決如何在博客中插入公式:
1,在博客設置中,html頭中添加代碼,導入mathML庫如: <script type="text/javascript" src="http://common.cnblogs.com/script/ASCIIMathML.js"></script>html
而後直接在博客中(不是html)書寫latex語法公式,公式先後有$ \$ $ 來包圍住,例如$\$$\frac{{-b}\pm\sqrt{b^2-4ac}}{2a}$\$$,就會顯示:java
$ \frac{{-b}\pm\sqrt{b^2-4ac}}{2a} $ web
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代碼:
一、會寫LaTex的
二、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.
三、在線數學公式輸入google
網址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是經過鼠標畫而生成公式的,識別比較準確,但對於多行的方程組很差用,單行公式的輸入最佳。