PhpMathPublisherとは
Web上で数式が作成できるマクロです。次のような数式が簡単に作成できます。
PhpMathPublisherの特長
- PHPとそのGDライブラリ、いくつかのフォントがあればPhpMathPublisherを利用できます。
- サーバー側にLatexプログラムなどは不要です。
- 数式はPHPスクリプトによって画像に変換されて表示されます。
- クライアント(ブラウザ)側にはフォントやプラグインの導入は不要です。
詳細についてはPhpMathPublisherのサイトを参照してください。 数式作成のデモを見ることができます。
サンプルはこんな感じになります。
PhpMathPublisherの導入
ダウンロード
まずはダウンロードします。
phpmathpublisher-0.3.tar.gz ファイルをダウンロード
解凍
適当なディレクトリ(./hogehoge)にアップロード後に解凍します。
%cd hogehoge
%gunzip -d phpmathpublisher-0.3.tar.gz
%tar xvzf phpmathpublisher-0.3.tar
x phpmathpublisher/
:
%
解凍すると、phpmathpublisherディレクトリ配下に「mathpublisher.php」ができるので、 フォントを格納するディレクトリとイメージを格納するディレクトリを指定します。
// absolute path to the fonts directory
$dirfonts=$_SERVER["DOCUMENT_ROOT"]."/phpmathpublisher/fonts";
// or $dirfonts=dirname(__FILE__)."/phpmathpublisher/fonts";
// absolute path to the images directory
$dirimg=$_SERVER["DOCUMENT_ROOT"]."/phpmathpublisher/img";
// or $dirimg=dirname(__FILE__)."/phpmathpublisher/img";
PhpMathPublisherの利用