Show More
@@ -54,6 +54,15 b' def print_png(o):' | |||||
54 | png = latex_to_png(s) |
|
54 | png = latex_to_png(s) | |
55 | return png |
|
55 | return png | |
56 |
|
56 | |||
|
57 | ||||
|
58 | def print_display_png(o): | |||
|
59 | """A function to display sympy expression using LaTex -> PNG.""" | |||
|
60 | s = latex(o, mode='plain') | |||
|
61 | s = s.strip('$') | |||
|
62 | png = latex_to_png('$$%s$$' % s, backend='dvipng') | |||
|
63 | return png | |||
|
64 | ||||
|
65 | ||||
57 | def can_print_latex(o): |
|
66 | def can_print_latex(o): | |
58 | """ |
|
67 | """ | |
59 | Return True if type o can be printed with LaTeX. |
|
68 | Return True if type o can be printed with LaTeX. | |
@@ -115,6 +124,9 b' def load_ipython_extension(ip):' | |||||
115 | png_formatter.for_type_by_name( |
|
124 | png_formatter.for_type_by_name( | |
116 | 'sympy.core.basic', 'Basic', print_png |
|
125 | 'sympy.core.basic', 'Basic', print_png | |
117 | ) |
|
126 | ) | |
|
127 | png_formatter.for_type_by_name( | |||
|
128 | 'sympy.matrices.matrices', 'Matrix', print_display_png | |||
|
129 | ) | |||
118 | for cls in [dict, int, long, float] + printable_containers: |
|
130 | for cls in [dict, int, long, float] + printable_containers: | |
119 | png_formatter.for_type(cls, print_png) |
|
131 | png_formatter.for_type(cls, print_png) | |
120 |
|
132 |
General Comments 0
You need to be logged in to leave comments.
Login now