Commits

Jonathan Fine committed 8b8e3a8

Add svg as adaption of amsmath objects.

Comments (0)

Files changed (2)

 # TODO: Inherit from a metaclass here.
 # TODO: repr AmsMath is "anon(tex='lots of stuff ...', etc)"
 class AmsMath(
-    collections.namedtuple('anon', 'tex dvi png svg'),
+    collections.namedtuple('anon', 'tex dvi eps png svg'),
     _Base
     ):
 
     try:
         dvi = do_amsmath(dirname, source)
         png = do_dvipng(dirname)
+        eps = do_dvips(dirname)
         svg = do_dvisvgm(dirname)
-        ao = AmsMath(tex=source, dvi=dvi, png=png, svg=svg)
+        ao = AmsMath(tex=source, dvi=dvi, png=png, svg=svg, eps=eps)
 
     finally:
         shutil.rmtree(dirname)
     return _generic_do(dirname, args, short_filename)
 
 
+def do_dvips(dirname):
+
+    args = [
+        'dvips',
+        '-E',                   # Create an EPS file.
+        '-o', 'o.eps',           # Name of output file.
+        'o.dvi',
+        ]
+    short_filename = 'o.png'
+
+    return _generic_do(dirname, args, short_filename)
+
+
 def add_formulas_to_aos(aos_path, formula_path_pairs):
 
     for formula, path in formula_path_pairs: