Hello,
I was wondering whether Makie supports printing mathematical equations in Latex form in the plot
Best,
I wonder if passing a LaTeXStrings.jl string might just work?
I actually try this out since it was my first thought as well but somehow it does not seem to work. The ad-hoc solution I came up with so far is to turn the equation into an image file and use image plot in makie. This way I can use it in conjuction with LaTeXString.jl.
hah, nice trick ;) how did you turn it into an image?
Oh, right now I just use some external program to have an image of an equation, but I feel like it is possible to combine various tools scattered around Julia to automate this kind trick. Do you happen to know how does Matplotlib rendered latex equation in the background?
not sure, likely a similar hack, since Latex pretty much has the monopoly on generating latex-> image/svg... So there is probably no way around having a latex install somewhere!
If you come up with a nice set of commands that uses a local latex install, let me know!
Sure.
Matplotlib has it's own layout engine for math as well as an option to use LaTeX. I wonder if this can be compiled to a shared library and used from Julia?
Pango can render tex, but it's a major pain getting it to work with the text abstraction we currently have. As I understand it, every character is laid out individually, which is incompatible with Pango's "layout this text, I don't care how" approach. Also, Pango assumes only Freetype as a rendering backend, and the API seems to have been created with that in mind...
There is also a C++ version of the library: https://github.com/lie-yan/formulae-cxx.
https://github.com/sciapp/gr/blob/e819f20ed89497ac3023f5dcec8ba55a730f9716/lib/gr/gr.c#L9560-L9712
is how GR has implemented this - essentially, shell out to Latex, and get a DVI. I wonder if we could do a similar thing here. @SimonDanisch, would it be possible to treat an image as a single "glyph" for the purposes of text layouting?
I've made some progress on this - you can now include arbitrary LaTeX documents (so long as you have texlive 2018+ installed) as images or layouted text, and they export to vector graphics in supported backends. This is all in github.com/asinghvi17/MakieTeX.jl.
As far as I can tell, MakieTeX doesn't work at present...
Most helpful comment
I've made some progress on this - you can now include arbitrary LaTeX documents (so long as you have texlive 2018+ installed) as images or layouted text, and they export to vector graphics in supported backends. This is all in github.com/asinghvi17/MakieTeX.jl.