# How to add custom environment in latex-suite

Latex-suite provides short keys to make working with environments like equation easier in VIM. For example, I like to press <F5> to change the environment.

One of the environments that I find missing is align; another one is subequations. I would like to add these as new environments. How can I do that?

• These short keys depends to the text editor. What editor you have adopted? Usually you can easily add new short but the procedure is different for each software – marchetto Feb 3 '14 at 11:19
• @marchetto Latex-Suite works for vim. – sjdh Feb 3 '14 at 13:19
• I'm sorry I did not know Latex-suite. – marchetto Feb 3 '14 at 14:57
• @marchetto thank you for asking. I added it to my question. Maybe I can add the vim tag too. – sjdh Feb 4 '14 at 12:59

The contents of the F5 list is encoded in the g:Tex_PromptedEnvironments variable in vim, adding (changing and expanding the list of environments as appropriate)

let g:Tex_PromptedEnvironments='align,align*,itemize,enumerate'


into .vimrc changes the list of prompted environments, allowing customisation according to needs. Any environments defined in the tex file itself will also be appended to the list though this may require restarting vim.

If adding an environment which requires something beyond the \begin{foo} \end{foo} and is not recognised by vim-latex by default, this can be customised with the g:Tex_Env_foo variable as described in this answer https://tex.stackexchange.com/a/127208/ and in the vim-latex manual http://vim-latex.sourceforge.net/documentation/latex-suite/customizing-macros.html#Tex_Env_name

To set up the itemize environment for example (though this should already be recognised and sensibly processed by vim-latex alongside a number of environments outside those listed by default in g:Tex_PromptedEnvironments) the following example can be used

 let g:Tex_Env_itemize="\\begin{itemize}\<CR>\\item <++>\<CR>\\end{itemize}"