3

I use a lot the autocomplete feature for commands and environments of AucTeX, via the TeX-insert-macro and LaTeX-environment functions. But is there a way to add to the built-in list more commands and macros (\enquote{}, \noindent, etc.)?

NVaughan
  • 1,595
  • 2
  • 9
  • 23

1 Answers1

6

The standard way to add support for macros and environment is writing a style file, it's documented here: https://www.gnu.org/software/auctex/manual/auctex.html#Style-Files The relevant functions are TeX-add-symbols and LaTeX-add-environments.

To add new macros and environments without creating style files see this answer: https://stackoverflow.com/a/17249399/2442087 For example, to add the foo macro and the bar environment add this to your init file:

(add-hook 'LaTeX-mode-hook
      (lambda ()
        (TeX-add-symbols "foo")
        (LaTeX-add-environments "bar")))
Community
  • 1
  • 1
giordano
  • 8,087
  • 3
  • 23
  • 48
  • Thanks, but it only changes the face of the command; it doesn't add it to the list of autocomplete macros---as far as I could see. – NVaughan Sep 07 '13 at 19:48
  • Actually those commands don't change fontification but add macros and environments to `TeX-symbol-list` and `LaTeX-environment-list` variables, that is what you want. So explain what you've done. Note you may need to restart Emacs to make changes effective. – giordano Sep 07 '13 at 19:52