3.10 Alt Key Macros

3.10.1 <Alt-L>
3.10.2 <Alt-B>
3.10.3 <Alt-C>
3.10.4 <Alt-I>

Latex-Suite utilizes a set of macros originally created by Carl Mueller in auctex.vim to make inserting all the \left ... \right stuff very easy and to also make some use of the heavily under-utilized <Alt> key.

Note

By default, typing Alt-<key> in Vim takes focus to the menu bar if a menu with the hotkey <key> exists. If in your case, there are conflicts due to this behavior, you will need to set

set winaltkeys=no

in your $VIM/ftplugin/tex.vim in order to use these maps.

Customizing the maps

If for some reason, you wish to not map the <Alt> keys, (some European users need to use the <Alt> key to enter diacritics), you can change these maps to other keys as described in the section Customizing Alt-key maps.

3.10.1 <Alt-L>

This is a polymorphic insert-mode mapping which expands to one of the following depending on the character just before the cursor location.

Character before cursorExpansion
(\left( <++> \right)
[\left[ <++> \right]
|\left| <++> \right|
{\left\{ <++> \right\}
<\langle <++> \rangle
q\lefteqn{<++>}<++>

If the character before the cursor is none of the above, then it will simply insert a \label{<++>}<++>.

3.10.2 <Alt-B>

This insert-mode mapping encloses the previous character in \mathbf{}.

3.10.3 <Alt-C>

In insert mode, this key is polymorphic as follows:

  1. If the previous character is a letter or number, then capitalize it and enclose it in \mathcal{}.
  2. otherwise insert \cite{}.

In visual mode, it will simply enclose the selection in \mathcal{}

3.10.4 <Alt-I>

This mapping inserts an \item command at the current cursor location depending on which environment the cursor is enclosed in. The style of the \item command is dependent on the enclosing environment. By default, <Alt-I> has styles defined forthe following environments:

EnvironmentStyle
itemize\item
enumerate\item
theindex\item
thebibliography\item[<+biblabel+>]{<+bibkey+>} <++>
description\item[<+label+>] <++>

<Alt-I> is intelligent enough to account for nested environments. For example,

\begin{itemize}
    \item first item
    \item second item
          \begin{description}
              \item[label1] first desc
              \item[label2] second
              % <Alt-I> will insert "\item[<+label+>] <++>" if
              % used here
          \end{description}
    \item third item
    % <Alt-I> will insert "\item " when if used here.
\end{itemize}
% <Alt-I> will insert nothing ("") if used here

The style used by <Alt-I> can be customized using the g:Tex_ItemStyle_environment variable.