Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Typst Support #16

Open
nathanrboyer opened this issue Oct 24, 2024 · 4 comments
Open

Typst Support #16

nathanrboyer opened this issue Oct 24, 2024 · 4 comments

Comments

@nathanrboyer
Copy link

There seems to be significant enthusiasm behind a new typesetting system called Typst to replace LaTeX. I would like to be able to use this package with it.

A Latexify.jl equivalent Typstry.jl already exists, so hopefully you can just swap out the backend?

Probably a big ask, but I leave it anyway for your consideration. Thanks.

@co1emi11er2
Copy link
Owner

All of the code is heavily dependent upon the Latexify.jl package, so I don't think this is doable without a Typst equivalent of latexify.jl. It looks like Typstry is more so the equivalent to LaTeXStrings.jl right?

However, I have used the typst option for rendering in quarto and the handcalcs equations render out. Have you tried that?

@nathanrboyer
Copy link
Author

@jakobjpeters can you comment on feasibility here?

@jakobjpeters
Copy link

It looks like Typstry is more so the equivalent to LaTeXStrings.jl right?

It has similar goals to both LaTeXStrings.jl and Latexify.jl. Formatting Julia values is done by defining methods of show_typst(::IO, ::T), which is called by show(::IO, ::MIME"text/typst", ::T) and integrates with TypstString(::T). However, LaTeXStrings.jl implements more formatting rules than Typstry.jl. The big one here is for Expr, which is arguably Latexify.jl's biggest feature.

So after Typstry.jl implements show_typst(::IO, ::Expr), I do think it would be feasible to support both as a back-end but would require some refactoring in Handcalcs.jl to split them. I'm still considering what approach I want to take with this feature, but it's in-progress. An example may look something like:

a = 2

@typst($a * x)
    == TypstString(:(2 * x))
    == TypstString(TypstFunction(*, 2, :x))
    == typst"$2x$"

@co1emi11er2
Copy link
Owner

I tried typst for the first time last night, and it is pretty amazing. I guess time will tell how good integration we can get in Julia with typst, but yeah I can try and get it integrated once features are closer to Latexify!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants