Universe

This is a package for writing pseudocode in Typst. It is named after the computer science pioneer Ada Lovelace and inspired by the pseudo package for LaTeX.

toot GitHub license GitHub release (latest by date) GitHub Repo stars

Pseudocode is not a programming language, it doesn’t have strict syntax, so you should be able to write it however you need to in your specific situation. Lovelace lets you do exactly that.

Main features include:

  • arbitrary keywords and syntax structures
  • optional line numbering
  • line labels
  • lots of customisation with sensible defaults

Getting started

Import the package using

#import "@preview/lovelace:0.3.1": *

The simplest usage is via pseudocode-list which transforms a nested list into pseudocode:

#pseudocode-list[
  + do something
  + do something else
  + *while* still something to do
    + do even more
    + *if* not done yet *then*
      + wait a bit
      + resume working
    + *else*
      + go home
    + *end*
  + *end*
]

resulting in:

simple

As you can see, every list item becomes one line of code and nested lists become indented blocks. There are no special commands for common keywords and control structures, you just use whatever you like.

To learn more about how to use and customize Lovelace, visit the tutorial.