latexsupport.txt LaTeX Support Aug 21 2016 LaTeX Support latex-support latexsupport Plug-in version 1.2 for Vim version 7.0 and above Wolfgang Mehner<wolfgang-mehner@web.de>
Fritz Mehner<mehner.fritz@web.de>
LaTeX-IDE for Vim/gVim. It is written to considerably speed up typesetting a document in a consistent style. This is done by inserting complete statements, idioms, code snippets, and comments. Compiling and viewing a document, format conversion and running make can be done with a few keystrokes. 1. Usage With GUI (gVim) |latexsupport-usage-gvim| 1.1 Menu 'Comments' |latexsupport-comments| 1.1.1 Append Aligned Comments To Lines |latexsupport-aligned-comm| 1.1.2 Adjust End-Of-Line Comments |latexsupport-comm-realign| 1.1.3 Toggle Comments |latexsupport-comm-toggle| 1.1.4 Frame Comments, File Header, ... |latexsupport-comm-templates| 1.2 Menu 'Text' |latexsupport-text| 1.2.1 Normal Mode, Insert Mode |latexsupport-stat-norm-ins| 1.2.2 Visual Mode |latexsupport-stat-visual| 1.3 Menu 'Math' |latexsupport-math| 1.4 Menu 'Document' |latexsupport-documents| 1.5 Menu 'BibTeX' |latexsupport-bibtex| 1.6 Menu 'Snippets' |latexsupport-snippets| 1.6.1 Code Snippets |latexsupport-snippets-menu| 1.6.2 Code Templates |latexsupport-templates-menu| 1.7 Menu 'Wizard' |latexsupport-wizard| 1.8 Menu 'Run' |latexsupport-run| 1.8.1 Running A Typesetter |latexsupport-run-typesetter| 1.9 Menu 'Tool Box' |latexsupport-toolbox| 1.9.1 Make |latexsupport-toolbox-make| 1.10 Menu 'Help' |latexsupport-help| 2. Usage Without GUI (Vim) |latexsupport-mappings| 3. Function Keys |latexsupport-function-keys| 4. Customization |latexsupport-customization| 4.1 Files |latexsupport-custom-files| 4.2 Global Variables |latexsupport-custom-variables| 4.3 The Root Menu |latexsupport-custom-root| 4.4 System-wide installation |latexsupport-system-wide| 5. Template Files and Tags |latexsupport-templates| 5.1 Template Files |latexsupport-templates-files| 5.2 Macros |latexsupport-templates-macros| 5.2.1 Formating Date and Time |latexsupport-templates-date| 5.3 Templates |latexsupport-templates-names| 5.3.1 Template definition |latexsupport-templates-definition| 5.3.2 The jump tags<+text+>
etc. |latexsupport-templates-jumptags| 5.3.3 Command Ctrl-j |latexsupport-Ctrl-j| 6. LaTeX Dictionary |latexsupport-dictionary| 7. Troubleshooting |latexsupport-troubleshooting| 8. ReleaseNote
s |latexsupport-release-notes|
1. USAGE WITH GUI (gVim) latexsupport-usage-gvim
The root menu is not visible by default. The root menu 'LaTeX' will appear when the first file with filetype 'tex' is opened. If the root menu 'LaTeX' is not visible you also can load it with the item "Load LaTeX Support" from the standard Tools-menu. The item "Unload LaTeX Support" can be used to unload the LaTeX root menu. (Compare |latexsupport-custom-root|.) Nearly all menu items insert code snippets or comments. All of these are contained within template files and can be changed by the user to meet their requirements. (See |latexsupport-templates|.)
1.1 MENU 'Comments' latexsupport-comments
1.1.1 APPEND ALIGNED COMMENTS TO LINES latexsupport-aligned-comm
In NORMAL MODE the menu item 'end-of-line comments' will append a comment to the current line. In VISUAL MODE this item will append aligned comments to all marked lines. Marking the 3 lines\fbox
{\begin{minipage}
[t][30mm][l]{73mm}
\begin
{flushleft}
\large
and choosing 'end-of-line comments' will yield{\textbf{Ex Commands}
}\\[1.0ex]\fbox
{\begin{minipage}
[t][30mm][l]{73mm}
% |\begin
{flushleft}
%\large
The cursor position above is marked by '|'. Empty lines will be ignored. The default starting column is 49 ( = (multiple of 2,4, or 8) + 1 ). This can be changed by setting a global variable in the file .vimrc , e.g. :{\textbf{Ex Commands}
}\\[1.0ex] %let g:Latex_LineEndCommColDefault = 65
The starting column can also be set by the menu item 'Comments->adjust end-of-line com.' . Just position the cursor in an arbitrary column (normal mode; the column number is shown in the Vim status line) and choose this menu item. This setting is buffer related. If the cursor was at the end of a line you will be asked for a column number because this position is most likely not the desired starting column. Your choice will be confirmed. 1.1.2 ADJUST END-OF-LINE COMMENTS latexsupport-comm-realign
After some copy/paste/change actions comments may be misaligned:\fbox
{\begin{minipage}
[t][30mm][l]{73mm}
% comment 1\begin
{flushleft}
% comment 2\large
Realignment can be achieved with the menu item 'adjust end-of-line com.' In normal mode the comment (if any) in the current line will be aligned to the end-of-line comment column (see above) if possible. In visual mode the comments in the marked block will be aligned:{\textbf{Ex Commands}
}\\[1.0ex] % comment 3\fbox
{\begin{minipage}
[t][30mm][l]{73mm}
% comment 1\begin
{flushleft}
% comment 2\large
1.1.3 TOGGLE COMMENTS latexsupport-comm-toggle{\textbf{Ex Commands}
}\\[1.0ex] % comment 3
The comment sign % can be set or removed at the beginning of the current line or for a marked block. A single line needs not to be marked. For marked block containing only lines with a '%' in the first column (and possibly empty lines) all lines will be uncommented. A marked block containing one or more nonempty lines without a '%' in the first column will be changed into a comment block. Whitespaces in front of the hash sign will be preserved. 1.1.4 FRAME COMMENTS, FILE HEADER, ... latexsupport-comm-templates
Frame comments and a file prolog are read as templates from the appropriate files (see |latexsupport-templates|).
1.2 MENU 'Text' latexsupport-text
This is the section containing frequently used text-related statements. 1.2.1 NORMAL MODE, INSERT MODE. latexsupport-stat-norm-ins
An empty statement will be inserted, e.g.\begin
{center}
|
\end
1.2.2 VISUAL MODE. latexsupport-stat-visual{center}
The highlighted areaxxxxx
xxxxx
can be surrounded by many statements, e.g.\begin
{center}
xxxxx
xxxxx
\end
{center}
1.3 MENU 'Math' latexsupport-math
This is the section containing frequently used math-related statements. The submenus can also be uses via hotkeys. The hotkey ´msp for instance will start an ex-command. Use tab-expansion to display the choices and the arrow keys to select an item:large \; medium \: qquad quad small \,
choose : large \\;
Some statements have a visual mode. If 'Length' is selected the hotkey ´mnr will surround it with the sqrt-statement in order to obtain the n-th root:... \sqrt[|]
{Length}
...
1.4 MENU 'Document' latexsupport-documents
This is the section containing frequently used document-related statements.
1.5 MENU 'BibTeX' latexsupport-bibtex
This is the section containing frequently used BibTeX-related statements. Complete BibTeX-entries will be inserted from the corresponding template, e.g.@article{,
author =
{}
,title =
{}
,journal =
{}
,year = ,
volume =
{}
,number =
{}
,pages =
{}
,month =
{}
,
note
={}
,}
1.6 MENU 'Snippets' latexsupport-snippets
1.6.1 Code Snippets latexsupport-snippets-menu
Code snippets are pieces of code which are kept in separate files in a special directory. File names are used to identify the snippets. The default snippet is directory is $HOME/.vim/latex-support/codesnippets. Snippets are managed with the 4 items LaTeX -> Snippets -> read code snippet LaTeX -> Snippets -> write code snippet LaTeX -> Snippets -> view code snippet LaTeX -> Snippets -> edit code snippet from the Snippets submenu. Creating a new snippet:
When nothing is marked, "write code snippet" will write the whole buffer to a snippet file. Otherwise the marked area will be written to a file. Insert a snippet:
Select the appropriate file from the snippet directory ("read code snippet"). The inserted lines will be indented. Indentation / no indentation
Code snippets are normally indented after insertion. To suppress indentation
add the file extension "ni" or "noindent" to the snippet file name, e.g.
xy.tex.noindent
There may be a few snippets belonging to this plug-in package. These are
examples. Add your own.
Snippet browser
Under a GUI a file requester will be put up. Without GUI the filename will be
read from the command line. You can change this behavior by setting a global
variable in your ~/.vimrc :
let g:Latex_GuiSnippetBrowser = 'commandline'
The default value is 'gui'.
1.6.2 Code Templates latexsupport-templates-menu
Nearly all menu items will insert code snippets or comments. All of these are
contained within template files and can be changed by the users to meet their
requirements (see|latexsupport-templates|on how to use the template system).
The menu items 'edit ... templates' open various template files. The stock
templates are usually located in the "local" template file:
~/.vim/latex-support/templates/Templates
The template files named "custom" and "personal" can be used for
customization, which avoids editing the stock templates.
There may be dependent files loaded from the main files. Change whatever file
you want, save it, and click on the menu item 'reread templates' to read in
the file(s) and to rebuild the internal representation of the templates.
Template browser
When editing a template file, it is selected via |:Explore
|. You can change this behavior by setting a global variable in your ~/.vimrc (see |g:Templates_TemplateBrowser|):let g:Templates_TemplateBrowser = 'browse'
Template Style
The template system supports different template styles. If there are more than one style the menu item 'choose style' let you choose a style on the fly. Template Jump Tags
You can use different jump tags in a template, e.g. {-tagname-}
. The allowed
tags can be chosen from this menu.(see|latexsupport-templates-jumptags|)
1.7 MENU 'Wizard' latexsupport-wizard
This is the section containing less frequently statements which have usually several lines, e.g. insertion of listings, tables, or figures. The menu item 'ligatures' lets you find double and triple ligatures and split them if appropriate.
1.8 MENU 'Run' latexsupport-run
The menu 'Run' let you run the predefined typesetter, call a viewer, run makeindex, run bibtex, and run a converter. 1.8.1 RUNNING A TYPESETTER latexsupport-run-typesetter
The default typesetter is 'pdflatex'. This can be changed by assigning one of the values 'tex', 'latex', and 'pfttex' to the variable g:Latex_Typesetter in your .vimrc file:let g:Latex_Typesetter = 'latex'
The predefined call of the typesetters arelatex -src-specials -file-line-error -interaction=nonstopmode
tex -src-specials -file-line-error -interaction=nonstopmode
pdflatex -src-specials -file-line-error -interaction=nonstopmode
pdftex -src-specials -file-line-error -interaction=nonstopmode
This can be changed in the .vimrc file using one of the variableslet g:Latex_Latex = 'latex ... '
let g:Latex_Tex = 'tex ... '
let g:Latex_Pdflatex = 'pdflatex ... '
let g:Latex_Pdftex = 'pdftex ... '
The errors a typesetter run will produce will be shown in a quickfix buffer. For convenience consider to use maps likenoremap
<silent>
<F5>
:copen<CR>
noremap
<silent>
<F6>
:cclose<CR>
noremap
<silent>
<F7>
:cp<CR>
noremap
in your .vimrc file to jump to the error locations (F7,F8) and to open and close the error window (F5,F6). This makes navigation a lot easier (see also file 'customization.vimrc', |latexsupport-custom-files|). The error list and the error locations in your source buffer will be synchronized.<silent>
<F8>
:cn<CR>
1.9 MENU 'Tool Box' latexsupport-toolbox
Tools which can be used by several plugins are located in the Tool Box.
Examples are tools for make(1) or doxygen. The Tool Box has its own
documentation:|toolbox|.
To switch the Tool Box off add the following line to the file .vimrc
let g:Latex_UseToolbox = 'no'
1.9.1 Make latexsupport-toolbox-make
The tool box for make provides a small set hotkeys, menu items, and ex
commands for controlling make. Please see|toolbox-make|.
To switch the make tool box off add the following line to the file .vimrc
let g:Latex_UseTool_make = 'no'
The hotkeys for the make tool are defined in the file ~/.vim/ftplugin/tex.vim .
1.10 MENU 'Help' latexsupport-help
This submenu offers convenient access to various documentations. The entry 'texdoc' starts texdoc for the word (package, command) under the cursor. If there is no word under the cursor, you will be prompted for the name of a package. The entry 'English' opens an online dictionary for the word under the cursor.
The browser for opening the online documentation, or the English dictionary,
can be configured by setting a global variable in your ~/.vimrc (see
|g:Templates_InternetBrowserExec| and |g:Templates_InternetBrowserFlags|):
let g:Templates_InternetBrowserExec = 'firefox'
2. USAGE WITHOUT GUI (Vim) latexsupport-mappings
The frequently used constructs can be inserted with key mappings. These mappings are also described in the document latex-hotkeys.pdf (reference card). All mappings are filetype specific: they are only defined for buffers with filetype 'tex' to minimize conflicts with mappings from other plug-ins. Some mappings can be used with range (of lines). In normal mode\cl
appends a end-of-line comment to the current line, whereas4\cl
appends end-of-line comments to the 4 lines starting with the current line. Legend: (i) insert mode, (n) normal mode, (v) visual mode [n] range ----------------------------------------------------------------- Help ----------------------------------------------------------------- ´he open an English dictionary for (ni) the word under the cursor ´ht start texdoc (ni) ´hp displays plugin help (ni) ----------------------------------------------------------------- Comments ----------------------------------------------------------------- [n]´cl end-of-line comment (niv) [n]´cj adjust end-of-line comments (niv) ´cs set end-of-line comment col. (n) [n]´cc toggle comment (niv) ´cfr1 frame comment, type 1 (ni) ´cfr2 frame comment, type 2 (ni) ´cfr3 frame comment, type 3 (ni) ´ch file prolog (ni) ´cm plug-in macros (ni) ´cd date (ni) ´ct date & time (ni) ----------------------------------------------------------------- Document ----------------------------------------------------------------- ´dc document class (ni) ´di indices (ni) ´dti title (ni) ´dbi bibliography (ni) ´dac addcontentsline (ni) ----------------------------------------------------------------- Text ----------------------------------------------------------------- ´e environment (niv) ´ts section (ni) ´to organization (ni) ´tld list environment, description (ni) ´tle list environment, enumerate (ni) ´tli list environment, itemize (ni) ´tll list environment, list (ni) ´tlit list environment, item (ni) ´tlil list environment, item+labels (ni) ´tf font style (niv) ´tfs font size (niv) ´tq quotes (niv) ´tsp spacing (ni) ´ta line alignment + spacing (niv) ´ttc textcomp characters (ni) ´tbi bibitem (ni) ´tci cite (ni) ´tfo footnote
(ni) ´tin index (ni) ´tla label (ni) ´tma marginpar (ni) ´tco newcommand (ni) ´tnc nocite (ni) ´tpa pageref (ni) ´tre ref (ni) ´tur url (niv) ----------------------------------------------------------------- Snippets ----------------------------------------------------------------- ´nr read code snippet (ni) ´nv view code snippet (ni) ´nw write code snippet (niv) ´ne edit code snippet (ni) ´ntg edit global templates (ni) ´ntl edit local templates (ni) ´ntc edit custom templates (ni) ´ntp edit personal templates (ni) ´ntr reread templates (ni) ´ntw template setup wizard (ni) ´nts choose style (ni) ----------------------------------------------------------------- Math ----------------------------------------------------------------- ´msp spaces (ni) ´mac accents (ni) ´mfs font styles (ni) ´md delimiter (ni) ´mf functions (ni) ´mgl lowercase greek (ni) ´mgu uppercase greek (ni) ´mo operators (ni) ´mr relations (ni) ´mar arrows (ni) ´me equation+label (niv) ´mea eqnarray+label (niv) ´mm matrix (ni) ´mch choose (niv) ´mddt ddot (niv) ´mdt dot (niv) ´mfr frac (niv) ´mnr nth root (niv) ´mpr prod (niv) ´msq sqrt (niv) ´msu sum (niv) ´mve vec (niv) ´mon operatorname (niv) ----------------------------------------------------------------- Wizard ----------------------------------------------------------------- ´wll lstlisting (niv) ´wlil lstinputlisting (ni) ´nls lstset (ni) ´wtt table (niv) ´wttf table, floating (niv) ´wtg tabbing (ni) ´wtr tabular (ni) ´wf figure (ni) ´wff floatingfigure (ni) ´wwf wrapfigure (ni) ´wbf fbox (niv) ´wbfr framebox (niv) ´wbm mbox (niv) ´wbmb makebox (niv) ´wmp minipage (niv) ´wbp parbox (niv) ----------------------------------------------------------------- Run ----------------------------------------------------------------- ´rr save + run typesetter (ni) ´rla save + run lacheck (ni) ´rdvi view DVI (ni) ´rpdf view PDF (ni) ´rps view PS (ni) ´rmi run makeindex (ni) ´rbi run bibtex (ni) ´rc run a converter (ni) ´rse show plugin settings (ni) ----------------------------------------------------------------- Tool Box ----------------------------------------------------------------- ´rm run make (ni) ´rmc run make clean (ni) ´rma command line arguments for make (ni) ´rcm choose make file (ni)
3. FUNCTION KEYS latexsupport-function-keys
The following function keys are defined in normal, visual and insert mode: Ctrl-F9 run typesetter (see ) Alt-F9 run viewer (see )
4. CUSTOMIZATION latexsupport-customization
4.1 FILES latexsupport-custom-files
README.md The starting point. autoload/mmtemplates/core The template system plug-in. doc/latexsupport.txt The latex-support help file for the local help. doc/templatesupport.txt The template system help file for the local help. plugin/latex-support.vim The LaTeX plug-in for Vim/gVim. latex-support/codesnippets/ The code snippets directory. latex-support/templates/* The template files. latex-support/wordlists/latex-keywords.list A file used as dictionary for automatic word completion. This file is referenced in the file customization.vimrc. --------------- ------------------------------------------------------------- --------------- The following files and extensions are for convenience only. latex-support.vim will work without them. ------------------------------------------------------------- latex-support/rc/vim.tex Additional filetype plug-in. latex-support/rc/customization.ctags Additional settings I use in ~.ctags. latex-support/rc/customization.gvimrc Additional settings I use in ~.gvimrc. latex-support/rc/customization.vimrc Additional settings I use in ~.vimrc: incremental search, tabstop, hot keys, font, use of dictionaries, ... The file is commented. Append it to your .vimrc if you like. latex-support/doc/latex-hotkeys.pdf Reference card for the key mappings. The mappings can also be used with the non-GUI Vim, where the menus are not available. latex-support/doc/ChangeLog The change log.
4.2 GLOBAL VARIABLES latexsupport-custom-variables
Several global variables are checked after the plug-in has been loaded to customize it:
global variable default value
-- Linux/Unix ---------------------------------------------------------------
g:Latex_Latex 'latex -src-specials -file-line-error -interaction=nonstopmode'
g:Latex_Tex 'tex -src-specials -file-line-error -interaction=nonstopmode'
g:Latex_Pdflatex 'pdflatex -src-specials -file-line-error -interaction=nonstopmode'
g:Latex_Pdftex 'pdftex -src-specials -file-line-error -interaction=nonstopmode'
g:Latex_Bibtex "bibtex"
g:Latex_DviViewer "xdvi"
g:Latex_PsViewer "gv"
g:Latex_PdfViewer "acroread"
g:Latex_DviPdf 'dvipdft'
g:Latex_DviPng 'dvipng'
g:Latex_DviPs 'dvips'
g:Latex_PdfPng 'convert'
g:Latex_PsPdf 'ps2pdf'
g:Latex_CustomTemplateFile $HOME.'/.vim/templates/latex.templates'
g:Latex_GlobalTemplateFile $VIMRUNTIME.'/latex-support/templates/Templates'
g:Latex_LocalTemplateFile $HOME.'/.vim/latex-support/templates/Templates'
-- MS Windows ---------------------------------------------------------------
g:Latex_Latex 'latex.exe -src-specials -file-line-error -interaction=nonstopmode'
g:Latex_Tex 'tex.exe -src-specials -file-line-error -interaction=nonstopmode'
g:Latex_Pdflatex 'pdflatex.exe -src-specials -file-line-error -interaction=nonstopmode'
g:Latex_Bibtex 'bibtex.exe'
g:Latex_Pdftex 'pdftex.exe -src-specials -file-line-error -interaction=nonstopmode'
g:Latex_DviViewer 'dviout.exe'
g:Latex_PsViewer ''
g:Latex_PdfViewer ''
g:Latex_DviPdf 'dvipdfm.exe'
g:Latex_DviPng 'dvipng.exe'
g:Latex_DviPs 'dvips.exe'
g:Latex_PdfPng ''
g:Latex_PsPdf 'ps2pdf.exe'
g:Latex_CustomTemplateFile $HOME.'/vimfiles/templates/latex.templates'
g:Latex_GlobalTemplateFile $VIMRUNTIME.'/latex-support/templates/Templates'
g:Latex_LocalTemplateFile $HOME.'/vimfiles/latex-support/templates/Templates'
-- all ----------------------------------------------------------------------
g:Latex_CodeSnippets root_dir.'latex-support/codesnippets/'
g:Latex_CreateMenusDelayed 'yes'
g:Latex_Dictionary_File ''
g:Latex_GuiSnippetBrowser 'gui'
g:Latex_InsertFileProlog 'yes'
g:Latex_LineEndCommColDefault 49
g:Latex_LoadMenus 'yes'
g:Latex_MapLeader '´'
g:Latex_Printheader "%<%f%h%m%< %=%{strftime('%x %X')}
Page %N"
g:Latex_RootMenu 'LaTe&X'
g:Latex_TexFlavor 'latex'
g:Latex_Typesetter 'pdflatex'
The variable root_dir will automatically be set to one of the following values:
$HOME.'/.vim/' for Linux/Unix
$VIM.'/vimfiles/' for MS-Windows
DESCRIPTION
g:Latex_Latex The command line used to call the LaTeX typesetter. g:Latex_Tex The command line used to call the TeX typesetter. g:Latex_Pdflatex The command line used to call the pdfLaTeX typesetter. g:Latex_Pdftex The command line used to call the pdfTeXtypesetter. g:Latex_Bibtex The command line used to call bibtex. g:Latex_DviViewer The command line used to call a DVi viewer. g:Latex_PsViewer The command line used to call a PS viewer. g:Latex_PdfViewer The command line used to call a PDF viewer. g:Latex_DviPdf The command line used to call a DVI to PDF converter. g:Latex_DviPng The command line used to call a DVI to Png converter. g:Latex_DviPs The command line used to call a DVI to PS converter. g:Latex_PdfPng The command line used to call a PDF to Png converter. g:Latex_PsPdf The command line used to call a PS to PDF converter. g:Latex_CodeSnippets The name of the (non-standard) code snippet directory (see below). g:Latex_CreateMenusDelayed Delaying the initialization until the first TeX/LaTeX file is opened. g:Latex_CustomTemplateFile Sets the custom template file, path+name, used to overwrite stock templates (see|latexsupport-templates|). g:Latex_Dictionary_File Path and filename of the LaTeX word list used for dictionary completion. g:Latex_GlobalTemplateFile Sets the global template file, path+name (see|latexsupport-templates|). g:Latex_GuiSnippetBrowser Code snippet browser: 'gui', 'commandline'. g:Latex_InsertFileProlog Insert file description comment in a new file ('yes', 'no'). g:Latex_LineEndCommColDefault Default starting column for line-end comments. g:Latex_LoadMenus Load menus and mappings ("yes", "no") at startup. g:Latex_LocalTemplateFile Sets the local template file, path+name (see|latexsupport-templates|). g:Latex_MapLeader Map leader for hotkeys (|latexsupport-mappings|). The mapleader can also be used in the ftplugin, by calling the functions Latex_SetMapLeader() and Latex_ResetMapLeader() . The maps created between the two calls will use |g:Latex_MapLeader| as the |<LocalLeader>
|:call Latex_SetMapLeader ()
map
<buffer>
<LocalLeader>
eg :echo "Example Map :)"<CR>
call Latex_ResetMapLeader ()
g:Latex_Printheader Hardcopy header format. g:Latex_RootMenu The name of the plug-in root menu. g:Latex_TexFlavor The filetype when starting with an empty file ('latex', 'plaintex') g:Latex_Typesetter The typesetter used by the run command ('rr', Ctrl-F9, or menu item): 'pdflatex', 'pdftex', 'latex', or 'tex'.
4.3 THE ROOT MENU latexsupport-custom-root
The root menu is not visible by default. The root menu 'LaTeX' will appear after the first file with extension 'tex' has been opened. When the root menu is visible all templates have been loaded and the internal data structures are built. On a slow computer this may cause a noticeable delay when starting the editor. Therefor loading the templates is delayed to the point where the first TeX/LaTeX file will be loaded. To load the menu anyway when the editor starts add the following line to ~/.vimrc :let g:Latex_CreateMenusDelayed = 'no'
The variable g:Latex_RootMenu, if set in .vimrc or in .gvimrc, gives the name of the single gVim root menu item in which the LaTeX submenus are contained. The default is'LaTe&X'
If you want to set the plug-in root menu as a submenu into another menu, e.g. your own with the name 'Plugin', this is done by the following line in '.vimrc'let g:Latex_RootMenu = '&Plugin.LaTe&X'
The appearance of the root menu item can also be controlled by the global variable g:Latex_LoadMenus. The linelet g:Latex_LoadMenus = 'no'
prevents the root menu item from appearing when the editor starts. You can switch it on (and off again) from the tools menu. The default for this variable is 'yes'.
4.4 System-wide installation latexsupport-system-wide
A system-wide installation (one installation for all users) is done as follows. As *** SUPERUSER *** : (1) Find the Vim installation directory. The Vim ex command ':echo $VIM' gives '/usr/local/share/vim' or something like that. Beyond this directory you will find the Vim installation, e.g. in '/usr/local/share/vim/vim73' if Vim version 7.3 has been installed (Windows: 'C:\Program Files\Vim'). (2) Create a new subdirectory 'vimfiles', e.g. '/usr/local/share/vim/vimfiles' (Windows: 'C:\Program Files\Vim\vimfiles'). (3) Install LaTeX Support Copy the archive latex-support.zip to this new directory and unpack it:unzip latex-support.zip
(4) Generate the help tags::helptags $VIM/vimfiles/doc
SPECIAL CASES. Some Linux distributions use non-standard names for Vim directories. SUSE has a directory '/usr/share/vim/site' to put plug-ins in. These directories will not be found automatically. After installing the plug-in below '/usr/share/vim/site' the use of the templates will be enabled by the following line in '~/.vimrc':let g:Latex_GlobalTemplateFile = '/usr/share/vim/site/latex-support/templates/Templates'
As *** USER *** : Use the template setup wizard: LaTeX -> Snippets -> template setup wizard to create a personalization file and/or a custom template file. The personalization file will be read by all plug-ins supporting this feature, and should contain only information relevant for all template libraries. You can set some macros in this file with your personal information in order to obtain personalized comments, e.g. something like this:SetMacro( 'AUTHOR', 'Dr. Fritz Mehner' )
SetMacro( 'AUTHORREF', 'fgm' )
SetMacro( 'EMAIL', 'mehner.fritz@web.de' )
SetMacro( 'COPYRIGHT', 'Copyright (c) |
Use the custom template file for LaTeX templates which override the global templates or to add new ones. The old system (before version 1.2), using a "local" template file,YEAR
|, |AUTHOR
|' )~/.vim/latex-support/templates
is still supported for backwards compatibility. Create your private snippet directory:mkdir --parents ~/.vim/latex-support/codesnippets
You may want to copy the snippets comming with this plug-in (in $VIM/vimfiles/latex-support/codesnippets) into the new directory or to set a link to the global directory.
5. TEMPLATE FILES AND TAGS latexsupport-templates
Nearly all menu items insert code snippets or comments. All of these are
contained within template files and can be changed by the user to meet their
requirements. The menu shortcuts (e.g. 'c' for the Comments menu) and the
menu item hotkeys (e.g. '´ct' insert date and time) are also defined in the
templates.
The template engine comes as a separate plug-in contributed by Wolfgang Mehner.
This section is a short introduction to this template system. Please see
|templatesupport| for more information.
The master template file is '$HOME/.vim/latex-support/templates/Templates' for
a user installation and '$VIM/vimfiles/latex-support/templates/Templates' for
a system-wide installation (see |latexsupport-system-wide|).
The master template file can be edited itself to adapt the templates/menus to
the users need. Alternatively, a custom template file can be added (see
|g:Latex_CustomTemplateFile|), which eliminates the need to edit stock
templates. The personalization (name, email, ..., date and time format) can be
done in a special personalization template file. It will be read by all
plug-ins which support this feature, so it should only contain basic
information not pertaining to a specific programming language. It can be set
up using a wizard, which is run by the map \ntw or the menu entry:
LaTeX -> Snippets -> template setup wizard
Further template files can be added using the call:
call mmtemplates#config#Add ( 'latex', '<PATH>
/some.templates', 'example', 'nte' )
The first parameter adds the file to your LaTeX templates, the second is the
path. The remaining two optional parameters specify the symbolic name for
these templates and the map to edit them. The map is '\nte' in this example,
if the standard mapleader is set.
5.1 TEMPLATE FILES latexsupport-templates-files
The master template file starts with various settings followed by templates for single menu items or better by including other template files grouping the templates according to the menu structure of this plug-in. The master file usually looks like this: Example:§ ==========================================================
§ Settings
§ ==========================================================
SetMacro( 'AUTHOR', 'YOUR NAME' )
SetMacro( 'AUTHORREF', '' )
SetMacro( 'EMAIL', '' )
SetMacro( 'ORGANIZATION', '' )
SetMacro( 'COMPANY', '' )
SetMacro( 'COPYRIGHT', 'Copyright (c) |
YEAR
|, |AUTHOR
|' )SetMacro( 'LICENSE', 'GNU General Public License' )
§ =============================================================
§ File Includes
§ =============================================================
MenuShortcut( 'Comments', 'c' )
MenuShortcut( 'Text', 't' )
MenuShortcut( 'Math', 'm' )
MenuShortcut( 'Document', 'd' )
MenuShortcut( 'BibTeX', 'b' )
MenuShortcut( 'Wizard', 'w' )
MenuShortcut( 'Help', 'h' )
IncludeFile( 'comments.templates' )
IncludeFile( 'text.templates' )
IncludeFile( 'math.templates' )
IncludeFile( 'document.templates' )
IncludeFile( 'bibtex.templates' )
IncludeFile( 'wizard.templates' )
Lines starting with a section sign (§) are comments. The section starting withSetMacro( 'AUTHOR', 'YOUR NAME' )
assigns values to predefined tags (macros). Arbitrary user-defined macros are possible. The macro name must follows the rules for a C language identifier: first character letter or underscore; case matters; digits are allowed beginning with the second character. Some of the macros assigned here are placeholders, they will be overwritten by template files read later on, which contain the user's configuration. The statementIncludeFile( 'comments.templates' )
includes the templates from the file 'comments.templates' (in the same directory). An absolute path would also be possible. The statementMenuShortcut( 'Comments', 'c' )
sets 'c' as the shortcut for the Comments menu.
5.2 MACROS latexsupport-templates-macros
The following macro names are predefined. The first group is used to personalize templates.|
BASENAME
| filename without path and suffix|
DATE
| the preferred date representation for the current localewithout the time
|
FILENAME
| filename without path|
PATH
| path without filename|
SUFFIX
| filename suffix|
TIME
| the preferred time representation for the current localewithout the date and the time zone or name or abbreviation
|
---------------------------------------------------------------------------- PREDEFINED TAGS USED IN TEMPLATES ----------------------------------------------------------------------------YEAR
| the year as a decimal number including the century<CURSOR>
The cursor position after insertion of a template.<+text+>
,<-text->
See |latexsupport-templates-jumptags|.{+text+}
,{-text-}
[+text+],[-text-]<SPLIT>
The split point when inserting in visual mode (see|latexsupport-templates|) A dependent template file can start with its own command section. There is no need to have all user defined macros in the master file.
5.2.1 Formating Date and Time latexsupport-templates-date The format for |DATE| ,|TIME| , and|YEAR| can be set by the user. The defaults are:|
DATE
| '%x'|
TIME
| '%X'|
See the manual page of the C function strftime() for the format. The accepted format depends on your system, thus this is not portable! The maximum length of the result is 80 characters. User defined formats can be set using the following function calls in the master template file is '$HOME/.vim/latex-support/templates/Templates', e.g.YEAR
| '%Y'SetFormat( 'DATE', '%D' )
SetFormat( 'TIME', '%H:%M' )
SetFormat( 'YEAR', 'year %Y' )
5.3 TEMPLATES latexsupport-templates-names
5.3.1 Template definition latexsupport-templates-definition The template behind a menu item is identified by a given name. The first part of the name identifies the menu name, the second part identifies the item. A template definition starts with a template header with the following syntax: == menu_name.template_name == options == The options are described here: |template-support-options|.
5.3.2 The jump tags<+text+>
etc. latexsupport-templates-jumptags There are four jump tag types which can be used as jump targets in templates:<+text+>
Can be jumped to by hitting Ctrl-j.{+text+}
Same as<+text+>
. Used in cases where indentation gives unwanted results with the first one.<-text->
Same as the two above. Will be removed if the template is used{-text-}
in visual mode. [+text+] The "optional" tag. Serves as a jump tag, but can be deleted using Ctrl-d. [-text-] Same as above, removed in visual mode. The text inside the brackets is userdefined and can be empty. The text can be composed from letters (uppercase and lowercase), digits, and underscores. After the insertion of an template these jump targets will be highlighted.
5.3.3 Command Ctrl-j latexsupport-Ctrl-j Use the command Ctrl-j to jump to the next target. The target will be removed and the mode will switched to insertion. Ctrl-j works in normal and in insert mode. The template for an if-else-statement can be written as follows:== Statements.if, else == map:sie, sc:i ==
if
<CURSOR>
<SPLIT>
<-IF_PART->
else
<+ELSE_PART+>
endif
The cursor will be set as shown. When the condition is specified a Ctrl-j let you jump to the target<-IF PART->
and deletes it. When the block is written a Ctrl-j leads you to the else-part. The target<+ELSE_PART+>
disappears and you can type on.
6. LATEX DICTIONARY latexsupport-dictionary
The file latex-keywords.list contains words used as dictionary for automatic word completion. This feature is enabled by default. The default word list is$HOME/.vim/latex-support/wordlists/latex-keywords.list
If you want to use an additional list MyLatex.List put the following line into .vimrc :let g:Latex_Dictionary_File = "$HOME/.vim/latex-support/wordlists/latex-keywords.list,".
\ "$HOME/any_of_my_directories/MyLatex.List"
The right side is a comma separated list of files.Note
the point at the end of the first line (string concatenation) and the backslash in front of the second line (continuation line). You can use Vim's dictionary featureCTRL-X
,CTRL-K
(andCTRL-P
,CTRL-N
).
7. TROUBLESHOOTING latexsupport-troubleshooting
* Some menus, such as "LaTeX -> Math -> greek lowercase" are not displayed correctly. - The character encoding used inside Vim is controlled by the option |'encoding'
| (the encoding of files can be different, see |'fileencoding'
|). It can be set by adding this lines to your '$HOME/.vimrc': :set encoding=utf-8 Create one if there is none, or better use customization.vimrc.
8. RELEASE NOTE
S latexsupport-release-notes
See files latex-support/README.md and doc/ChangeLog.
vim:tw=78:expandtab:ts=2:ft=help:norl:
Generated by vim2html (modified) on So 21. Aug 20:22:43 CEST 2016