JuliaHomotopyContinuation/HomotopyContinuation.jl

LaTeX pretty printing breaks for (negative) exponents

b-reinke opened this issue · 2 comments

The LaTeX pretty printing of expressions works badly with superscripts that are more than one letter long:

Using jupyter,

using HomotopyContinuation
@var x
x^-1

produces the latex output $$x^(-1)$$
as the string x^(-1) is passed to the latex output more or less directly.

I think there are proper LaTeX printers in SymEngine, see for example https://symengine.org/symengine/classSymEngine_1_1LatexPrinter.html
I don't know how to call them from Julia though.

My hotfix (using Latexify) is the following:

using Latexify
Base.show(io::IO, ::MIME"text/latex", z::Expression) = println(io, latexify(string(z)))

This is good enough for me at the moment, but I guess you can avoid using Latexify by using the LaTeX printer of SymEngine.

Okay, thanks for noticing. I will keep it in mind for the next update.