MakieOrg / Makie.jl

Interactive data visualizations and plotting in Julia
https://docs.makie.org/stable
MIT License
2.41k stars 313 forks source link

Standalone Latex backend support #3634

Open albertomercurio opened 8 months ago

albertomercurio commented 8 months ago

Hello,

I was wondering about a possible implementation of a standalone Latex backend. Matplotlib already has this feature, with the possibility to even define a preamble

matplotlib.rc("text", usetex = true)
matplotlib.rc("text.latex", preamble = raw"\usepackage{amsmath} \usepackage{physics}")

So that I'm able to use the physics package in my figures.

I know that Makie.jl uses MathTeXEngine.jl for the Latex, which is a great solution for simple implementations. However, I think that there might be a limit in several circumstances. For instance, as I already mentioned, when using external packages, or when a different font is needed.

ffreyer commented 2 months ago

Maybe solved by https://github.com/JuliaPlots/MakieTeX.jl?

asinghvi17 commented 2 months ago

Yep, that's the idea!

albertomercurio commented 2 months ago

Ok, thanks. It seems to still not be ready for a general preamble with a general package, right? But it is on the way to do it. So, great.

asinghvi17 commented 2 months ago

You can create a TeXDocument which is just a regular latex document (though not multi file). So it can render arbitrary latex including packages. Just put the entire document as a String into the TeXDocument constructor.