「TeXばなし/Inkscapeにはまる」の編集履歴(バックアップ)一覧はこちら

TeXばなし/Inkscapeにはまる」(2009/03/01 (日) 02:56:14) の最新版変更点

追加された行は緑色になります。

削除された行は赤色になります。

*Inkscapeにはまる #contents(fromhere) **有用なサイト the inkscape tutorials blog — a big list of cool inkscape tutorials — http://inkscapetutorials.wordpress.com/ ryan lerch http://ryanler.wordpress.com/ nicu - a window to my sucky life http://nicubunu.blogspot.com/ # http://howto.nicubunu.ro/inkscape_face_draw/ # とかいいね Inkscape@JP http://inkscape.paix.jp/ # ttp://inkscape.nyx.bne.jp/practice/ バグったらここへ: inkscape - Revision 20795: /inkscape/trunk/share/extensions https://inkscape.svn.sourceforge.net/svnroot/inkscape/inkscape/trunk/share/extensions/ **TeXの数式を使う(InkLaTeX) バグるときの対処法 ***&u(){Windowsの場合} http://www.empitsu.com/wp/?p=24 より引用。 c:\program files\inkscape\share\extentions ディレクトリにあるeqtexsvg.pyをいじる: eqtexsvg.py (83行目) #base_dir = tempfile.mkdtemp("", "inkscape-"); base_dir = "d:\\temp\\inkscape\\" eqtexsvg.py (100行目) #os.rmdir(base_dir) extexsvg.py (113行目) #os.system('dvips -q -f -E -D 600 -y 5000 -o ' + ps_file + ' ' + dvi_file) os.system('dvips -q -f -E -Pdl -o ' + ps_file + ' ' + dvi_file) ***&u(){Ubuntu Hardyの場合} https://bugs.launchpad.net/inkscape/+bug/195052 より引用。 patchを拾ってきて当てる: cd /usr/share/inkscape/extensions curl -s 'http://launchpadlibrarian.net/12978623/eqtexsvg.py.patch' | sudo patch -p0 patchの中身: --- eqtexsvg.py 2008-03-30 17:04:58.000000000 +0200 +++ eqtexsvg.py.new 2008-03-30 17:17:25.000000000 +0200 @@ -49,16 +49,18 @@ doc_sizeW = max(doc_width,doc_height) def clone_and_rewrite(self, node_in): - if node_in.tag != 'svg': - node_out = inkex.etree.Element(inkex.addNS(node_in.tag,'svg')) + in_tag = node_in.tag.rsplit('}',1)[-1] + if in_tag != 'svg': + node_out = inkex.etree.Element(inkex.addNS(in_tag,'svg')) for name in node_in.attrib: node_out.set(name, node_in.attrib[name]) else: node_out = inkex.etree.Element(inkex.addNS('g','svg')) for c in node_in.iterchildren(): - if c.tag in ('g', 'path', 'polyline', 'polygon'): + c_tag = c.tag.rsplit('}',1)[-1] + if c_tag in ('g', 'path', 'polyline', 'polygon'): child = clone_and_rewrite(self, c) - if c.tag == 'g': + if c_tag == 'g': child.set('transform','matrix('+str(doc_sizeH/700.)+',0,0,'+str(-doc_sizeH/700.)+','+str(-doc_sizeH*0.25)+','+str(doc_sizeW*0.75)+')') node_out.append(child) ***&u(){最終手段} textextを使う: http://www.elisanet.fi/ptvirtan/software/textext/index.html # 再編集できるから、こっちの方が便利なんじゃないか? 導入法: http://www.empitsu.com/wp/?p=411 http://d.hatena.ne.jp/CoolDriver/20081231/p2 **TeXの数式を使う(textext) というわけで、textextも導入。 日本語化は http://blog.livedoor.jp/les_paul_sp/archives/399981.html にしたがう。 # texをeuc-jpでコンパイルしてる人用です。 # shift-jisの人も同じようにできるらしい…。 # とりあえず、codecs.getwriterでググってみてください。 # http://www.google.co.jp/search?hl=ja&q=codecs.getwriter textext.py(textext-0.4.4)の変更箇所: import inkex import os, sys, tempfile, traceback, glob, re, md5, copy from lxml import etree ↓ import codecs import inkex import os, sys, tempfile, traceback, glob, re, md5, copy from lxml import etree texwrapper = r""" \documentclass[landscape,a0]{article} %s \pagestyle{empty} \begin{document} \noindent %s \end{document} """ % (preamble, latex_text) ↓ texwrapper = r""" \documentclass{jarticle} %s \pagestyle{empty} \begin{document} \noindent %s \end{document} """ % (preamble, latex_text) # Write tex f_tex = open(self.tmp('tex'), 'w') try: f_tex.write(texwrapper) finally: f_tex.close() # Exec pdflatex: tex -> pdf exec_command(['pdflatex', self.tmp('tex')] + latexOpts) if not os.path.exists(self.tmp('pdf')): raise RuntimeError("pdflatex didn't produce output") ↓ # Write tex f_tex = open(self.tmp('tex'), 'w') euc_tex = codecs.getwriter('euc-jp')(f_tex) try: euc_tex.write(texwrapper) finally: f_tex.close() euc_tex.close() # Exec pdflatex: tex -> pdf exec_command(['platex', self.tmp('tex')] + latexOpts) exec_command(['dvipdfmx', self.tmp('dvi')] ) if not os.path.exists(self.tmp('pdf')): raise RuntimeError("pdflatex didn't produce output") **gnuplotでつくったsvgの図を使う バグるときの対処法 http://www.yamamo10.jp/yamamoto/wordpress/?p=46 http://bits.6w9.org/?p=239 などより引用。 1.fix-gp-svg.plをつくる。 #!/usr/local/bin/perl use warnings; use strict; while (<>) { s/(color:)(.*?)(;\s* stroke:)currentColor/$1$2$3$2/; print; } 2.適用する。 cat buggy.svg | fix-gp-svg.pl > correct.svg **その他のInkscapeのバグ 関数プロット(Function Plotter)のバグ https://bugs.launchpad.net/inkscape/+bug/230765 http://pc11.2ch.net/test/read.cgi/linux/1188293074/256-356 などより引用。 --- /usr/share/inkscape/extensions/funcplot.py.orig 2008-06-27 02:07:22.000000000 +0900 +++ /usr/share/inkscape/extensions/funcplot.py 2008-06-27 02:07:58.000000000 +0900 @@ -114,7 +114,7 @@ dx0 = (x1 - x0)/ds dy0 = (y1 - y0)/ds else: # derivative given by the user - dx0 = 0 # Only works for rectangular coordinates + dx0 = 1 # Only works for rectangular coordinates dy0 = fp(xstart) # Start curve @@ -138,7 +138,7 @@ dx1 = (x1 - x2)/ds dy1 = (y1 - y2)/ds else: # derivative given by the user - dx1 = 0 # Only works for rectangular coordinates + dx1 = 1 # Only works for rectangular coordinates dy1 = fp(x1) # create curve a.append([' C ', [[戻る>TeXばなし]] ----
*Inkscapeにはまる #contents(fromhere) **有用なサイト the inkscape tutorials blog — a big list of cool inkscape tutorials — http://inkscapetutorials.wordpress.com/ ryan lerch http://ryanler.wordpress.com/ nicu - a window to my sucky life http://nicubunu.blogspot.com/ # http://howto.nicubunu.ro/inkscape_face_draw/ # とかいいね Inkscape@JP http://inkscape.paix.jp/ # ttp://inkscape.nyx.bne.jp/practice/ バグったらここへ: inkscape - Revision 20795: /inkscape/trunk/share/extensions https://inkscape.svn.sourceforge.net/svnroot/inkscape/inkscape/trunk/share/extensions/ **TeXの数式を使う(InkLaTeX) バグるときの対処法 ***&u(){Windowsの場合} http://www.empitsu.com/wp/?p=24 より引用。 c:\program files\inkscape\share\extentions ディレクトリにあるeqtexsvg.pyをいじる: eqtexsvg.py (83行目) #base_dir = tempfile.mkdtemp("", "inkscape-"); base_dir = "d:\\temp\\inkscape\\" eqtexsvg.py (100行目) #os.rmdir(base_dir) extexsvg.py (113行目) #os.system('dvips -q -f -E -D 600 -y 5000 -o ' + ps_file + ' ' + dvi_file) os.system('dvips -q -f -E -Pdl -o ' + ps_file + ' ' + dvi_file) ***&u(){Ubuntu Hardyの場合} https://bugs.launchpad.net/inkscape/+bug/195052 より引用。 patchを拾ってきて当てる: cd /usr/share/inkscape/extensions curl -s 'http://launchpadlibrarian.net/12978623/eqtexsvg.py.patch' | sudo patch -p0 patchの中身: --- eqtexsvg.py 2008-03-30 17:04:58.000000000 +0200 +++ eqtexsvg.py.new 2008-03-30 17:17:25.000000000 +0200 @@ -49,16 +49,18 @@ doc_sizeW = max(doc_width,doc_height) def clone_and_rewrite(self, node_in): - if node_in.tag != 'svg': - node_out = inkex.etree.Element(inkex.addNS(node_in.tag,'svg')) + in_tag = node_in.tag.rsplit('}',1)[-1] + if in_tag != 'svg': + node_out = inkex.etree.Element(inkex.addNS(in_tag,'svg')) for name in node_in.attrib: node_out.set(name, node_in.attrib[name]) else: node_out = inkex.etree.Element(inkex.addNS('g','svg')) for c in node_in.iterchildren(): - if c.tag in ('g', 'path', 'polyline', 'polygon'): + c_tag = c.tag.rsplit('}',1)[-1] + if c_tag in ('g', 'path', 'polyline', 'polygon'): child = clone_and_rewrite(self, c) - if c.tag == 'g': + if c_tag == 'g': child.set('transform','matrix('+str(doc_sizeH/700.)+',0,0,'+str(-doc_sizeH/700.)+','+str(-doc_sizeH*0.25)+','+str(doc_sizeW*0.75)+')') node_out.append(child) ***&u(){最終手段} textextを使う: http://www.elisanet.fi/ptvirtan/software/textext/index.html # 再編集できるから、こっちの方が便利なんじゃないか? 導入法: http://www.empitsu.com/wp/?p=411 http://d.hatena.ne.jp/CoolDriver/20081231/p2 **TeXの数式を使う(textext) というわけで、textextも導入。日本語化は http://blog.livedoor.jp/les_paul_sp/archives/399981.html にしたがう。 # 気になる人は改変後、名前やソース中のtextextとかを # jtextextとかに直してください。 # ついでに言うと、これはtexをeuc-jpでコンパイルしてる人用です。 # shift-jisの人も同じようにできるらしい…。 # とりあえず、codecs.getwriterでググってみてください。 # http://www.google.co.jp/search?hl=ja&q=codecs.getwriter textext.py(textext-0.4.4)の変更箇所: import inkex import os, sys, tempfile, traceback, glob, re, md5, copy from lxml import etree ↓ import codecs import inkex import os, sys, tempfile, traceback, glob, re, md5, copy from lxml import etree texwrapper = r""" \documentclass[landscape,a0]{article} %s \pagestyle{empty} \begin{document} \noindent %s \end{document} """ % (preamble, latex_text) ↓ texwrapper = r""" \documentclass{jarticle} %s \pagestyle{empty} \begin{document} \noindent %s \end{document} """ % (preamble, latex_text) # Write tex f_tex = open(self.tmp('tex'), 'w') try: f_tex.write(texwrapper) finally: f_tex.close() # Exec pdflatex: tex -> pdf exec_command(['pdflatex', self.tmp('tex')] + latexOpts) if not os.path.exists(self.tmp('pdf')): raise RuntimeError("pdflatex didn't produce output") ↓ # Write tex f_tex = open(self.tmp('tex'), 'w') euc_tex = codecs.getwriter('euc-jp')(f_tex) try: euc_tex.write(texwrapper) finally: f_tex.close() euc_tex.close() # Exec pdflatex: tex -> pdf exec_command(['platex', self.tmp('tex')] + latexOpts) exec_command(['dvipdfmx', self.tmp('dvi')] ) if not os.path.exists(self.tmp('pdf')): raise RuntimeError("pdflatex didn't produce output") **gnuplotでつくったsvgの図を使う バグるときの対処法 http://www.yamamo10.jp/yamamoto/wordpress/?p=46 http://bits.6w9.org/?p=239 などより引用。 1.fix-gp-svg.plをつくる。 #!/usr/local/bin/perl use warnings; use strict; while (<>) { s/(color:)(.*?)(;\s* stroke:)currentColor/$1$2$3$2/; print; } 2.適用する。 cat buggy.svg | fix-gp-svg.pl > correct.svg **その他のInkscapeのバグ 関数プロット(Function Plotter)のバグ https://bugs.launchpad.net/inkscape/+bug/230765 http://pc11.2ch.net/test/read.cgi/linux/1188293074/256-356 などより引用。 --- /usr/share/inkscape/extensions/funcplot.py.orig 2008-06-27 02:07:22.000000000 +0900 +++ /usr/share/inkscape/extensions/funcplot.py 2008-06-27 02:07:58.000000000 +0900 @@ -114,7 +114,7 @@ dx0 = (x1 - x0)/ds dy0 = (y1 - y0)/ds else: # derivative given by the user - dx0 = 0 # Only works for rectangular coordinates + dx0 = 1 # Only works for rectangular coordinates dy0 = fp(xstart) # Start curve @@ -138,7 +138,7 @@ dx1 = (x1 - x2)/ds dy1 = (y1 - y2)/ds else: # derivative given by the user - dx1 = 0 # Only works for rectangular coordinates + dx1 = 1 # Only works for rectangular coordinates dy1 = fp(x1) # create curve a.append([' C ', [[戻る>TeXばなし]] ----

表示オプション

横に並べて表示:
変化行の前後のみ表示: