Contributing to MiTeX

April 4, 2026 ยท View on GitHub

Currently, MiTeX maintains following three parts of code:

For a translation process, for example, we have:

\frac{1}{2}

===[parser]===> AST ===[converter]===>

#eval("$frac(1, 2)$", scope: (frac: (num, den) => $(num)/(den)$))

You can use the #mitex-convert() function to get the Typst Code generated from LaTeX Code.

Adding missing TeX commands

Even if you don't know Rust at all, you can still add missing TeX commands to MiTeX by modifying specification files, since they are written in typst! You can open an issue to acquire the commands you want to add, or you can edit the files and submit a pull request.

In the future, we will provide the ability to customize TeX commands, which will make it easier for you to use the commands you create for yourself.

Installing Dependencies

You should install Typst and Rust for running the build script.

If you want to build the WASM plugin, you should also setup the wasm target by rustup:

rustup target add wasm32-unknown-unknown

Build

For Linux:

git clone https://github.com/mitex-rs/mitex.git
scripts/build.sh

For Windows:

git clone https://github.com/mitex-rs/mitex.git
.\scripts\build.ps1

Fuzzing (Testing)

The afl.rs only supports Linux.

Installing afl.rs on Linux:

cargo install cargo-afl

Building and fuzzing:

cargo afl build --bin fuzz-target-mitex
cargo afl fuzz -i local/seed -o local/fuzz-res ./target/debug/fuzz-target-mitex

To minimize test cases, using afl-tmin

cargo afl tmin -i crash.tex -o minimized.tex ./target/debug/fuzz-target-mitex

Documents

TODO.