A typst plugin for unit-aware calculations
typst
Typst 37.9%
Rust 22.1%
Other 40.0%
6 2 0

Clone this repository

https://tangled.org/vidyasagarv.com/evaltor
git@knot.vidyasagarv.com:vidyasagarv.com/evaltor

For self-hosted knots, clone URLs may differ based on your setup.

README.md

Evaltor: Typst plugin for unit-aware calculations#

I initially wanted to use numbat but since it requires access to filesystem (which is not allowed in typst), I ended up choosing fend as the backend.

If I find fend to be limiting, I will try to implement in-memory module importer in numbat where all the nbt files are imported at compile-time.

Built using typst-wasm.

First compile the rust code to wasm32 using:

rustup target add wasm32-unknown-unknown
cargo build --release --target wasm32-unknown-unknown

Then install the typst package locally using tlp or utpm:

tlp init

Then you can directly use in typst like:

#import "@local/evaltor:0.1.0": print_eval

#print_eval("2 km + 30 m")

will produce the output:

2 km + 30 m = 2.03 km  

For more details, see examples.typ and fend manual.