sponsor Vim development Vim logo Vim Book Ad

tex.vim : LaTeX macros in Vim (which emulate operator-pending mode operations)

 script karma  Rating 44/23, Downloaded by 3671  Comments, bugs, improvements  Vim wiki

created by
Srinath Avadhanula
script type
This file type plugin intended provides some insert mode macros for the
LaTeX typesetting language. The nice thing about these mappings is that
they emulate the operator pending mode in the insert mode.  i.e, the user
does NOT have to type the LHS in a hurry or without making mistakes. This
facilitates using the macros greatly.

See below for the detailed list of macros provided or just browe the file after downloading it.
In brief, this file provides stubs for the most commonly used typsetting
commands such as figures, matrices etc. As an example, the commonly used
matrix element is provided. Typing


in the insert mode will expand to the following familiar matrix element:


with the cursor placed where the underscore is shown (note the underscore is
not part of the macro, it just shows the cursor placement)
NOTE: <tab> is part of the LHS of the mapping. however, the characters need
      NOT be typed in quick succession as in most insert mode commands.

See the section "ADDING" in the file in order to modify/add new mappings.

A quick way to enter greek symbols is also provided. For example, typing
'\q<tab>' will expand to \theta. (NOTE: quotes are not part of the LHS).
See the section "SYMBOLS" in the file for adding/modifying the way the
greek alphabet is mapped into the english alphabet. Again <tab> can be
conviniently pressed after a long time or after moving around and coming back.

a few other shortcuts:
== expands to &=& (useful while writing eqnarrays)
$$ expands to $$ but the cursor is repositioned before the last $ (so you dont have to go back)
_ expands to _{}
^ expands to ^{}


1. TABLE: tab<tab>


2. ARRAY: bar<tab>


3. ENUMERATE: ben<tab>
\item -

4. ITEMIZE: bit<tab>
\item -

5. EQUATION: beq<tab>

6. EQUATION ARRAY: bqn<tab>

6. EPS FIGURE: bfg<tab>

7. EMPTY FIGURE: bfe<tab>

8. TABULAR: btb<tab>


9. TABLE: bta<tab>


10. PICTURE: pic<tab>

11. MATRIX: mat<tab>

12. FRAC: frac<tab>

13. DOT: dot<tab>

14. DOUBLE DOT: ddot<tab>
install details
For Vim-6.0, drop the file in the $VIMRUNTIME\ftplugin directory, where it will be sourced automatically at startup.
For previous versions, source it using the .vimrc file.

rate this script Life Changing Helpful Unfulfilling 
script versions (upload new version)

Click on the package to download.

package script version date Vim version user release notes
tex.vim 1.2 2001-12-10 6.0 Srinath Avadhanula removed a bug which was causing nested environments to be entered incorrectly.
added a few more commands. removed some debugging statements.
added a function RunLaTeX() which runs latex on the current file or a master file
if one exists. see the file for additional details.
tex.vim 1.1 2001-12-07 6.0 Srinath Avadhanula added a wrapper function which makes the insert mode mappings emulate the operator pending mode. i.e, the user does not have to type the LHS fast. Even making mistakes and moving around in the file is allowed before coming back and typing the last character (in this case its chosen to be the tab) expands nicely to the RHS.
tex.vim 2001-09-24 6.0 Srinath Avadhanula Initial upload
ip used for rating:

If you have questions or remarks about this site, visit the vimonline development pages. Please use this site responsibly.
Questions about Vim should go to the maillist. Help Bram help Uganda.