#!/usr/bin/env python # -*- coding: cp1252 -*- """ eqtexsvg.py functions for converting LaTeX equation string into SVG path This extension need, to work properly: - a TeX/LaTeX distribution (MiKTeX ...) - pstoedit software: <http://www.pstoedit.net/pstoedit>

Copyright (C) 2006 Julien Vitard <julienvitard@gmail.com>

2010-04-04: Added support for custom packages Christoph Schmidt-Hieber <christsc@gmx.de>

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 (at your option) any later version.

This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details.

You should have received a copy of the GNU General Public License along with this program; if not, write to the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA

"""

import inkex, os, tempfile, sys, xml.dom.minidom

def parse_pkgs(pkgstring): pkglist = pkgstring.replace(" ","").split(",") header = "" for pkg in pkglist: header += "
usepackagereturnheaderdefcreate_equation_tex(filename,equation,add_header=""):tex=open(filename,'w')tex.write("""
documentclassarticle
usepackageamsmath
usepackageamssymb
usepackageamsfonts """) tex.write(add_header) tex.write("""
thispagestyleempty
begindocument """) tex.write(equation) tex.write("
enddocument