2

I'm trying to get the printing to work with Google Colaboratory.

I've updated the Sympy version to 1.3 using !pip install --upgrade Sympy, but the magical line

sp.init_printing(use_unicode=True)

Does not work. And also, use_latex is not as beautiful as you hope it would be.

sp.init_printing(use_latex='True')

What I currently do is to copy the LaTeX code Sympy produces into a text block. Is there a better solution?

UPDATE: My question is a duplicate of here, And the answer there works great.

Phoenix666
  • 183
  • 1
  • 14
  • 1
    `use_latex='True'` does not look right, because there is no LaTeX rendered called "True". `use_latex=True` would make sense (but is inconsequential because that's the default). –  Oct 08 '18 at 11:05

1 Answers1

1

use_unicode=True simply says you are okay with the printer using Unicode characters if it wishes. It does not mean "do not use LaTeX".

The root issue is that MathJax is not available in Google Colab. Two ways to get around this that I know: (a) use matplotlib rendering formulas as images,

init_printing(use_latex='matplotlib')

which results in

matplotlib

(b) disable LaTeX, so that the printer steps down to pretty-print (which does use Unicode by default).

init_printing(use_latex=False)

which results in

pretty