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.

The quick start guide for AUCTeX says

As nearly everywhere in AUCTeX, you can use the TAB or SPC key to get a list of available level names, and to auto-complete what you started typing.

Which tantalizingly makes me thing AUCTeX has an auto-complete feature. But pressing TAB does nothing. I apologize for the simple question, but I've spent more time searching for it than I am ever likely to save so this is a last resort before I give up on it.

So, is there in fact an auto-complete feature in Emacs AUCTeX? How does one turn it on if so?

Edit: I just figured out M-TAB is problematic since it is bound to a OS GUI action. I saw a website discuss this problem and it notes that there are two key bindings which are supposed to be equivalent: c-[ c-I and ESC TAB. Except these for some reason give me dictionary spelling corrections for the word I wrote which is not exactly what I was expecting.

share|improve this question
    
Can you please share the way of turning off this flyspell mode? I tried the two methods given elsewhere on this site ....Latex-mode-hook 'turn-off-flyspell and '(flyspell-mode f) –  Anusha Jul 5 '12 at 3:24
    
Why are you trying to use M-TAB for autocomplete? As you quoted: AUCTeX uses TAB or SPC to prompt for possible autocomplete actions (i.e., no Meta-<something>). –  jon Jul 5 '12 at 5:29
    
@jon The manual lists M-Tab as the default binding for TeX-complete-symbol. –  N.N. Oct 2 '12 at 19:07
1  
@N.N. -- huh, never noticed that. I always just use C-c C-m or C-c <RET> (if I want to insert something like \footnote) at which point <TAB> and <SPC> will do tab-completion to the point where further disambiguation is needed (e.g., there are a lot of known commands starting with \foot-). –  jon Oct 2 '12 at 19:24
add comment

3 Answers

It does have auto-complete powers. (It has more than any one person knows about.) Try, e.g., C-c C-m (for calling macros like \footnote or \ref); type the letter 's' and hit TAB. The rest will become clear. C-c C-e will prompt for for starting new environments. And so on.

If you use AUCTeX with reftex, try things like C-[ to prompt you for a bibliographical \cite{<key>} command.

You should skim the manual for the sections that are most relevant for your work.

share|improve this answer
1  
Thank you. I figured out why the key binding given in the manual wasn't working. Flyspell is bound to the same key as the auto-complete function so it has to be disabled for auto-complete to work. –  Awnani Maus Jun 8 '12 at 5:57
    
@AwnaniMaus You should post that as an answer to your question. –  N.N. Jun 9 '12 at 7:03
    
Can you please share the way of turning off this flyspell mode? I tried the two methods given elsewhere on this site ....Latex-mode-hook 'turn-off-flyspell and '(flyspell-mode f) –  Anusha Jul 5 '12 at 3:23
    
@Anusha -- Let's start with this: Can you turn off flyspell-mode when you are in a .tex buffer with the following command: M-x flyspell-mode RET? (If it is on, this should turn it off; if it is off, this should turn it on.) –  jon Jul 5 '12 at 5:27
    
@jon Thanks. This works. I guess autocomplete in emacs means working with macros or defined key bindings. –  Anusha Jul 5 '12 at 18:39
show 1 more comment

As you mention AUCTeX has an auto-complete function which per default is bound to M-Tab which conflicts with many window managers. The function is called TeX-complete-symbol and you can use it via M-x TeX-complete-symbol or bind it to any other key you prefer. By inserting the following into your .emacs you bind it to C-Tab in LaTeX-mode (i.e. AUCTeX):

(add-hook 'LaTeX-mode-hook
      (lambda()
        (local-set-key [C-tab] 'TeX-complete-symbol)))

Still, I think it may be more effective to use C-c Ret (for TeX-insert-macro), C-c C-e (for LaTeX-environment) and YASnippet.

share|improve this answer
add comment

As of recently, AucTEX seems to work out of the box with Predictive Mode, providing "full "Intellisense" features for writing LaTeX documents in Emacs." (See the AucTeX entry on the EmacsWiki for more info). I have not tried this yet, but surely will when I get home in the evening.

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.