日期:2014-05-17  浏览次数:20540 次

用Emacs MUSE生成HTML报告时包含数学公式

需求如题,现在首先明白,最新版本的emacs自带了muse-latex2png.el文件。该程序会将latex转换成png,然后显示在html图片上。

在~/.emacs中添加:

(require 'muse-latex2png)
但是以来另一个程序转成png,在Ubuntu下安装:

apt-get install dvipng

好了,打开Muse文档,输入如下标记:

<latex>
\[
E = mc^2
\]
</latex>

会显示:



觉得生成的公式图片太大了?可以在~/.emacs中设置变量muse-latex2png-scale-factor的值。

(custom-set-variables
  ;; custom-set-variables was added by Custom.
  ;; If you edit it by hand, you could mess it up, so be careful.
  ;; Your init file should contain only one such instance.
  ;; If there is more than one, they won't work right.

 '(muse-latex2png-scale-factor 1.2))
(custom-set-faces
  ;; custom-set-faces was added by Custom.
  ;; If you edit it by hand, you could mess it up, so be careful.
  ;; Your init file should contain only one such instance.
  ;; If there is more than one, they won't work right.
 )



参考这篇文章,有一些选项设置可借鉴。

http://lifegoo.pluskid.org/wiki/MuseLatex2Png.html