/cetz

CeTZ: ein Typst Zeichenpaket - A library for drawing stuff with Typst.

Primary LanguageTypstGNU Lesser General Public License v3.0LGPL-3.0

CeTZ

CeTZ (CeTZ, ein Typst Zeichenpacket) is a library for drawing with Typst with an API inspired by TikZ and Processing.

Examples

Karl's Picture Tree Layout 3D Chart
Pie Chart Plot Clustered Barchart

Click on the example image to jump to the code.

Usage

For information, see the manual.

To use this package, simply add the following code to your document:

#import "@preview/cetz:0.1.2"

#cetz.canvas({
  import cetz.draw: *
  // Your drawing code goes here
})

Installing

To install the CeTZ package under your local typst package dir you can use the install script from the repository.

just install

The installed version can be imported by prefixing the package name with @local.

#import "@local/cetz:0.1.2"

#cetz.canvas({
  import cetz.draw: *
  // Your drawing code goes here
})

Just

This project uses just, a handy command runner.

You can run all commands without having just installed, just have a look into the justfile. To install just on your system, use your systems package manager. On Windows, Cargo (cargo install just), Chocolatey (choco install just) and some other sources can be used. You need to run it from a sh compatible shell on Windows (e.g git-bash).

Testing

This package comes with some unit tests under the tests directory. To run all tests you can run the just test target.

You need to have ImageMagick installed on your system, which is needed for image comparison.

Windows

If you are using the Chocolatey package manager, you can install imagemagick using choco install imagemagick. Otherwise download and install a matching package from the ImageMagick website.

Projects using CeTZ

  • circuitypst A port of circuitikz to Typst.
  • conchord Package for writing lyrics with chords that generates fretboard diagrams using CeTZ.
  • finite Finite is a Typst package for rendering finite automata