This is the first big update for Typst, a new markup-based typesetting system for the sciences. Typst has been in preview since late December 2022. Since then we've been busy building a new math mode and improving our web app.

The time since we have started our preview test late last year has been incredible for us: After all the time we developed Typst more or less in secret, it has been wonderful to see people learn, test, and discuss it. We've heard many positive voices on our Discord server, but have also gotten tons of helpful feedback, feature request and bug reports! Some people have created practical documents and templates for CVs, commutative diagrams, or volunteer schedules with Typst. Others wrote fun experiments like Conway's Game of Life, an interactive PDF game, and even a raytracer.

But there is one thing we have heard time and again: To be used for research and university, Typst needs proper math typesetting. While the existing math mode demonstrated how we imagined math to work in Typst, it was very limiting and broken in myriad ways. Today, we deliver on the original promise of Typst's math mode: We are releasing a large update with a completely rebuilt math mode, lots of new features and tons of bugfixes. Apart from math, this update also contains improvements to the collaboration & editing experience in our web app. Let's get into it!

Hash Syntax

First of all, an important breaking change to Typst's syntax: The hash syntax in markup has been expanded to support more expressions (including field accesses, method calls, strings, parenthesized expressions, and blocks). At the same time, code and content blocks now require a leading hash. Curly braces and balanced square brackets directly in markup are now displayed verbatim. This change makes code even more comfortable to embed into markup and brings more consistency between expressions in markup and math. As a further improvements, we changed the import syntax so that the path comes before the import items, enabling autocompletion for the items. For more details on these changes, see the updated scripting page.

#false \
#emoji.face \
#"string".len() \
#(1 + 2) \
#{ let x = 3; x + 4 }
Preview

New Math Mode

With this out of the way, let's get to the math mode! Previously, Typst's math mode used ReX internally, a library that replicates TeX's math layout in Rust. As of today, we no longer depend on ReX. Instead, we have implemented our own, fully custom math typesetting. This new engine brings many improvements, including better symbol support, text operators, smart delimiter matching, multi-line alignment and matrices. Furthermore, mathematical formulas can now use all of Typst's regular functions and contain all kinds of content (e.g., images).

Symbols

With this update, we removed the special symbol syntax. Rather than having custom and hard-to-extend syntax, symbols are now normal values. Typst defines many useful symbols in the sym and emoji modules, but you can also define your own with the symbol function. The linked documentation pages also feature our new symbol picker.

#sym.arrow.r \
#emoji.face.halo \
$alpha^2 lt.eq.not Delta$
Preview

The new symbol system retains the concept of symbol modifiers, but they are now applied using the field access syntax, as in arrow.r.long. This shrinks the syntax surface and is less visually noisy than the colon that was used before. Another improvement we made is with accent symbols. To attach them to a base, you can now call them like functions instead of using the accent function.

$tilde(n)$
$arrow(A)$
$accent(A, ->)$
$accent(A, arrow)$
Preview

Text Operators

Typst now predefines well-known operators like lim and sin. Arbitrary text operators can be created with the op function. This function ensures correct spacing and control over placement of scripts/limits.

$ tan(x) = (sin x)/(cos x) $
$ lim_(n->oo) 1/n $
Preview

Delimiter matching

Delimiter usage in math is tricky. Typically, pairs of mirrored delimiters are used, but it's also common to pair different brackets (e.g. $[a, b)$) or non-mirrored brackets (e.g. $]a,b]$). Typst's new math mode automatically matches and scales pairs of opening and closing delimiters, but also allows you to (1) prevent scaling by escaping the brackets, and (2) manually match two arbitrary brackets with the lr function. This function also allows you to take exact control over the delimiter sizes: This comes in handy for instance when typesetting sums, where automatically scaled brackets might be overly large.

$ (a/2 + b) = |x/2| $
$ lr(]a/2]) $
$ lr((sum_a^b), size: #70%) $
Preview

Multi-line alignment

Math mode now supports multi-line math with alignment points. Insert a line break with the backslash (\) and an alignment point with the ampersand (&). You can also use multiple alignment points within each line to align at multiple positions.

$ sum_(x=0)^n
    &= 1 + ... + n \
    &= (n(n+1)) / 2 $
Preview

Matrices

We've now also added matrices in addition to vectors. As these are 2-dimensional in nature, some indicator is needed to separate rows. For this, Typst's math mode gained the new semicolon syntax that turns the preceding arguments into an array. The matrix function itself is blissfully unaware of this, it simply takes an arbitrary number of arrays as arguments. This also makes it easy to create matrices entirely from code!

$ mat(
  1, 2, ..., 10;
  2, 2, ..., 10;
  dots.v, dots.v, dots.down, dots.v;
  10, 10, ..., 10;
) $

#let data = ((1, 2, 3), (4, 5, 6))
#let matrix = math.mat(..data)
$ v := matrix $
Preview

And More ...

Typst's new math mode has many other new features, including:

  • Non-square roots
  • Under- and overbraces, -brackets, and -lines
  • Control over whether attachments display as sub/superscripts or limits
  • Manual spacing with h and predefined thin, med, thick, and quad spacings
  • Support for different text colors
  • Support for alternative math fonts through:
    #show math.formula: set text("Fira Math")

Also, there's this other kind of math you might wanna do. Where you really calculate things. Typst's new calc module equips you with the functions needed to do that.

Editing

But math isn't all we've been working on. We have also developed something really cool: Tooltips now let you peek into your code. If you hover over a variable name in your Typst source code, you can see all the values it ever takes on! Similarly, hovering over a for-loop shows a tooltip with the loop's value. This comes in handy when you use Typst's scripting capabilities and takes debugging your automations to the next level. Forget print debugging. Just hover over your values and see what's going on.

We also made autocomplete smarter: It now completes local variables and is aware of their values and types. The autocomplete panel shows dictionary keys, module definitions, and methods on values. Furthermore, it helps you select the right symbol by offering all available modifiers for a symbol after you entered a dot behind the symbol name.

Ever wondered what fonts you can use with Typst? We've added a font picker with previews to the editor. Just press the Ag icon button to check out the list of available fonts. Note that we are not displaying all global variants of the Noto and IBM Plex fonts to keep things concise, but they of course remain accessible with the text function.

Cloud

Last but not least, there are a couple of new features and improvements we have already rolled out int the past weeks.

Link sharing offers new opportunities for collaboration on single documents: Need to write a group report for class? Do you want a colleague to review your paper? You can use the share button in the editor to create share links that you can distribute to grant access to your project. At the moment, the receivers of the share link also need a Typst account, but we will add anonymous access in the future. In the meantime, you can find collaborators in our Discord community, or, if you do not have access yet, be sure to sign up for the wait list and join our Discord anyway!

We have also improved the reliability of all of Typst's components. Be it unusual or fast input or bad internet connections, Typst should now be able to deal with it better. To improve the user experience, Typst further gained more keyboard shortcuts (with indicators in the menus) and descriptive tooltips on all icon buttons.

That's it for the first update after the infrastructure test started. What's your favorite feature in this release? Is something you need still missing? We'd love to hear from you on the Discord or by tweeting at @typstapp. For a comprehensive overview over the changes in this update, also see the changelog.