MimeTex for WordPress & bbPress

1.该插件已升级为Latex for WordPress。

2.Document (in English) are hosted at WordPress.org

2.1.Download

2.1.1.以下的中文文档只作参考,一切以英文文档为准

3.功能:

在文章内输入latex公式,将自动生成公式图片。图片的alt属性使得即使插件运行不正常(比如CGI服务器中断服务),也不会影响文章的可读性。

latex公式指左右各两个美元$符号所包含的部分。

下面是两个例子:

  1. 行内公式: \alpha+\beta\geq\gamma,源代码\(\alpha+\beta\geq\gamma\),类似于Latex中的
  2. 行间公式(独立一行,居中显示):

    \left\{\begin{array}{ccc}x_1+x_2&\leq&2\\x_1-x_2&\leq&3\\end{array}

    源代码:\(!\left\{\begin{array}{ccc}x_1+x_2&\leq&2\\x_1-x_2&\leq&3\end{array}\)在源代码前面添加!号即表示此公式为一个行间公式,独立一行显示,等价于Latex中的

  3. 如何显示源代码:要想显示latex源代码,不替换成图片怎么办?在公式的最后添加一个!号,比如要想直接显示\(1+1\neq2\),使用源代码\(1+1\neq2!\)。
  4. 要想显示2个$号怎么办?不好意思,现在还没有解决办法,请尽量避免这样做。你说你没事写2个$干吗呢。或者用$$这样的HTML字符写法。

4.插件是如何实现的?

  • 利用正则表达式查找文章中的数学公式
  • 查找此公式对应的公式图片是否存在,如果不存在,向MimeTex服务器请求图片,并缓存它。
  • 将数学公式替换成相应图片。

5.安装:

5.1.MimeTex for WordPress

  • 下载插件后上传到WordPress的插件目录。
  • 到管理员后台激活插件。
  • 在wp-content下新建cache文件夹,并赋予777权限。

5.2.MimeTex for bbPress

  • 察看你的bbPress根目录下是否有my-plugins目录,没有的话,新建它。
  • 下载MimeTex for bbPress,并上传到my-plugins目录下。
  • 察看你的bbPress根目录下是否有my-plugins目录,没有的话,新建它。赋予777的读写权限。

6.注意事项:

6.1.建立你自己的MimeTex服务

由于公用的MimeTex服务关掉了,现在插件里填写的是我能找到的公用服务器,随时有可能失效。请尽量使用自己的服务。

建立方法:到MimeTex首页下载源代码,按照它所给方法编辑,将编译后的mimetex.cgi文件放到你想要的文件夹,比如根目录的cgi-bin下,然后你便可以通过http://yourdomain/cgi-bin/mimetex.cgi?访问你的mimetex服务了。修改你的mimetex-plugin.php的$mimetex_server变量:

<?php
// change it to your server
$mimetex_server = "http://zhiqiang.org/cgi-bin/mimetex.cgi"
?>

你甚至不需要编译它,它的首页上直接提供编译好的版本下载:WindowsLinux (i386)FreeBSD (i386)NetBSD (i386)Sparc/Solaris8Alpha/VMSVAX/VMS

6.2.修改公式的tag:

这个插件默认的公式是两边各两个美元符号(与平时写latex文档一致),如果你喜欢的话,你也可以改成别的,到mimetex-plugin.php,修改$regex变量的值

<?php
// change it to
// $regex = '#

tex

(.*?)

/tex

#si';
// if you want [tex]your formula[/tex] stype in your post
$regex = '#\$\$(.*?)\$\$#si';
?>

6.3.图片式样

所有生成图片都拥有class="tex",你可以到你的css文件设置它的式样。

7.Change Log

7.1.version 2.0

  • 修改公式形式,与latex文档兼容。
  • 修改MimeTex服务器地址
  • 增加一层decode函数,处理"&"等特殊字符
关于 »
91条留言 -> 跳到留言表格
    41 old comments are not displayed. Click to display all comments
  • At 2009.07.12 11:10, watchmath said:

    Hi, instead of using ! to produce a display style can you modify the regex so that display style is render when using the standard [ ]?

    • At 2009.07.13 12:31, zhiqiang said:

      Sorry, but what's you meaning of standard?

      • At 2009.08.11 20:55, watchmath said:

        By standard mean using [ ] as in the latex original syntax.
        I modified your plugin so that it uses the usual latex $latex$ for the inline symbols and [latex] for the displayed one. If anyone interested, you can check the modified plugin features here:http://watchmath.com/vlog/?p=586
        and here for the installation: http://watchmath.com/vlog/?p=750

    • At 2009.07.17 17:33, seatop· said:

      您好,安装成功了,不过我的系统式bo-blog,有没有mimetex for bo-blog或需要对MimeTex for WordPress 作怎样的修改啊,好像插件格式不同啊,请帮帮忙!谢谢

      • At 2009.07.18 09:29, zhiqiang said:

        没用过bo-blog,也就没打算移植到bo-blog上。不过我想大致思路一样,你可以依样画葫芦自己写一个。

        • At 2009.07.18 21:20, seatop· said:

          谢谢,我写了个定义UBB代码插件,也方便使用了,只是没生成图片!

      • At 2009.07.18 21:26, seatop· said:

        我是传到服务器上编译才成功的

        • At 2009.07.24 12:14, zhu said:

          为什么我总是找不到你说的mimetex-plugin.php以及mimetex.php?

          • At 2009.07.24 14:13, zhu said:

            问题已经解决了,就是latex.php :-)

            • At 2009.07.26 22:53, Malloc said:

              测试一下largezeta (s)=sum_{n=1}^infty

              • At 2009.07.26 23:01, Malloc said:

                再试试
                largezeta (s)=sumlimits_{n=1}^infty frac{1}{n^s}

                • At 2009.07.27 09:53, Malloc said:

                  自建的cgi产生的图片无法显示,是什么原因捏?

                  • At 2009.07.27 22:47, Malloc said:

                    我也遇到同样问题了。如果你解决了这个问题,请告诉我。

                    • At 2009.09.13 10:15, chin said:

                      \left\{\begin{array}{ccc}x_1+x_2&\leq&2\\x_1-x_2&\leq&3\end{array}

                      • At 2009.09.13 10:32, c said:

                         \mathcal{H}_{\alpha, \beta}^{\frac{1}{2}}

                        • At 2009.09.27 13:42, chin said:

                          x+y=z

                          • At 2009.10.03 23:15, How to show latex formulas on your blog/webpage/wordpress – Cloudly's Blog said:

                            [...] we have a wordpress plugin Latex for WordPess ( MimeTex for wordpress & bbPress,from here ). After the installation, it will automatically convert latex codes into gif images and cache them [...]

                            • At 2009.10.03 23:18, 落园 » 如何在wordpress博客网页中显示latex公式|专注经济视角下的互联网 said:

                              [...] 不过上面的是不是有点麻烦呢?每次都要改链接。所幸已经有了wordpress插件,Latex for WordPess(MimeTex for wordpress & bbPress,来自阅微堂)。安装好后,他会自动请求服务器。哈哈,适用于我这种懒人。 [...]

                              • At 2009.10.28 17:38, dutor said:

                                如果多次反复编辑同一个公式的话,\LARGE \tilde{cache}里面就会有大量的无用图片,只好全部删除,再次打开页面时重新缓存。

                                • At 2009.11.23 03:23, Math on Web II « Ramblings and Musings said:

                                  [...] Few plugins for WordPress, I checked this one mimtex [...]

                                  • At 2010.01.21 23:11, robert said:

                                    let me try if it works well: $$! \alpha + \beta = \mu

                                    • At 2010.01.21 23:12, robert said:

                                      et me try if it works well:

                                       \alpha + \beta = \mu

                                      • At 2010.02.28 11:28, Hieu said:

                                        \(\)!{x^{\log }}{_2^3} + \,{x^{\log }}{_2^5}\, = \,{\log _2}{x^6}\, + \,2

                                        • At 2010.02.28 11:28, Hieu said:

                                          [tex]\alpha + \beta = \mu[/tex]

                                          • At 2010.03.07 01:37, Test $$e^pi$$ « Logic Engine said:

                                            [...] 这里介绍了如何在自己主机上用mimetex实现公式显示: http://zhiqiang.org/blog/plugin/mimetex [...]

                                            • At 2010.03.07 05:41, 几种WordPress的$$TeX$$ $$LaTeX$$公式插件比较 « Logic Engine said:

                                              [...] 这里介绍了如何在自己主机上用mimetex实现公式显示: http://zhiqiang.org/blog/plugin/mimetex [...]

                                              • At 2010.03.10 03:13, Laboratory » Comparison of several $$TeX$$ & $$LaTeX$$ plugins. said:

                                                [...] 这里介绍了如何在自己主机上用mimetex实现公式显示: http://zhiqiang.org/blog/plugin/mimetex [...]

                                                • At 2010.03.22 17:02, 在IXWebHositing主机上安装Mimetex实现在wordpress中使用latex输入数学公式 | 比特裁缝铺 1.0 said:

                                                  [...] 上述调用方式太不方便,阅微堂开发了一个插件,可以使用$符号做嵌入式输出,而且也可以灵活调用服务器(适合自己安装不了的人)。插件地址! [...]

                                                  • At 2010.03.27 22:34, 强!推荐使用LaTeX | 静心杨飞 said:

                                                    [...] 其实,我也是刚刚开始接触LaTeX。这是由于自己要在本博客上写的一些博文需要输入数学公式,而后台又不直接支持输入公式,又觉得把公式图片上传到博客很麻烦。于是,自己通过Google发现有多种可以解决在后台输入公式的方法。自己最终按照阅微堂提供的方法成功地安装解决了。在这过程中,自己又发现LaTeX非常强大。自己又下了CTeX来研究一下。超值! [...]

                                                    • [...]   你有独立Blog吗?你使用Wordpress吗?你经常需要在文章中插入数学公式吗?如果你的回答是肯定的,那么这篇文章就是写给你的。   先前,我一直使用zhiqiang的一款流行的插件LaTeX for WordPress。这款插件使用LaTeX语法,和Wordpress提供的mimeTeX服务,为数学公式生成图片,缓存在博客程序所在主机上。每次访问页面,如果缓冲文件夹中没有所请求的公式图片,就会向远程服务器发出请求,从而生成图片,否则就直接使用缓冲文件夹已经生成的图片。关于这款插件的使用方法见zhiqiang(阅微堂)的这篇文章。 [...]

                                                      • At 2010.06.21 10:13, Bcnof said:

                                                        请问能否使LaTeX for WordPress 生成的图片背景色为透明?

                                                        • At 2010.08.02 02:10, Robert said:

                                                          Thank you for the plug-in but we have a huge differences, in my page http://ansus.comeze.com/ I have a blurred image that is very different that you have. The other problem that I have is that I pasted the same code that you have and I din't have nothing. I don't know If you can help me but I will be very glad if it is...Thank you in advance.
                                                          Sorry for my bad English

                                                          • [...] 这里介绍了如何在自己主机上用mimetex实现公式显示: http://zhiqiang.org/blog/plugin/mimetex [...]

                                                            • At 2010.08.20 05:31, 荒唐的世界 said:

                                                              [...] 这里介绍了如何在自己主机上用mimetex实现公式显示: http://zhiqiang.org/blog/plugin/mimetex [...]

                                                              • At 2010.11.12 18:17, ren said:

                                                                博主开发的这个LaTeX插件确实很好用,但是自己下载mimeTex编译成CGI文件渲染出来的公式稍显粗糙。阅微堂上的公式挺清晰的,不知用的是公用的mimeTex服务器还是自己编译的?另外MathJax也挺不错的,公式显示效果很好,就是稍微有点卡。

                                                                • At 2011.01.11 23:38, abrahamx said:

                                                                  sum_{n=1}^{100}f(n)
                                                                  怎么不行呢

                                                                  • At 2011.01.11 23:39, abrahamx said:

                                                                    $sum_{n=1}^{100}f(n)$
                                                                    再试试

                                                                    • At 2011.01.11 23:39, abrahamx said:

                                                                      sum_{n=1}^{100}f(n)
                                                                      继续!

                                                                      • At 2011.01.11 23:40, abrahamx said:

                                                                        哈哈!终于成功了!
                                                                        sum_{n=1}^{100}f(n)
                                                                        $sum_{n=1}^{100}f(n)$

                                                                        • At 2011.01.12 01:10, abrahamx said:

                                                                          我的也搞好了,欢迎来看看:
                                                                          abrahamgx.com

                                                                          • At 2011.01.12 21:49, abrahamx said:

                                                                            我有个问题,就是在wordpress里面发布文章的时候,如果文章里面含有源代码,比如我要发布一段matlab程序,怎么让源代码漂亮的显示出来呢?

                                                                            • At 2011.02.09 23:00, like said:

                                                                              我空间中的cgi-bin在浏览器中禁止访问:
                                                                              You don't have permission to access /cgi-bin/mimetex.cgi on this server..
                                                                              cgi-bin以及mimetex.cgi的权限我都改成777了,请问应该怎么办?

                                                                            • At 2011.03.16 08:33, zjch said:

                                                                              \left\{\begin{array}{ccc}x_1+x_2&\leq&2\\x_1-x_2&\leq&3\end{array}

                                                                              试试看

                                                                              • At 2011.03.16 08:39, zjch said:

                                                                                博主我安装了Latex for WordPress启用插件后还是不行,是什么问题啊?

                                                                                • At 2011.03.16 09:18, zhiqiang said:

                                                                                  你这个给的信息太少。

                                                                                  不过我一直想着给Latex for WordPress升级,最近我自己用的时候增加了很多新功能,包括对MathJax的支持,到时候一块儿加进去。

                                                                                • At 2011.03.16 09:29, zhiqiang said:

                                                                                  \frac{e^{\alpha+\beta_1X_1+\beta_2X_2+\beta_{12}X_1X_2}(\beta_2+\beta_{12}X_1)}{(1+e^{\alpha+\beta_1X_1+\beta_2X_2+\beta_{12}X_1X_2})^2}

                                                                                  • At 2011.11.29 15:07, Fractal said:

                                                                                    怎么只显示图片?\sum_{n=1}^{100}{n}=5050

                                                                                    • At 2011.12.30 22:38, van abel said:

                                                                                      Can I use Latex command, such as \title{Document title} \author{van abel} \section{This is the first section} and \newcommand{\\rd}{\mathrm d} \int_a^b f(x)\rd x.
                                                                                      测试下? 希望能支持排版命令, 而非只是数学命令.

                                                                                      41 old comments are not displayed. Click to display all comments

                                                                                      (Required)
                                                                                      (Required, not published)

                                                                                        B | I | U | D | 添加链接 | 插入引用 | 插入代码 | 插入表情 | | + | ?

                                                                                      guest | 注册 | 管理

                                                                                      阅微堂

                                                                                      理工科背景的证券从业人员
                                                                                      Loading...
                                                                                      Loading...
                                                                                      Loading...