3.1 Environment Mappings

3.1.1 Inserting Environments
3.1.2 Enclosing in Environments
3.1.3 Changing Environments
Latex-Suite provides a rich set of mappings to insert, enclose and modify LaTeX environments, i.e, \begin{...} ... \end{...} pairs.

3.1.1 Inserting Environments

Latex-Suite provides the following ways to insert environments Method 1: Pressing <F5>

If you press <F5> in the insert or normal mode while on an empty line, Latex-Suite prompts you with a list of environments you might want to insert. You can either choose one from the list or type in a new environment name. If you press <F5> on a line which already has a word, then that word is used instead of prompting.

See Tex_Env_name for a description of how Latex-Suite uses the word to form the expansion and how to modify Latex-Suite's behavior.

The list of environments which Latex-Suite prompts you with (when <F5> is pressed on an empty line) is formed from the Tex_PromptedEnvironments setting.

In addition to this setting, Latex-Suite also lists environments found in custom packages as described in the section Package actions. Method 2: Using <S-F1>-<S-F4>

The shifted function keys, <S-F1> to <S-F4> can be mapped to insert very commonly used environments. The environments mapped to each key can be customized via the g:Tex_HotKeyMappings setting. Method 3: Using three letter sequences

Environments can also be inserted by pressing a 3 capital letter sequence starting with an E. The sequence of 3 letters generally tries to follow the following rules:

  1. All environment mappings begin with E
  2. If the environment can be broken up into 2 distinct words, such as flushright (flush + right), then the next 2 letters are the first letters of the 2 words. Example:
    flushleft  (_f_lush + _l_eft)  ---> EFL
    flushright (_f_lush + _r_ight) ---> EFR
    eqnarray   (_e_qn + _a_rray)   ---> EEA
    If on the other hand, the environment name cannot be broken up into 2 distinct words, then the next 2 letters are the first 2 letters of the name of the environment. Example:
    equation (_eq_uation)          ---> EEQ

Unfortunately there are some environments that cannot be split in two words and first two letters in name are identical. In this case shortcut is created from E, first and last letter. Example:

quote     (_q_uot_e_)          ---> EQE
quotation (_q_uotatio_n_)      ---> EQN

Of course, not every last one of the environments can follow this rule because of ambiguities. In case of doubt, pull down the Tex-Environments menu. The menu item should give the hint for the map.

3.1.2 Enclosing in Environments

Latex-Suite provides visual-mode mappings which enclose visually selected portions of text in environments. There are two ways provided to do this. Method 1: Pressing <F5>

You can also select a portion of text visually and press <F5> while still in visual mode. This will prompt you with a list of environments. (This list can be customized via the g:Tex_PromptedEnvironments setting). You can either choose from this list or type in a new environment name. Once the selection is done, Latex-Suite encloses the visually selected portion in the chosen environment. Method 2: Using three letter mappings

You can also select text visually and press a sequence of three characters beginning with , (the single comma character) and the selected text will be enclosed in the chosen environment. The three letter sequence follows directly from the three letter sequence used to insert environments as described here. The following example describes the rule used:

If ECE inserts a \begin{center}...\end{center} environment, then to enclose a block of selected text in \begin{center}...\end{center}, simply select the text and press ,ce. The rule simply says that the leading E is converted to , and the next 2 letters are small case.

Some of the visual mode mappings are sensitive to whether you choose line-wise or character-wise. For example, if you choose a word and press ,ce, then you get \centerline{word}, whereas if you press ,ce on a line-wise selection, you get:


3.1.3 Changing Environments

Pressing <S-F5> in normal mode detects which environment the cursor is presently located in and prompts you to replace it with a new one. The innermost environment is detected. For example, in the following source:

    2 & 3 & 4

if you are located in the middle "2 & 3 & 4" line, then pressing <S-F5> will prompt you to change the array environment, not the eqnarray environment. In addition, Latex-Suite will also try to change lines within the environment to be consistent with the new environment. For example, if the original environment was an eqnarray environment with a \label command, then changing it to an eqnarray* environment will delete the \label.

Pressing <F5> in normal mode has the same effect as pressing <F5> in insert-mode, namely you will be prompted to choose an environment to insert.