A New Typst Template for Pandoc

https://news.ycombinator.com/rss Hits: 13
Summary

A New Typst Template for Pandoc Last summer I spent a lot of time with Typst (at that point v0.11) and Pandoc, working on a flexible and reusable workflow to typeset markdown-formatted articles to PDF. I designed a Pandoc template for Typst that would do nice things with layout and typography, and I posted about that here. Fast-forward to spring 2025. In the intervening months, Typst has been upgraded twice (to v0.13) and Pandoc has upgraded at least 3 times (currently at v3.6.4), and my templates don’t work anymore. Partly this is because Pandoc’s own Typst output template is different and makes some different assumptions about how it is called, and partly because major changes to Typst’s logic emerged since v0.12 So this past month – in the context of a graduate class I teach – I set about rebuilding my workflow. My new templates (see below) use Pandoc’s default Typst output template, which itself does very little in terms of formatting, but now utilize an actual Typst Template (that is, written for Typst, not for Pandoc). It’s called like so: pandoc file.md -o file.pdf -V template=article.typ --pdf-engine=typst Note that this looks kinda similar asking Pandoc to use one of its templates, but note that this is actually -V passing a variable to Pandoc… Pandoc’s own template.typst watches for this to be set, and then imports the named template. That’s a little syntactically confusing (I was confused), but it does separate out Pandoc’s logic from Typst’s logic. As it should be. This ought to be a little more robust long-term, too. Breaking that up a bit for clarity… pandoc article.md \ -f markdown --wrap=none \ -t pdf --pdf-engine=typst \ -V template=article.typ \ -o article.pdf The Typst template I’ve produced assumes you’re running it this way, and it gathers all the metadata Pandoc can recognize from your markdown source. I’m assuming you have a metadata block at the top of your markdown source with things like title, author, date, and so on. You can download the ...

First seen: 2026-05-27 23:59

Last seen: 2026-05-28 12:10