mathTeX
mathTeXのインストール
予めlatexとdvipngをaptitudeなどを使ってインストールしておく。
次に
$ wget http://www.forkosh.com/mathtex.zip $ unzip mathtex.zip $ gcc mathtex.c –DLATEX=\"$(which latex)\" \ –DDVIPNG=\"$(which dvipng)\" \ –o mathtex.cgi
としてmathtex.cgiを作成。
後はmathtex.cgiをcgi-binとかの下に置けばOK。ただし、ディレクトリにwrite権限を立てとかないとうまく動かないので注意。
PukiWikiから使用する
次の内容のファイルを作成して、pluginフォルダの中に入れておく。
MATHTEX_PATHは各自の環境にあわせて変更してね。
- mathtex.inc.php
<?php // // mathtex.inc.php -- mathTeX plugin for pukiwiki // define('MATHTEX_PATH', '/cgi-bin/tex/mathtex.cgi'); function plugin_mathtex_inline() { $args = func_get_args(); $args = join($args, ' '); $args = preg_replace('/^\s+', '', $args); $args = preg_replace('/\s+$/', '', $args); $url = MATHTEX_PATH . '?' . $args; return "<img src=\"$url\" alt=\"$args\" />"; } ?>