Languages & compilers

LaTeX to Typst

Convert LaTeX mathematics to Typst with the structure intact.

Recorded result

Explore the example
From the example below.

Why I’m interested

A document converter has to preserve what the mathematics means as well as how it looks. Fractions, matrices, and sums put that problem in front of you: the source, converted structure, and rendered result all have to agree. My Tylax work focuses on those semantics and on the package behavior around them.

Progress

My local fork covers semantic conversion, package contracts, parser expansion, and validation. Three native conversions appear below with Typst previews. Their reports mark the artifacts Degraded because amsmath has no active handler. That package diagnostic is the next fix.

Follow the mathematics into Typst

Choose a fraction, matrix, or sum and compare its LaTeX source, converted Typst, and preview.

Choose an example

From LaTeX source to Typst output

The source becomes a Typst document with a rendered preview. Tylax reports Degraded because amsmath has no active handler, even though the converted math compiles.

From LaTeX source to Typst output
Converter
Tylax 0.3.6
Artifact grade
Degraded
Preview compiler
Typst 0.15.1

Input

\documentclass{article}
\usepackage{amsmath}
\begin{document}
\[\frac{a}{b} + \sqrt{x}\]
\end{document}

Result

#set text(font: "New Computer Modern", size: 10pt)
#set par(leading: 2pt)

$ frac(a, b)+sqrt(x) $

From LaTeX source to Typst output

The source becomes a Typst document with a rendered preview. Tylax reports Degraded because amsmath has no active handler, even though the converted math compiles.

From LaTeX source to Typst output
Converter
Tylax 0.3.6
Artifact grade
Degraded
Preview compiler
Typst 0.15.1

Input

\documentclass{article}
\usepackage{amsmath}
\begin{document}
\[\begin{pmatrix}1 & 2 \\ 3 & 4\end{pmatrix}\]
\end{document}

Result

#set text(font: "New Computer Modern", size: 10pt)
#set par(leading: 2pt)

$ mat(delim: "(", 1, 2; 3, 4) $

From LaTeX source to Typst output

The source becomes a Typst document with a rendered preview. Tylax reports Degraded because amsmath has no active handler, even though the converted math compiles.

From LaTeX source to Typst output
Converter
Tylax 0.3.6
Artifact grade
Degraded
Preview compiler
Typst 0.15.1

Input

\documentclass{article}
\usepackage{amsmath}
\begin{document}
\[\sum_{i=1}^{n} i = \frac{n(n+1)}{2}\]
\end{document}

Result

#set text(font: "New Computer Modern", size: 10pt)
#set par(leading: 2pt)

$ sum_(i = 1)^(n)i=frac(n ( n + 1 ) , 2) $

The native Rust converter produces the recorded output, and Typst 0.15.1 renders the preview. The artifact grade identifies the amsmath handler to fix next. SciPenAI authors Tylax.

Sources and reference notes

Upstream converter

Reference: Tylax by SciPenAI. The examples record output from the native Rust converter and preserve its artifact grades.
Read the original source

What comes next

Add the amsmath handler and compare the converted documents with the converter's target compiler.

Implementation and credits

How does the converted structure preserve the original mathematics?

Three native Tylax conversions pair LaTeX source with Typst output, previews, and the converter artifact grade.

Compare the source, converted text, and preview for a fraction, matrix, and sum.

The native Rust converter produces the Typst output. Typst renders the SVG previews.

SciPenAI authors Tylax. My local fork covers semantic conversion and validation.

Back to the collection