Package Information
- Last Updated
- Minimum Typst Version
- 0.13.0
- Categories
- components
- Disciplines
- computer-sciencemathematics
1. Get the package
Download the package using the TPIX CLI:
tpix get @preview/lovelace:0.3.12. Import in your Typst file
Add this to your .typ file:
#import "@preview/lovelace:0.3.1": *Version History
Lovelace
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.
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:
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.