gtg922r / obsidian-numerals

An obsidian plugin which turns a math code block into a full featured calculator
Other
384 stars 7 forks source link

[Feature Request] Easy syntax for new/custom units #9

Open gtg922r opened 1 year ago

gtg922r commented 1 year ago

Add a math block syntax for easily creating new units.

Currently new units can be created using the mathjs function createUnit. However, this will throw an error the second (or later) time the code block is evaluated as the unit already exists. {override:true} is only allowed on derived units, not new base units.

Numerals should have a simple syntax for a new type of unit:

```math
# Unit{"can","bottle"}
coke_bottle_vol = 20 floz / bottle
coke_bottle_cost = $1.25 / bottle
coke_can_vol = 12 floz / can
coke_can_cost =  $1 / can

coke_can = coke_can_cost / coke_can_vol
coke_bottle = coke_bottle_cost / coke_bottle_vol
Bobronium commented 1 year ago

Yes! And the example describes exactly why I was looking for it :)

freqyfreqy commented 2 months ago

Yes I'd love this feature as well!

freqyfreqy commented 2 months ago

This is called 'dimensional analysis' in engineering and science.