11.3 Macro Customization

11.3.1 Customizing the macros concerning environments
11.3.2 Customizing the macros concerning commands
11.3.3 Enabling / disabling macros
11.3.4 g:Imap_FreezeImap
11.3.5 g:Tex_CatchVisMapErrors
11.3.6 g:Tex_Diacritics
11.3.7 g:Tex_Leader
11.3.8 g:Tex_Leader2

11.3.1 Customizing the macros concerning environments

11.3.1.1 Tex_Env_name

If you wish to wish to expand certain environments differently from the way Latex-Suite does it, you can define custom expansions using global variables of the form Tex_Env_{name} where name corresponds to the environment.

For example, if you press <F5> after typing theorem, Latex-Suite will by default expand it to

\begin{theorem}
      \label{<++>}<++>
\end{theorem}<++>

However, if you wish change this to

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

then define the following variable

let g:Tex_Env_theorem = "\\begin{theorem}\<CR><++>\<CR>\\end{theorem}"

If the expansion uses special keys such as carriage return etc, then use double-quotes and use the "\<key>" notation for special keys. Backslashes have to be doubled.

You could even use strings returned by functions as the expansion by using the IMAP_PutTextWithMovement() function.

If the name of the environment contains special characters (for example, the align* environment), then use the following form:

let g:Tex_Env_{'align*'} =
         \ "\\begin{align*}\<CR><++> &= <++>\<CR>\\end{align*}<++>"

This will make pressing <F5> after align* expand to

\begin{align*}
     <++> &= <++>
 \end{align*}<++>

11.3.1.2 Tex_EnvLabelprefix_name

By default, Latex-Suite inserts labels without prefixes. The setting Tex_EnvLabelprefix_{name}, where name corresponds to the environment, is used to create labels with prefixes automatically. For instance, if you use

let g:Tex_EnvLabelprefix_equation = "eq:"

the prefix eq: is inserted in all labels in generated equations:

\begin{equation}
      <++>
      \label{eq:<++>}
\end{equation}<++>

This setting works for the environments figure, table, theorem, definition, lemma, proposition, corollary, assumption, remark, equation, align and multline.

11.3.1.3 Tex_EnvEndWithCR
TypeBoolean
Default Value0

If Tex_EnvEndWithCR is set to 1, a carriage return (i.e., line break) is inserted between \end{environment} and the last placeholder:

\begin{equation}
      <++>
      \label{<++>}
\end{equation}
<++>

11.3.1.4 Tex_ItemsWithCR
TypeBoolean
Default Value0

If Tex_ItemsWithCR is set to 1, a carriage return (i.e., line break) is inserted after \item and the placeholder, e.g., itemize<F5> is expanded to

\begin{itemize}
      \item
            <++>
\end{itemize}

11.3.1.5 Tex_LabelAfterContent
TypeBoolean
Default Value1

If Tex_LabelAfterContent is set to 0, the label is placed before the content of the environment:

\begin{equation}
      \label{<++>}
      <++>
\end{equation}<++>

11.3.1.6 g:Tex_UseMenuWizard
TypeBoolean
Default Value0

If this variable is set to 1, then when an environment is chosen from the menu then for selected environments, Latex-Suite asks a series of questions on the command line and inserts a template with the corresponding fields already filled in. Setting this to zero will insert a template with place-holders marking off the places where fields need to be filled.

11.3.1.7 g:Tex_PromptedEnvironments
TypeString
Default Value'equation,equation*,align,align*,enumerate,itemize,figure,table'

This string represents a comma separated list of fields corresponding to environments. Pressing <F5> in insert-mode in the body of the document asks you to choose from one of these environments to insert.

Leaving this string empty will leave the <F5> key unmapped

11.3.1.8 g:Tex_HotKeyMappings
TypeString
Default Value'equation*,equation,bmatrix'

This string represents a comma separated list of environments which are mapped to <Shift-F-1> through <Shift-F-4>. For example, pressing <Shift-F-2> with this setting inserts the equation environment.

Leaving this string empty will leave <Shift-F-1> through <Shift-F-4> unmapped.

Note

Only the first four fields of this list are used. The rest are silently ignored.

11.3.2 Customizing the macros concerning commands

11.3.2.1 Tex_Com_name

If you wish to define new expansions for fast command insertion as described here, or redefine expansions from the default values in Latex-Suite, you will need to define variables of the form g:Tex_Com_{name} where name is a command name. For example, with the setting

let g:Tex_Com_frac = "\\frac{<++>}{<++>}<++>"

pressing <F7> after typing frac will change it to \frac{<++>}{<++>}<++>

See Tex_Env_name for additional details on how to create this setting in various special circumstances.

11.3.2.2 g:Tex_PromptedCommands
TypeString
Default Value 'footnote,cite,pageref,label'

This string represents a comma separated list of LaTeX commands which Latex-Suite uses for the <F7> and <S-F7> maps as described here.

Leaving this string empty will leave the <F7> key unmapped.

11.3.2.3 Tex_ItemStyle_environment

This setting affects the style which Latex-Suite uses to insert an \item when <Alt-I> is pressed as described here. By default Latex-Suite defines styles for the following environments:

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

Each style is defined by a variable of the form g:Tex_ItemStyle_{envname} where envname is the name of the environment for which the style is defined. For example, by default

g:Tex_ItemStyle_description = '\item[<+label+>] <++>'

Redefining the style for a particular environment or defining a style for an entirely new environment is simply a matter of setting the value of a variable of the corresponding name.

11.3.3 Enabling / disabling macros

The following variables disable various parts of the macro functionality of Latex-Suite. See the links to the relevant sections to see what functionality setting each of the variables to zero will take away.

SettingLink to relevant sectionDefault Value
g:Tex_EnvironmentMaps Environment Mappings1
g:Tex_EnvironmentMenus 1
g:Tex_FontMaps Font Mappings1
g:Tex_FontMenus  1
g:Tex_SectionMaps Section Mappings1
g:Tex_SectionMenus  1

11.3.4 g:Imap_FreezeImap

Typeboolean
Default Value0

This option when set to 1, temporarily freezes Latex-Suite's macro expansion. It might be useful when you are using some other keymap which is causing excessive macro expansion. Use a buffer-local variable of the same name if you wish to affect just the present buffer.

11.3.5 g:Tex_CatchVisMapErrors

TypeBoolean
Default Value1

With so many visual maps, its helpful to have a way of catching typing errors made in visual mode. What this does is to prompt you to correct your visual mode mapping if you start out with g:Tex_Leader and then type some illegal keys. It basically maps just the g:Tex_Leader character to a function.

11.3.6 g:Tex_Diacritics

TypeBoolean
Default Value0

Whether or not you want to use diacritics.

11.3.7 g:Tex_Leader

TypeString
Default Value'`'

The mappings in Latex-Suite are by default prefixed with the back-tick character. For example, `/ inserts \frac{<++>}{<++>}<++> etc. You can change the prefix with the following setting. ',', '/', '`' are preferred values. '' or '\' will lead to a lot of trouble.

g:Tex_Leader is also used for visual mode mappings for fonts.

11.3.8 g:Tex_Leader2

TypeString
Default Value','

In order to avoid clashes between the large number of visual mode macros provided, the visual mode macros for environments and sections start with a character different from g:Tex_Leader.