| 1 | initial version |
Until Trac #31629 is merged (cf. @slelievre 's answer), a possible workaround is to define a subclass of LatexExpr relying on Jupyter's native LaTeX rendering (not Sage's one), as follows:
class LatexExprFix(LatexExpr):
def _repr_latex_(self):
return '$' + str(self) + '$'
It suffices to type the above code is a cell of the Jupyter notebook. Then
LatexExprFix(r'\infty')
displays the LaTeX-rendered formula.
However this does not work with %display latex. If you have some part of the notebook with %display latex, you have to revert to a plain display with %display plain before using LatexExprFix. Maybe this can be improved...
| 2 | No.2 Revision |
Until Trac #31629 is merged (cf. @slelievre 's answer), a possible workaround is to define a subclass of LatexExpr relying on Jupyter's native LaTeX rendering (not Sage's one), as follows:
class LatexExprFix(LatexExpr):
def _repr_latex_(self):
return '$' + str(self) + '$'
It suffices to type the above code is in a cell of the Jupyter notebook. Then
LatexExprFix(r'\infty')
displays the LaTeX-rendered formula.
However this does not work with %display latex. If you have some part of the notebook with %display latex, you have to revert to a plain display with %display plain before using LatexExprFix. Maybe this can be improved...
Copyright Sage, 2010. Some rights reserved under creative commons license. Content on this site is licensed under a Creative Commons Attribution Share Alike 3.0 license.