A typst plugin for unit-aware calculations
typst
Typst 38.0%
Rust 22.1%
Other 39.9%
8 2 1

Clone this repository

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

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

Download tar.gz
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.

Plans#

  • Add rink as a backend, gives preference to unit over operation unlike fend.
  • Use unify or zero to format input and output.
  • Check out numr