Go to the first, previous, next, last section, table of contents.

Completion

Emacs lisp programmers probably know the lisp-complete-symbol command, usually bound to M-tab. Users of the wonderful ispell mode know and love the ispell-complete-word command from that package. Similarly, AUC TeX has a TeX-complete-symbol command, usually bound to M-tab. Using LaTeX-complete-symbol makes it easier to type and remember the names of long LaTeX macros. In order to use TeX-complete-symbol, you should write a backslash and the start of the macro. Typing M-tab will now complete as much of the macro, as it unambiguously can. For example, if you type ``\renewc'' and then `M-tab, it will expand to ``\renewcommand''.

Command: TeX-complete-symbol
(M-tab) Complete TeX symbol before point.

A more direct way to insert a macro is with TeX-insert-macro, bound to C-c C-m. It has the advantage over completion that it knows about the argument of most standard LaTeX macros, and will prompt for them. It also knows about the type of the arguments, so it will for example give completion for the argument to `\include'. Some examples are listed below.

Command: TeX-insert-macro
(C-c C-m) Prompt (with completion) for the name of a TeX macro, and if AUC TeX knows the macro, prompt for each argument.

As a default selection, AUC TeX will suggest the macro last inserted or, as the first choice the value of the variable TeX-default-macro.

User Option: TeX-default-macro
Default macro to insert when invoking TeX-insert-macro first time.

A faster alternative is to bind the function TeX-electric-macro to `\'. This can be done by setting the variable TeX-electric-escape

User Option: TeX-electric-escape
If this is non-nil when AUC TeX is loaded, the TeX escape character `\' will be bound to TeX-electric-macro

The difference between TeX-insert-macro and TeX-electric-macro is that space will complete and exit from the minibuffer in TeX-electric-macro. Use tab if you merely want to complete.

Command: TeX-electric-macro
Prompt (with completion) for the name of a TeX macro, and if AUC TeX knows the macro, prompt for each argument. Space will complete and exit.

By default AUC TeX will put an empty set braces `{}' after a macro with no arguments to stop it from eating the next whitespace. This can be stopped by entering LaTeX-math-mode, see section Entering Mathematics, or by setting TeX-insert-braces to nil

User Option: TeX-insert-braces
If non-nil, append a empty pair of braces after inserting a macro.

Completions work because AUC TeX can analyze TeX files, and store symbols in emacs lisp files for later retrieval. See section Automatic Customization, for more information.

AUC TeX will also make completion for many macro arguments, for example existing labels when you enter a `\ref' macro with TeX-insert-macro or TeX-electric-macro, and BibTeX entries when you enter a `\cite' macro. For this kind of completion to work, parsing must be enabled as described in see section Automatic Parsing of TeX files.. For `\cite' you must also make sure that the BibTeX files have been saved at least once after you enabled automatic parsing on save, and that the basename of the BibTeX file does not conflict with the basename of one of TeX files.


Go to the first, previous, next, last section, table of contents.