In [1]:
import IPython.lib.latextools as lt
from IPython.lib.latextools import latex_to_png
class LatexRender(object):
def __init__(self, s):
self.s = s
def _repr_png_(self):
# As matplotlib does not support display style, dvipng backend is used here.
png = latex_to_png(self.s, backend='dvipng', wrap=True)
return png
In [3]:
LatexRender('\\color{red}{x}')
Out[3]:
In [33]:
'\n'.join(lt.genelatex('\\color{yellow}{0}', True))
Out[33]:
In [27]:
IPython.lib.latextools.genelatex??
In [ ]: