In a regular jupyter notebook, running, for example, the following:
from IPython.display import display, Math, Latex
display(Math(r'F(k) = \int_{-\infty}^{\infty} f(x) e^{2\pi i k} dx'))
produces an equation rendered in LaTeX (via Mathjax).
Even though LaTeX works fine in markdown cells, LaTeX equations produced as above do not seem to render in Google Colaboratory.
The same happens to the output of functions for example from qutip, which would normally render in latex (for example, qutip.basis(2, 0)
would normally render in latex, but doesn't in Colaboratory).
Why does this happen? Is there a way to have this work?
You can get the Latex to render by including the MathJax library.
from IPython.display import Math, HTML
display(HTML("<script src='https://cdnjs.cloudflare.com/ajax/libs/mathjax/2.7.3/"
"latest.js?config=default'></script>"))
Math(r'F(k) = \int_{-\infty}^{\infty} f(x) e^{2\pi i k} dx')
A similar questions was asked here: Rendering LaTeX in output cells in Colaboratory