# Evaltor: Typst plugin for unit-aware calculations I initially wanted to use [numbat](https://github.com/sharkdp/numbat) but since it requires access to filesystem (which is not allowed in typst), I ended up choosing [fend](https://printfn.github.io/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](https://github.com/sjfhsjfh/typst-wasm). First compile the rust code to wasm32 using: ```sh rustup target add wasm32-unknown-unknown cargo build --release --target wasm32-unknown-unknown ``` Then install the typst package locally using [tlp](https://tangled.org/vidyasagarv.com/tlp) or [utpm](https://github.com/typst-community/utpm): ```sh tlp init ``` Then you can directly use in typst like: ```typ #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](tests/examples.typ) and [fend manual](https://printfn.github.io/fend/documentation/). ## Plans - Add [rink](https://github.com/tiffany352/rink-rs/) as a backend, gives preference to unit over operation unlike fend. - Use [unify](https://github.com/ChHecker/unify) or [zero](https://github.com/Mc-Zen/zero) to format input and output. - Check out [numr](https://github.com/nasedkinpv/numr)