Emacs auctex: can i use autocomplete tags?

I am currently using emacs and auctex to write my latex documents. This, of course, is fantastic. However, I would like emacs and / or auctex to automatically populate the section label when using Cc Ce to create a new header. It should look like this:

 \section{This is a section title} \label{sec:this-is-a-section-title} 

with a label for the title, similar to the title, but without spaces. I do not know lisp or elisp, and I had no idea where to start. If someone can help, it will be great!

+4
source share
1 answer

If you use RefTeX, then Cc ( will do what you want (giving you the ability to change the shortcut if you want). Also Cc ) will insert \ref{...} , choosing a buffer to choose which label to use. It also performs other functions, including working with bibliographies. You must definitely study it.

I think this is now part of the AUCTeX distribution, so all you have to do is add

 (add-hook 'LaTeX-mode-hook (function turn-on-reftex)) (setq reftex-plug-into-AUCTeX t) 

to your .emacs.

+7
source

Source: https://habr.com/ru/post/1304585/


All Articles