2005年4月06日 18:43
前些日子,在登陸GNU網站時,發現一個不錯的軟件—l2p。它是LaTeX to PNG的縮寫,可以以簡單的方式生成所需要的數學公式的圖片形式。如
生成此图命令是:
l2p -T -i '$\varepsilon(\lambda,T)=\frac{2\pi\nu^2}{c^2}
\frac{h\nu}{e^{\frac{h\nu}{kT}}-1}$' -o plank.png
l2p是用Perl寫的小程序,代碼有500多行,15KB的大小。
安裝:下載安裝文件l2p-latest.zip,解壓後將l2p複製到你的可執行文件的目錄如/usr/local/bin中即可使用。
注意:安裝此程序的必備條件是你的系統中已經正確安裝了TeX系統,不過一般的Linux系統都已經默認安裝了TeX系統。另外還有libpng、Perl也都是必須的。
詳細的用法如下:
usage:
l2p [options] [latex_code_file]
or
l2p [options] -i '$LaTeX-expression$'
Options:
-o output.png Name of output file. Default is 'eqn.png'
-i '$latex$' equation/expression in (La)TeX format
-f 'rrggbb' foreground color
-b 'rrggbb' background color
-d dpi Conversion resolution (default 300)
-T Transparent background
-C Suppress removal (cleanup) of temporary files
-F Input is full LaTeX document, not just fragment
-h Show this help and exit
Also see the full documentation (try typing 'perldoc l2p').
一般使用就是
l2p -i '$latex公式$' -o output.png
其他常用的參數有:
-T 底色透明;
-f 'RRGGBB' 設置前景色;
-b 'RRGGBB' 設置背景色;
-d dpi 設置解析度(默認300dpi);
-F 可以從一個LaTeX檔中載入代碼。
有興趣的可以試試這個小軟件。