Typst for TTRPG's

Typst is a markup-based typesetting system with a familiar syntax, powerful features, and fast performance. You can create documents in a few minutes with reasonable defaults, or dive in deep and render hundreds of pages in seconds. I’ve found it to be a lot more approachable than LaTeX and much more flexible than a WYSIWYG editor like Word or Google Docs. My setup uses the runtime and live preview feature locally, without having to worry about an internet connection or subscription fee. The runtime is relatively small (about 25 MB uncompressed) and supports the fonts you already have installed. I’d like to share some of the cool tricks I’ve discovered so you can get right to the fun parts.

Installation

First, have the Typst CLI available on your system. It’s available in many package managers as typst, or you can manually set it up. See GitHub for more instructions. You’ll also need a text editor.

The simplest workflow is to create a source file like file.typ, invoke typst watch file.typ, then open the source file in your text editor and the output PDF file.pdf in a PDF viewer. Saving the source file will cause Typst to recompile the PDF, and your viewer should automatically reload the PDF. Type some stuff, save the file, and see the results. Check the terminal output if nothing happens, there might be a syntax error.

For local live previews, I recommend using the Tinymist language server with one of its supported editors like VSCodium. It provides syntax and error highlighting (really nice), preview navigation (click on an element to go to its location in the source), and optional PDF output on file save. If you already use VSCodium, it’s painless to install and start hacking.

Android 9+ users can try BeauTyXT, an editor with a live Typst preview feature.

You can also try the online Typst editor, which has a built-in preview feature and supports multiple users editing a doc at once. This requires an internet connection and an account.

Getting started

Once you’re rendering PDF’s, the Typst tutorial is a great high-level overview. Keep the reference section of the docs handy.

More practical applications and examples are available in the Typst Examples Book.

Examples & going deeper

What made Typst click for me was learning the difference between “content mode” and “scripting mode”. By default, you’re in content mode, which has a Markdown-like syntax. The biggest difference is using = for headings instead of #. To enter scripting mode, type # and write whatever script you want, like a function call, show rule, definition, etc. Inside scripting mode, you can move back to content mode with [] hard brackets - everything inside those is treated as content, so you get headers, lists, etc. The tutorial covers this, but I needed to keep reminding myself of it until it felt natural.

You can find packages with advanced features at the Typst Universe. The Typst Discord has a Showcase channel with many cool projects.

Sample projects

Blogs

Caveats and missing features

  • No support for variable fonts yet - you’ll need to use static versions.
  • Very limited support for wrapping text around floating objects or figures, especially non-rectangular ones.
  • No clipping masks, limited transparency effects.
  • Gradients can be very big and slow to render.
  • Columns of text are not auto-balanced.
  • Tinymist live preview navigation breaks if you turn on clipping or use a gradient as a fill.
  • HTML export support in development.

What’s next?

I’d like to get into more depth about creating graphs and charts, especially those used in games around here (i.e., hex flower charts, D66 tables, etc.). I’ll post pretty pictures later.

Have you played around with Typst? Show off your projects and experiments! You can ask questions here or consult the Typst Community for answers and more inspiration.

9 Likes

Thanks for kicking off this discussion! I’ve really been enjoying Typst (I made The Demon of Dogwater Gulch as Window Dump linked). I also blogged about Typst a few months ago in the lead-up to writing that module: First Impressions of Typst, a Promising New Layout Tool (includes some links to sample repos of stuff I’ve made). I also used Typst to make foldable printable standees for my Lancer games – spacing and sizing was really easy.

Overall I’ve been super impressed with it and plan to continue using it in the future. Being able to commit changes to a Git repository is awesome.

It’s not for everyone though. If the idea of writing a module in Markdown isn’t appealing to you, then I’d probably stick with a traditional DTP software like Affinity Publisher.

Stuff I wish Typst properly supported:

1 Like

I have played around with Typst. It’s a lot of fun. It is of course not on par with the more sophisticated layout tools (yet?), but it is surprising how much you can already do.

If you like CSS, LaTeX, or a little bit of coding you should definitely check it out. The post here has everything to get you started, thanks @WindowDump !

Whoops, knew I missed something when I was collecting links! This post inspired me to make a Typst pamphlet, which was a lot of fun.

Ooh, how exciting! A new toy. :slight_smile:

There’s been a lot of activity in this PR lately. This would at least make progress towards enabling users to embed color profiles in their exported PDFs which is a requirement for print-on-demand services. :crossed_fingers:

1 Like

I got inspired by Orbital Blues and its wonderful typography to make a character sheet that I could also use to track my campaign for it. Character (& ship) sheet template and sample which can be filled in directly in Typst for pregens or on-screen tracking, or filled with placeholder values for a printable version. See the generated PDF for an example of a filled in sheet.

Speaking of printer-friendly, in my quest for single source, multiple variations, I dug into the context expression and wrapped my head around it, so the lines on the sheet are the same color as the text. This makes it easy to make a printer-friendly version that gets the same style and layout tweaks as the pretty color version.

Notable features:

  • Characters are Typst dictionaries, pass them to the sheet function to get a sheet. If you pass in content you can click on the preview to go to the same line
  • Option for character’s Heart to use table-friendly boxes or screen-friendly text.
  • Lines used in the sheet are the same color as the text, with the power of context.
  • Page template with set and show rules, and arguments to set page background and text fill colors.
  • Wacky hacks to get around Montserrat having every alternate character in the same stylistic set when I only want the Q and G.

Hot Typst tip: the context statement returns content, not code, not dictionaries, not arrays, etc. If you need context (ie, to get page.fill or text.fill), wrap the closest content type with it.

1 Like