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

SymPy output not rendered as inline math with MathJax #141

Closed
ruboerner opened this issue May 31, 2024 · 3 comments · Fixed by #147
Closed

SymPy output not rendered as inline math with MathJax #141

ruboerner opened this issue May 31, 2024 · 3 comments · Fixed by #147
Assignees

Comments

@ruboerner
Copy link

Problem: The output generated by SymPy.jl is not typeset as inline math.

See the following MWE:

---
engine: julia
---

```{julia}
using SymPy
@syms x
integrate(sin(x)*cos(x), x)
```

The expected output can be generated with

---
jupyter: julia-1.10
---

```{julia}
using SymPy
@syms x
integrate(sin(x)*cos(x), x)
```

The generated HTML files reveal that QuartoNotebookRunner.jl does not (yet) support mathjax rendering.

@MHellmund
Copy link
Contributor

QuartoNotebookRunner.run!(server, "notebook.qmd"; output = "notebook.ipynb")

produces both the text/plain and the text/latex output cell:

           "outputs": [
                {
                    "output_type": "execute_result",
                    "execution_count": 1,
                    "data": {
                        "text/plain": "   2   \nsin (x)\n───────\n   2   ",
                        "text/latex": "$\\frac{\\sin^{2}{\\left(x \\right)}}{2}$"
                    },
                    "metadata": {
                    }
                }
            ],

With the jupyter/ijulia engine, the text/plain output is an array of lines and the order of the MIME types is reversed, text/latex comes first:

      "outputs": [
        {
          "data": {
            "text/latex": [
              "$\\frac{\\sin^{2}{\\left(x \\right)}}{2}$"
            ],
            "text/plain": [
              "   2   \n",
              "sin (x)\n",
              "───────\n",
              "   2   "
            ]
          },
          "execution_count": 2,
          "metadata": {},
          "output_type": "execute_result"
        }
      ],

Is the order important for quarto?

@MichaelHatherly
Copy link
Collaborator

What is typeof(integrate(sin(x)*cos(x), x)) in this case? If it's also a LaTeXString then this is probably covered by #145.

@MichaelHatherly
Copy link
Collaborator

Is the order important for quarto?

Ideally not, those are unordered dicts that we convert to JSON so don't really have much control over the ordering there at the moment.

@MichaelHatherly MichaelHatherly self-assigned this Jun 7, 2024
@MichaelHatherly MichaelHatherly linked a pull request Jun 7, 2024 that will close this issue
MichaelHatherly added a commit that referenced this issue Jun 7, 2024
* Fix #141 and fix #145, LaTeX rendering improvements

* Attempt to resolve PyCall in CI issue
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.

3 participants