Skip to content

Latex is not rendered in HTML output of in VSCode #1132

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

Closed
lkies opened this issue Mar 1, 2025 · 2 comments · Fixed by #1133
Closed

Latex is not rendered in HTML output of in VSCode #1132

lkies opened this issue Mar 1, 2025 · 2 comments · Fixed by #1133
Milestone

Comments

@lkies
Copy link
Contributor

lkies commented Mar 1, 2025

On f6799ab

As the title says, the math sections in HTML output generated by _repr_html_ from StateSpace (and other classes) is not rendered.

Image

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.

Image

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:

Image

@murrayrm
Copy link
Member

murrayrm commented Mar 1, 2025

A couple of possibilities:

  • 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.

It would be nice to have this fixed for 0.10.2.

@lkies
Copy link
Contributor Author

lkies commented 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.

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

Successfully merging a pull request may close this issue.

2 participants