Latex output in Julia with Symbolics.jl

Viewed 36

I am new in Julia and using Symbolics. I wanna make Latex output. In Symbolics' docs there is an easy example:

using Latexify
latexify(A) # A - some symbolic expression

And in their example they have a beautiful Latex output. But in my case I have Latex code as output.

julia> expr = 2x + y^2
       2x + y^2

julia> latexify(expr)
 L"\begin{equation*}
 2 x + y^{2}
 \end{equation*}
"

How can I fix it?

1 Answers

latexify produces an LaTeXString objects that does not provide any visualization of its own. However there are many renderers that can display contents havingtext/latex MIME type. Have a look at https://github.com/stevengj/LaTeXStrings.jl

Perhaps your best bet is IJulia (Jupyter notebook)

enter image description here

Note that Symbolics object get correctly displayed regardless whether you use latexify.

Another possible renderers could be plotting packages that support LaTeX annotations on plots via functions such as annotate!.

Related