Typst - LaTeX Alternative

02/21/2024, Wed
Categories: #shell #typst
Tags: #NodeJs

Typesetting Documents with Rust

LaTeX is a time-honored typesetting application that has developed a large community. With age, comes accumulation of the wealth of packages for general document creation. Although it is tool that is well-developed, it tends to be slower and is burden with a legacy design that is not as performant as newer tools. Since its use is so pervasive, it has become entrenched in the document creation community preventing new competing application has come forth. However, there is an alternative that is worth considering and that one is Typst.

Install

To install the Typst application, note the instructions. If you happen have node installed on your machine, you can install it readily from npm.

Typst is a small self-contained binary (10mb) that allows you to quickly get started. LateX on the other hand is a very large installation size.

Example

A Typst document starts with a plain text file that ends with the typ file extension.

Navigate to a location and create the document file.

touch sample.typ

Add some sample content into the sample.typ.

This is some content.

To make Typst compile this automatically,

typst watch sample.typ

Typst will monitor this document and automatically compiles your file to a pdf.

If you have installed Typst with NPM, you can use Typst programmatically within nodejs.

The compilation process takes less than 5ms from the example above. Typst promises fast rendering through incremental compilation.

There is also thorough documentation on how to use Typst. Typst was designed to offer the flexibility and power of LaTeX in an easier to use concise syntax of markdown.

You can also live preview the pdf when you make changes to the source typst file by opening the pdf in Okular since Okular refreshes the pdf when it detects a change in it.