stargazer
stargazer copied to clipboard
Render LaTeX output for Jupyter
I couldn't find a way to render LaTeX output in a Jupyter notebook. Do you know of a way? Or could the package render it behind the scenes and have an image (e.g. png) output in a Jupyter cell?
The question goes beyond stargazer: is there a way to render generic LaTeX (that is, not just formulae) in jupyter? And the answer, I'm afraid, is no, as jupyter uses MathJax to render LaTeX, and MathJax only supports formulae.
I guess your best option is to create a small command that takes some text, saves it in an empty document template, calls rubber on it and opens the result in a separate pdf viewer.
(Then it would not be too hard to convert the result to png and feature it in jupyter... but I wonder: why not just using the html output then?)
why not just using the html output then?
Doesn't look as nice ;)
I think the rendered HTML looks quite nice in a Jupyter notebook. It also has the added benefit of integrating well with the browser (e.g. for selecting cells, copying content). To implement it, we can use rich display:
def _repr_html_(self):
return self.render_html()
As to this issue: I could understand the use of checking the LaTeX output inside Jupyter, but running LaTeX behind the scenes is out of the scope of this package. If some other library provides a simple way to do it we can consider supporting it.