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.