Are there any available programs/software/etc. that allow you to autocalculate and then autocomplete TeX equations? It would be great if for example, I were doing really long messy equations like
120 000 \, inches \times \frac{1 \, mile}{63360 \, inches} =
and the program could just fill in the blank with
1.89 \, miles
Best Answer
Here's an approach based on my
pythontex
package, which provides access to SymPy. I've written some code that takes an expression written withsiunitx
, converts it to SymPy format (if it's not too complex and doesn't break the regular expressions), and then calculates the result. The SymPy code is accessed with a macro I've called\autocalc
, which takes two arguments: an expression written withsiunitx
, and the desired units for the answer (also written withsiunitx
). This won't handle everything without some additional regex work, but it should handle most one-line unit conversions.