[ < ] [ > ]   [ << ] [ Up ] [ >> ]         [Top] [Contents] [Index] [ ? ]

2.4 Inserting Environment Templates

A large apparatus is available that supports insertions of environments, that is ‘\begin{}’ — ‘\end{}’ pairs.

AUCTeX is aware of most of the actual environments available in a specific document. This is achieved by examining your ‘\documentclass’ command, and consulting a precompiled list of environments available in a large number of styles.

You insert an environment with C-c C-e, and select an environment type. Depending on the environment, AUCTeX may ask more questions about the optional parts of the selected environment type. With C-u C-c C-e you will change the current environment.

Command: LaTeX-environment arg

(C-c C-e) AUCTeX will prompt you for an environment to insert. At this prompt, you may press <TAB> or <SPC> to complete a partially written name, and/or to get a list of available environments. After selection of a specific environment AUCTeX may prompt you for further specifications.

If the optional argument arg is not-nil (i.e. you have given a prefix argument), the current environment is modified and no new environment is inserted.

As a default selection, AUCTeX will suggest the environment last inserted or, as the first choice the value of the variable LaTeX-default-environment.

User Option: LaTeX-default-environment

Default environment to insert when invoking ‘LaTeX-environment’ first time.

If the document is empty, or the cursor is placed at the top of the document, AUCTeX will default to insert a ‘document’ environment.

Most of these are described further in the following sections, and you may easily specify more. See section Customizing Environments.

You can close the current environment with C-c ], but we suggest that you use C-c C-e to insert complete environments instead.

Command: LaTeX-close-environment

(C-c ]) Insert an ‘\end’ that matches the current environment.


[ < ] [ > ]   [ << ] [ Up ] [ >> ]         [Top] [Contents] [Index] [ ? ]

2.4.1 Equations

When inserting equation-like environments, the ‘\label’ will have a default prefix, which is controlled by the following variables:

User Option: LaTeX-equation-label

Prefix to use for ‘equation’ labels.

User Option: LaTeX-eqnarray-label

Prefix to use for ‘eqnarray’ labels.

User Option: LaTeX-amsmath-label

Prefix to use for amsmath equation labels. Amsmath equations include ‘align’, ‘alignat’, ‘xalignat’, ‘aligned’, ‘flalign’ and ‘gather’.


[ < ] [ > ]   [ << ] [ Up ] [ >> ]         [Top] [Contents] [Index] [ ? ]

2.4.2 Floats

Figures and tables (i.e., floats) may also be inserted using AUCTeX. After choosing either ‘figure’ or ‘table’ in the environment list described above, you will be prompted for a number of additional things.

float position

This is the optional argument of float environments that controls how they are placed in the final document. In LaTeX this is a sequence of the letters ‘htbp’ as described in the LaTeX manual. The value will default to the value of LaTeX-float.

caption

This is the caption of the float. The default is to insert the caption at the bottom of the float. You can specify floats where the caption should be placed at the top with LaTeX-top-caption-list.

label

The label of this float. The label will have a default prefix, which is controlled by the variables LaTeX-figure-label and LaTeX-table-label.

Moreover, you will be asked if you want the contents of the float environment to be horizontally centered. Upon a positive answer a ‘\centering’ macro will be inserted at the beginning of the float environment.

User Option: LaTeX-float

Default placement for floats.

User Option: LaTeX-figure-label

Prefix to use for figure labels.

User Option: LaTeX-table-label

Prefix to use for table labels.

User Option: LaTeX-top-caption-list

List of float environments with top caption.


[ < ] [ > ]   [ << ] [ Up ] [ >> ]         [Top] [Contents] [Index] [ ? ]

2.4.3 Itemize-like Environments

In an itemize-like environment, nodes (i.e., ‘\item’s) may be inserted using C-c <LFD>.

Command: LaTeX-insert-item

(C-c <LFD>) Close the current item, move to the next line and insert an appropriate ‘\item’ for the current environment. That is, ‘itemize’ and ‘enumerate’ will have ‘\item ’ inserted, while ‘description’ will have ‘\item[]’ inserted.


[ < ] [ > ]   [ << ] [ Up ] [ >> ]         [Top] [Contents] [Index] [ ? ]

2.4.4 Tabular-like Environments

When inserting Tabular-like environments, that is, ‘tabular’ ‘array’ etc., you will be prompted for a template for that environment. Related variables:

User Option: LaTeX-default-format

Default format string for array and tabular environments.

User Option: LaTeX-default-position

Default position string for array and tabular environments. If nil, act like the empty string is given, but don’t prompt for a position.


[ < ] [ > ]   [ << ] [ Up ] [ >> ]         [Top] [Contents] [Index] [ ? ]

2.4.5 Customizing Environments

See section Adding Support for Environments, for how to customize the list of known environments.


[ < ] [ > ]   [ << ] [ Up ] [ >> ]

This document was generated on September 2, 2010 using texi2html 1.82.