I am currently using emacs and auctex to author my latex documents. This is, of course, fantastic. However, I would like to have emacs and/or auctex auto-fill the section label when using C-c C-e
to make a new header. It should end up looking like this:
\section{This is a section title}
\label{sec:this-is-a-section-title}
with the label for the header the same as the title, but with no spaces. I don't know lisp or elisp, and I'd have no idea where to start. If anyone could help that would be great!
If you use RefTeX then C-c (
will do what you want (giving you the opportunity to change the label if you wish). Also C-c )
will insert \ref{...}
, popping up a buffer to choose which label to use. It also does other stuff including working with bibliographies. You should definitely look into it.
I think it's now part of the AUCTeX distribution so that all you should have to do is add
(add-hook 'LaTeX-mode-hook (function turn-on-reftex))
(setq reftex-plug-into-AUCTeX t)
to your .emacs.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With