Created
November 3, 2018 14:06
Star
You must be signed in to star a gist
Add LaTeX support to a Colab notebook for SymPy
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import sympy | |
def custom_latex_printer(exp, **options): | |
from google.colab.output._publish import javascript | |
url = "https://cdnjs.cloudflare.com/ajax/libs/mathjax/2.7.3/latest.js?config=default" | |
javascript(url=url) | |
return sympy.printing.latex(exp, **options) | |
sympy.init_printing(use_latex="mathjax", latex_printer=custom_latex_printer) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Great! Should be more prominent.
Used
config=TeX-MML-AM_HTMLorMML
to avoid\operatorname not defined
errors.