Skip to main content
Logo Triophore
What is Typst a brief tutorial

What is Typst a brief tutorial

If you’ve spent any time in academia or technical writing, you know the "LaTeX tax": massive 5GB installations, cryptic error messages, and compilation times that feel like an eternity.

Typst is the modern answer to that struggle. Written in Rust, it’s a markup-based typesetting system that is as powerful as LaTeX but as intuitive as Markdown. In this tutorial, we’ll walk through the basics of Typst so you can go from a blank page to a professional PDF in minutes.

Why Choose Typst?

Before we dive into the code, here is why Typst is making waves in 2025:

  • Instant Preview: It compiles in milliseconds. You see changes as you type.
  • Built-in Scripting: No more "macro hell." Typst uses a real, readable programming language.
  • Single Binary: No massive distributions. Just one tiny executable.
  • Friendly Errors: It actually tells you what went wrong and where.

Getting Started: The Basic Syntax

Typst uses three main modes: Markup, Math, and Code.

Markup Mode (Default)

Markup is where you write your text. It feels a lot like Markdown but with more control.

Code snippet

= Introduction
In this paper, we explore the *efficiency* of Rust-based compilers.

- Fast compilation
- Native Unicode support
- Modern font handling

Math Mode

Surround your equations with $. If you add spaces inside the dollar signs (e.g., $ x^2 $), it becomes a block equation. Otherwise, it stays inline.

Code snippet

The area of a circle is $A = pi r^2$.

$ sum_(k=0)^n k = (n(n+1)) / 2 $
Copied!


Code Mode

Prefix commands with a # to enter code mode. This is used for functions, variables, and styling.

Code snippet

#let name = "Typst"
Welcome to #name!
Copied!


Styling with "Set" and "Show" Rules

In LaTeX, you often need complex packages to change a font. In Typst, you use Set Rules to define defaults and Show Rules to transform elements.

The Set Rule (Defining Defaults)

Think of this as setting your document's global properties.

Code snippet

#set page(paper: "us-letter", numbering: "1")
#set text(font: "Linux Libertine", size: 11pt)
#set heading(numbering: "1.1.")

= This heading is now numbered!
Copied!


The Show Rule (Deep Customization)

Show rules allow you to change how an element looks throughout the entire document. For example, if you want all your headings to be navy blue:

Code snippet

#show heading: set text(navy)

= I am navy blue
Copied!

Organizing Complex Documents

For larger projects like a thesis or a book, you don't want everything in one file. Typst makes importing and templating easy.

Creating a Template

You can wrap your styling in a function and save it as template.typ:

Code snippet

// template.typ
#let project(title, authors: (), body) = {
  set document(title: title, author: authors)
  set page(margin: 2cm)
  
  align(center)[
    #text(2em, weight: 700)[#title]
  ]
  
  body
}
Copied!


Using the Template

In your main.typ, you simply import and apply it:

Code snippet

#import "template.typ": project

#show: project.with(
  title: "A Study on Fast Typesetting",
  authors: ("Alice", "Bob"),
)

= Introduction
Now we can start writing our content...
Copied!


Visuals: Images and Tables

Tables in LaTeX are famously difficult. In Typst, the table function is remarkably logical.

Code snippet

#figure(
  table(
    columns: (1fr, auto, auto),
    inset: 10pt,
    align: horizon,
    [*Feature*], [*LaTeX*], [*Typst*],
    [Speed], [Slow], [Instant],
    [Syntax], [Complex], [Intuitive],
  ),
  caption: [A comparison of typesetting tools.],
)

#image("diagram.png", width: 80%)
Copied!

Next Steps

Typst is evolving rapidly. The best way to learn is to use the Typst Web App for a zero-install experience or install the CLI and use the VS Code extension for local development; we will discuss that in upcoming tutorials.

visit official website of Typst and the official Github repo