JuliaPlots / MakieTeX.jl

TeX integration in Makie
MIT License
86 stars 12 forks source link

Implement Typst backend #48

Closed jakobjpeters closed 4 weeks ago

jakobjpeters commented 4 weeks ago

As described in the documentation and this comment, this pull request implements a Typst backend using Typstry.jl.

This initial draft contains a minimal working implementation:

julia> using MakieTeX, CairoMakie

julia> teximg(convert(MakieTeX.PDFDocument, MakieTeX.CachedTypst(typst"$ 1 / x $")))

TODO

asinghvi17 commented 4 weeks ago

BTW: don't worry about the CI, it gets stuck somewhere, probably in the render_texample bit...I will probably have to clean it up at some point!

asinghvi17 commented 4 weeks ago

https://typst.app/universe/package/cetz/ has some nice illustrations that one could render in a similar way to render_texample as tests.

jakobjpeters commented 4 weeks ago

Alright, I think it's almost done. I ran test/typst.jl locally and those examples worked. Do you have suggestions for additional tests or things to check manually?

Is there anything to consider regarding Typst and Makie integration, such as the preamble?

asinghvi17 commented 4 weeks ago

Ah, I was trying to push to the PR and it looks like I somehow pushed to this repo's master instead! Oops.

No worries - the PR was in pretty good shape anyway and local testing seemed to work well. Thanks again @jakobjpeters!

In terms of additional tests, not really - that the basic functionality works is mostly what I wanted. It seems as though Typst doesn't really need a preamble unless you're using a package, and if you are then you can just write that import statement anywhere if I understand correctly? So we can use a preamble later, especially in text integration for fonts, colors, etc, but right now there doesn't seem to be a need for it.

jakobjpeters commented 4 weeks ago

Woo! You're welcome