Writing a Mathematical Equation on Your Blog

In fact it is quite rare for a blog writer to put some mathematical models on the blog unless it is an article related to some very professional courses. However, low propability can hardly mean never happen. Taking myself for example, I would like to post some of my notes on econometrics and my feeling of research proposal with the blog readers, though I can write them with a Latex system and then compile it to a PDF document, providing it as an attachment for download. While I don’t think most readers would prefer such behavior. Reading that directly can be a much more pleasant experience, especially when there is not many complicated equations.

Thanks to the flexibility of the WordPress system and its countless expanded plug-ins, the solution for this can be quite simple. The only thing you are willing to do is to be familiar with the LaTex syntax, which, under most occasions, would not be a big problem for most users who are willing to do so. Even though you are unlikely to type the raw code, Mathtype can help you transfer the equation. The only work thus left for you is copy and paste.

Taking a search at WordPress.org, with the keyword of ‘latex’, you are likely to find the following plug-ins.

  1. Some Plug-ins for WordPress

    Among the plug-ins that are available, I made an attempt for the following ones on my blog. Here is a summary about each of them. For details, you can refer to their websites.

    1. WP Latex

      This is an official plug-ins for Latex from WordPress.com, with its default service based on wordpress.com. No cache is needed. You can freely change its style through the css file in settings. The only problem is that its original server ‘s.wordpress.com’ is forbidden in China, you have to change it to ‘wordpress.com’ to make it work. Besides, you can also set up your own service, but I wonder if it can violate the regulation from the host.

    2. Easy Latex

      Comparing to the official plug-ins, this one offer more flexible features. Besides the colors, you can also freely change its size directly through its GUI. Cache option is provided so that the readers can stil read the equations on your blog even when the latex service is out of work.

    3. Youngwhan’s Simple Latex

      This is the simplest plug-ins for use among the three. No other option is presented besides the address of the latex service. The service for this plugin, unlike WP Latex and Easy Latex, is provided by some open source project. Though it is convenient to set up, its flexibility is a question.

  2. My Choice

    I finally choose the official plug-ins with the consideration of the limitation of file numbers on my server. And there is no free CGI support. Which means, I can hardly construct my own system and can hardly bear too many cache files. For those whose server can support CGI, a self-constructed system should be preferred considering its stability.

  3. An Example

    As a final, I shall present an example. This is a measurement of likelihood that is common to see in econometrics.

    [latex size=2]{{R}^{2}}=\frac{SSE}{SST}=\frac{{{\left( \sum\limits_{i=1}^{n}{\left( {{y}_{i}}-\bar{y} \right)\left( {{{\hat{y}}}_{i}}-\bar{\hat{y}} \right)} \right)}^{2}}}{\left( \sum\limits_{i=1}^{n}{{{\left( {{y}_{i}}-\bar{y} \right)}^{2}}} \right)\left( \sum\limits_{i=1}^{n}{{{\left( {{{\hat{y}}}_{i}}-\bar{\hat{y}} \right)}^{2}}} \right)}[/latex]

    Where [latex]y[/latex] stands for the real value and [latex]\hat{y}[/latex] stands for the estimated value from a regression model like:

    [latex]y=\alpha_0+\alpha_1*x_1+\alpha_2*x_2+\alpha_3*x_3+\cdots+\alpha_n*x_n, n\in {{Z}^{+}}[/latex]

    The only problem left here is: how to adjust the alignments? I want them to be centered, but not left-aligned.

LYX: A New Written Instrument

经过几天的奋斗,终于完成了研究计划的初稿。12页的英文写作果然不是闹着玩的。累的我差点小命送掉。不过这次我也得到了一个教训,那就是,只有自己熟悉的东西才能做好,永远不要轻易去尝试你所不了解的事情。不过首当其冲要感谢的,则是我在Linux下新伙伴,LYX。这个系统同时给了我LATEX系统的便捷,也让我享受到了可视化编辑的乐趣。我之所以喜欢LATEX,是因为在我结束了最后一个字符的同时,我的文本排版也在倾刻间完成了。这是Word系统远远不能比拟的。

我不知道现在新版本的LYX是否支持了JabRef的管道功能。至少在我于Windows系统上使用LYX 1.5的时候,该项功能是不支持的。在LYX中输入参考文献的唯一方法是直接在系统自带的BiBTEX中跟据Key来寻找。这是一个非常费力而且容易出错的工作。尤其是对于我这样的习惯Endnote的人而言,不能从文献管理工具直接插入Citation,而是需要如此的手工操作直接就是一场噩梦。另外,如Bill所言,Java在Linux下的执行效率相当高,这也为我电脑上流畅运行JabRef提供了保证。

说到JabRef,我不得不同时提到另一个工具。该工具是Firefox下的插件,叫做Zotero。这个插件可以非常高效从Google Scholar,JSTOR等数据库中快速提取Reference,并且记录。此类技术,比较Endnote的导入工作,显得更进了一步。当然,不可否认,Endnote可以使用大部分英文数据库的Direct Export。这也是非常有吸引力的。

最后要提到的Bibtex的自动生成Reference。不知道为什么,我总觉得BiBtex显示的效果要比Endnote要漂亮。Lyx还有一个很人性化的功能。就是你在插入Citation的同时,可以选择显示方法,比如王小二(2009)要改成(王小二,2009)。这点比Endnote需要手工修改来的容易的多。

总而言之,我觉得Ubuntu+Lyx+Zotero是一个不错的选择,绝对不亚于Windows+Word+Endnote。有兴趣的朋友可以去试试看哦。

Linux: My New Working System

对于大多数会计专业的学生而言,Linux应该是一个陌生的名词。事实上,这是一个基于UNIX构架的个人版系统。它的计算性能非常优秀。著名的Matlab,Mathematica等工具在Linux环境下都有着远胜于Windows平台的表现。而科研写作工具Latex的配置也比windows下高效和便捷的多。只是由于我们的研究很少使用这类“高级”工具,而且中文论文也必须使用Word文档来投稿,这个好东西自然就入不了大多数人的法眼了。

其实我知道Linux差不多已经有十多年了,第一次使用发行版是在迅达的家中。当时我们对Linux都有着一种神奇的向往,而他当时也有个人电脑可以用来尝鲜。记得当时市场上有卖Redhat的套装,78元,一个大盒子,10张光盘。只是当时作为高中生的我们,78元的价格还是略显太贵,最后他选择了Fedoral,版本号记不得了。当时第一次看到这个系统的感觉就是新奇,但是我却死活想不出来这个系统可以用来干吗。更多的,在当时56K 的时代,网络下载软件还是一种奢侈行为的年代,使用Linux是属于典型“折腾”行为。毕竟我们没有使用它来替代Windows的足够好的理由。

在我有了个人电脑的时候,Linux的世界已经发生了翻天覆地的变化。Redhat似乎已经不再做桌面系统,而是直接将其交给了社区来管理,fedoral倒是依然健在,不过似乎也是社区发行版,网上有了足够多的Linux社区,讨论版和个人博客。市场上似乎也很少看到盒装发行版。更多的Linux则是直接从网络上下载。Linux下的软件也丰富了很多。更方便的是,使用Linux几乎不会遇到版权方面的问题,毕竟这个平台下的大多数软件都是开源的。(当然,使用Matlab的话,我目前还只能继续盗版,毕竟正版价格对我来说还是个天文数字。期间我第一次接触了Ubuntu,当时是7.04,直到今天我还记得其中有一段曼德拉的关于世界和平的讲话。

这次使用Ubuntu 9.10,则是我第一次真正的把系统用于工作环境。因为在此系统下使用和安装Lyx(一个Latex的前端,免除了写大量代码的麻烦)都很方便,系统会根据其依赖(Dependence )自动安装所需要的package,这点比Windows 要方便了很多。当然,出于偷懒,我只是使用了系统自带的channel来安装了软件,却没有去从外部源安装。事实上,使用lyx写作省去了我大量的排版工作,只是,我现在还不知道怎么去使用中文,我尝试了xetex,却似乎有错误。xecjk无法正确加载。好在我目前写的几乎都是英文。

至于即时通讯,Pidgin作了个很好的典范,ibus提供的输入法尽管没有网络更新,但是却也很好用。一点儿也不逊于Windows下的Google 拼音。总而言之,这是个非常适合研究人员来用的平台。

PS :我现在使用的是BLOGTK 来写作的,但是这个编辑器不支持直接离线插入图片,搞得有点像当年学Cdida时候的HTML编辑器。有什么好的编辑器推荐下阿。

Junjun's Home