Hot answers tagged


Assuming you're happy with floating point arithmetic then you just need to make one of the numbers a float. e.g.: (/ 15.0 6) => 2.5 Refer to C-hig (elisp)Arithmetic Operations each of these functions accepts both integer and floating-point arguments, and returns a floating-point number if any argument is floating point.


Go to the beginning of your text and press C-M-%. That key sequence is bound to the command query-replace-regexp. Give \([+-]?[0-9]+\|\_<[[:alpha:]]\)/\([+-]?[0-9]+\|[[:alpha:]]\_>\) as search string and {\1 \\over \2} as replacement and press RET. Note that this searches for integers maybe composed of several digits and with optional sign + or -. ...

Only top voted, non community-wiki answers of a minimum length are eligible