You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
Latex is not rendered in HTML output of in VSCode #1132
As the title says, the math sections in HTML output generated by _repr_html_ from StateSpace (and other classes) is not rendered.
This is not really the fault of this library and there is an open issue in the VSCode repo for this, but the simpler output which used _html_latex_ before #1091 did not have this problem.
I think adding back the old _repr_latex_ would allow the user to choose between the new mixed HMTL output and the old Latex output if using VSCode, what do you think?
Another option that I saw in the VSCode issue is to explicitly add the renderer into the HTML but this seems really hacky:
If have _repr_html and _repr_latex allows VSCode to use LaTeX and Jupyter to use HTML, that could work.
We could add something into _repr_html that checks for VSCode and set the output accordingly (won't be as pretty, but should work OK).
We could add an option that allows the default repr format to be changed and users could use then set the format to vscode (or something like that), which would give the older style format.
I did try at one point getting things to look good with just LaTeX, but it was very hard to convince the LaTeX processor in Jupyter to do the right thing (it wanted raw latex math code, if memory serves).
I don't have access to VSCode, so someone else would have to create PR that worked there and we can then confirm Jupyter still renders correctly.
I experimented a bit more and it seems that VSCode will render latex contained in _repr_markdown_ which mostly behaves like a superset of _repr_html_. So one can simply switch the output to text/markdown and everything works pretty much as it should have in the first place.
Pull request for blanked _repr_markdown_ comming in a few minutes.
Activity
murrayrm commentedon Mar 1, 2025
A couple of possibilities:
_repr_htmland_repr_latexallows VSCode to use LaTeX and Jupyter to use HTML, that could work._repr_htmlthat checks for VSCode and set the output accordingly (won't be as pretty, but should work OK).reprformat to be changed and users could use then set the format tovscode(or something like that), which would give the older style format.I did try at one point getting things to look good with just LaTeX, but it was very hard to convince the LaTeX processor in Jupyter to do the right thing (it wanted raw latex math code, if memory serves).
I don't have access to VSCode, so someone else would have to create PR that worked there and we can then confirm Jupyter still renders correctly.
It would be nice to have this fixed for 0.10.2.
lkies commentedon Mar 1, 2025
I experimented a bit more and it seems that VSCode will render latex contained in
_repr_markdown_which mostly behaves like a superset of_repr_html_. So one can simply switch the output to text/markdown and everything works pretty much as it should have in the first place.Pull request for blanked
_repr_markdown_comming in a few minutes.