4

Is there any AUCTeX style for siunitx? If not are there any simple tricks which make it more easy to type siunitx commands in emacs. For example if I type C-c C-m SI it inserts just \SI{} with one pair of braces and not two. In particular it doesn't give a prompt to insert the arguments.

student
  • 29,003

1 Answers1

2

I figured it out by myself, just an example:

One can create a custom siunitx.el file and put this into a TeX-style-path such that TeX can find it.

To see what paths are in TeX-style-path just do M-x describe variable RET TeX-style-path for example: ~/.emacs.d/auctex/auto is usually in TeX-style-path (if the directory doesn't exist, one have to create it).

The siunitx.el file contains for example the following:

;;; siunitx.el --- AUCTeX style file for Siunitx
(TeX-add-style-hook "siunitx"
              (function
               (lambda ()
             (TeX-add-symbols
              '("SI"       "Value" "Unit")
                      '("ang"      "Angle")
              ))))

If you change the siunitx.el file and want to apply the changes to your current buffer editing a file which uses siunitx, just press C-c C-n in this buffer.

To use it type for example C-c C-m RET SI RET. Then emacs asks you for the value and the unit.

N.N.
  • 36,163
student
  • 29,003