by David Pardue (kalwisti)
Although my educational background is not in STEM, I have been using LaTeX for approximately seventeen years. I am a fan of its typesetting capabilities but try not to be a LaTeX evangelist — or a LaTeX snob. I keep an open mind towards possible alternatives; I have dabbled with the LyX document processor (which uses LaTeX as its typesetting engine) as well as the GNU TeXmacs scientific editor (not based on LaTeX but inspired by it). I am aware of the SILE typesetter (which contains a port of the TeX line-breaking algorithm) as well as the old-school groff (also known as GNU roff) typesetting system. To date, I have not yet experimented with either SILE or groff.
A newcomer on the scene is Typst (IPA: /taɪpst/, “Ty” like in Typesetting and “pst” like in Hipster). It is a markup-based typesetting system that is designed to be as powerful as LaTeX, while claiming to be much easier to learn and use. I was hesitant to try Typst because I was not sure how much LaTeX I would have to unlearn in order to acquire a basic knowledge of Typst. However, after reading many positive comments about the application, I became convinced to dive in. In this article, I will provide an overview of Typst and describe my experience with it from the perspective of an (intermediate-level) LaTeX user.
I should mention that Typst is not currently in the PCLinuxOS repositories. It is possible to install the Typst compiler and its CLI locally; I will cover that procedure in next month's article. In the meantime, the most comfortable way of using Typst is to sign up for its online app at https://typst.app/. It furnishes an integrated IDE-like experience with autocompletion, syntax highlighting and instant preview. Another advantage of the web app is that you do not need to install anything on your computer.
Typst has adopted a freemium pricing model; their Free plan offers basic features (enough to use it productively) while the Pro plan provides extra functionality and storage for a subscription fee ($7.99 US per month or $79.99 US per year).
Origins of Typst
Typst was created by two computer science graduates: Martin Haug and Laurenz Mädje. They began developing Typst in 2019, due to their frustrations with LaTeX. Typst started as a hobby project, but it has since grown into a full-fledged typesetting system. Haug and Mädje founded the startup Typst company in 2023, with headquarters in Berlin. Haug presents Typst's history in more detail, in his talk “LaTeX: It's Not You, It's Me” (presented at the Ubuntu Summit [Nov. 2023, Riga, Latvia]). Mädje wrote his Master's s thesis, “Typst: A Programmable Markup Language for Typesetting” (2022), using the new Typst software. Haug also wrote his Master's thesis, “Fast Typesetting with Incremental Compilation” (2022), on the topic of Typst.
Typst is funded by the Technical University of Berlin [Technische Universität Berlin], the State of Berlin and the European Union (through the European Social Funds).
Typst is not a wrapper around TeX, nor is it a “better implementation” of LaTeX. It is written in Rust and is a completely different software. Typst is open-source, with the compiler and CLI available on GitHub under an Apache 2.0 license. The libraries created for Typst, such as svg2pdf, biblatex, and pdf-writer are also open source.
It is important to remember that Typst is a work in progress, under rapid development. (In fact, Typst was just updated to ver. 0.12.0 while I was preparing this article.) Although the developers have been very responsive to user feedback, Typst lacks the complete, rich feature set of LaTeX and its package ecosystem lags far behind that of TeX and friends. Nevertheless, considering how young Typst is, my experience with it was positive.
Advantages over LaTeX
Typst claims to have several advantages over LaTeX, such as:
Intuitive and easy to learn. I believe the easiest way to get started with Typst is to register for the free web app and work through the four-chapter online tutorial. I estimate that, working slowly, it took me approximately two hours to complete.
If you're already familiar with LaTeX, there is a Typst quick-start “Guide for LaTeX Users” which explains the main differences between these two typesetting systems.
Once you have acquired the basics, you can consult Typst's thorough online documentation for reference. Help is also available via Discord or the recently created user forum.
Although there is a learning curve with Typst, my impression thus far is that it is less steep than learning LaTeX (which one Reddit commenter succinctly described as “high-effort/high-reward”).
Typst's live, incremental compilation allows you to preview your changes instantly. Based on my experience, this claim is accurate. Typst compiles faster than LaTeX; compilation typically takes milliseconds rather than seconds.
Typst provides clear, understandable error messages. This claim is also true. Although I enjoy using LaTeX, I admit that error messages are one of its “pain points.” Users quickly become familiar with common error messages, but non-trivial errors can be difficult to interpret. (If I had a nickel for every LaTeX error that I have generated over the years, I would be a multimillionaire!)
As a small example, let us compare a simple/common LaTeX error message (taken from within my Overleaf account) to a Typst error message.
In the screenshot below, I intentionally omitted the closing square bracket of the item in LaTeX's description environment. (It should be “ \item[YAML] “):
Overleaf's editor alerts me that there is a problem by displaying a red circle in the left margin. When I view the log file, I see this:
LaTeX categorizes the error as a “Runaway argument?” and states that the “ \@item “ is incomplete but does not suggest how I can fix it.
Typst's error messages try to guide you towards a solution. In the screenshot below, while experimenting with the term list function, I intentionally omitted the mandatory colon following the term. (It should be “ / YAML: “)
Typst not only notifies me of the error, but also helpfully suggests that a colon is expected in this environment:
There is also a pop-up dialog that appears in the web app's interface:
Typst has a consistent styling system for configuring everything from fonts and margins to the appearance of headings and lists. Also, Typst uses familiar programming constructs instead of hard-to-understand macros. Functions are written in a nice, JavaScript-like programming language.
For bibliography and reference management, Typst uses either the new bibliography file format called Hayagriva (which has the extension .yml), or a traditional BibLaTeX .bib file. The Hayagriva YAML file format is described here. (I did not have enough time to experiment with Hayagriva, but I used a sample .bib file, which worked fine.)
A Glimpse at Typst's Structure
A complete description of Typst's structure is beyond the scope of this introductory article. As a non-programmer, I also lack in-depth knowledge to understand all of Typst's programming concepts. Therefore, I will try to offer only a glimpse at a few characteristics of the system.
Like LaTeX, Typst is a markup-based typesetting system. You compose your document in a text file and mark it up with commands and other syntax. Then, you use a compiler to typeset the source file into a PDF.
However, Typst's creators made design decisions which differ from LaTeX. For instance, Typst uses markdown syntax instead of commands for common tasks. To italicize a word or phrase, Typst uses single underscores (as shown below):
_lorem ipsum_ |
produces the output |
lorem ipsum |
Whereas LaTeX uses this command:
\textit{lorem ipsum} |
produces the output |
lorem ipsum |
To boldface a word or phrase:
Typst: |
*dolor sit* |
produces the output |
dolor sit |
LaTeX: |
\textbf{dolor sit} |
produces the output |
dolor sit |
LaTeX has 'environments' to create different sorts of lists: itemize (for bulleted lists), enumerate (for numbered/ordered lists), and description (for lists labeling each entry item). In contrast, Typst uses markdown (as shown below for a bulleted/itemized list):
+ Fast
+ Flexible
+ Intuitive
Typst differentiates between markup mode and code mode. The default is markup mode, where you compose text and apply syntactic constructs such as *asterisks for bold text*. Code mode, on the other hand, parallels programming languages like Python, providing the option to input and execute segments of code.
Within Typst's markup, you can switch to code mode for a single command (or rather, expression) using a hash (#). This is how you call functions to, for example, split your project into different files or render text based on some condition, e.g., Let me show how to do
#underline([_underlined_ text] produces Let me show how to do underlined text.
#underline([_underlined_ text] produces Let me show how to do underlined text.
Typst has functions that insert content (for example, the image function shown below):
while other functions manipulate content that they receive as arguments (e.g., the align function):
Typst's online documentation includes a full syntax cheat sheet, available at https://typst.app/docs/reference/syntax/.
Another significant difference between the typesetting systems is that LaTeX uses different document classes (article, report, book, letter, etc.) to define how your document is supposed to look, whereas Typst styles your document via functions. Typically, you use a template that provides a function that styles your whole document. First, you import the function from a template file. Then, you apply it to your whole document. This is accomplished with a 'show rule' that wraps the following document in a given function. The following example illustrates how it works:
Typst's Web App
Although the Typst compiler (its core typesetting engine) is open-source, the web app is proprietary and closed-source. Since it is difficult to make money from an open-source project, the Typst developers believe that subscribers' fees for the Pro plan will help sustain the project in the longer term. (However, the developers promise that the web app will always have a free tier option.)
The web app is efficiently designed and was inspired by Overleaf's interface (in my estimation). A screenshot of Typst's user interface appears at the beginning of this article; it has a two-pane layout, with your source file (document) in the left pane, and a preview of the compiled document in the right-hand pane.
Dashboard
After logging in to the web app, you will land in the Dashboard area, which displays thumbnails of your Typst projects:
Create a New Document
If you want to create a new document, you can either start from scratch (by clicking on the Empty document button) or you can choose an option from the drop-down Start from template button (shown below):
Clicking on the Start from template option will open a new pop-up window which displays thumbnails of templates from Typst Universe. You can filter the list by category (report, paper, thesis, presentation, CV, etc.) and/or discipline (biology, chemistry, engineering, mathematics, physics, etc.).
One of the options is Start from a file; this allows you to import a file and convert it to Typst format (.typ). Supported file formats are: .docx, .md [markdown], .tex and .odt. This feature is labeled as “Experimental” and a pop-up cautions users that “Conversion may not result in the best Typst files, but it is a good starting point.”
I experimented with importing a LaTeX file (.tex) and a LibreOffice Writer file (.odt). Neither file contained images, and their formatting was straightforward. My .odt file was fine; however, the .tex file was not parsed correctly and a small data chunk was lost. (The source file had an itemized list within a paragraph [accomplished with LaTeX's paralist package]). The Typst converter apparently did not recognize the “inparaenum” environment or know how to process it.)
Toolbar (Left Margin, Upper)
In the upper left margin of the interface, there are three icons.
Explore files [File drawer icon]:
Clicking on this icon opens a new panel in which you can view files associated with your project. In the screenshot above, you can see that in addition to my Typst document (main.typ), I uploaded three image files (.png) as well as a BibTeX bibliography file.
Show outline [Icon of multifold brochure]:
Opens a new panel and displays an outline of your document. The screenshot above shows that my test document has nine sections.
See issues and suggestions [Pencil icon]:
Opens a new panel and displays Typst error messages (with suggestions how to correct the error(s)), reader comments (if you have a paid Typst Pro subscription) as well as misspellings (if you activated the “Enable spellchecking” option in the editor).
Top Toolbar (Upper Left)
On the left side of the toolbar, there is a series of eleven buttons. All buttons have tooltips, so when you hover your cursor over the button, a brief explanation pops up.
The buttons function as follows (proceeding from left to right):
Change Font:
Currently, 119 fonts are available — including various math fonts (such as Fira Math, Lete Sans Math, New Computer Modern Math and the TeX Gyre math fonts [Bonum, Pagella, Schola, Termes]).
Toggle strong/bold text
Toggle emphasized/italic text
Toggle underlined text
Change heading levels:
Changes the heading level from Section to Subsection, then to Subsubsection, etc.
Toggle list:
Creates a bulleted list item (by adding a “ - “ sign)
Toggle enumeration:
Creates a numbered list item (by adding a “ + “ sign)
Toggle math mode:
Adds two dollar signs (” $$ “) for an inline equation environment.
Toggle code block:
Adds two backticks (” \\ “) for a 'raw text' environment. This will display the text verbatim and in a monospace font — typically used to embed computer code in your document.
Insert Reference
Add comment:
This feature is only available to paid subscribers with the Typst Pro plan.
Top Toolbar (Middle)
In the middle of the toolbar, you see three buttons:
Scroll preview to cursor position [Curved down arrow icon]:
This will scroll your preview to match the cursor position in the document editor (i.e., the left-hand pane).
Zoom options [Minus sign, 100%, Plus sign]:
Zoom out or zoom in the displayed preview.
Show preview in popup [Icon of pop-up window with border]:
Displays a preview of your current document in a separate, pop-up window.
Top Toolbar (Right)
In the upper-right corner of the toolbar, there are three buttons:
Share button:
Permits sharing your document with someone else.
Typst allows collaboration via link sharing. Users can create share links (either read-only or read-write) for a document, enabling others — such as a thesis supervisor or co-author — to access the document. However, Typst's free version does not have a built-in comment feature (similar to Overleaf's) which allows collaborators to leave reader comments directly within the document.
I tested this feature by sharing a read-write link with myself (under a different username/e-mail address). It worked fine; after opening the link in an e-mail message, I was taken directly to the shared document and could begin editing its content. No separate login was required.
Backup button:
Downloads a zipped copy (.zip) of your current Typst project.
Quick export PDF [Down arrow icon]:
This button immediately exports your compiled PDF and downloads it to your computer.
Clicking on the right-hand portion of the button triggers a drop-down menu with the options: Export as PDF, PNG (or) SVG
Toolbar (Left Margin, Lower)
Three icons are found in the lower left margin:
Open Settings [Gear icon]:
If you are in the Dashboard display, i.e., with no open/active document, you will see settings related to your account, the theme chosen, amount of storage, etc. (Typst's free tier provides 200 MB of storage.)
If a document is open/active, you will see information such as the project name, Typst compiler version, editor font and font size and spellchecker status (on/off).
Typst Universe [Icon of planet Saturn]:
Allows you to explore packages and templates to enhance Typst.
Help [Question mark icon]:
Opens the Typst Documentation website in a new browser tab.
Information Privacy
If you are concerned about information privacy, Typst's policy — in part — states: “Your data is stored in a Microsoft Azure data center in Germany and encrypted at rest … We can access your documents, but do so only to fix problems on your request or to enforce our terms of service.”
You may disable telemetry, if you wish, by clicking on the Gear icon [Open Settings] in the lower-left pane of the editor > then look for the section labeled Telemetry. Uncheck/untick the Enable telemetry box:
Challenges for Typst
For Typst to compete with LaTeX, scientific journals must start accepting submissions in .typ format. That will probably not happen anytime soon because academia is conservative. (La)TeX has a very well established ecosystem, professors frequently collaborate with it and experienced faculty prefer the tool that they know: LaTeX. For a commercial journal that already accepts LaTeX, there is little incentive to justify the extra cost of accepting Typst submissions as long as there is no large, influential user base demanding it.
Exporting a Typst .typ file to LaTeX format (.tex) is not possible. Martin Haug closed this issue on GitHub in April 2023 and classified it as “not planned,” writing: “We will not directly support LaTeX export as Typst is just too different to provide a satisfactory high-quality conversion. However, the Pandoc project might work on adding a reader for Typst files that will allow medium-fidelity conversion to LaTeX. Alternatively, an approach could be to directly convert the eventual HTML output.”
There is a (partial) workaround; user nullst commented that Pandoc has a working “Typst reader”, which means that it can be used to convert Typst code to LaTeX (as well as to HTML, Markdown, and many other formats). However, he noted that conversion is rather lossy, and that moderately complicated documents usually cause parsing errors in Pandoc's reader.
Typst uses its own syntax for math notation. If you are an experienced user who is accustomed to LaTeX's math syntax, switching to Typst's syntax will require some relearning. After browsing a few Reddit discussions on this topic, I conclude that opinions are mixed. Some people believe that Typst's math syntax is cleaner and easier to write; others argue that LaTeX's math syntax is almost universal at this point and/or they spent so much time learning the standard, that they are unwilling to change to anything different.
Users cannot yet draw complex images like with the TikZ package in LaTeX. However, the CeTZ package in Typst is a library for drawing and plots, which was inspired by TikZ (although not yet as powerful as TikZ). Typst's Touying package for creating presentation slides is similar to the Beamer class in LaTeX.
Typst currently lacks the ability to export as HTML and ePub, but they are listed as planned features on the development roadmap.
Typst does not support including PDFs as images. (In LaTeX, vector graphics are often inserted as PDF or EPS files.) Neither of those formats are supported as an image format in Typst; the developers acknowledge this as a limitation because many journals require that figures be submitted in PDF format. They recommend the workaround of converting PDF and EPS images into SVG files with online tools or Inkscape. The Typst web app automatically converts PDF files to SVG files when they are uploaded.
As a brief aside, I would like to dispel the notion that LaTeX development is stagnant. Recent developments include the LaTeX Tagged PDF project, which extends LaTeX to allow the creation of accessible PDFs for people with visual impairments. LaTeX2e (the latest stable version) is typically released once a year; if you are interested in reading technical details of the changes, they are explained in a release newsletter.
Is Typst for You?
I cannot answer that question, unfortunately; the answer depends on your workflow and the type of writing you do. Based on my experience, Typst seems well suited to writing scientific articles, math papers, theses, reports and/or technical documentation — the sorts of documents that include equations, tables, figures, bibliographical references, etc.
If you need a typesetting program, are just starting out and only need PDF output, Typst is a good alternative since it is easier to learn than LaTeX. If you are already familiar with LaTeX, that will work to your advantage, and you should be able to learn Typst fairly quickly. Although I do not plan on abandoning LaTeX, I definitely plan to experiment more with Typst. If you are a LaTeX user who relies heavily on specific packages, I suggest that you research beforehand whether Typst supports that functionality.
I am very impressed with Typst and believe it is worth your time — and effort — to explore. I cannot predict Typst's future or potential market share, but its developers have accomplished a tremendous amount in a relatively short time. (We should recall that Donald Knuth originally estimated TeX development would take six months, but ultimately it took nearly ten years!)
I will conclude with the advice that regardless of which typesetting platform you choose, focus on your content first and worry about formatting/layout later.
Additional Resources
YouTuber BamDone [Isaac Weintraub] has produced a series of videos on Typst. The tutorial below is well-structured and informative; it walks you through the process of creating a document in Typst (using the web app). Instead of relying on a template, the presenter demonstrates the syntax / code blocks that you need to accomplish these tasks.
“Getting Started with Typst: Some Basics.” YouTube, 5 Apr. 2024. (47 min., 55 sec.)
User sitandr has written an extended tutorial for Typst; it is a book of educational examples / code snippets. He cautions that the book is unofficial and that although he will try to keep it current, it may contain some outdated information. (Nevertheless, I found his tips helpful.)
For LaTeX users, there is a handy five-page cheat sheet, created by Jianrui Lyu, which lists equivalent Typst function names for LaTeX commands: “Equivalent Typst Function Names of LaTeX Commands.”
Typst already has built-in support for the functionality of several popular LaTeX packages. The table below (reproduced from here) shows frequently loaded packages and their corresponding Typst functions:
If you are interested in seeing a sample of Typst-generated output, I tried to replicate this article using Typst. I have uploaded the PDF [14 p., 1.1 MB] to my PCLOS Cloud account and shared it from there.
Although the formatting could undoubtedly be improved by someone with more knowledge of Typst, this document shows what you can accomplish even at the introductory level.
Good luck, and enjoy exploring Typst!
|