I use siunitx
to typeset units in LaTeX. This is quite painless when typesetting it directly because of Emacs's siunitx.el
(see below).
However, sometimes I copy exercises or solutions containing units from the Web or other sources which are not formatted.
So I paste something like 50 m
, 50m/s
, 1.2 m
or 1,2 m
(german comma) into a file in Emacs. Now I want to be able to mark this, type C-c C-m \SI
and make Emacs automatically recognize units and transform them to \SI{50}{m}
, \SI{50}{m\per s}
, \SI{1,2}{m}
and so on.
Any ideas how to modify siunitx.el
to achieve this?
;;; siunitx.el --- AUCTeX style file for Siunitx
(TeX-add-style-hook "siunitx"
(function
(lambda ()
(TeX-add-symbols
'("SI" "Value" "Unit")
'("ang" "Angle")
))))