Take the 2-minute tour ×
TeX - LaTeX Stack Exchange is a question and answer site for users of TeX, LaTeX, ConTeXt, and related typesetting systems. It's 100% free, no registration required.

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.

share|improve this question
1  
You could use YASnippet to insert siunitx macros. –  N.N. Aug 27 '12 at 20:20

1 Answer 1

up vote 2 down vote accepted

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.

share|improve this answer

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.