JuliaPy / SymPy.jl

Julia interface to SymPy via PyCall
http://juliapy.github.io/SymPy.jl/
MIT License
269 stars 61 forks source link

Pluto.jl support? #400

Closed schneiderfelipe closed 3 years ago

schneiderfelipe commented 3 years ago

Hi, I got the following when defining a symbolic variable inside Pluto.jl:

Screenshot from 2021-01-03 19-36-11

The MathJax error says "\begin is only supported in math mode." This is probably due to the \text above, right?

The following code reproduces the behavior:

using SymPy

x = symbols("x")

(@syms x shows the same output.)

jverzani commented 3 years ago

Hmm, I can confirm. I guess the display of latex differs between pluto and IJulia. Here is an immediate workaround via Markdown. If this works, I might have to figure out how to put this as the default for SymPy assuming it doesn't break IJulia

function Base.show(io::IO, M::MIME"text/latex", x::SymPy.SymbolicObject) 
    out = Markdown.parse("``$(sympy.latex(x, mode="equation*"))``")
    show(io,  M, out)
end
jverzani commented 3 years ago

Thanks for reporting! I put in this fix. When merged, you'll just need to update SymPy.

schneiderfelipe commented 3 years ago

@jverzani Thanks a lot!