Created
November 3, 2018 14:06
-
-
Save nikibobi/025750022c0b774d9c96c76b03e712cd to your computer and use it in GitHub Desktop.
Add LaTeX support to a Colab notebook for SymPy
This file contains hidden or 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.