| Crates.io | tylax |
| lib.rs | tylax |
| version | 0.2.1 |
| created_at | 2026-01-05 10:32:33.825408+00 |
| updated_at | 2026-01-25 07:30:41.765373+00 |
| description | Tylax - High-performance bidirectional LaTeX ↔ Typst converter |
| homepage | |
| repository | https://github.com/scipenai/tylax |
| max_upload_size | |
| id | 2023583 |
| size | 1,721,025 |
Bidirectional, AST-based LaTeX ↔ Typst Converter
Tylax is a high-performance tool written in Rust that converts mathematical formulas, tables, full documents, and TikZ graphics between LaTeX and Typst formats. It focuses on static analysis to preserve the document structure for manual editing and adjustment.
\newcommand, \def, \ifmmode, and complex nested macros.#let, #for loops, and conditionals before conversion.multicolumn, multirow, and booktabs.Note: While Tylax covers most common LaTeX and Typst features, there are still uncovered edge cases. If you encounter any conversion issues, please open an issue with a minimal example. Your feedback helps improve the tool! Thank you!
cargo install tylax
git clone https://github.com/scipenai/tylax.git
cd tylax
cargo build --release
# Basic conversion (auto-detect format)
t2l input.tex -o output.typ
# Convert math formula from stdin
echo '\frac{1}{2}' | t2l -d l2t
# Convert TikZ to CeTZ
t2l tikz input.tex -o output.typ
Add to Cargo.toml:
[dependencies]
tylax = "0.2.0"
use tylax::{latex_to_typst, typst_to_latex};
fn main() {
let typst = latex_to_typst(r"\frac{1}{2} + \alpha");
println!("{}", typst); // Output: 1/2 + alpha
}
Tylax can be compiled to WASM for browser usage. See the Online Demo for a live example. The online demo does not collect any user data.
# Build for web
wasm-pack build --target web --out-dir web/src/pkg --features wasm --no-default-features
To build a handy tool specifically for LaTeX and Typst conversion scenarios.
%%{init: {'theme': 'base', 'themeVariables': { 'primaryColor': '#4a90d9', 'primaryTextColor': '#fff', 'primaryBorderColor': '#2d6cb5', 'lineColor': '#5c6bc0', 'secondaryColor': '#81c784', 'tertiaryColor': '#fff3e0'}}}%%
flowchart LR
subgraph INPUT ["📄 Input"]
direction TB
LaTeX["LaTeX\n.tex"]
Typst["Typst\n.typ"]
end
subgraph CORE ["⚙️ Core Engine"]
direction TB
subgraph L2T ["LaTeX → Typst"]
direction LR
LE[["⚙️ Macro\nEngine"]]
MP[["🔍 MiTeX\nParser"]]
LA[("AST")]
LC{{"Converter"}}
LE --> MP --> LA --> LC
end
subgraph T2L ["Typst → LaTeX"]
direction LR
subgraph MINIEVAL ["⚙️ MiniEval"]
direction TB
TP1[["Parse"]]
EXEC[["Expand"]]
TP1 --> EXEC
end
TP2[["🔍 typst-syntax\nParser"]]
TA[("AST")]
TC{{"Converter"}}
MINIEVAL --> TP2 --> TA --> TC
end
subgraph FEATURES ["📦 Features"]
direction TB
F1["Tables\n(Coverage Tracking)"]
F2["TikZ/CeTZ\n(Coord Parser)"]
F4["References"]
end
end
subgraph OUTPUT ["📄 Output"]
direction TB
TypstOut["Typst\n.typ"]
LaTeXOut["LaTeX\n.tex"]
end
LaTeX --> LE
LC --> TypstOut
Typst --> MINIEVAL
TC --> LaTeXOut
LC -.- FEATURES
TC -.- FEATURES
style INPUT fill:#e3f2fd,stroke:#1976d2,stroke-width:2px
style CORE fill:#fff8e1,stroke:#ff8f00,stroke-width:2px
style OUTPUT fill:#e8f5e9,stroke:#388e3c,stroke-width:2px
style L2T fill:#e1f5fe,stroke:#0288d1
style T2L fill:#fce4ec,stroke:#c2185b
style FEATURES fill:#f3e5f5,stroke:#7b1fa2
style MINIEVAL fill:#ffebee,stroke:#c62828
style MP fill:#bbdefb,stroke:#1976d2
style TP1 fill:#f8bbd0,stroke:#c2185b
style TP2 fill:#f8bbd0,stroke:#c2185b
style LA fill:#fff9c4,stroke:#fbc02d
style TA fill:#fff9c4,stroke:#fbc02d
style LC fill:#c8e6c9,stroke:#388e3c
style TC fill:#c8e6c9,stroke:#388e3c
Join the conversation!
Contributions are welcome! Please feel free to submit issues and pull requests.
git checkout -b feature/amazing-feature)git commit -m 'Add amazing feature')git push origin feature/amazing-feature)cargo fmt and cargo clippy before committingThis project is licensed under the Apache-2.0 License - see the LICENSE file for details.
This project builds upon the following excellent projects: