inkscape

TexText extension

https://github.com/textext/textext/releases

LaTeX な数式を埋め込むための extension で、inkscape 1.3.x に対応しているのは最新の textext-1.9.0 以降。 source をとってきて、

python3 ./setup.py   (Linuxの場合)

すればよい。install される extension は ~/.config/inkscape/extensions/ 内。古い textext (1.8等) + inkscape 1.3 で数式を埋め込もうとすると固まるので、古い version はよしなに処理するのが吉。 なお LaTeX 環境が使えることは前提。

使い方: inkscape の extension → text → TexText で開くパネル内に、$\Delta$ のように入力すればよい。

TexText extension 日本語の処理

標準の TexText extension は tex -> pdf のために "pdflatex" か "xelatex" か "lualatex"を用いるようになっている。(変数 tex_command)

pdflatex (pdftex) で日本語が入っていると「LaTeX Error: Unicode character あ (U+3042)」みたいなのが出てしまう。 日本語処理をできるようにするには、pdflatex ではなく、platex & dvipdfmx を使うように extension の python script を手直しすればよい。(もちろん platex と dvipdfmx が使えるという前提です。)例えば以下のように修正すれば当方ではうまくいきました。

--- .config/inkscape/extensions/textext/base.py.bkup	2023-09-13 12:21:24.994136638 +0900
+++ .config/inkscape/extensions/textext/base.py	2023-10-10 14:33:10.244445200 +0900
@@ -560,7 +560,9 @@

             # Exec tex_command: tex -> pdf
             try:
-                exec_command([tex_command, self.tmp('tex')] + self.LATEX_OPTIONS)
+#                exec_command([tex_command, self.tmp('tex')] + self.LATEX_OPTIONS)
+                exec_command(['platex', self.tmp('tex')])
+                exec_command(['dvipdfmx', self.tmp('dvi')])
             except TexTextCommandFailed as error:
                 if os.path.exists(self.tmp('log')):
                     parsed_log = self.parse_pdf_log()

 差分パッチ→ inkscape_textext_ja.patch

Last modified:2023/10/10 16:39:45
Keyword(s):
References:[Software]