Web2.0 > MediaWiki
インストール先URL → http://www.300000.jp/
- 2008年04月17日(木)に,やっと数式を使えるようになりました。
ただし,数式の記述には<math></math>タグではなく<tex></tex>タグを使います。
- http://www.forkosh.dreamhost.com/mimetex.exe/ から適切なファイルをDLし,解凍した中の mimetex.cgi を,バイナリモードでアップロードし,パーミッションを755にする。
- 以下の内容を記した mimetex.php というファイルを,extensionsフォルダにアップロードする。
<?php
$wgExtensionFunctions[] = "MimetexExtension";
function MimetexExtension() {
global $wgParser;
# register the extension with the WikiText parser
# the first parameter is the name of the new tag.
# In this case it defines the tag <example> ... </example>
# the second parameter is the callback function for
# processing the text between the tags
$wgParser->setHook( "tex", "render_Mimetex" );
}
/**
* Renders $text in Mimetex
*/
function render_Mimetex($input, $argv, $parser = null) {
if (!$parser) $parser =& $GLOBALS['wgParser'];
// $img_url is the url the mimetex will be sent to.
// IMPORTANT!! The URL below should be the link to YOUR mimetex.cgi if possible
$img_url = "http://***.******.***/mimetex.cgi?".$input;
// Sets the output of the tex tag using the url from above, and the input as
// the Alt text. It's important to note that there is no error output added yet.
$output = "<img src=\"$img_url\" alt= \"$input\" />";
return $output;
}
?>
- 以下の1行を,localsettings.php の最後の行に追加する。
require("extensions/mimetex.php");
- inludesディレクトリにある editpage.php から
'open' => "\\<math\\>",
'close' => "<\\/math\\>",
という2行を探し,ここを次のように変更する。
'open' => "\\<tex\\>",
'close' => "\\</tex\\>",