Using Typst Today: When You Need LaTeX
Typst is a new system for technical typesetting and document preparation that is the first realistic candidate to become a LaTeX replacement. One of its many advantages over LaTeX is a simplified markup system for mathematics that makes equations easier to enter and the source document easier to read.
Very few journals or conferences accept manuscripts in Typst format. Nevertheless, you can take advantage of its improved markup system even if you need to produce a LaTeX manuscript. The key is to use Pandoc, the document conversion tool, with a simple filter. If you’re writing your papers or books in Pandoc you’re already using a simple and pleasant system for text markup, based on Markdown. However, by default you still need to enter math using the verbose LaTeX syntax.
Pandoc lets you write filters in Lua that transform elements in the input document. I’ve written a simple filter that I use to let me enter my equations using Typst syntax. The filter transforms all the math-mode markup into LaTeX in the output file. So I can use Markdown and Typst math, and still get a LaTeX (with RevTeX or whatever template I need to use) file for submission.
I’m keeping the filter in a Git repository because, although it’s dead simple, I’ll probably make adjustments and add things to it. Also, as I’ve pointed out in a comment in the code, I’m not quite happy with how I had to write it, so if any Pandoc filter experts can suggest a more elegant solution, I’ll incorporate it.
To get the filter, just do
git clone https://lee-phillips.org/typstfilters/code
The repository is read-only. Please send patches or suggestions by email.