Is there a workaround to render symbols from Symbolics.jl in Pluto.jl

When I use Symbolics.jl in Pluto.jl I get an invalid latex expression (at least for Mathjax).

Is there a workaround to remove the text part from the output?
I basically makes Symbolics.jl very bothersome to use.

I also found this issue, but It does not provide a workaround yet.
SymPy formulas are not rendered correctly · Issue #488 · fonsp/Pluto.jl · GitHub

I may have found a way.
I hope this does not mess up other things.

Base.show(io::IO,::MIME"text/html",x::Num) = show(io,MIME("text/latex"),x)

The following has worked for me:

using Symbolics, Latexify

set_default(; env=:inline)

At the same time, I am no expert. Maybe there is some reason this is not a good way to work around. I’d love to hear if it works for you and if you have found anything better.

5 Likes

Thank you for your solution. I think I’ll be using that one.

1 Like

Note that this is no longer needed in the latest Pluto (0.14.7). Thank you fonsp!

2 Likes