Show More
@@ -35,9 +35,10 b' def print_basic_unicode(o, p, cycle):' | |||||
35 | def print_png(o): |
|
35 | def print_png(o): | |
36 | """A funciton to display sympy expression using LaTex -> PNG.""" |
|
36 | """A funciton to display sympy expression using LaTex -> PNG.""" | |
37 | s = latex(o, mode='inline') |
|
37 | s = latex(o, mode='inline') | |
38 |
# mathtext does not understand |
|
38 | # mathtext does not understand certain latex flags, so we try to replace | |
39 | # like sin, cos can print. We should possible replace it with mathrm. |
|
39 | # them with suitable subs. | |
40 | s = s.replace('\\operatorname','') |
|
40 | s = s.replace('\\operatorname','') | |
|
41 | s = s.replace('\\overline', '\\bar') | |||
41 | png = latex_to_png(s, encode=True) |
|
42 | png = latex_to_png(s, encode=True) | |
42 | return png |
|
43 | return png | |
43 |
|
44 | |||
@@ -52,6 +53,10 b' def load_ipython_extension(ip):' | |||||
52 | plaintext_formatter.for_type_by_name( |
|
53 | plaintext_formatter.for_type_by_name( | |
53 | 'sympy.core.basic', 'Basic', print_basic_unicode |
|
54 | 'sympy.core.basic', 'Basic', print_basic_unicode | |
54 | ) |
|
55 | ) | |
|
56 | plaintext_formatter.for_type_by_name( | |||
|
57 | 'sympy.matrices.matrices', 'Matrix', print_basic_unicode | |||
|
58 | ) | |||
|
59 | ||||
55 | png_formatter = ip.display_formatter.formatters['image/png'] |
|
60 | png_formatter = ip.display_formatter.formatters['image/png'] | |
56 | png_formatter.for_type_by_name( |
|
61 | png_formatter.for_type_by_name( | |
57 | 'sympy.core.basic', 'Basic', print_png |
|
62 | 'sympy.core.basic', 'Basic', print_png |
General Comments 0
You need to be logged in to leave comments.
Login now