Last active
October 8, 2016 05:26
-
-
Save efraintorlo/a2e1f55b7237c0263a48f282ac366e44 to your computer and use it in GitHub Desktop.
Clean the LaTeX output for functions and expressions in SageMathCloud. This can be used to dump latex in files or for show clean latex outputs inside sagews notebooks.
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 re | |
def latex_clean(f): | |
_latex = re.sub('\\\\left\([{}\w\s\\\\,]+\s\\\\right\)\s\\\\\s\{\\\\mapsto\}\s\\\\\s', '', f._latex_()) | |
return _latex | |
def show_clean(f): | |
_latex = r"$" + latex_clean(f) + "$" | |
show(_latex) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment