textextの代替

2011/05/18未分類import
残念ながら,inkscapeのバージョンを上げたらtextextが動作しなくなりました.
というわけで,代替のプログラム(というかバッチファイルを作成です.)
TeXのコードを実行すると,svgファイルとpngファイルが出来るはず.
textextよりは使い勝手は悪いですが,無いよりは遙かにマシです.
platex "%~1".tex
dvipsk -E -Ppdf "%~1".dvi -o "%~1".eps
gswin32c -q -sDEVICE=pbm -sOutputFile="%~1".pbm -r2400 -dNOPAUSE -dBATCH -dSAFER -dEPSCrop "%~1".eps
potrace -o "%~1".svg -s "%~1".pbm
convert "%~1".pbm "%~1"-res.png
convert "%~1"-res.png -resize 1500 "%~1"-toka.png
convert -transparent white "%~1"-toka.png "%~1".png
rm "%~1".aux
rm "%~1".log
rm "%~1"-res.png
rm "%~1".dvi
rm "%~1".eps
rm "%~1".pbm
dvipskは若干古い模様.5月に新規に導入したWindows版TeX環境では入っていませんでした.
ないなどと警告が出たときは,dvipsに書き換えてください.


ちなみに,これで読み込ませるTeXファイルは以下のようなものが良いかもしれません.
例を挙げます.
\documentclass{jarticle}
\usepackage{amsmath}
\usepackage{amssymb}
\usepackage{amsfonts}
\usepackage{txfonts}

\thispagestyle{empty}
\begin{document}
\begin{gather}
\begin{split}
\sigma&=\sigma_1\exp\left( -\dfrac{t}{\tau_1}\right)+\sigma_2\exp\left( -\dfrac{t}{\tau_2}\right)%\\
\end{split}
\nonumber
\end{gather}
\end{document}

imagemagickとpotraceのインストール

これをやらないと,上記バッチファイルは動きません.
ネットの海をさまよって,インストールしてください.
私はimagemagickの公式サイトのリンクから"ImageMagick-6.6.9-9-Q16-windows-dll.exe"
と,titleから"potrace-1.9.win32.zip"をダウンロードしました.

日本語の対応について

当初,私の環境では日本語が化けました.
対策ですが,C:\gs\gs9.02\lib以下のcidfmapを次のように記述したら直りました.
現在は日本語を入力することも可能な状態です.
%!
% cidfmap generated automatically by mkcidfm.ps from fonts found in
%   C:/Windows/Fonts

% Substitutions
/DFKaiShu-SB-Estd-BF << /CSI [(CNS1) 2] /Path (C:/Windows/Fonts/kaiu.ttf) /FileType /TrueType /SubfontID 0 >> ;
/Meiryo-BoldItalic << /CSI [(Japan1) 3] /Path (C:/Windows/Fonts/meiryob.ttc) /FileType /TrueType /SubfontID 1 >> ;
/Meiryo << /CSI [(Japan1) 3] /Path (C:/Windows/Fonts/meiryo.ttc) /FileType /TrueType /SubfontID 0 >> ;
/MS-Gothic << /CSI [(Japan1) 3] /Path (C:/Windows/Fonts/msgothic.ttc) /FileType /TrueType /SubfontID 0 >> ;
/MicrosoftYaHei << /CSI [(GB1) 2] /Path (C:/Windows/Fonts/msyh.ttf) /FileType /TrueType /SubfontID 0 >> ;
/GulimChe << /CSI [(Korea1) 3] /Path (C:/Windows/Fonts/gulim.ttc) /FileType /TrueType /SubfontID 1 >> ;
/Gulim << /CSI [(Korea1) 3] /Path (C:/Windows/Fonts/gulim.ttc) /FileType /TrueType /SubfontID 0 >> ;
/MalgunGothicRegular << /CSI [(Korea1) 3] /Path (C:/Windows/Fonts/malgun.ttf) /FileType /TrueType /SubfontID 0 >> ;
/PMingLiU << /CSI [(CNS1) 2] /Path (C:/Windows/Fonts/mingliu.ttc) /FileType /TrueType /SubfontID 1 >> ;
/MS-UI-Gothic << /CSI [(Japan1) 3] /Path (C:/Windows/Fonts/msgothic.ttc) /FileType /TrueType /SubfontID 2 >> ;
/FangSong << /CSI [(GB1) 2] /Path (C:/Windows/Fonts/simfang.ttf) /FileType /TrueType /SubfontID 0 >> ;
/NSimSun << /CSI [(GB1) 2] /Path (C:/Windows/Fonts/simsun.ttc) /FileType /TrueType /SubfontID 1 >> ;
/MalgunGothicBold << /CSI [(Korea1) 3] /Path (C:/Windows/Fonts/malgunbd.ttf) /FileType /TrueType /SubfontID 0 >> ;
/BatangChe << /CSI [(Korea1) 3] /Path (C:/Windows/Fonts/batang.ttc) /FileType /TrueType /SubfontID 1 >> ;
/DotumChe << /CSI [(Korea1) 3] /Path (C:/Windows/Fonts/gulim.ttc) /FileType /TrueType /SubfontID 3 >> ;
/KaiTi << /CSI [(GB1) 2] /Path (C:/Windows/Fonts/simkai.ttf) /FileType /TrueType /SubfontID 0 >> ;
/MS-PGothic << /CSI [(Japan1) 3] /Path (C:/Windows/Fonts/msgothic.ttc) /FileType /TrueType /SubfontID 1 >> ;
/GungsuhChe << /CSI [(Korea1) 3] /Path (C:/Windows/Fonts/batang.ttc) /FileType /TrueType /SubfontID 3 >> ;
/Dotum << /CSI [(Korea1) 3] /Path (C:/Windows/Fonts/gulim.ttc) /FileType /TrueType /SubfontID 2 >> ;
/Meiryo-Italic << /CSI [(Japan1) 3] /Path (C:/Windows/Fonts/meiryo.ttc) /FileType /TrueType /SubfontID 1 >> ;
/MS-PMincho << /CSI [(Japan1) 3] /Path (C:/Windows/Fonts/msmincho.ttc) /FileType /TrueType /SubfontID 1 >> ;
/Gungsuh << /CSI [(Korea1) 3] /Path (C:/Windows/Fonts/batang.ttc) /FileType /TrueType /SubfontID 2 >> ;
/SimSun << /CSI [(GB1) 2] /Path (C:/Windows/Fonts/simsun.ttc) /FileType /TrueType /SubfontID 0 >> ;
/MicrosoftYaHeiBold << /CSI [(GB1) 2] /Path (C:/Windows/Fonts/msyhbd.ttf) /FileType /TrueType /SubfontID 0 >> ;
/MingLiU << /CSI [(CNS1) 2] /Path (C:/Windows/Fonts/mingliu.ttc) /FileType /TrueType /SubfontID 0 >> ;
/Batang << /CSI [(Korea1) 3] /Path (C:/Windows/Fonts/batang.ttc) /FileType /TrueType /SubfontID 0 >> ;
/Meiryo-Bold << /CSI [(Japan1) 3] /Path (C:/Windows/Fonts/meiryob.ttc) /FileType /TrueType /SubfontID 0 >> ;
/MicrosoftJhengHeiRegular << /CSI [(CNS1) 2] /Path (C:/Windows/Fonts/msjh.ttf) /FileType /TrueType /SubfontID 0 >> ;
/MS-Mincho << /CSI [(Japan1) 3] /Path (C:/Windows/Fonts/msmincho.ttc) /FileType /TrueType /SubfontID 0 >> ;
/SimHei << /CSI [(GB1) 2] /Path (C:/Windows/Fonts/simhei.ttf) /FileType /TrueType /SubfontID 0 >> ;
/MicrosoftJhengHeiBold << /CSI [(CNS1) 2] /Path (C:/Windows/Fonts/msjhbd.ttf) /FileType /TrueType /SubfontID 0 >> ;

% Aliases
/AdobeSongStd-Light /SimSun ;
/MSung-Medium /MingLiU ;
/MSung-Light /MingLiU ;
/HYSMyeongJo-Medium /Batang ;
/STKaiti-Regular /KaiTi ;
/KozMinPr6N-Regular /MS-Mincho ;
/STHeiti-Regular /MicrosoftYaHei ;
/STFangsong-Light /FangSong ;
/AdobeMingStd-Light /MingLiU ;
/AdobeMyungjoStd-Medium /Batang ;
/MKai-Medium /DFKaiShu-SB-Estd-BF ;
/Ryumin-Light /MS-Mincho ;
/MHei-Medium /MicrosoftJhengHeiRegular ;
/HYGoThic-Medium /Dotum ;
/HYRGoThic-Medium /Gulim ;
/HeiseiMin-W3 /MS-Mincho ;
/Ryumin-Medium /MS-Mincho ;
/AdobeHeitiStd-Regular /MicrosoftYaHei ;
/HeiseiKakuGo-W5 /MS-Gothic ;
/STSong-Light /SimSun ;
/GothicBBB-Medium /MS-Gothic ;