korsbo / Latexify.jl

Convert julia objects to LaTeX equations, arrays or other environments.
MIT License
562 stars 59 forks source link

Unwrapped exponents with SymEngine #270

Closed ThatcherC closed 1 month ago

ThatcherC commented 1 year ago

I'm seeing a weird issue where SymEngine expressions with exponents with decimal points don't get latexified correctly.

Running in Julia 1.9,

(@v1.9) pkg> status SymEngine Latexify
Status `~/.julia/environments/v1.9/Project.toml`
  [23fbe1c1] Latexify v0.16.1
  [123dc426] SymEngine v0.9.1

julia> using SymEngine, Latexify

julia> @vars a
(a,)

julia> latexify(a^0.5)
L"$a^0.5$"

julia> latexify(:(b ^ 0.4))
L"$b^{0.4}$"

Visually the two Latex outputs look like this: image

Clearly the 0.5 exponent in the a^0.5 expression should have been rendered as $a^{0.5}, like the b expression was.

What's extra weird is that my SymEngine expression converts to the same Expr as the literal one I wrote above:

julia> @vars a
(a,)

julia> Meta.parse(string( a^0.5 ))
:(a ^ 0.5)

Any idea what's up? I've looked throughsrc/latexoperation.jl but can't find anything amiss.

gustaphe commented 1 month ago

It appears this was solved at some point, possibly with #263