3.1 Environment Mappings

3.1.1 Insert-mode Mappings
3.1.2 Visual-mode Mappings
3.1.3 Normal Mode Mappings
Latex-Suite provides a rich set of mappings to insert, enclose and modify LaTeX environments.

3.1.1 Insert-mode Mappings

3.1.1.1 Method 1
3.1.1.2 Method 2
3.1.1.3 Method 3
3.1.1.4 Method 4

These mappings insert LaTeX "environments" such as:

\begin{center}
    <++>
\end{center}<++>

with the cursor left at the first |placeholder|. There are various ways of inserting environments into the source file. If the environment is a standard latex environment, then latex suite might also include common fields associated with it.

3.1.1.1 Method 1

If you press <F5> in the insert 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. This list can be customized via the g:Tex_PromptedEnvironments setting.

In addition to the Tex_PromptedEnvironments variable, Latex-Suite also lists envionments found in custom packages as described in the section Package actions.

3.1.1.2 Method 2

If you press <F5> while on a line containing a single word, then latex-suite creates a environment of that name.

3.1.1.3 Method 3

The shifted function keys, <S-F1> to <S-F4> can also be optionally mapped to some common environments which you insert most often. The environments mapped to each key can also be customized via the g:Tex_HotKeyMappings setting.

3.1.1.4 Method 4

Environments can also be inserted by pressing a 3 capital letter sequence starting with an E. The following subsection describes this in detail. 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 Visual-mode Mappings

Latex-Suite provides visual-mode mappings which enclose visually selected portions of text in environments. These mappings are derived from the corresponding insert-mode environment mappings according to the following simple rule:

ECE           --> ,ce

The rule simply says that the leading E is converted to , and the next 2 letters are small case. Here ECE is the insert-mode map which inserts the \begin{center} ... \end{center} environment. Correspondingly, if you select a portion of text visually and press ,ce while still in visual mode, then the selected portion will be enclosed in \begin{center} ... \end{center}. 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:

\begin{center}
    line
\end{center}

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.

3.1.3 Normal Mode Mappings

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:

\begin{eqnarray}
  \begin{array}{ccc}
    2 & 3 & 4
  \end{array}
\end{eqnarray}

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.