Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Render LaTeX output for Jupyter #15

Open
MaxGhenis opened this issue Feb 9, 2020 · 5 comments
Open

Render LaTeX output for Jupyter #15

MaxGhenis opened this issue Feb 9, 2020 · 5 comments

Comments

@MaxGhenis
Copy link
Contributor

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?

@toobaz
Copy link
Collaborator

toobaz commented Feb 9, 2020

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?)

@MaxGhenis
Copy link
Contributor Author

why not just using the html output then?

Doesn't look as nice ;)

@csemken
Copy link
Contributor

csemken commented Jun 3, 2020

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()

@toobaz
Copy link
Collaborator

toobaz commented Jun 3, 2020

To implement it, we can use rich display:

Great idea: #40

@toobaz
Copy link
Collaborator

toobaz commented Jun 3, 2020

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.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants