博客中插入公式——之在线数学公式生成

在写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得到的代码:
[plain] view plaincopy
 
 
  1. % MathType!MTEF!2!1!+-  
  2. % feaaguart1ev2aaatCvAUfeBSjuyZL2yd9gzLbvyNv2CaerbuLwBLn  
  3. % hiov2DGi1BTfMBaeXatLxBI9gBaerbd9wDYLwzYbItLDharqqtubsr  
  4. % 4rNCHbWexLMBbXgBd9gzLbvyNv2CaeHbl7mZLdGeaGqiVu0Je9sqqr  
  5. % pepC0xbbL8F4rqqrFfpeea0xe9Lq-Jc9vqaqpepm0xbba9pwe9Q8fs  
  6. % 0-yqaqpepae9pg0FirpepeKkFr0xfr-xfr-xb9adbaqaaeGaciGaai  
  7. % aabeqaamaabaabauaakeaadaGabaabaeqabaGaamyyaiabgUcaRiaa  
  8. % dkgacqGHRaWkcaWG4bGaeyypa0JaaG4maiaadMhaaeaacaWGHbGaam  
  9. % iEaiabgkHiTiaadkgacaWG5bGaeyypa0JaaGymaaqaaiaadggacaWG  
  10. % IbGaey4kaSIaamiEaiaadMhacqGH9aqpcaaIYaaabaGaamyyaiabgU  
  11. % caRiaadkgacqGH9aqpcaGGOaGaamiEaiabgUcaRiaadMhacaGGPaWa  
  12. % aWbaaSqabeaacaaIYaaaaaaakiaawUhaaaaa!5D4F!  
  13. \[\left\{ \begin{gathered}  
  14.   a + b + x = 3y \hfill \\  
  15.   ax - by = 1 \hfill \\  
  16.   ab + xy = 2 \hfill \\  
  17.   a + b = {(x + y)^2} \hfill \\   
  18. \end{gathered}  \right.\]  
只要把
[plain] view plaincopy
 
 
  1. \[\left\{ \begin{gathered}  
  2.   a + b + x = 3y \hfill \\  
  3.   ax - by = 1 \hfill \\  
  4.   ab + xy = 2 \hfill \\  
  5.   a + b = {(x + y)^2} \hfill \\   
  6. \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是通过鼠标画而生成公式的,识别比较准确,但对于多行的方程组不好用,单行公式的输入最佳。
posted @ 2014-03-28 08:58  二郎那个三郎  阅读(7844)  评论(0编辑  收藏  举报