Index: share/extensions/eqtexsvg.py =================================================================== --- share/extensions/eqtexsvg.py (revision 22692) +++ share/extensions/eqtexsvg.py (working copy) @@ -9,6 +9,9 @@ Copyright (C) 2006 Julien Vitard +2010-04-04: Added support for custom packages + Christoph Schmidt-Hieber + This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation; either version 2 of the License, or @@ -27,15 +30,24 @@ import inkex, os, tempfile, sys, xml.dom.minidom -def create_equation_tex(filename, equation): +def parse_pkgs(pkgstring): + pkglist = pkgstring.replace(" ","").split(",") + header = "" + for pkg in pkglist: + header += "\\usepackage{%s}\n" % pkg + + return header + +def create_equation_tex(filename, equation, add_header=""): tex = open(filename, 'w') tex.write("""%% processed with eqtexsvg.py \\documentclass{article} \\usepackage{amsmath} \\usepackage{amssymb} \\usepackage{amsfonts} - -\\thispagestyle{empty} +""") + tex.write(add_header) + tex.write("""\\thispagestyle{empty} \\begin{document} """) tex.write(equation) @@ -78,6 +90,10 @@ action="store", type="string", dest="formula", default=10.0, help="LaTeX formula") + self.OptionParser.add_option("-p", "--packages", + action="store", type="string", + dest="packages", default=10.0, + help="Additional packages") def effect(self): base_dir = tempfile.mkdtemp("", "inkscape-"); @@ -102,7 +118,8 @@ os.remove(err_file) os.rmdir(base_dir) - create_equation_tex(latex_file, self.options.formula) + add_header = parse_pkgs(self.options.packages) + create_equation_tex(latex_file, self.options.formula, add_header) os.system('latex "-output-directory=%s" -halt-on-error "%s" > "%s"' \ % (base_dir, latex_file, out_file)) try: Index: share/extensions/eqtexsvg.inx =================================================================== --- share/extensions/eqtexsvg.inx (revision 22692) +++ share/extensions/eqtexsvg.inx (working copy) @@ -8,6 +8,7 @@ dvips pstoedit \(\displaystyle\frac{\pi^2}{6}=\lim_{n \to \infty}\sum_{k=1}^n \frac{1}{k^2}\) + all Index: po/inkscape.pot =================================================================== --- po/inkscape.pot (revision 22692) +++ po/inkscape.pot (working copy) @@ -20392,6 +20392,14 @@ msgid "LaTeX formula: " msgstr "" +#: ../share/extensions/eqtexsvg.inx.h:3 +msgid "Additional packages" +msgstr "" + +#: ../share/extensions/eqtexsvg.inx.h:4 +msgid "Additional packages (comma-separated): " +msgstr "" + #: ../share/extensions/export_gimp_palette.inx.h:1 msgid "Export as GIMP Palette" msgstr ""