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.

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".

share|improve this question
1  
The variable LaTeX-amsmath-label contains this, which should be inserted by Reftex if it is bound to the usual key C-c-( (control-C "("). If this doesn't work, well, something's wrong... –  Charles Stewart Sep 15 '10 at 12:34
    
@Charles Stewart: That key combination successfully inserts a label wherever I am, but doesn't insert `\` or a line break. It's what I've been using so far, since it's way better than typing a label. But I was sure there was a key for labeling and line breaking all in one.=/ –  Bruce Connor Sep 15 '10 at 13:57
1  
Reftex should look at the environment you're in, and insert the full string. To help try and figure out what is wrong: what version of Emacs are you using? Where did you get Auctex? Is the function LaTeX-amsmath-env-alignat defined (use C-h a, apropos-function, to check)? –  Charles Stewart Sep 15 '10 at 16:46
    
@Charles: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. The major/minor modes I use for editing latex documents are "LaTeX/S Ref". –  Bruce Connor Sep 16 '10 at 13:58
add comment

1 Answer 1

up vote 1 down vote accepted

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.

share|improve this answer
add comment

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.