4

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

4
  • 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... Sep 15, 2010 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.=/
    – Malabarba
    Sep 15, 2010 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)? Sep 15, 2010 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".
    – Malabarba
    Sep 16, 2010 at 13:58

1 Answer 1

1

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.

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .