[Tex/LaTex] Emacs keyboard shortcut to insert \label{} \\ and a new line in math mode.

editorsemacsmath-mode

So, I'm using emacs with auctex to edit my latex documents. It's been a while since last time I used it, but I still remember my shortcuts. Except one.

While editing equations inside and align environment, you have to add \\ at the end of each line, and add a label if you want reference that line specifically. I remember that emacs had a keyboard shorcut for that. You would use the shorcut and emacs automatically added \label{numer} \\ followed by a line break.

What shortcut is that? I tried Alt+Enter, but that simply inserts a new line followed by a \item.

EDIT: Seems that C-c-( key should be doing the trick, but it just inserts a label for me.

I got both auctex and emacs from the repositories. My emacs version is 32.1.1. If I use C-h a and type in "LaTeX-amsmath-env-alignat" (or even just "amsmath") it doesn't find any matches, so I guess it's not defined. The major/minor modes I use for editing latex documents are "LaTeX/S Ref".

Best Answer

Got it. Back when I wasn't using Reftex I had to add this line to my .emacs file: (add-hook 'LaTeX-mode-hook (lambda () (LaTeX-add-environments '("align" LaTeX-env-label)))) because auctex alone didn't recognize the align environment. Now that I'm using Reftex, this line was causing it to misbehave. Removing it solved my problem. The shortcut that does what I was asking for is: Alt+Enter.