literate-calc-mode.el
literate-calc-mode.el copied to clipboard
Units convertion
How can we convert units? I've done it using usimplify like in the readme:
Surface = 5000000 mm^2
=usimplify(1 m^2 + Surface - 1 m^2) => 5 m^2
Is there a better way?
Best regards
Sorry it took a while to respond. I've been scouring the Emacs docs and source code, but usimplify seems to be the best we have available without implementing something else. Regular calc has calc-convert-units, which is an interactive command that prompts for source and target units, but that is not available as algebraic function.
Maybe the best long-term approach would be to build a custom algebraic function that fills that gap?
That's far from my reach, I think. Why don't you ask on orgmode mail list? https://lists.gnu.org/mailman/listinfo/emacs-orgmode
This was a dealbreaker for me but everything else about literate-calc-mode has been amazing. From another blogpost, you can do something like
(after! calc
(defalias 'calcFunc-uconv 'math-convert-units))
https://hungyi.net/posts/solve-system-of-equations-literate-calc-mode/
Which works great and also now makes it easy to convert other emacs calc functions -> algebraic functions for use in literate.
Thanks for writing such a nicer mode, I'm using it all the time now!