Hi everyone! ![]()
I’m excited to showcase Tylax, an open-source tool I’ve been building for bidirectional LaTeX ↔ Typst conversion.
It started as a small experiment I shared here previously (https://forum.typst.app/t/small-tool-latex-typst-converter-math-doc-tikz-cetz-experiments/7463?u=democat), and has now evolved into a full-fledged Rust project with robust AST parsing.
GitHub Repository: GitHub - scipenai/tylax: A bi-directional converter between Typst and LaTeX. Available as both a CLI tool and a Web interface.
Online Demo (WASM): https://convert.silkyai.cn/
Installation: Run cargo install tylaxin your terminal.
Why another converter?
Unlike regex-based scripts, Tylax uses full AST parsing (powered by mitex-parser and typst-syntax) to handle nested structures correctly. It handles math, tables, and even TikZ graphics with high precision.
Key Features
Bidirectional: Converts LaTeX to Typst AND Typst to LaTeX.
Math Mode: Robust conversion of complex formulas, matrices, and cases.
Graphics Support: Experimental TikZ ↔ CeTZ conversion! (Supports absolute/relative coords, styling, and basic shapes).
Smart Tables: Handles \multicolumnand\multirowwith cell coverage tracking.
Fast & Private: Runs locally via CLI or completely in-browser via WebAssembly.
Examples
Here are some conversions showing the robustness of the parser:
1. Complex Calculus (LaTeX → Typst)
\int_{-\infty}^{\infty} \frac{\cos(kx)}{x^2 + a^2} dx = \frac{\pi}{a} e^{-|ka|}
↓
integral_(- infinity)^(infinity) frac(cos (k x), x^(2) + a^(2)) d x = pi/a e^(- | k a |)
2. Linear Algebra (LaTeX → Typst)
\mathbf{X} = \begin{pmatrix}
x_{11} & \cdots & x_{1n} \\
\vdots & \ddots & \vdots \\
x_{m1} & \cdots & x_{mn}
\end{pmatrix} \in \mathbb{R}^{m \times n}
↓
upright(bold(X)) = mat(delim: "(", x_(1 1), ..., x_(1 n) ;
dots.v, dots.down, dots.v ;
x_(m 1), ..., x_(m n)) in RR^(m times n)
3. Piecewise Function (Typst → LaTeX)
f(x) = cases(
x^2 "if" x > 0,
0 "otherwise"
)
↓
f\left( x\right) = \begin{cases}
x^2 \text{if} x > 0 \\
0 \text{otherwise}
\end{cases}
4. Maxwell’s Equations (Typst → LaTeX)
nabla dot arrow(E) = rho / epsilon_0
quad
nabla times arrow(B) = mu_0 arrow(J) + mu_0 epsilon_0 (partial arrow(E)) / (partial t)
↓
\nabla \cdot \overrightarrow{E} = \frac{\rho}{\epsilon_0} \quad \nabla \times \overrightarrow{B} = \mu_0 \overrightarrow{J} + \mu_0 \epsilon_0 \frac{(\partial \overrightarrow{E})}{(\partial t)}
Try it out
You can try the online demo directly in your browser, or install the CLI for batch processing:
cargo install tylax
t2l input.tex -o output.typ
Contributions and feedback on GitHub are very welcome. Thanks! ![]()