MathTeX を使って数式を画像で出力する
概要
TeX の数式表現は綺麗ですが、出力は標準で印刷物になってしまう。 数式を画像として出力したい場合どうすれば良いのか調べてみたら、 MathTeX というのを使えば良いみたい。
インストール
Ubuntu の場合は↓。
TeXの環境がインストールされていない場合は、そこそこ時間がかかる。
実行
以下のコマンドを打つことで作業ディレクトリに out.png が出来上がる。 \png
を付けない場合、出力の形式はgifになる。 \dpi{xxx}
で画像の大きさを変更することができる。
備考
Ubuntu16.04, Ubuntu14.04 で再度試してみたが、下記のようにエラーが発生し、実行は不可能になっていた。
+-----------------------------------------------------------------------+
|mathTeX vers 1.03, Copyright(c) 2007-2009, John Forkosh Associates, Inc|
+-----------------------------------------------------------------------+
| mathTeX is free software, licensed to you under terms of the GNU/GPL |
| and comes with absolutely no warranty whatsoever. |
| See http://www.forkosh.com/mathtex.html for complete details. |
+-----------------------------------------------------------------------+
mathTeX> running image: mathtex
mathTeX> input expression: \png \dpi{300} F(x):=sqrt(x^a)
mathTeX> system() return status: 0
mathTeX> output image file: out.png
^C
mathTeX> message#10 succeeded:
(10) dvipng ran but failed:
上記で報告はされているが、現時点では解決されていない。