Skip to content

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

Description

@lkies

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

Activity

  1. murrayrm commented on Mar 1, 2025

    @murrayrm
    Member

    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.

  2. lkies commented on Mar 1, 2025

    @lkies
    ContributorAuthor

    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.

  3. added this to the 0.10.2 milestone on Mar 3, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions