mimetex.inc.php
Last Modified. 01/03/2007
Display Math Equations using mimetex.cgi
Table of Contents |
Abstract
This plugin shows images of TeX style math equation using mimetex. In principal, this just returns img tag which calls mimetex.cgi, but this has a cache functionality also.
Please see original site mimetex.html about what you can do with mimetex.
How to use and examples
&mimetex( \sqrt{x^2+y^2} = z );
#mimetex( \sqrt{x^2+y^2} = z )
In block type, it centerizes automatically.

You can use multiline block plugin style, too.
#mimetex(){{ e^{i \theta} = \cos \theta + i \, \sin \theta\\ e^{\pi i} + 1 = 0 }}

設定
Installation of mimetex
I will omit. Please refer the mimetex original site, http://www.forkosh.com/mimetex.html.
PukiWiki 設定
プラグインで複数行引数を使えるようにしておきます。PukiWiki を 1.4.6 以上にアップデートしてください。
pukiwiki.ini.php
-define('PKWKEXP_DISABLE_MULTILINE_PLUGIN_HACK', 1); // 1 = Disabled +define('PKWKEXP_DISABLE_MULTILINE_PLUGIN_HACK', 0); // 1 = Disabled
Plugin Configuration
Open mimetex.inc.php and modify.
defined('MIMETEX_PATH') or define('MIMETEX_PATH', 'http://www.forkosh.dreamhost.com/cgi-bin/mimetex.cgi'); defined('MIMETEX_CACHE') or define('MIMETEX_CACHE', 1); // 1: Use Cache Function defined('MIMETEX_CACHE_DIR') or define('MIMETEX_CACHE_DIR', CACHE_DIR); defined('MIMETEX_CACHE_URI') or define('MIMETEX_CACHE_URI', CACHE_DIR); defined('MIMETEX_CACHE_POSTFIX') or define('MIMETEX_CACHE_POSTFIX', '.mimetex.gif');
MIMETEX_PATH is the url of mimetex.cgi.
The original site is preparing http://www.forkosh.com/mimetex.cgi for testing purpose, so this plugin will use it on default settings.
Change this url after installing mimetex.cgi on your server.
ヒント:設定を別ファイルに分離しておけます。プラグインアップデートの際に楽です。 plugin ディレクトリなどと同階層に init ディレクトリを作成、そのディレクトリに以下のファイルを保存し、編集してください。(Pukiwiki Plus! i18n の場合は init ディレクトリがデフォルトで存在するはずです。)
Access to cache image
This plugin uses cache functionality as default. Cache images are stored in cache directory as cache/md5(mathequation).mimetex.gif.
Please modify cache/.htaccess to enable to access the cache files via http. It is not necessary in the case of pukiwiki plus because this is the default setting.
Order allow,deny Deny from all <Files ~ "\.(gif|jpg|png)$"> Allow from all </Files>
FAQ
$ $ で数式を書きたい
Hack/convwiki_rules を適用し、rules.ini.php に
$convwiki_rules = array( '^\$\$ (.+) \$\$$' => '#mimetex($1)', '\$ ([^$]+) \$' => '&mimetex($1);', );
のように追加します。これで
$$ x $$ this is $ a $ pen.
のように記述することで
#mimetex(x) this is &mimetex(a); pen.
と記述するのと同じことになります。
この設定例では
$ x $
のように $ の間に空白がないと発動しないようになっています。$hoge = $hoge + 1; のような文章では発動しないようにするためです。
ただし本体改造になりますので、PukiWiki のアップデートの際に面倒くさくなるかもしれないことは覚悟してください。
Download
Save from right-click, and put into plugin directory.
What's new
viewcvs
Compatibility Check
Please join us to check compatibilities.
Compatible
Incompatible
技術的詳細
Rivals
- pukiwiki + texvc で TeX 数式の書ける wiki
-- Texvc
コマンドを使う
- math プラグイン
--texコードを生成し、latex コマンドを使用する
- ASCIIMathML.js --ASCIIMathML.js を使用するテスト。画像生成ではないので、一般ユーザーにMathPlayerや数式フォントを要求する。ボツにして mimetex.inc.php をメンテナンスすることにした。
- MathML プラグイン - Nodalab Wiki
- プラグイン中で MathML コードを生成している。一般ユーザーにMathPlayerや数式フォントを要求する。
References
- MimeTex - Okabe-jp
-- TeX のように $ $ を使う方法。mimetex プラグインを使用しないのでキャッシュ機能は使えなくなる。
- mimetex.html
-- Mimetex 本家
- org:自作プラグイン/mimetex.inc.php
-- org:mimetex.inc.php
- Plugin/keyの拡張/mimetex -[io] Wiki
-- mimetex.inc.php 本家
- Pukiwiki Plugin mimetexの修正版スクリプト
-- Safari 対応修正
- はてな - mimetexとは
-- はてなの mimetex
- mimetex - Theater of Economics
Pukiwikiで数式を使う
- Hack/convwiki_rules -- $ $ で mimetex プラグインを起動できるように本体を改造。