Small tool: LaTeX ↔ Typst converter (math/doc + TikZ/CeTZ experiments)

Hi everyone,

I’ve been experimenting with a small browser-based tool to convert LaTeX ↔ Typst.

It’s mainly for my own workflow, but I’d love to get early feedback from the community.

Try it here: https://convert.silkyai.cn/

What it currently does

  • LaTeX → Typst: math + some document structures (sections/lists/tables), plus basic TikZ → CeTZ conversion

  • Typst → LaTeX: math + document wrapper, and basic CeTZ → TikZ conversion

  • Runs locally in the browser (WASM), so input isn’t uploaded.

A few examples (screenshots)

  1. TikZ → CeTZ (polar coords / units / styles)

  2. Typst → LaTeX (doc structure)

Feedback I’m looking for

  • Any LaTeX/Typst snippets you rely on that don’t convert well

  • TikZ/CeTZ edge cases you want supported

  • Output style preferences (e.g., more verbose vs. more idiomatic)

Thanks in advance — even a single broken example is helpful. :raised_hands:

7 Likes

Hi, welcome to the forum!

Your website looks good. Is it open-source? If so, it can be added to Best of Typst (TCDM) (the Math section or the Conversion section).

1 Like

Thank you for your reply. I plan to open-source this tool. I’m currently organizing my code and will soon make it publicly available on GitHub, continuously updating and maintaining it based on user feedback. :blush:

4 Likes

Thanks for waiting! I just released the source code and posted a new Showcase thread with detailed examples and benchmarks:

Tylax: Open-source bidirectional LaTeX ↔ Typst converter for full documents (Tylax: Open-source bidirectional LaTeX ↔ Typst converter for full documents (AST-based, CLI & WASM))

It’s now fully open-source on GitHub. Feel free to check it out and add it to the “Best of Typst” list if you think it fits! :blush:

3 Likes

Fine!

One point: Could you also set https://convert.silkyai.cn/ as the homepage of the GitHub repo?
If you do so, it can be automatically fetched by the best-of generator, and get updated if you change the domain name in the future.
The setting is at the top-right corner of the repo’s main page.

3 Likes

Thanks for the tip! I’ve updated the repository homepage URL as suggested. :white_check_mark:

1 Like

Incredible work, thank you! It will definitely be useful for me (so far I relied on a regex monster to do my conversions).

A few edge cases I identified:

  • The LaTeX $\macro$ gets converted to the Typst $macro$, but the Typst $macro$ gets converted to the LaTeX $macro$ (without the slash). I would be nice to enforce the slash, so that in LaTeX we don’t forget to define \macro and put the pretty \mathit formatting.
  • The LaTeX $ 1$ gets converted to the Typst $ 1 $. An extra space has been added at the end. This can pose a problem because an inline LaTeX equation became a centered Typst equation.
3 Likes

Would be cool to have conversion between the latex physics package and the typst physica package.

1 Like

Thank you so much for using this tool and for your feedback! I will address the issues you raised in future updates and continue to improve it!

Thank you for using this feature. I will assess the workload and implementation difficulty and then add it. It’s something I will do; it’s just a matter of time. Thank you! :heart:

Why not use Pandoc?

I personally had trouble using Pandoc because, in my case, it tried to be too smart and check some of the semantics of my document to ensure it produced a compilable document out of the box (and if it couldn’t, it just panicked). This happened frequently in my attempts, as I have several Typst packages (including custom ones) in my projects, for which the mapping to LaTeX is not always straightforward.

What I want is simply “dumb” syntactic rules that convert some LaTeX elements to Typst and vice-versa, without failing when it is not always to do a full conversion that compiles perfectly.

IMO, this is a feature request for Pandoc. Strange that it’s not possible to disable that stuff already.