pytex: a tex engine written in python

Junling Ma <[email protected]> Sun, 12 Jul 2026 23:15:51 -0700
Newsgroups gmane.comp.tex.texhax
Message-ID <[email protected]>
Hi all,

I've been working (with plenty of help from Codex) on a very preliminary =
TeX engine in Python called pytex, currently available on GitHub at =
roverrobot/pytex. It is built around a modular architecture to make it =
easier to extend in areas such as safe \write18 support, \special =
handling, font handling, and additional output backends such as HTML and =
DOCX. It supports Unicode out of the box. The parser itself supports =
incremental parsing and introspection, so it can be incorporated into =
other tools. In addition, the architecture is intended to support =
concurrent parser instances (more work is needed though).

The current focus is compatibility with existing TeX/LaTeX documents =
rather than performance. At the moment, it implements enough of pdfTeX =
and XeTeX to run the LaTeX2=CE=B5 engine, and it can produce DVI, XDV, =
PDF, SVG, HTML, and DOCX output. Since this is still at a very early =
stage, it is quite slow, does not yet support the TeX format dump files =
(it uses a compressed JSON format instead), does not support =
bidirectional text, and currently requires an existing TeX Live =
installation. I'm also sure there are many bugs and missing features. My =
hope, however, is that the overall architecture is flexible enough to =
make future extensions straightforward.

If you're interested, I'd be very grateful for feedback. You are also =
very welcome to contribute.

Best,
Junling Ma=