00| Introduction to Typst Tutorial

Miles Robertson, 05.17.25

Introduction

Typst (pronounced like "types" with a "t" at the end) is a powerful typesetting language with a thriving online community and many passionate users. A typesetting language allows users to write commands to create a document. You are likely more familiar with typesetting programs that use graphical interfaces, like Microsoft Word and Google Docs. Given that typesetting can be an abstract concept to understand at first, I will give an example of a project that you might do in MS Word:

You would like to make a resumé that outlines your previous job experience. You would like each entry to include a job title, the period of time worked, the company name, and a job description, which you want to be organized like this:

Job descriptionMM, YYYY - MM, YYYY
Jobname, Inc.
Lorem ipsum dolor sit amet, consectetur adipiscing elit. Sed elit purus, fringilla ut magna ut, aliquet ultricies felis. Nullam nec nunc ultricies, gravida lectus volutpat, feugiat diam. Donec at sodales massa, nec sagittis lectus. Donec enim arcu, interdum et neque eu, auctor consequat ligula. Etiam ultricies ullamcorper sagittis.

You want to use this format for every entry in your resumé. Think about how you would you do this in a program like MS Word. One way is like this:

  1. Create a table with two columns and three rows
  2. For the second and third rows, merge the two cells to be one
  3. Make the table borders invisible
  4. Enter in some dummy text like what you see above as placeholders
  5. Bold the font for the two cells in the top row, italicize the font for the cell in the second row, and shrink the font size slightly for the third row cell

Then, you could copy and paste this table as many times as you have job entries, and fill in each one as necessary.

Admittedly, making a resumé as described above might work just fine for your needs. However, there are some issues with MS Word and Google Docs that might have infuriated you in the past:

Because of these issues, it is very possible that you will end up with a product that took you a long time, is not quite how you want it to be, and left you feeling frustrated. Unfortunately, MS Word and Google Docs are really doing the best they can, as almost all of these problems are things that are inherent to typesetting programs that use graphical editing. However, all of these outlined issues can be circumvented with a typesetting language. Look at the code below for an example of how you might complete this same resumé in Typst, and the image that follows that shows how this looks when rendered:

#let resume-entry(title, time, company, description) = [
  *#title #h(1fr) #time* \
  _#company;_ \
  #text(10pt, description)
  #v(1cm)
]

#resume-entry(
  "Customer Experience Associate",
  "2019 - 2023",
  "BrightMart Superstore, Atlanta, GA",
  "Helped train new hires on POS systems and service standards."
)

#resume-entry(
  "Sales Floor Team Member",
  "2016 - 2019",
  "StyleHub Clothing Co., Charlotte, NC",
  "Recognized twice as Employee of the Month for outstanding service."
)

#resume-entry(
  "Cashier & Customer Support",
  "2014 - 2016",
  "FreshHarvest Market, Tampa, FL",
  "Played a key role in maintaining smooth front-end operations during peak hours."
)
a resume example

Although this code is unfamiliar to you, take a moment to just see if you can understand the basic idea of what is happening here. At the top, this resume-entry variable is given a definition that tells it what to do when given four different things. Then, resume-entry is used for three different job entries, which are all rendered to the final document. (I will briefly note that this example is a few steps ahead of where we will start, so don't think you are already lost!)

I hope that you can see at least some of the ways that a typesetting language can sidestep the issues discussed above. Instead of clicking and typing on the document directly, you can provide a set of instructions on how you want your computer to create the document. There are some important benefits to note here:

Several typesetting languages exist, but far and away the most popular one is called LaTeX. It was first developed in the 1980's, and has been maintained and modified by many people over the years. It is a terrific program and has played a pivotal role in many professions, but has several shorcomings. If you are familiar with LaTeX or are interested in what those shortcomings are, I will list them here: (1) The syntax used is clunky and inconsistent, making it hard to learn and leaving most users to rely on lots of googling to get their desired stylings. (2) It is woefully slow at generating documents. (3) Users must rely on several other imported code packages to have even the most basic funcitonality, such that you almost always need a long and complex template document to start writing. (4) Documentation is scattered across different organizations and websites. (5) It is hard to get help with LaTeX on the internet. Forums exist, but often have low activity.

The creators of Typst, two graduates from a Berlin university, say that "Typst was born out of our frustration with LaTeX. Not knowing what we were in for, we decided to take matters into our own hands and started building." Several years later, this hobby project has become an internationally-used tool. Typst is fast, well-maintained, and intuitive, and I hope you will fall in love with it like I did.

In this chapter, I will tell you how I hope you use this tutorial and introduce some basic concepts about using Typst. This tutorial is written for absolute beginners, no previous coding or typesetting experience necessary!

How to Use This Tutorial

There is a lot of reading and learning to do in this tutorial. Everyone wants the easiest way to learn a topic, but generally, learning just takes some amount of unavoidable work. I believe that hesitancy to learn new things is largely based on the fear of failure. However, I want to assure you that with some hard work, you are completely capable of learning coding.

There are a lot of code snippets in this tutorial, as in the resumé example above. Every time you see a code snippet like this as you are reading, you should type it into a Typst document (how to do this is explained later). I will emphasize that you should type it in by yourself, instead of copying and pasting. In fact, I have disabled copying for code snippets unless otherwise stated (please don't hate me). Typing out code is different from reading it: you catch little nuances in code when you type that you completely miss if your eyes just skim the structure. In real life coding experiences, those little nuances are pivotal for your success.

Similarly, when you get a curiosity about how something works, try it out! Learning Typst is fun to learn in part because you can test out new concepts and get immediate feedback. There are only a few things in this world that give opportunities for learning in this way.

Workflow and Conventions

Generally, when people start learning a coding language for the first time, they approach coding projects like I approached French class in high school: with blind repetition and without a drive to understand underlying concepts. However, I hope to introduce coding topics in a way that allows you to understand what you are doing every step of the way, so that you can build on what you already know.

Typesetting coding is a little less intricate than other coding projects, so it does not require as much planning ahead. However, having good organization in your code makes it easy to modify later. This will be discussed later in the tutorial, as you do not have to write any scripting code to make a basic Typst document.

Keyboard Shortcuts

Unless you have made a concerted effort to learn keyboard shortcuts (i.e., pressing a few keys to perform certain functions), you likely do not use them frequently. However, you may be surprised to learn that using the mouse is at minimum ten times slower than using keyboard shortcuts. Although a single instance of moving a mouse to a button and clicking is negligible, that time adds up fast when you need to do that hundreds of times to edit a document of any kind. The downside to keyboard shortcuts is that you have to learn and remember them. That might not seem all that attractive of a trade-off, but trust me when I say that you will be glad to learn even a few keyboard shortcuts. I want to introduce you to a few keyboard shortcuts are particularly time-saving. I hope you pick a two or three to learn and try to use them while coding.

The Basics


ActionWindows
Shortcut
MacOS
Shortcut
Select All TextCtrl + ACmd + A
Undo Last ActionCtrl + ZCmd + Z
Cut Selected TextCtrl + XCmd + X
Copy Selected TextCtrl + CCmd + C
Paste Text from
Clipboard
Ctrl + VCmd + V

Move Cursor, Select Text


ActionWindows
Shortcut
MacOS
Shortcut
Move Cursor to
Beginning of Line
Fn + LeftArrowKey
or
Home
Cmd + LeftArrowKey
Move Cursor to
End of Line
Fn + RightArrowKey
or
End
Cmd + RightArrowKey
*Select Character
to the Left
Shift + LeftArrowKeyShift + LeftArrowKey
*Select Character
to the Right
Shift + RightArrowKeyShift + RightArrowKey
Select All Text to the
Left of the Cursor
Fn + Shift + LeftArrowKey
or
Shift + Home
Cmd + Shift + LeftArrowKey
Select All Text to the
Right of the Cursor
Fn + Shift + RightArrowKey
or
Shift + End
Cmd + Shift + RightArrowKey

* For these shortcuts, you can hold shift and keep pressing the arrow key to select several characters.

Text Editing

These shortcuts work with several text editors, including Typst's online app.

ActionWindows
Shortcut
MacOS
Shortcut
Move Current Line
Up One Line
Alt + UpArrowKeyOption + UpArrowKey
Move Current Line
Down One Line
Alt + DownArrowKeyOption + DownArrowKey
Add Multiple Cursors
for Simultaneous Editing
Alt + LeftClick Option + LeftClick

Online Resources

There are several online resources that can help you learn about Typst. No matter which you use, try to understand what you find on the internet instead of blindly copying it. Here are some of my favorite resources:

Conclusion

Typesetting is an incredible tool, and is worth your attention. It is empowering and will help you present your ideas well. I have made this tutorial in hopes to provide you with a resource to help you learn Typst from scratch, which is more achievable than you might think. With diligent efforts, I believe everyone can get a grasp on these topics. Have fun and explore your curiosities!