imgTeXはWeb上で数式を表示するための方法の1つです。 mimeTeXやmimeTeXのページ で論じられているような他の方法と同様の処理を行います。 imgTeXは dvipngと FastCGI,それに簡単なオンメモリキャッ シュ機構に基づいています。これらの特徴から,速く綺麗なレンダリングが可 能となります。
次のものは,Usageの例に対する結果で,今,レンダリングされ たものです(注:キャッシュされている可能性もあります)。
Here are some examples. Both math:
,
and displaymath:
can be used.
You can also write more complicated equations:
Interactive imgTeXでimgTeXをインタラクティ ブに使うこともできます。
HTMLファイルの中で,次のように書くことができます。
<p>Here are some examples. Both math: <img src="imgtex.fcgi?{$ f(x)=\int_{-\infty}^xe^{-t^2}dt $}" style="vertical-align:middle" />, and displaymath: <img src="imgtex.fcgi?{\[ f(x)=\int_{-\infty}^xe^{-t^2}dt \]}" style="vertical-align:middle" /> can be used. </p> <p>You can also write more complicated equations:</p> <div style="text-align:center"> <img src="imgtex.fcgi?[res=300]{ \begin{equation*} A = \begin{pmatrix} a_{11} & \ldots & a_{1n} \\ \vdots & \ddots & \vdots \\ a_{m1} & \ldots & a_{mn} \end{pmatrix} \end{equation*} }" /> </div> <div style="text-align:center"> <img src="imgtex.fcgi?[res=200]{ \[ \frac{\pi}{2} = \left( \int_{0}^{\infty} \frac{\sin x}{\sqrt{x}} dx \right)^2 = \sum_{k=0}^{\infty} \frac{(2k)!}{2^{2k}(k!)^2} \frac{1}{2k+1} = \prod_{k=1}^{\infty} \frac{4k^2}{4k^2 - 1} \] }" /> </div>
ここでresはdvipngの"-D"オプションに対する解像度です。上記の例は mimeTeXおよび TeXWikiから取っ てきたものです。
GNU General Public License (GPL).
まず,t1libのサポート付きのdvipng,およびPerlに対するFastCGIが必要です。 これらをインストールした後,
なお,preverr.pngは preview-latex で配布しているpreverr.xpmから変換したものです。
また、セキュリティの問題を避けるため、texmf.cnf (通常 /usr/share/texmf/web2c/texmf.cnfにあります)の次のエントリを設定すること を強く勧めます。
% no shell escape shell_escape = f % disallow to read/write for parent directories openout_any = p openin_any = p % disallow to specify the type of tex at the first line. parse_first_line = f
この設定は、 TeXをWebで で議論されているものです。Chris Porterさんがこの脆弱性について指摘し てくださいました。ありがとうございます。
もし,PukiWikiから imgtex.fcgiを使いたいのであれば,次のimgtex_inc_php.txtを imgtex.inc.phpとしてpluginディレクトリに保存してファイル中の IMGTEX_PATHを設定してください。使用例もコメントとして含まれています。
この項目は,Debianでimgtexのパッケージを作り,また保守をしてくださっ ている香田さんからのアドバイスで追記しました。ありがとうございます。
imgtexの出力をカスタマイズしたい場合は,imgtex.fcgi内の次の箇所を変更し てください。
print FO <<"EOF"; \\documentclass\{article\} \\usepackage\{type1cm\} \\usepackage[psamsfonts]\{amssymb\} \\usepackage\{amsmath\} \\begin\{document\} \\thispagestyle{empty} $cmd \\end\{document\} EOF
たとえば,色を変える機能を使いたければ,
\\usepackage\{amsmath\}
を
\\usepackage\{amsmath,color\}
のように変えると,
\color{red}\[f(x)\]
のような指定ができるようになります。
中丸 幸治