Move a LaTeX paper to Typst
Your own macros are expanded, references and labels carry over, and citations are resolved from the .bbl file that arXiv ships with the sources.
v0.6.0 Open source, MIT Rust + WebAssembly
docmux is a document converter that runs in your browser. Give it a LaTeX paper and get Typst that compiles, a Word file with real equations, HTML or Markdown. Nothing is uploaded: the conversion happens on your machine.
\newcommand{\kl}[2]{D_{\mathrm{KL}}\left(#1 \,\|\, #2\right)}
\section{Variational bound}\label{sec:bound}
For any $q(z \mid x)$, the evidence is bounded below:
\begin{equation}\label{eq:elbo}
\log p(x) \ge \mathbb{E}_{q}\left[\log p(x \mid z)\right]
- \kl{q(z \mid x)}{p(z)}
\end{equation}
We maximize Eq.~\eqref{eq:elbo} over $q$.
#set math.equation(numbering: "(1)")
= Variational bound <sec:bound>
For any $q(z divides x)$, the evidence is bounded below:
$
log p(x) gt.eq bb(E)_q[log p(x divides z)]-D_("KL") (q(z divides x) thin||thin p(z))
$ <eq:elbo>
We maximize Eq. (#ref(<eq:elbo>, supplement: none)) over $q$.
Your own macros are expanded, references and labels carry over, and citations are resolved from the .bbl file that arXiv ships with the sources.
Equations become native Word equations that can be edited, not images or LaTeX text. Cross-references jump to their target.
Install the npm package and convert in the browser or in Node. No server to run, and no document leaves the user's machine.
Convert files with the docmux command, or use each reader and writer as its own Rust crate.
Every format is a reader and a writer around one shared document tree, so any input converts to any output.
Each reader, writer and transform is a separate Rust crate, so the WebAssembly build only carries what it uses.
| Format | Read | Write |
|---|---|---|
| LaTeX | ✓ | ✓ |
| Typst | ✓ | ✓ |
| Markdown (CommonMark + GFM) | ✓ | ✓ |
| Word (.docx) | ✓ | ✓ |
| HTML | ✓ | ✓ |
| MyST Markdown | ✓ | ✓ |
| Plain text | – | ✓ |
Unit tests pass long before real documents do. So docmux is also checked against the LaTeX sources of eight well-known arXiv papers, and every failure they find becomes a small test in the crate that owns it.
$ npm install @docmux/wasm
import { convert } from "@docmux/wasm";
const { output, error } = await convert(
latex, "latex", "typst",
);
$ cargo install docmux-cli
$ docmux paper.tex -t typst -o paper.typ
$ docmux paper.tex -o paper.docx
$ docmux report.docx -o report.md
$ cargo add docmux-core
$ cargo add docmux-reader-latex
$ cargo add docmux-writer-typst
let doc = LatexReader::new().read(src)?;
let opts = WriteOptions::default();
let typ = TypstWriter::new()
.write(&doc, &opts)?;
Full API and options in the README.
docmux covers a part of what pandoc does. pandoc handles many more formats and edge cases, and if it already works for you, there is no reason to switch. docmux is for when you need conversion inside a web app, under the MIT license, or with a focus on LaTeX, Typst and math in Word.
It is young, and real documents still find gaps. If one of yours breaks it, an issue with the file or a piece of it helps a lot.
The playground opens with a paper already converted. Drop in a .tex, .md, .typ or .docx file.