Skip to content
KernGet the app

How to Convert a LaTeX Project to Typst

By Laxmi SolutionsUpdated 3 min read

Moving a LaTeX document to Typst is mostly mechanical: sections become headings, environments become functions, and math loses its backslashes. Tools can do much of it for you; what remains is custom macros, complex tables and drawings. This guide covers the mapping, the tools, and a checklist for the manual part.

Option 1: let a tool do the first pass

  • Kern (Android, with Kern Pro): on the projects screen, tap Import a LaTeX project and pick a .tex file, a folder or an Overleaf .zip. Kern converts the structure and the formulas on the device and creates a new Typst project, copying images and .bib files along. Your original files are not changed.
  • Pandoc (desktop): pandoc main.tex -t typst -o main.typ converts structure and math. It works best on documents that use standard LaTeX.
  • tex2typst: converts individual formulas from LaTeX to Typst math. Kern uses it for formulas.

Whichever you use, compile the result straight away and work through the errors from the top. Typst's messages point at the exact spot.

Option 2: convert by hand

For short documents, or to understand what a converter produced, this table covers the constructs most documents use:

LaTeX constructs and their Typst equivalents
LaTeXTypst
\section{Intro}, \subsection{...}= Intro, == ...
\emph{x}, \textbf{x}_x_, *x*
\texttt{x}Raw text between backticks
itemize / enumerate with \item- item / + item
\label{eq:1} and \ref{eq:1}<eq1> after the element, and @eq1
\cite{knuth}@knuth, with #bibliography("refs.bib")
\footnote{x}#footnote[x]
\href{url}{text}#link("url")[text]
\includegraphics[width=.7\linewidth]{plot}#image("plot.png", width: 70%)
\newpage#pagebreak()
\tableofcontents#outline()
geometry margins#set page(margin: 2cm)

Figures, tables and references

#figure(
  image("plot.png", width: 70%),
  caption: [Accuracy by model size.],
) <accuracy>

#figure(
  table(
    columns: 3,
    [*Model*], [*Size*], [*Accuracy*],
    [Small], [1 M], [81%],
    [Large], [10 M], [93%],
  ),
  caption: [Results.],
) <results>

As @accuracy and @results show, size helps.

tabular has no automatic conversion in most tools; rewrite tables with #table as above. Cells are content in brackets, and columns takes a count or a list of widths such as (1fr, auto, auto).

Macros become functions

A \newcommand becomes a #let. Typst functions take named and positional arguments, so they replace most macro tricks:

\newcommand{\vect}[1]{\mathbf{#1}}
\newcommand{\R}{\mathbb{R}}
$\vect{v} \in \R^n$
#let vect(x) = math.bold(x)
$vect(v) in RR^n$

\mathbb{R} is simply RR in Typst, so that macro is not needed at all.

What needs manual work

  • TikZ and PGFPlots: there is no automatic route. Redraw with the CeTZ package, or export the figure from LaTeX as PDF or SVG and include it with #image.
  • Custom document classes: recreate the layout with set and show rules, or start from a Typst Universe template for your format.
  • Bibliography styles: Typst reads .bib files directly and uses CSL styles, for example #bibliography("refs.bib", style: "ieee"). Output can differ slightly from a BibTeX .bst style.
  • Packages without a counterpart: check Typst Universe first; many common needs (theorems, algorithms, units) are covered.
  • Math with macros: formulas using your own macros convert once the macros exist as #let functions.

Converting on Android: Kern's LaTeX import runs on the phone, so unpublished work is never uploaded. See also Typst vs LaTeX if you are still deciding.

Typst, on your phone.

Get it on Google Play